Skip to content

Changing skip-service-worker flag to use-service-workers enum #435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 14, 2017
Merged
41 changes: 31 additions & 10 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,27 @@ explicitly set <a for=/>request</a>'s
this flag set are subject to additional processing requirements.

<p>A <a for=/>request</a> has an associated
<dfn export>skip-service-worker flag</dfn>. Unless stated otherwise it is
unset.
<dfn for=request export>service-workers mode</dfn>, that is "<code>all</code>",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to add some non-normative text somewhere to explain what this mode actually means? Of course you can figure that out by reading the algorithms, but I find the non-normative notes that many of the requests attributes have to be quite helpful in quickly figuring out what a particular thing is for.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sounds good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"<code>foreign</code>", or "<code>none</code>". Unless stated otherwise it is
"<code>all</code>".

<div class=note>
<p>This determines which service workers will receive a {{fetch!!event}} event for this fetch.

<dl>
<dt>"<code>all</code>"
<dd>Relevant local and foreign service workers will get a {{fetch!!event}} or
{{foreignfetch!!event}} event for this fetch.

<dt>"<code>foreign</code>"
<dd>Only relevant foreign service workers will get a {{foreignfetch!!event}} event for this fetch.
{{fetch(input)!!method}} uses this to bypass the current service worker if the global is a
{{ServiceWorkerGlobalScope}}.

<dt>"<code>none</code>"
<dd>Neither local nor foreign service workers will get events for this fetch.
</dd>
</div>

<p>A <a for=/>request</a> has an associated
<dfn export for=request id=concept-request-initiator>initiator</dfn>, which is
Expand Down Expand Up @@ -2800,16 +2819,13 @@ optional <i>CORS flag</i> and <i>CORS-preflight flag</i>, run these steps:
<li><p>Let <var>actualResponse</var> be null.

<li>
<p>If <var>request</var>'s <a>skip-service-worker flag</a> is unset, then run these
<p>If <var>request</var>'s <a>service-workers mode</a> is not "<code>none</code>", then run these
substeps:

<ol>
<li>
<p>If <var>request</var>'s <a for=request>client</a> is null or
<var>request</var>'s <a for=request>client</a>'s
<a for="environment settings object">global object</a> is not a
{{ServiceWorkerGlobalScope}} object, then set <var>response</var>
to the result of invoking <a for=/>handle fetch</a> for <var>request</var>.
<p>If <var>request</var>'s <a>service-workers mode</a> is "<code>all</code>", then set
<var>response</var> to the result of invoking <a for=/>handle fetch</a> for <var>request</var>.
[[!HTML]] [[!SW]]

<li>
Expand Down Expand Up @@ -2900,7 +2916,8 @@ optional <i>CORS flag</i> and <i>CORS-preflight flag</i>, run these steps:

<li>
<p>If <var>request</var>'s <a for=request>redirect mode</a> is
"<code>follow</code>", then set <var>request</var>'s <a>skip-service-worker flag</a>.
"<code>follow</code>", then set <var>request</var>'s <a>service-workers mode</a> to
"<code>foreign</code>".

<p class="note no-backref">Redirects coming from the network (as opposed to from a service
worker) are not to be exposed to a service worker.
Expand Down Expand Up @@ -5192,6 +5209,10 @@ method, must run these steps:
<var>init</var> as arguments. If this throws an exception, reject
<var>p</var> with it and return <var>p</var>.

<li>If <var>request</var>'s <a for=request>client</a>'s
<a for="environment settings object">global object</a> is a {{ServiceWorkerGlobalScope}} object,
set <var>request</var>'s <a>service-workers mode</a> to "<code>foreign</code>".

<li><p>Let <var>responseObject</var> be a new {{Response}} object and a new associated
{{Headers}} object whose <a for=Headers>guard</a> is
"<code>immutable</code>".
Expand Down Expand Up @@ -5343,7 +5364,7 @@ therefore not shareable, a WebSocket connection is very close to identical to an
<li><p>Let <var>request</var> be a new <a for=/>request</a>, whose
<a for=request>url</a> is <var>requestURL</var>,
<a for=request>client</a> is <var>client</var>,
<a>skip-service-worker flag</a> is set,
<a>service-workers mode</a> is "<code>none</code>",
<a>synchronous flag</a> is set,
<a for=request>mode</a> is "<code>websocket</code>",
<a for=request>credentials mode</a> is
Expand Down