Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / property-access-on-cached-properties-after-frame-navigated.html
blob83ee607d44ad526adf9e64739d1572ba26ab08da
1 <html>
2 <head>
3 <script src="../../../resources/js-test.js"></script>
4 <script src="resources/window-property-collector.js"></script>
5 <script>
6 var jsTestIsAsync = true;
8 var childWindow;
9 var propertiesToVerify = [];
11 function insertExpectedResult(path, expected)
13 if (path.length < 2)
14 return;
15 var propertyDir = path.slice(0, -1).join('.');
16 var cachedPropertyDir = "cached_" + propertyDir.replace('.', '_');
17 window[cachedPropertyDir] = eval("childWindow." + propertyDir);
18 propertiesToVerify.push({
19 'property': ["window", cachedPropertyDir, path[path.length - 1]].join("."),
20 'expected': expected,
21 });
24 function runTest()
26 var frame = document.getElementById("frame");
27 if (frame.src != 'about:blank') {
28 description("Tests access of cached DOMWindow properties after the associated frame is navigated. Test should not crash and properties should be set to sane defaults.");
29 childWindow = frame.contentWindow;
30 // Have expected results assume that the frame hasn't been closed (=> window.closed = false.)
31 collectProperties(false);
32 frame.src = 'about:blank';
33 return;
35 for (var i = 0; i < propertiesToVerify.length; ++i)
36 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected);
37 finishJSTest();
39 </script>
40 </head>
41 <body>
42 <iframe id="frame" src="resources/blank.html" onload="runTest()"></iframe>
43 </body>
44 </html>