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 var propertyPath = path.join('.'); | 13 var propertyPath = path.join('.'); |
14 propertiesToVerify.push({'property': "childWindow." + propertyPath, 'expecte
d': expected}); | 14 propertiesToVerify.push({'property': "childWindow." + propertyPath, 'expecte
d': expected}); |
15 } | 15 } |
16 | 16 |
17 function runTest() | 17 function runTest() |
18 { | 18 { |
19 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 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."); |
20 var frame = document.getElementById("frame"); | 20 var frame = document.getElementById("frame"); |
21 childWindow = frame.contentWindow; | 21 childWindow = frame.contentWindow; |
22 // Have expected results assume that the frame has been closed and GCed (=>
window.closed = true.) | 22 // Have expected results assume that the frame has been closed and GCed (=>
window.closed = true.) |
23 collectProperties(true); | 23 collectProperties(true); |
24 frame.parentNode.removeChild(frame); | 24 frame.parentNode.removeChild(frame); |
25 window.setTimeout(verifyResults, 0); | 25 asyncGC(function () { |
26 } | 26 for (var i = 0; i < propertiesToVerify.length; ++i) |
27 | 27 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expec
ted); |
28 function verifyResults() | 28 finishJSTest(); |
29 { | 29 }); |
30 if (window.gc) | |
31 gc(); | |
32 for (var i = 0; i < propertiesToVerify.length; ++i) | |
33 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected)
; | |
34 finishJSTest(); | |
35 } | 30 } |
36 </script> | 31 </script> |
37 </head> | 32 </head> |
38 <body> | 33 <body> |
39 <iframe id="frame" src="about:blank" onload="runTest()"></iframe> | 34 <iframe id="frame" src="about:blank" onload="runTest()"></iframe> |
40 </body> | 35 </body> |
41 </html> | 36 </html> |
OLD | NEW |