diff --git a/notifications/interfaces.html b/interfaces/notifications.idl similarity index 59% rename from notifications/interfaces.html rename to interfaces/notifications.idl index a348450e5fe456..82d2724faf4e84 100644 --- a/notifications/interfaces.html +++ b/interfaces/notifications.idl @@ -1,27 +1,9 @@ - - -Notification interface IDL tests -
- - - - - - - + +dictionary GetNotificationOptions { + DOMString tag = ""; +}; + +partial interface ServiceWorkerRegistration { + Promise showNotification(DOMString title, optional NotificationOptions options); + Promise> getNotifications(optional GetNotificationOptions filter); +}; + +[Constructor(DOMString type, NotificationEventInit eventInitDict), + Exposed=ServiceWorker] +interface NotificationEvent : ExtendableEvent { + readonly attribute Notification notification; + readonly attribute DOMString action; + readonly attribute DOMString? reply; +}; + +dictionary NotificationEventInit : ExtendableEventInit { + required Notification notification; + DOMString action = ""; + DOMString? reply = null; +}; + +partial interface ServiceWorkerGlobalScope { + attribute EventHandler onnotificationclick; + attribute EventHandler onnotificationclose; +}; diff --git a/notifications/interfaces.any.js b/notifications/interfaces.any.js new file mode 100644 index 00000000000000..de721984e1e603 --- /dev/null +++ b/notifications/interfaces.any.js @@ -0,0 +1,41 @@ +// META: global=worker +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// See https://notifications.spec.whatwg.org/ + +// This file's contents are duplicated in notifications/interfaces.https.any.js +// as a workaround for https://github.com/w3c/web-platform-tests/issues/11105 + +"use strict"; + +promise_test(async () => { + const sw_idl = await fetch('/interfaces/ServiceWorker.idl').then(r => r.text()); + const dedicated_workers_idl = await fetch('/interfaces/dedicated-workers.idl').then(r => r.text()); + const dom_idl = await fetch('/interfaces/dom.idl').then(r => r.text()); + + const notifications_idl = await fetch('/interfaces/notifications.idl').then(r => r.text()); + + var idlArray = new IdlArray(); + + idlArray.add_untested_idls(sw_idl, { only: [ + 'ServiceWorkerRegistration', + 'ServiceWorkerGlobalScope', + 'ExtendableEvent', + 'ExtendableEventInit', + ] }); + + idlArray.add_untested_idls(dedicated_workers_idl); + idlArray.add_untested_idls(dom_idl, { only: [ 'Event', 'EventInit' ] }); + + idlArray.add_idls(notifications_idl); + + if (!self.GLOBAL.isWorker()) { + idlArray.add_objects({ + Notification: ['new Notification("Running idlharness.")'], + }); + } + + idlArray.test(); + done(); +}, 'notifications interfaces.'); diff --git a/notifications/interfaces.https.any.js b/notifications/interfaces.https.any.js new file mode 100644 index 00000000000000..5b84d5ef6d655f --- /dev/null +++ b/notifications/interfaces.https.any.js @@ -0,0 +1,40 @@ +// META: global=worker +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// See https://notifications.spec.whatwg.org/ + +// The contents of this file are duplicated in notifications/interfaces.any.js +// as a workaround for https://github.com/w3c/web-platform-tests/issues/11105 +"use strict"; + +promise_test(async () => { + const sw_idl = await fetch('/interfaces/ServiceWorker.idl').then(r => r.text()); + const dedicated_workers_idl = await fetch('/interfaces/dedicated-workers.idl').then(r => r.text()); + const dom_idl = await fetch('/interfaces/dom.idl').then(r => r.text()); + + const notifications_idl = await fetch('/interfaces/notifications.idl').then(r => r.text()); + + var idlArray = new IdlArray(); + + idlArray.add_untested_idls(sw_idl, { only: [ + 'ServiceWorkerRegistration', + 'ServiceWorkerGlobalScope', + 'ExtendableEvent', + 'ExtendableEventInit', + ] }); + + idlArray.add_untested_idls(dedicated_workers_idl); + idlArray.add_untested_idls(dom_idl, { only: [ 'Event', 'EventInit' ] }); + + idlArray.add_idls(notifications_idl); + + if (!self.GLOBAL.isWorker()) { + idlArray.add_objects({ + Notification: ['new Notification("Running idlharness.")'], + }); + } + + idlArray.test(); + done(); +}, 'notifications interfaces.');