OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../../resources/js-test.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
4 <script src="resources/window-property-collector.js"></script> | 4 <script src="resources/window-property-collector.js"></script> |
5 <script> | 5 <script> |
6 var jsTestIsAsync = true; | 6 var jsTestIsAsync = true; |
7 | 7 |
8 var childWindow; | 8 var childWindow; |
9 var propertiesToVerify = []; | 9 var propertiesToVerify = []; |
10 | 10 |
11 function insertExpectedResult(path, expected) | 11 function insertExpectedResult(path, expected) |
12 { | 12 { |
13 propertiesToVerify.push({"path": path.slice(0), "property": path.join("."),
"expected": expected}); | 13 var property = path.join("."); |
| 14 if (property == "location.ancestorOrigins.length") |
| 15 expected = '0'; |
| 16 propertiesToVerify.push({"path": path.slice(0), "property": property, "expec
ted": expected}); |
14 } | 17 } |
15 | 18 |
16 function runTest() | 19 function runTest() |
17 { | 20 { |
18 description("Tests property access on a cached DOMWindow after the associate
d frame is no longer in a web page. Test should not crash and properties should
be set to sane defaults."); | 21 description("Tests property access on a cached DOMWindow after the associate
d frame is no longer in a web page. Test should not crash and properties should
be set to sane defaults."); |
19 var frame = document.getElementById("test_frame"); | 22 var frame = document.getElementById("test_frame"); |
20 childWindow = frame.contentWindow; | 23 childWindow = frame.contentWindow; |
21 // Have expected results assume that the frame has been closed (=> window.cl
osed = true.) | 24 // Have expected results assume that the frame has been closed (=> window.cl
osed = true.) |
22 collectProperties(document.getElementById("src_frame").contentWindow, true); | 25 collectProperties(document.getElementById("src_frame").contentWindow, true); |
23 frame.parentNode.removeChild(frame); | 26 frame.parentNode.removeChild(frame); |
24 for (var i = 0; i < propertiesToVerify.length; ++i) { | 27 for (var i = 0; i < propertiesToVerify.length; ++i) { |
25 // It's ok if the property no longer exists. | 28 // It's ok if the property no longer exists. |
26 if (pathExists(childWindow, propertiesToVerify[i].path)) | 29 if (pathExists(childWindow, propertiesToVerify[i].path)) |
27 shouldBe("childWindow." + propertiesToVerify[i].property, propertiesToVe
rify[i].expected); | 30 shouldBe("childWindow." + propertiesToVerify[i].property, propertiesToVe
rify[i].expected); |
28 } | 31 } |
29 finishJSTest(); | 32 finishJSTest(); |
30 } | 33 } |
31 </script> | 34 </script> |
32 </head> | 35 </head> |
33 <body onload="runTest()"> | 36 <body onload="runTest()"> |
34 <iframe id="src_frame"></iframe> | 37 <iframe id="src_frame"></iframe> |
35 <iframe id="test_frame" src="about:blank"></iframe> | 38 <iframe id="test_frame" src="about:blank"></iframe> |
36 </body> | 39 </body> |
37 </html> | 40 </html> |
OLD | NEW |