Skip to content

Commit 03578ce

Browse files
committed
Backport c858a0d to V1
1 parent c858a0d commit 03578ce

File tree

4 files changed

+43
-32
lines changed

4 files changed

+43
-32
lines changed

docs/index.bs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,15 +2480,14 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
24802480
* |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.
24812481

24822482
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+
24842484
1. Set |request|'s [=skip-service-worker flag=].
24852485
1. If the [=fetching scripts/is top-level=] flag is unset, then return the result of [=/fetching=] |request|.
24862486
1. Append \`<code>Service-Worker</code>\`/\`<code>script</code>\` to |request|'s [=request/header list=].
24872487

24882488
Note: See the definition of the Service-Worker header in Appendix B: Extended HTTP headers.
24892489

24902490
1. Set |request|'s [=request/redirect mode=] to "<code>error</code>".
2491-
24922491
1. [=/Fetch=] |request|, and asynchronously wait to run the remaining steps as part of fetch's <a>process response</a> for the [=/response=] |response|.
24932492
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:
24942493
1. Invoke <a>Reject Job Promise</a> with |job| and a "{{SecurityError}}" exception.

docs/index.html

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@
11771177
}
11781178
}
11791179
</style>
1180-
<meta content="Bikeshed version 0feafaae1a97b66d9da46b325858f9805ac01fb2" name="generator">
1180+
<meta content="Bikeshed version 190a4fcba8ed9462253188b3415e5074949e11bd" name="generator">
11811181
<style>/* style-md-lists */
11821182

11831183
/* This is a weird hack for me not yet following the commonmark spec
@@ -1424,7 +1424,7 @@
14241424
<div class="head">
14251425
<p data-fill-with="logo"><a class="logo" href="http://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
14261426
<h1 class="p-name no-ref" id="title">Service Workers Nightly</h1>
1427-
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="2016-12-09">9 December 2016</time></span></h2>
1427+
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="2016-12-15">15 December 2016</time></span></h2>
14281428
<div data-fill-with="spec-metadata">
14291429
<dl>
14301430
<dt>This version:
@@ -4265,7 +4265,7 @@ <h4 class="heading settled" data-level="6.5.5" id="cache-storage-keys"><span cla
42654265
<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>
42664266
<ol>
42674267
<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>
42694269
<li data-md="">
42704270
<p>Return <var>cacheKeys</var>.</p>
42714271
</ol>
@@ -4762,13 +4762,8 @@ <h3 class="heading settled" id="update-algorithm"><span class="content"><dfn cla
47624762
<dd data-md="">
47634763
<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>
47644764
</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>
47664766
<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>
47724767
<li data-md="">
47734768
<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>
47744769
<ul>
@@ -4780,6 +4775,15 @@ <h3 class="heading settled" id="update-algorithm"><span class="content"><dfn cla
47804775
<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>
47814776
</ul>
47824777
<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>
4778+
<li data-md="">
4779+
<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>.</p>
4780+
<li data-md="">
4781+
<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>
47834787
<li data-md="">
47844788
<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>
47854789
<li data-md="">
@@ -4851,7 +4855,7 @@ <h3 class="heading settled" id="update-algorithm"><span class="content"><dfn cla
48514855
</ol>
48524856
<p>Else, continue the rest of these steps after the algorithm’s asynchronous completion, with <var>script</var> being the asynchronous completion value.</p>
48534857
<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>
48554859
<ol>
48564860
<li data-md="">
48574861
<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>
@@ -5988,7 +5992,7 @@ <h3 class="heading settled" id="scope-match-algorithm"><span class="content"><df
59885992
<li data-md="">
59895993
<p>Let <var>matchingScope</var> be the empty string.</p>
59905994
<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>
59925996
<li data-md="">
59935997
<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>
59945998
<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>
@@ -7120,6 +7124,7 @@ <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span cla
71207124
<li><a href="https://html.spec.whatwg.org/multipage/semantics.html#the-link-element">link</a>
71217125
<li><a href="https://html.spec.whatwg.org/multipage/webappapis.html#list-of-active-timers">list of active timers</a>
71227126
<li><a href="https://html.spec.whatwg.org/multipage/indices.html#event-message">message</a>
7127+
<li><a href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-module-record">module record</a>
71237128
<li><a href="https://html.spec.whatwg.org/multipage/webappapis.html#module-script">module script</a>
71247129
<li><a href="https://html.spec.whatwg.org/multipage/browsers.html#navigate">navigate</a>
71257130
<li><a href="https://html.spec.whatwg.org/multipage/browsers.html#nested-browsing-context">nested browsing context</a>
@@ -7171,7 +7176,7 @@ <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span cla
71717176
<li><a href="https://infra.spec.whatwg.org/#ascii-case-insensitive">ascii case-insensitive</a>
71727177
<li><a href="https://infra.spec.whatwg.org/#map-exists">exists</a>
71737178
<li><a href="https://infra.spec.whatwg.org/#map-iterate">for each</a>
7174-
<li><a href="https://infra.spec.whatwg.org/#map-get-the-keys">get the keys</a>
7179+
<li><a href="https://infra.spec.whatwg.org/#map-getting-the-keys">get the keys</a>
71757180
<li><a href="https://infra.spec.whatwg.org/#ordered-map">ordered map</a>
71767181
<li><a href="https://infra.spec.whatwg.org/#map-remove">remove</a>
71777182
<li><a href="https://infra.spec.whatwg.org/#map-set">set</a>

docs/v1/index.bs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,20 +2192,22 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
21922192
: "<code>module</code>"
21932193
:: <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.
21942194

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:
21962196

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>".
22022197
1. Set |request|'s [=request/cache mode=] to "<code>no-cache</code>" if any of the following are true:
22032198
* |registration|'s [=service worker registration/use cache=] is false.
22042199
* |job|'s [=force bypass cache flag=] is set.
22052200
* |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.
22062201

22072202
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.
22082203

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>".
22092211
1. [=/Fetch=] |request|, and asynchronously wait to run the remaining steps as part of fetch's <a>process response</a> for the [=/response=] |response|.
22102212
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:
22112213
1. Invoke <a>Reject Job Promise</a> with |job| and a "{{SecurityError}}" exception.

0 commit comments

Comments
 (0)