You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This patch fixes the control flow of registration.update() method such
that the algorithm returns a promise rejected with an exception on error
conditions. Before this patch, the steps rejected a non-returned promise
and aborted the steps right away.
Issue raised through #1152.
<dfn method for="ServiceWorkerRegistration"><code>update()</code></dfn> method *must* run these steps:
477
477
478
-
1. Let |p| be a <a>promise</a>.
479
478
1. Let |registration| be the [=ServiceWorkerRegistration/service worker registration=].
480
479
1. Let |newestWorker| be the result of running <a>Get Newest Worker</a> algorithm passing |registration| as its argument.
481
-
1. If |newestWorker| is null, reject |p| with an "{{InvalidStateError}}" exception and abort these steps.
482
-
1. If the <a>context object</a>'s <a>relevant settings object</a>'s [=environment settings object/global object=] |globalObject| is a {{ServiceWorkerGlobalScope}} object, and |globalObject|'s associated [=ServiceWorkerGlobalScope/service worker=]'s <a>state</a> is *installing*, reject |p| with an "{{InvalidStateError}}" exception and abort these steps.
483
-
1. Let |job| be the result of running <a>Create Job</a> with *update*, |registration|'s [=service worker registration/scope url=], |newestWorker|'s [=service worker/script url=], |p|, and the <a>context object</a>'s <a>relevant settings object</a>.
480
+
1. If |newestWorker| is null, return [=a promise rejected with=] an "{{InvalidStateError}}" exception and abort these steps.
481
+
1. If the <a>context object</a>'s <a>relevant settings object</a>'s [=environment settings object/global object=] |globalObject| is a {{ServiceWorkerGlobalScope}} object, and |globalObject|'s associated [=ServiceWorkerGlobalScope/service worker=]'s <a>state</a> is *installing*, return [=a promise rejected with=] an "{{InvalidStateError}}" exception and abort these steps.
482
+
1. Let |promise| be a <a>promise</a>.
483
+
1. Let |job| be the result of running <a>Create Job</a> with *update*, |registration|'s [=service worker registration/scope url=], |newestWorker|'s [=service worker/script url=], |promise|, and the <a>context object</a>'s <a>relevant settings object</a>.
484
484
1. Set |job|'s <a>worker type</a> to |newestWorker|'s [=service worker/type=].
<dfn method for="ServiceWorkerRegistration"><code>unregister()</code></dfn> method *must* run these steps:
495
495
496
-
1. Let |p| be a <a>promise</a>.
497
-
1. Let |job| be the result of running <a>Create Job</a> with *unregister*, the [=service worker registration/scope url=] of the [=ServiceWorkerRegistration/service worker registration=], null, |p|, and the <a>context object</a>'s <a>relevant settings object</a>.
496
+
1. Let |promise| be a <a>promise</a>.
497
+
1. Let |job| be the result of running <a>Create Job</a> with *unregister*, the [=service worker registration/scope url=] of the [=ServiceWorkerRegistration/service worker registration=], null, |promise|, and the <a>context object</a>'s <a>relevant settings object</a>.
0 commit comments