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.grantWebNotificationPermission(location.origin, true); | 15 testRunner.grantWebNotificationPermission(location.origin, true); |
15 testRunner.setCanOpenWindows(); | 16 testRunner.setCanOpenWindows(); |
16 } | 17 } |
17 | 18 |
18 async_test(function (test) { | 19 async_test(function (test) { |
19 var win = window.open('resources/window-close-in-unload-event.html'); | 20 var win = window.open('resources/window-close-in-unload-event.html'); |
20 window.addEventListener('message', function (event) { | 21 window.addEventListener('message', function (event) { |
21 if (event.data == 'opened') { | 22 if (event.data == 'opened') { |
22 win.close(); | 23 win.close(); |
23 } else if (event.data == 'closed') { | 24 } else if (event.data == 'closed') { |
24 test.done(); | 25 test.done(); |
25 } | 26 } |
26 }); | 27 }); |
27 | 28 |
28 }, 'Closing a notification in the "unload" event does not crash.'); | 29 }, 'Closing a notification in the "unload" event does not crash.'); |
29 </script> | 30 </script> |
30 </body> | 31 </body> |
31 </html> | 32 </html> |
OLD | NEW |