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
1. If |newestWorker| is not null, |job|'s [=job/scope url=] [=url/equals=] |newestWorker|'s [=service worker/scope url=], |job|'s [=job/script url=] [=url/equals=] |newestWorker|'s [=service worker/script url=], |job|'s [=job/worker type=] equals |newestWorker|'s [=service worker/type=], and |job|'s [=job/update via cache mode=]'s value equals |registration|'s [=service worker registration/update via cache mode=], then:
2617
2616
1. Invoke [=Resolve Job Promise=] with |job| and |registration|.
2618
2617
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2618
+
1. Let |scopeRegistration| be the result of running the <a>Get Registration By Scope</a> algorithm passing |job|'s [=job/scope url=] as the argument.
2619
+
1. If |scopeRegistration| is not null, |scopeRegistration| is not |registration|, and |scopeRegistration|'s <a>active worker</a>'s [=service worker/scope url=][=url/equals=] |job|'s [=job/scope url=], then:
2620
+
1. Invoke [=Reject Job Promise=] with |job| and "{{InvalidStateError}}" {{DOMException}}.
2621
+
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2619
2622
1. Else:
2620
2623
1. Invoke <a>Set Registration</a> algorithm with |job|'s [=job/origin=], |job|'s [=job/id=], and |job|'s [=job/update via cache mode=].
2621
2624
1. Invoke <a>Update</a> algorithm passing |job| as the argument.
:: |origin|, a [=environment settings object/origin=]
3405
3408
:: |id|, a [=service worker registration/id=]
3406
3409
: Output
3407
-
:: A [=/service worker registration=]
3410
+
:: A [=/service worker registration=] or null.
3408
3411
3409
3412
1. Run the following steps atomically.
3410
3413
1. [=map/Get=] (|origin|,|id|) from [=registration map=] and return the result.
3411
3414
</section>
3412
3415
3416
+
<section algorithm>
3417
+
<h3 id="get-registration-by-scope-algorithm"><dfn>Get Registration By Scope</dfn></h3>
3418
+
3419
+
: Input
3420
+
:: |scope|, a [=URL=]
3421
+
: Output
3422
+
:: A [=/service worker registration=] or null.
3423
+
3424
+
1. Run the following steps atomically.
3425
+
1. [=map/For each=] |key| → |value| of <a>registration map</a>:
3426
+
1. If |value|'s <a>active worker</a>'s [=service worker/scope url=][=url/equals=] |scope|, then return |value|.
3427
+
1. If |value|'s <a>waiting worker</a>'s [=service worker/scope url=][=url/equals=] |scope|, then return |value|.
3428
+
1. If |value|'s <a>installing worker</a>'s [=service worker/scope url=][=url/equals=] |scope|, then return |value|.
3429
+
1. Return null.
3430
+
3431
+
Note: Only one registration should be associated with a given scope at a time since we fail <a>Register</a> when there is a conflicting registration with the same scope.
0 commit comments