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 frame; | 8 var frame; |
9 var oldChildWindow; | 9 var oldChildWindow; |
10 var newChildWindow; | 10 var newChildWindow; |
11 var propertiesToVerify = []; | 11 var propertiesToVerify = []; |
12 | 12 |
13 function insertExpectedResult(path, expected) | 13 function insertExpectedResult(path, expected) |
14 { | 14 { |
15 var propertyPath = path.join('.'); | 15 var propertyPath = path.join('.'); |
16 propertiesToVerify.push({'property': "oldChildWindow." + propertyPath, 'expe
cted': "newChildWindow." + propertyPath}); | 16 propertiesToVerify.push({'property': "oldChildWindow." + propertyPath, 'expe
cted': "newChildWindow." + propertyPath}); |
17 } | 17 } |
18 | 18 |
19 function runTest() | 19 function runTest() |
20 { | 20 { |
21 frame = document.getElementById("test_frame"); | 21 frame = document.getElementById("test_frame"); |
22 description("Tests property access on a cached DOMWindow after the associate
d frame is navigated. Test should not crash and properties read from the cached
DOMWindow should be identical to properties through the 'current' DOMWindow."); | 22 description("Tests property access on a cached DOMWindow after the associate
d frame is navigated. Test should not crash and properties read from the cached
DOMWindow should be identical to properties through the 'current' DOMWindow."); |
23 oldChildWindow = frame.contentWindow; | 23 oldChildWindow = frame.contentWindow; |
24 // Have expected results assume that the frame hasn't been closed (=> window
.closed = false.) | 24 // Have expected results assume that the frame hasn't been closed (=> window
.closed = false.) |
25 collectProperties(document.getElementById("src_frame").contentWindow, false)
; | 25 collectProperties(document.getElementById("src_frame").contentWindow, false)
; |
| 26 frame.onload = testFrameLoaded; |
26 frame.src = 'about:blank'; | 27 frame.src = 'about:blank'; |
27 } | 28 } |
28 | 29 |
29 function testFrameLoaded() | 30 function testFrameLoaded() |
30 { | 31 { |
31 if (frame) { | 32 if (frame) { |
32 newChildWindow = frame.contentWindow; | 33 newChildWindow = frame.contentWindow; |
33 for (var i = 0; i < propertiesToVerify.length; ++i) | 34 for (var i = 0; i < propertiesToVerify.length; ++i) |
34 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expec
ted); | 35 shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expec
ted); |
35 finishJSTest(); | 36 finishJSTest(); |
36 } | 37 } |
37 } | 38 } |
38 </script> | 39 </script> |
39 </head> | 40 </head> |
40 <body onload="runTest()"> | 41 <body onload="runTest()"> |
41 <iframe id="src_frame"></iframe> | 42 <iframe id="src_frame"></iframe> |
42 <iframe id="test_frame" src="resources/blank.html" onload="testFrameLoaded()"></
iframe> | 43 <iframe id="test_frame" src="data:text/plain,"></iframe> |
43 </body> | 44 </body> |
44 </html> | 45 </html> |
OLD | NEW |