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
* |newestWorker| is not null, and |registration|'s [=last update check time=] is not null and the time difference in seconds calculated by the current time minus |registration|’s [=last update check time=] is greater than 86400.
2481
2481
2482
2482
Note: Even if the cache mode is not set to "<code>no-cache</code>", the user agent obeys Cache-Control header's max-age value in the network layer to determine if it should bypass the browser cache.
2483
-
2483
+
2484
2484
1. Set |request|'s [=skip-service-worker flag=].
2485
2485
1. If the [=fetching scripts/is top-level=] flag is unset, then return the result of [=/fetching=] |request|.
2486
2486
1. Append \`<code>Service-Worker</code>\`/\`<code>script</code>\` to |request|'s [=request/header list=].
2487
2487
2488
2488
Note: See the definition of the Service-Worker header in Appendix B: Extended HTTP headers.
2489
2489
2490
2490
1. Set |request|'s [=request/redirect mode=] to "<code>error</code>".
2491
-
2492
2491
1. [=/Fetch=] |request|, and asynchronously wait to run the remaining steps as part of fetch's <a>process response</a> for the [=/response=] |response|.
2493
2492
1. <a>Extract a MIME type</a> from the |response|'s [=response/header list=]. If this MIME type (ignoring parameters) is not one of <code>text/javascript</code>, <code>application/x-javascript</code>, and <code>application/javascript</code>, then:
2494
2493
1. Invoke <a>Reject Job Promise</a> with |job| and a "{{SecurityError}}" exception.
<p class="note" role="note">Note: The promise returned from this method resolves with the sequence of keys, cache names in DOMString, in insertion order.</p>
4266
4266
<ol>
4267
4267
<li data-md="">
4268
-
<p>Let <var>cacheKeys</var> be the result of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-get-the-keys">getting the keys</a> of <a data-link-type="dfn" href="#dfn-name-to-cache-map" id="ref-for-dfn-name-to-cache-map-10">name to cache map</a>.</p>
4268
+
<p>Let <var>cacheKeys</var> be the result of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-getting-the-keys">getting the keys</a> of <a data-link-type="dfn" href="#dfn-name-to-cache-map" id="ref-for-dfn-name-to-cache-map-10">name to cache map</a>.</p>
<p><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-worker-script-tree">Fetch a module worker script graph</a> given <var>job</var>’s <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-serializer">serialized</a> <a data-link-type="dfn" href="#dfn-job-script-url" id="ref-for-dfn-job-script-url-8">script url</a>, <var>job</var>’s <a data-link-type="dfn" href="#dfn-job-client" id="ref-for-dfn-job-client-11">client</a>, "<code>serviceworker</code>", "<code>omit</code>", and the to-be-created <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object">environment settings object</a> for this service worker.</p>
4764
4764
</dl>
4765
-
<p>To <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-perform-fetch">perform the fetch</a> given <var>request</var>, run the following steps if the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-top-level">is top-level</a> flag is set:</p>
4765
+
<p>To <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-perform-fetch">perform the fetch</a> given <var>request</var>, run the following steps:</p>
4766
4766
<ol>
4767
-
<li data-md="">
4768
-
<p>Append `<code>Service-Worker</code>`/`<code>script</code>` to <var>request</var>’s <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-request-header-list">header list</a>.</p>
4769
-
<p class="note" role="note">Note: See the definition of the Service-Worker header in Appendix B: Extended HTTP headers.</p>
4770
-
<li data-md="">
4771
-
<p>Set <var>request</var>’s <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#skip-service-worker-flag">skip-service-worker flag</a> and <var>request</var>’s <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-request-redirect-mode">redirect mode</a> to "<code>error</code>".</p>
4772
4767
<li data-md="">
4773
4768
<p>Set <var>request</var>’s <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-request-cache-mode">cache mode</a> to "<code>no-cache</code>" if any of the following are true:</p>
<p><var>newestWorker</var> is not null, and <var>registration</var>’s <a data-link-type="dfn" href="#dfn-last-update-check-time" id="ref-for-dfn-last-update-check-time-4">last update check time</a> is not null and the time difference in seconds calculated by the current time minus <var>registration</var>’s <a data-link-type="dfn" href="#dfn-last-update-check-time" id="ref-for-dfn-last-update-check-time-5">last update check time</a> is greater than 86400.</p>
4781
4776
</ul>
4782
4777
<p class="note" role="note">Note: Even if the cache mode is not set to "<code>no-cache</code>", the user agent obeys Cache-Control header’s max-age value in the network layer to determine if it should bypass the browser cache.</p>
<p>If the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-is-top-level">is top-level</a> flag is unset, then return the result of <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-fetch">fetching</a> <var>request</var>.</p>
4782
+
<li data-md="">
4783
+
<p>Append `<code>Service-Worker</code>`/`<code>script</code>` to <var>request</var>’s <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-request-header-list">header list</a>.</p>
4784
+
<p class="note" role="note">Note: See the definition of the Service-Worker header in Appendix B: Extended HTTP headers.</p>
4785
+
<li data-md="">
4786
+
<p>Set <var>request</var>’s <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-request-redirect-mode">redirect mode</a> to "<code>error</code>".</p>
4783
4787
<li data-md="">
4784
4788
<p><a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-fetch">Fetch</a> <var>request</var>, and asynchronously wait to run the remaining steps as part of fetch’s <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#process-response">process response</a> for the <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-response">response</a> <var>response</var>.</p>
<p>Else, continue the rest of these steps after the algorithm’s asynchronous completion, with <var>script</var> being the asynchronous completion value.</p>
4853
4857
<li data-md="">
4854
-
<p>If <var>newestWorker</var> is not null, <var>newestWorker</var>’s <a data-link-type="dfn" href="#dfn-script-url" id="ref-for-dfn-script-url-5">script url</a> <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-equals">equals</a> <var>job</var>’s <a data-link-type="dfn" href="#dfn-job-script-url" id="ref-for-dfn-job-script-url-11">script url</a> with the <em>exclude fragments flag</em> set, and <var>script</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-classic-script-source-text">source text</a> is a byte-for-byte match with <var>newestWorker</var>’s <a data-link-type="dfn" href="#dfn-script-resource" id="ref-for-dfn-script-resource-6">script resource</a>'s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-classic-script-source-text">source text</a>, if <var>script</var> is a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#classic-script">classic script</a>, and <var>script</var>’s <a data-link-type="dfn">module record</a>'s [[ECMAScriptCode]] is a byte-for-byte match with <var>newestWorker</var>’s <a data-link-type="dfn" href="#dfn-script-resource" id="ref-for-dfn-script-resource-7">script resource</a>'s <a data-link-type="dfn">module record</a>'s [[ECMAScriptCode]] otherwise, then:</p>
4858
+
<p>If <var>newestWorker</var> is not null, <var>newestWorker</var>’s <a data-link-type="dfn" href="#dfn-script-url" id="ref-for-dfn-script-url-5">script url</a> <a data-link-type="dfn" href="https://url.spec.whatwg.org/#concept-url-equals">equals</a> <var>job</var>’s <a data-link-type="dfn" href="#dfn-job-script-url" id="ref-for-dfn-job-script-url-11">script url</a> with the <em>exclude fragments flag</em> set, and <var>script</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-classic-script-source-text">source text</a> is a byte-for-byte match with <var>newestWorker</var>’s <a data-link-type="dfn" href="#dfn-script-resource" id="ref-for-dfn-script-resource-6">script resource</a>'s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-classic-script-source-text">source text</a>, if <var>script</var> is a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#classic-script">classic script</a>, and <var>script</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-module-record">module record</a>'s [[ECMAScriptCode]] is a byte-for-byte match with <var>newestWorker</var>’s <a data-link-type="dfn" href="#dfn-script-resource" id="ref-for-dfn-script-resource-7">script resource</a>'s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-module-record">module record</a>'s [[ECMAScriptCode]] otherwise, then:</p>
4855
4859
<ol>
4856
4860
<li data-md="">
4857
4861
<p>Invoke <a data-link-type="dfn" href="#resolve-job-promise" id="ref-for-resolve-job-promise-2">Resolve Job Promise</a> with <var>job</var> and the <code class="idl"><a data-link-type="idl" href="#serviceworkerregistration" id="ref-for-serviceworkerregistration-18">ServiceWorkerRegistration</a></code> object which represents <var>registration</var>.</p>
<p>Let <var>matchingScope</var> be the empty string.</p>
5990
5994
<li data-md="">
5991
-
<p>Let <var>allScopes</var> be the result of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-get-the-keys">getting the keys</a> from <a data-link-type="dfn" href="#dfn-scope-to-registration-map" id="ref-for-dfn-scope-to-registration-map-11">scope to registration map</a>.</p>
5995
+
<p>Let <var>allScopes</var> be the result of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-getting-the-keys">getting the keys</a> from <a data-link-type="dfn" href="#dfn-scope-to-registration-map" id="ref-for-dfn-scope-to-registration-map-11">scope to registration map</a>.</p>
5992
5996
<li data-md="">
5993
5997
<p>Set <var>matchingScope</var> to the longest value in <var>allScopes</var> which the value of <var>clientURLString</var> starts with, if it exists.</p>
5994
5998
<p class="note" role="note">Note: The URL string matching in this step is prefix-based rather than path-structural (e.g. a client URL string with "/prefix-of/resource.html" will match a registration for a scope with "/prefix").</p>
:: <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.
2194
2194
2195
-
To [=fetching scripts/perform the fetch=] given |request|, run the following steps if the [=fetching scripts/is top-level=] flag is set:
2195
+
To [=fetching scripts/perform the fetch=] given |request|, run the following steps:
2196
2196
2197
-
1. Append \`<code>Service-Worker</code>\`/\`<code>script</code>\` to |request|'s [=request/header list=].
2198
-
2199
-
Note: See the definition of the Service-Worker header in Appendix B: Extended HTTP headers.
2200
-
2201
-
1. Set |request|'s <a>skip-service-worker flag</a> and |request|'s [=request/redirect mode=] to "<code>error</code>".
2202
2197
1. Set |request|'s [=request/cache mode=] to "<code>no-cache</code>" if any of the following are true:
2203
2198
* |registration|'s [=service worker registration/use cache=] is false.
2204
2199
* |job|'s [=force bypass cache flag=] is set.
2205
2200
* |newestWorker| is not null, and |registration|'s [=last update check time=] is not null and the time difference in seconds calculated by the current time minus |registration|’s [=last update check time=] is greater than 86400.
2206
2201
2207
2202
Note: Even if the cache mode is not set to "<code>no-cache</code>", the user agent obeys Cache-Control header's max-age value in the network layer to determine if it should bypass the browser cache.
2208
2203
2204
+
1. Set |request|'s [=skip-service-worker flag=].
2205
+
1. If the [=fetching scripts/is top-level=] flag is unset, then return the result of [=/fetching=] |request|.
2206
+
1. Append \`<code>Service-Worker</code>\`/\`<code>script</code>\` to |request|'s [=request/header list=].
2207
+
2208
+
Note: See the definition of the Service-Worker header in Appendix B: Extended HTTP headers.
2209
+
2210
+
1. Set |request|'s [=request/redirect mode=] to "<code>error</code>".
2209
2211
1. [=/Fetch=] |request|, and asynchronously wait to run the remaining steps as part of fetch's <a>process response</a> for the [=/response=] |response|.
2210
2212
1. <a>Extract a MIME type</a> from the |response|'s [=response/header list=]. If this MIME type (ignoring parameters) is not one of <code>text/javascript</code>, <code>application/x-javascript</code>, and <code>application/javascript</code>, then:
2211
2213
1. Invoke <a>Reject Job Promise</a> with |job| and a "{{SecurityError}}" exception.
0 commit comments