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