Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / window-property-clearing.html
blobf168d6fc2f853faf9ba072b2566d5ee458482710
1 <p>
2 This page tests whether global declarations are cleared after a navigation.
3 If the test passes, you'll see a series of PASS messages below.
4 </p>
5 <pre id="console"></pre>
7 <script>
8 function log(s)
10 document.getElementById("console").appendChild(document.createTextNode(s + "\n"));
13 function shouldBe(evalA, a, b)
15 if (evalA === b) {
16 log("PASS: " + a + " should be " + b + " and is.");
17 } else {
18 log("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".");
22 var count = 0;
23 function didFinishLoading(childWindow) // called by subframes
25 log("\nPage " + count + ":");
26 if (!count) {
27 shouldBe('x' in childWindow, "'x' in childWindow", true);
28 shouldBe(childWindow.x, "childWindow.x", 1);
29 shouldBe('f' in childWindow, "'f' in childWindow", true);
30 shouldBe(typeof childWindow.f, "childWindow.f", "function");
32 childWindow.name = "test";
34 childWindow.location = "window-property-clearing-iframe1.html";
36 ++count;
37 } else {
38 shouldBe('x' in childWindow, "'x' in childWindow", false);
39 shouldBe(childWindow.x, "childWindow.x", undefined);
40 shouldBe('f' in childWindow, "'f' in childWindow", false);
41 shouldBe(typeof childWindow.f, "typeof childWindow.f", "undefined");
42 shouldBe('name' in childWindow, "'name' in childWindow", true);
43 shouldBe(childWindow.name, "childWindow.name", "test");
45 if (window.testRunner)
46 testRunner.notifyDone();
50 function test()
52 if (window.testRunner) {
53 testRunner.dumpAsText();
54 testRunner.waitUntilDone();
58 test();
59 </script>
61 <iframe src="resources/window-property-clearing-iframe0.html"></iframe>