idlharness.https.any.js (1038B)
1 // META: global=window,worker 2 // META: script=/resources/WebIDLParser.js 3 // META: script=/resources/idlharness.js 4 5 'use strict'; 6 7 // https://notifications.spec.whatwg.org/ 8 9 idl_test( 10 ['notifications'], 11 ['service-workers', 'hr-time', 'html', 'dom'], 12 idl_array => { 13 if (self.ServiceWorkerGlobalScope) { 14 idl_array.add_objects({ 15 ServiceWorkerGlobalScope: ['self'], 16 }); 17 // NotificationEvent could be tested here, but the constructor requires 18 // a Notification instance which cannot be created in a service worker, 19 // see below. 20 } else { 21 // While the Notification interface is exposed in service workers, the 22 // constructor (https://notifications.spec.whatwg.org/#dom-notification-notification) 23 // is defined to throw a TypeError. Therefore, we only add the object in 24 // the other scopes. 25 idl_array.add_objects({ 26 Notification: ['notification'], 27 }); 28 self.notification = new Notification('title'); 29 self.notification.close(); 30 } 31 } 32 );