OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Notifications: Closing a notification in the "unload" event does not
crash.</title> | 4 <title>Notifications: Closing a notification in the "unload" event does not
crash.</title> |
5 <script src="../resources/testharness.js"></script> | 5 <script src="../resources/testharness.js"></script> |
6 <script src="../resources/testharnessreport.js"></script> | 6 <script src="../resources/testharnessreport.js"></script> |
7 <script src="resources/test-helpers.js"></script> | 7 <script src="resources/test-helpers.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <script> | 10 <script> |
11 // Tests that closing a displayed Web Notification in the unload event doe
s not | 11 // Tests that closing a displayed Web Notification in the unload event doe
s not |
12 // cause the browser to crash. | 12 // cause the browser to crash. |
13 if (window.testRunner) { | 13 if (window.testRunner) { |
14 testRunner.setPermission('notifications', 'granted', location.origin,
location.origin); | 14 testRunner.setPermission('notifications', 'granted', location.origin,
location.origin); |
15 testRunner.grantWebNotificationPermission(location.origin, true); | |
16 testRunner.setCanOpenWindows(); | 15 testRunner.setCanOpenWindows(); |
17 } | 16 } |
18 | 17 |
19 async_test(function (test) { | 18 async_test(function (test) { |
20 var win = window.open('resources/window-close-in-unload-event.html'); | 19 var win = window.open('resources/window-close-in-unload-event.html'); |
21 window.addEventListener('message', function (event) { | 20 window.addEventListener('message', function (event) { |
22 if (event.data == 'opened') { | 21 if (event.data == 'opened') { |
23 win.close(); | 22 win.close(); |
24 } else if (event.data == 'closed') { | 23 } else if (event.data == 'closed') { |
25 test.done(); | 24 test.done(); |
26 } | 25 } |
27 }); | 26 }); |
28 | 27 |
29 }, 'Closing a notification in the "unload" event does not crash.'); | 28 }, 'Closing a notification in the "unload" event does not crash.'); |
30 </script> | 29 </script> |
31 </body> | 30 </body> |
32 </html> | 31 </html> |
OLD | NEW |