OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <script src="../../../../resources/js-test.js"></script> | 2 <script src="../../../../resources/js-test.js"></script> |
3 <script> | 3 <script> |
4 description("Updating window.location after the window has been closed, without
crashing."); | 4 description("Updating window.location after the window has been closed, without
crashing."); |
5 | 5 |
6 // This tests opens a new window, sets a timeout to close it, then | 6 // This tests opens a new window, sets a timeout to close it, then |
7 // sets a timeout to navigate it via window.location. We pass if we | 7 // sets a timeout to navigate it via window.location. We pass if we |
8 // don't crash when setting the location of the already closed window, | 8 // don't crash when setting the location of the already closed window, |
9 // or when shutting down just after. | 9 // or when shutting down just after. |
10 | 10 |
11 if (window.testRunner) { | 11 if (window.testRunner) { |
12 testRunner.dumpAsText(); | 12 testRunner.dumpAsText(); |
13 testRunner.setCanOpenWindows(); | 13 testRunner.setCanOpenWindows(); |
14 testRunner.waitUntilDone(); | 14 testRunner.waitUntilDone(); |
15 } | 15 } |
16 | 16 |
17 var w = window.open('resources/set-location-after-close-new-window.html'); | 17 var w = window.open('../../../../resources/window-postmessage-open-close.html'); |
18 | 18 |
19 window.addEventListener("message", processMessage, false); | 19 window.addEventListener("message", processMessage, false); |
20 | 20 |
21 function finish() { | 21 function finish() { |
22 // Clear out window and force a GC to finalize the Window | 22 // Clear out window and force a GC to finalize the Window |
23 // object and its wrapper. Verifies that the shutdown is | 23 // object and its wrapper. Verifies that the shutdown is |
24 // done in an orderly manner. | 24 // done in an orderly manner. |
25 w = null; | 25 w = null; |
26 gc(); | 26 gc(); |
27 if (window.testRunner) | 27 if (window.testRunner) |
28 testRunner.notifyDone(); | 28 testRunner.notifyDone(); |
29 } | 29 } |
30 | 30 |
31 function processMessage(event) { | 31 function processMessage(event) { |
32 if (event.data == "opened") | 32 if (event.data == "opened") |
33 w.close(); | 33 w.close(); |
34 else if (event.data == "closed") { | 34 else if (event.data == "closed") { |
35 w.location = ''; | 35 w.location = ''; |
36 setInterval(finish, 0); | 36 setInterval(finish, 0); |
37 } | 37 } |
38 } | 38 } |
39 </script> | 39 </script> |
OLD | NEW |