forked from mirrors/gecko-dev
Automatic update from web-platform-testsRename idlharness tests for [SecureContext] APIs to .https. (#12353) Spurious failures that should be fixed by this: https://wpt.fyi/results/background-fetch/idlharness.any.html?sha=eea0b54014&label=experimental https://wpt.fyi/results/push-api/idlharness.any.html?sha=eea0b54014&label=experimental https://wpt.fyi/results/notifications/idlharness.any.html?sha=eea0b54014&label=experimental Most commonly caused by ServiceWorkerRegistration not being exposed. -- wpt-commits: 1e79f6d25a79ca5e5d47bc3696904c303d173033 wpt-pr: 12353 --HG-- rename : testing/web-platform/tests/background-fetch/idlharness.any.js => testing/web-platform/tests/background-fetch/idlharness.https.any.js rename : testing/web-platform/tests/notifications/idlharness.any.js => testing/web-platform/tests/notifications/idlharness.https.any.js rename : testing/web-platform/tests/push-api/idlharness.any.js => testing/web-platform/tests/push-api/idlharness.https.any.js
42 lines
1.4 KiB
JavaScript
42 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
|
|
|
|
// https://w3c.github.io/push-api/
|
|
|
|
idl_test(
|
|
['push-api'],
|
|
['service-workers', 'html', 'dom'],
|
|
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(); });
|
|
});
|
|
}
|
|
}
|
|
);
|