blob: f168d6fc2f853faf9ba072b2566d5ee458482710 [file] [log] [blame]
<p>
This page tests whether global declarations are cleared after a navigation.
If the test passes, you'll see a series of PASS messages below.
</p>
<pre id="console"></pre>
<script>
function log(s)
{
document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
}
function shouldBe(evalA, a, b)
{
if (evalA === b) {
log("PASS: " + a + " should be " + b + " and is.");
} else {
log("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".");
}
}
var count = 0;
function didFinishLoading(childWindow) // called by subframes
{
log("\nPage " + count + ":");
if (!count) {
shouldBe('x' in childWindow, "'x' in childWindow", true);
shouldBe(childWindow.x, "childWindow.x", 1);
shouldBe('f' in childWindow, "'f' in childWindow", true);
shouldBe(typeof childWindow.f, "childWindow.f", "function");
childWindow.name = "test";
childWindow.location = "window-property-clearing-iframe1.html";
++count;
} else {
shouldBe('x' in childWindow, "'x' in childWindow", false);
shouldBe(childWindow.x, "childWindow.x", undefined);
shouldBe('f' in childWindow, "'f' in childWindow", false);
shouldBe(typeof childWindow.f, "typeof childWindow.f", "undefined");
shouldBe('name' in childWindow, "'name' in childWindow", true);
shouldBe(childWindow.name, "childWindow.name", "test");
if (window.testRunner)
testRunner.notifyDone();
}
}
function test()
{
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
}
test();
</script>
<iframe src="resources/window-property-clearing-iframe0.html"></iframe>