<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
</head>
<body>

<script>
description("This tests that customized properties on window.location and window.navigator won't get lost after garbage collection. Results may be different when run manually, since forcing GC may not be exposed in all applications. Browsers disagree about what happens to properties on window.screen, window.history, and others through 'toolbar' in the list below, but the behavior of window.location and window.navigator is consistent.");

function check(name, shouldSurvive) {
  window[name].myProp = 10;
  gc();
  if (shouldSurvive)
    shouldBe("window." + name + ".myProp", "10");
  else
    shouldBeUndefined("window." + name + ".myProp");
}

check("screen", true);
check("history", true);
check("locationbar", true);
check("menubar", true);
check("personalbar", true);
check("scrollbars", true);
check("statusbar", true);
check("toolbar", true);

check("location", true);
check("navigator", true);
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
