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
Two <a>jobs</a> are <dfn id="dfn-job-equivalent">equivalent</dfn> when their <a>job type</a> is the same and:
2254
2254
2255
-
* For *register* and *update* <a>jobs</a>, both their [=service worker registration/scope url=] and the [=service worker/script url=] are the same.
2256
-
* For *unregister* <a>jobs</a>, their [=service worker registration/scope url=] is the same.
2255
+
* For *register* and *update* <a>jobs</a>, both their [=job/scope url=] and the [=job/script url=] are the same.
2256
+
* For *unregister* <a>jobs</a>, their [=job/scope url=] is the same.
2257
2257
2258
-
A <dfn id="dfn-job-queue">job queue</dfn> is a thread safe queue used to synchronize the set of concurrent <a>jobs</a>. The <a>job queue</a> contains <a>jobs</a> as its elements. The <a>job queue</a> *should* satisfy the general properties of FIFO queue. A user agent *must* maintain a separate <a>job queue</a> for each [=/service worker registration=] keyed by its [=service worker registration/scope url=]. A <a>job queue</a> is initially empty. Unless stated otherwise, the <a>job queue</a> referenced from the algorithm steps is a <a>job queue</a> for the <a>job</a>'s [=service worker registration/scope url=].
2258
+
A <dfn id="dfn-job-queue">job queue</dfn> is a thread safe queue used to synchronize the set of concurrent <a>jobs</a>. The <a>job queue</a> contains <a>jobs</a> as its elements. The <a>job queue</a> *should* satisfy the general properties of FIFO queue. A user agent *must* maintain a separate <a>job queue</a> for each [=/service worker registration=] keyed by its [=service worker registration/scope url=]. A <a>job queue</a> is initially empty. Unless stated otherwise, the <a>job queue</a> referenced from the algorithm steps is a <a>job queue</a> for the <a>job</a>'s [=job/scope url=].
1. If the result of running <a>potentially trustworthy origin</a> with the [=environment settings object/origin=] of |job|'s [=service worker/script url=] as the argument is <code>Not Trusted</code>, then:
2395
+
1. If the result of running <a>potentially trustworthy origin</a> with the [=environment settings object/origin=] of |job|'s [=job/script url=] as the argument is <code>Not Trusted</code>, then:
2396
2396
1. Invoke <a>Reject Job Promise</a> with |job| and a "{{SecurityError}}" exception.
2397
2397
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2398
-
1. If the [=environment settings object/origin=] of |job|'s [=service worker/script url=] is not |job|'s [=job/referrer=]'s [=environment settings object/origin=], then:
2398
+
1. If the [=environment settings object/origin=] of |job|'s [=job/script url=] is not |job|'s [=job/referrer=]'s [=environment settings object/origin=], then:
2399
2399
1. Invoke <a>Reject Job Promise</a> with |job| and a "{{SecurityError}}" exception.
2400
2400
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2401
-
1. If the [=environment settings object/origin=] of |job|'s [=service worker registration/scope url=] is not |job|'s [=job/referrer=]'s [=environment settings object/origin=], then:
2401
+
1. If the [=environment settings object/origin=] of |job|'s [=job/scope url=] is not |job|'s [=job/referrer=]'s [=environment settings object/origin=], then:
2402
2402
1. Invoke <a>Reject Job Promise</a> with |job| and a "{{SecurityError}}" exception.
2403
2403
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2404
-
1. Let |registration| be the result of running the <a>Get Registration</a> algorithm passing |job|'s [=service worker registration/scope url=] as the argument.
2404
+
1. Let |registration| be the result of running the <a>Get Registration</a> algorithm passing |job|'s [=job/scope url=] as the argument.
2405
2405
1. If |registration| is not null, then:
2406
2406
1. If |registration|'s <a>uninstalling flag</a> is set, unset it.
2407
2407
1. Let |newestWorker| be the result of running the <a>Get Newest Worker</a> algorithm passing |registration| as the argument.
2408
-
1. If |newestWorker| is not null and |job|'s [=service worker/script url=] [=url/equals=] |newestWorker|'s [=service worker/script url=] with the *exclude fragments flag* set, then:
2409
-
1. Invoke <a>Resolve Job Promise</a> with |job| and the {{ServiceWorkerRegistration}} object which represents |registration|.
2410
-
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2408
+
1. If |newestWorker| is not null and |job|'s [=job/script url=] [=url/equals=] |newestWorker|'s [=service worker/script url=] with the *exclude fragments flag* set, then:
2409
+
1. Invoke <a>Resolve Job Promise</a> with |job| and the {{ServiceWorkerRegistration}} object which represents |registration|.
2410
+
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2411
2411
1. Else:
2412
-
1. Invoke <a>Set Registration</a> algorithm passing |job|'s [=service worker registration/scope url=] as its argument.
2412
+
1. Invoke <a>Set Registration</a> algorithm passing |job|'s [=job/scope url=] as its argument.
2413
2413
1. Invoke <a>Update</a> algorithm passing |job| as the argument.
1. Let |registration| be the result of running the <a>Get Registration</a> algorithm passing |job|'s [=service worker registration/scope url=] as the argument.
2424
+
1. Let |registration| be the result of running the <a>Get Registration</a> algorithm passing |job|'s [=job/scope url=] as the argument.
2425
2425
1. If |registration| is null or |registration|'s <a>uninstalling flag</a> is set, then:
2426
2426
1. Invoke <a>Reject Job Promise</a> with |job| and a <code>TypeError</code>.
2427
2427
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2428
2428
1. Let |newestWorker| be the result of running <a>Get Newest Worker</a> algorithm passing |registration| as the argument.
2429
-
1. If |job|'s <a>job type</a> is *update*, and |newestWorker|'s [=service worker/script url=] does not [=url/equal=] |job|'s [=service worker/script url=] with the *exclude fragments flag* set, then:
2429
+
1. If |job|'s <a>job type</a> is *update*, and |newestWorker|'s [=service worker/script url=] does not [=url/equal=] |job|'s [=job/script url=] with the *exclude fragments flag* set, then:
2430
2430
1. Invoke <a>Reject Job Promise</a> with |job| and a <code>TypeError</code>.
2431
2431
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2432
2432
1. Let |httpsState| be "<code>none</code>".
2433
2433
1. Let |referrerPolicy| be the empty string.
2434
2434
1. Switching on |job|'s <a>worker type</a>, run these substeps with the following options:
2435
2435
<!-- TODO: reorganize algorithm so that the worker environment is created before fetching happens -->
2436
2436
: "<code>classic</code>"
2437
-
:: <a>Fetch a classic worker script</a> given |job|’s <a lt="URL serializer">serialized</a>[=service worker/script url=], |job|’s [=job/client=], "<code>serviceworker</code>", and the to-be-created <a>environment settings object</a> for this service worker.
2437
+
:: <a>Fetch a classic worker script</a> given |job|’s <a lt="URL serializer">serialized</a>[=job/script url=], |job|’s [=job/client=], "<code>serviceworker</code>", and the to-be-created <a>environment settings object</a> for this service worker.
2438
2438
: "<code>module</code>"
2439
-
:: <a>Fetch a module worker script graph</a> given |job|’s <a lt="URL serializer">serialized</a>[=service worker/script url=], |job|’s [=job/client=], "<code>serviceworker</code>", "<code>omit</code>", and the to-be-created <a>environment settings object</a> for this service worker.
2439
+
:: <a>Fetch a module worker script graph</a> given |job|’s <a lt="URL serializer">serialized</a>[=job/script url=], |job|’s [=job/client=], "<code>serviceworker</code>", "<code>omit</code>", and the to-be-created <a>environment settings object</a> for this service worker.
2440
2440
2441
2441
To [=fetching scripts/perform the fetch=] given |request|, run the following steps if the [=fetching scripts/is top-level=] flag is set:
1. Let |scopeURL| be |registration|'s [=service worker registration/scope url=].
2466
2466
1. Let |maxScopeString| be null.
2467
2467
1. If |serviceWorkerAllowed| is null, then:
2468
-
1. Set |maxScopeString| to "<code>/</code>" concatenated with the strings, except the last string that denotes the script's file name, in |job|'s [=service worker/script url=]'s [=url/path=] (including empty strings), separated from each other by "<code>/</code>".
2468
+
1. Set |maxScopeString| to "<code>/</code>" concatenated with the strings, except the last string that denotes the script's file name, in |job|'s [=job/script url=]'s [=url/path=] (including empty strings), separated from each other by "<code>/</code>".
2469
2469
1. Else:
2470
-
1. Let |maxScope| be the result of <a lt="URL parser">parsing</a> |serviceWorkerAllowed| with |job|'s [=service worker/script url=].
2470
+
1. Let |maxScope| be the result of <a lt="URL parser">parsing</a> |serviceWorkerAllowed| with |job|'s [=job/script url=].
2471
2471
1. Set |maxScopeString| to "<code>/</code>" concatenated with the strings in |maxScope|'s [=url/path=] (including empty strings), separated from each other by "<code>/</code>".
2472
2472
1. Let |scopeString| be "<code>/</code>" concatenated with the strings in |scopeURL|'s [=url/path=] (including empty strings), separated from each other by "<code>/</code>".
2473
2473
1. If |scopeString| starts with |maxScopeString|, do nothing.
Else, continue the rest of these steps after the algorithm's asynchronous completion, with |script| being the asynchronous completion value.
2493
2493
2494
-
1. If |newestWorker| is not null, |newestWorker|'s [=service worker/script url=] [=url/equals=] |job|'s [=service worker/script url=] with the *exclude fragments flag* set, and |script| is a byte-for-byte match with |newestWorker|'s <a>script resource</a>, then:
2494
+
1. If |newestWorker| is not null, |newestWorker|'s [=service worker/script url=] [=url/equals=] |job|'s [=job/script url=] with the *exclude fragments flag* set, and |script| is a byte-for-byte match with |newestWorker|'s <a>script resource</a>, then:
2495
2495
1. Invoke <a>Resolve Job Promise</a> with |job| and the {{ServiceWorkerRegistration}} object which represents |registration|.
2496
2496
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2497
2497
1. Else:
2498
2498
1. Let |worker| be a new [=/service worker=].
2499
2499
1. Generate a unique opaque string and set |worker|'s <a>id</a> to the value.
2500
-
1. Set |worker|'s [=service worker/script url=] to |job|'s [=service worker/script url=], |worker|'s <a>script resource</a> to |script|, and |worker|'s <a>type</a> to |job|'s <a>worker type</a>.
2500
+
1. Set |worker|'s [=service worker/script url=] to |job|'s [=job/script url=], |worker|'s <a>script resource</a> to |script|, and |worker|'s <a>type</a> to |job|'s <a>worker type</a>.
2501
2501
1. Set |worker|'s <a>script resource</a>'s <a>HTTPS state</a> to |httpsState|.
2502
2502
1. Set |worker|'s <a>script resource</a>'s [=script resource/referrer policy=] to |referrerPolicy|.
2503
2503
1. Invoke <a>Run Service Worker</a> algorithm with |worker| as the argument.
1. If the [=environment settings object/origin=] of |job|'s [=service worker registration/scope url=] is not |job|'s [=job/client=]'s [=environment settings object/origin=], then:
2965
+
1. If the [=environment settings object/origin=] of |job|'s [=job/scope url=] is not |job|'s [=job/client=]'s [=environment settings object/origin=], then:
2966
2966
1. Invoke <a>Reject Job Promise</a> with |job| and a "{{SecurityError}}" exception.
2967
2967
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
2968
-
1. Let |registration| be the result of running <a>Get Registration</a> algorithm passing |job|'s [=service worker registration/scope url=] as the argument.
2968
+
1. Let |registration| be the result of running <a>Get Registration</a> algorithm passing |job|'s [=job/scope url=] as the argument.
2969
2969
1. If |registration| is null, then:
2970
2970
1. Invoke <a>Resolve Job Promise</a> with |job| and false.
2971
2971
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
0 commit comments