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 childWindow; | 6 var childWindow; |
7 var propertiesToVerify = []; | 7 var propertiesToVerify = []; |
8 | 8 |
9 function insertExpectedResult(path, expected) | 9 function insertExpectedResult(path, expected) |
10 { | 10 { |
11 if (path.length < 2) | 11 if (path.length < 2) |
12 return; | 12 return; |
13 var propertyDir = path.slice(0, -1).join('.'); | 13 var propertyDir = path.slice(0, -1).join('.'); |
14 var cachedPropertyDir = "cached_" + propertyDir.replace('.', '_'); | 14 var cachedPropertyDir = "cached_" + propertyDir.replace('.', '_'); |
15 window[cachedPropertyDir] = eval("childWindow." + propertyDir); | 15 window[cachedPropertyDir] = eval("childWindow." + propertyDir); |
16 propertiesToVerify.push({ | 16 propertiesToVerify.push({ |
17 'property': ["window", cachedPropertyDir, path[path.length - 1]].join(".
"), | 17 'property': ["window", cachedPropertyDir, path[path.length - 1]].join(".
"), |
18 'expected': expected, | 18 'expected': expected, |
19 }); | 19 }); |
20 } | 20 } |
21 | 21 |
22 function runTest() | 22 function runTest() |
23 { | 23 { |
24 description("Tests access of cached DOMWindow properties after the associate
d frame is no longer in a web page. Test should not crash and properties should
be set to sane defaults."); | 24 description("Tests access of cached DOMWindow properties after the associate
d frame is no longer in a web page. Test should not crash and properties should
be set to sane defaults."); |
25 var frame = document.getElementById("frame"); | 25 var frame = document.getElementById("frame"); |
26 childWindow = frame.contentWindow; | 26 childWindow = frame.contentWindow; |
27 collectProperties(); | 27 // Have expected results assume that the frame hasn't been closed (=> window
.closed = false.) |
| 28 collectProperties(false); |
28 frame.parentNode.removeChild(frame); | 29 frame.parentNode.removeChild(frame); |
29 for (var i = 0; i < propertiesToVerify.length; ++i) | 30 for (var i = 0; i < propertiesToVerify.length; ++i) |
30 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected)
; | 31 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected)
; |
31 } | 32 } |
32 </script> | 33 </script> |
33 </head> | 34 </head> |
34 <body> | 35 <body> |
35 <iframe id="frame" src="about:blank" onload="runTest()"></iframe> | 36 <iframe id="frame" src="about:blank" onload="runTest()"></iframe> |
36 </body> | 37 </body> |
37 </html> | 38 </html> |
OLD | NEW |