Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit a13797b

Browse files
committed
[cookie-store] Deflake service worker registration (part 2)
This is a follow-up to web-platform-tests/wpt#18324 This change by itself isn't sufficient to deflake the two tests.
1 parent 36b35d5 commit a13797b

2 files changed

+8
-8
lines changed

cookie-store/serviceworker_cookieStore_subscriptions_eventhandler_attribute.tentative.https.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
(async () => {
1212
const scope = 'scope';
1313

14-
let registration = await navigator.serviceWorker.getRegistration(scope);
15-
if (registration)
16-
await registration.unregister();
17-
registration = await navigator.serviceWorker.register(
14+
const registration = await navigator.serviceWorker.register(
1815
'serviceworker_cookieStore_subscriptions_eventhandler_attribute.js', {scope});
16+
add_completion_callback(() => {
17+
registration.unregister();
18+
});
1919

2020
fetch_tests_from_worker(registration.installing);
2121
})();

cookie-store/serviceworker_cookieStore_subscriptions_mismatch.tentative.https.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
(async () => {
1111
const scope = 'scope';
1212

13-
let registration = await navigator.serviceWorker.getRegistration(scope);
14-
if (registration)
15-
await registration.unregister();
16-
registration = await navigator.serviceWorker.register(
13+
const registration = await navigator.serviceWorker.register(
1714
'serviceworker_cookieStore_subscriptions_mismatch.js', {scope});
15+
add_completion_callback(() => {
16+
registration.unregister();
17+
});
1818

1919
fetch_tests_from_worker(registration.installing);
2020
})();

0 commit comments

Comments
 (0)