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 removed from a web page and garbage collected. 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 removed from a web page and garbage collected. 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 and GCed (=>
window.closed = true.) | 24 // Have expected results assume that the frame has been closed and GCed (=>
window.closed = 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 asyncGC(function () { | 27 asyncGC(function () { |
25 for (var i = 0; i < propertiesToVerify.length; ++i) { | 28 for (var i = 0; i < propertiesToVerify.length; ++i) { |
26 // It's ok if the property no longer exists. | 29 // It's ok if the property no longer exists. |
27 if (pathExists(childWindow, propertiesToVerify[i].path)) | 30 if (pathExists(childWindow, propertiesToVerify[i].path)) |
28 shouldBe("childWindow." + propertiesToVerify[i].property, proper
tiesToVerify[i].expected); | 31 shouldBe("childWindow." + propertiesToVerify[i].property, proper
tiesToVerify[i].expected); |
29 } | 32 } |
30 finishJSTest(); | 33 finishJSTest(); |
31 }); | 34 }); |
32 } | 35 } |
33 </script> | 36 </script> |
34 </head> | 37 </head> |
35 <body onload="runTest()"> | 38 <body onload="runTest()"> |
36 <iframe id="src_frame"></iframe> | 39 <iframe id="src_frame"></iframe> |
37 <iframe id="test_frame" src="about:blank"></iframe> | 40 <iframe id="test_frame" src="about:blank"></iframe> |
38 </body> | 41 </body> |
39 </html> | 42 </html> |
OLD | NEW |