fune/testing/web-platform/tests/push-api/idlharness.https.any.js
Philip Jägenstedt bcb596171f Bug 1743984 [wpt PR 31831] - Sync interfaces/ with @webref/idl 2.8.1 (manually), a=testonly
Automatic update from web-platform-tests
Sync interfaces/ with @webref/idl 2.8.1 (manually) (#31831)

This is https://github.com/web-platform-tests/wpt/pull/31358 with fixes applied.

interfaces/css-cascade-5.idl is kept around due to:
https://github.com/w3c/browser-specs/issues/438
https://github.com/w3c/csswg-drafts/issues/6841
--

wpt-commits: e1e258720df02a79ead784006c7c8b92c7064caa
wpt-pr: 31831
2021-12-20 11:37:46 +00:00

43 lines
1.4 KiB
JavaScript

// META: global=window,worker
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: script=/service-workers/service-worker/resources/test-helpers.sub.js
// META: timeout=long
// https://w3c.github.io/push-api/
idl_test(
['push-api'],
['service-workers', 'hr-time', 'html', 'dom', 'permissions'],
async (idl_array, t) => {
const isServiceWorker = 'ServiceWorkerGlobalScope' in self
&& self instanceof ServiceWorkerGlobalScope;
if (isServiceWorker) {
idl_array.add_objects({
ServiceWorkerGlobalScope: ['self'],
PushEvent: ['new PushEvent("type")'],
PushSubscriptionChangeEvent: [
'new PushSubscriptionChangeEvent("pushsubscriptionchange")'
],
})
}
if (GLOBAL.isWindow() || isServiceWorker) {
idl_array.add_objects({
// self.registration set for window below, and registration is already
// part of ServiceWorkerGlobalScope.
ServiceWorkerRegistration: ['registration'],
PushManager: ['registration.pushManager'],
});
}
if (GLOBAL.isWindow()) {
const scope = '/service-workers/service-worker/resources/';
const worker = `${scope}empty-worker.js`;
return service_worker_unregister_and_register(t, worker, scope)
.then(registration => {
self.registration = registration;
t.add_cleanup(function () { registration.unregister(); });
});
}
}
);