4 <title>Notifications: Requesting notification permission in a detached context should not crash.
</title>
5 <script src=
"../resources/testharness.js"></script>
6 <script src=
"../resources/testharnessreport.js"></script>
7 <script src=
"resources/test-helpers.js"></script>
11 // Tests that notifications created in a different context do not crash when said
12 // context gets detached, and events are still being fired on it.
13 if (window
.testRunner
) {
14 testRunner
.setPermission('notifications', 'granted', location
.origin
, location
.origin
);
15 testRunner
.setCanOpenWindows();
18 async_test(function (test
) {
19 var win
= window
.open('resources/window-permission-detached-context.html'),
20 notificationObj
= null;
22 window
.addEventListener('message', function (event
) {
23 if (event
.data
== 'opened') {
24 assert_own_property(win
, 'Notification');
25 notificationObj
= win
.Notification
;
28 } else if (event
.data
== 'closed') {
29 assert_equals(notificationObj
.permission
, 'granted');
30 notificationObj
.requestPermission(function () {});
34 assert_unreached('Unrecognized message from the opened window.');
38 }, 'Requesting notification permission in a detached context should not crash.');