Automatic update from web-platform-tests Sync interfaces/ with @webref/idl 3.73.0 (#57971) * Sync interfaces/ with @webref/idl 3.73.0 * Update idl files by adding pointerevents and renaming web-based-payment * Re-add 'uievents' to the idl_test dependencies * Re-add 'uievents' to html/dom/idlharness.any.js * Re-add 'uievents' to pointerlock idlharness.window.js * Fix html/dom/idlharness.https.html --------- Co-authored-by: wpt-pr-bot <wpt-pr-bot@users.noreply.github.com> -- wpt-commits: 1c520bcb6d8d1d679da638a3042d47e1e4449265 wpt-pr: 57971
46 lines
1.4 KiB
JavaScript
46 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
|
|
|
|
'use strict';
|
|
|
|
// https://w3c.github.io/web-based-payment-handler/
|
|
|
|
idl_test(
|
|
['web-based-payment-handler'],
|
|
['service-workers', 'html', 'dom'],
|
|
async (idl_array, t) => {
|
|
const isWindow = self.GLOBAL.isWindow();
|
|
const isServiceWorker = 'ServiceWorkerGlobalScope' in self;
|
|
const hasRegistration = isServiceWorker || isWindow;
|
|
|
|
if (hasRegistration) {
|
|
idl_array.add_objects({
|
|
ServiceWorkerRegistration: ['registration'],
|
|
PaymentManager: ['paymentManager'],
|
|
});
|
|
}
|
|
if (isServiceWorker) {
|
|
idl_array.add_objects({
|
|
ServiceWorkerGlobalScope: ['self'],
|
|
CanMakePaymentEvent: ['new CanMakePaymentEvent("type")'],
|
|
PaymentRequestEvent: ['new PaymentRequestEvent("type")'],
|
|
})
|
|
}
|
|
|
|
if (isWindow) {
|
|
const scope = '/service-workers/service-worker/resources/';
|
|
const reg = await service_worker_unregister_and_register(
|
|
t, '/service-workers/service-worker/resources/empty-worker.js', scope);
|
|
self.registration = reg;
|
|
await wait_for_state(t, reg.installing, "activated");
|
|
add_completion_callback(() => reg.unregister());
|
|
}
|
|
if (hasRegistration) {
|
|
self.paymentManager = self.registration.paymentManager;
|
|
}
|
|
}
|
|
);
|