Skip to content
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

Service worker registration selection #322

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#concept-ipv4">IPv4 address</dfn>
<li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#concept-ipv6">IPv6 address</dfn>
<li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#concept-url">URL</dfn>
<li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#is-local">is local</dfn>
<li><dfn data-noexport="" data-x="concept-url-origin" data-x-href="https://url.spec.whatwg.org/#concept-url-origin">Origin</dfn> of URLs
<li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#syntax-url-absolute">Absolute URL</dfn>
<li><dfn data-noexport="" data-x-href="https://url.spec.whatwg.org/#syntax-url-relative">Relative URL</dfn>
Expand Down Expand Up @@ -2809,6 +2810,7 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<li><dfn data-noexport="" data-x="default-user-agent-value" data-x-href="https://fetch.spec.whatwg.org/#default-user-agent-value">default `<code>User-Agent</code>` value</dfn>
<li><dfn data-noexport="" data-x-href="https://fetch.spec.whatwg.org/#concept-header-extract-mime-type">extract a MIME type</dfn>
<li><dfn data-noexport="" data-x="concept-fetch" data-x-href="https://fetch.spec.whatwg.org/#concept-fetch">fetch</dfn>
<li><dfn data-noexport="" data-x="non-subresource-request" data-x-href="https://fetch.spec.whatwg.org/#non-subresource-request">non-subresource request</dfn>
<li><dfn data-noexport="" data-x-href="https://fetch.spec.whatwg.org/#ok-status">ok status</dfn>
<li>`<dfn data-noexport="" data-x="http-origin" data-x-href="https://fetch.spec.whatwg.org/#http-origin"><code>Origin</code></dfn>` header
<li><dfn data-noexport="" data-x-href="https://fetch.spec.whatwg.org/#process-response">process response</dfn>
Expand Down Expand Up @@ -3851,7 +3853,15 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d
<p>The following terms are defined in <cite>Service Workers</cite>: <ref spec="SW"></p>

<ul class="brief">
<li><dfn data-noexport="" data-x="active-worker" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-active-worker">active worker</dfn></li>
<li><dfn data-noexport="" data-x="control" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-control">control</dfn></li>
<li><dfn data-noexport="" data-x="on-fetch-request-algorithm" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#on-fetch-request-algorithm">handle fetch</dfn></li>
<li><dfn data-noexport="" data-x="scope-match-algorithm" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#scope-match-algorithm">match service worker registration</dfn></li>
<li><dfn data-noexport="" data-x="scope-url" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-scope-url">scope url</dfn></li>
<li><dfn data-noexport="" data-x="service-worker" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-service-worker">service worker</dfn></li>
<li><dfn data-noexport="" data-x="service-worker-registration" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-service-worker-registration">service worker registration</dfn></li>
<li><dfn data-noexport="" data-x="window-client" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-window-client">window client</dfn></li>
<li><dfn data-noexport="" data-x="worker-client" data-x-href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#dfn-worker-client">worker client</dfn></li>
</ul>

</dd>
Expand Down Expand Up @@ -8558,6 +8568,10 @@ partial /*sealed*/ interface <dfn>Document</dfn> {
data-x="concept-document-module-map">module map</dfn>, which is a <span>module map</span>,
initially empty.</p>

<p>The <code>Document</code> has an <dfn data-dfn-for="Document" data-x="concept-document-active-
worker">active worker</dfn> (null or a <span data-x="service-worker">service worker</span>). It is
initially null.</p>


<h4><dfn>Resource metadata management</dfn></h4>

Expand Down Expand Up @@ -76211,6 +76225,11 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {
set <var>document</var>'s <span data-x="the document's referrer">referrer</span> to the
<span>creator URL</span>.</p></li>

<li><p>If the new <span>browsing context</span> has a <span>creator browsing context</span>, then
set the <code>Document</code>'s <span data-x="concept-document-active-worker">active
worker</span> to the <span>creator browsing context</span>'s <span>active document</span>'s <span
data-x="concept-document-active-worker">active worker</span>.</p></li>

<li><p>Ensure that <var>document</var> has a single child <code>html</code> node, which itself
has two empty child nodes: a <code>head</code> element, and a <code>body</code>
element.</p></li>
Expand Down Expand Up @@ -76981,6 +77000,14 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {

</dd>

<dt>The <span>active worker</span></dt>
<dd>

<p>Return the <span data-x="concept-document-active-worker">active worker</span> of the
<code>Document</code> with which <var>window</var> is currently associated.</p>

</dd>

</dl>
</li>

Expand Down Expand Up @@ -81260,6 +81287,45 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
algorithm on the <code>Document</code> object and the resource used to generate the document.
<ref spec="CSP"></p>

<li>

<p>If <span>the document's address</span> <span>is local</span>, then: if the
<span>browsing context</span> has a <span>creator browsing context</span>, then set the
<code>Document</code>'s <span data-x="concept-document-active-worker">active worker</span> to
the <span>creator browsing context</span>'s <span>active document</span>'s <span
data-x="concept-document-active-worker">active worker</span>.</p>

<p class="note">A document in a <span>nested browsing context</span> whose address <span>is
local</span> (e.g. an <span data-x="an iframe srcdoc document"><code>iframe</code> <code
data-x="attr-iframe-srcdoc">srcdoc</code> document</span> or a document in an
<code>iframe</code> after it had its <code data-x="attr-iframe-src">src</code> attribute set
to the empty string) inherits the <span data-x="concept-document-active-worker">active
worker</span> from its parent document.</p>

</li>

<li>

<p>Otherwise, if <span>the document's address</span> <span data-x="scope-match-
algorithm">matched</span> a <span data-x="service-worker-registration">service worker
registration</span> <var>registration</var> when the fetch algorithm obtained the resource,
and <var>registration</var>'s <span data-x="active-worker">active worker</span> <var>active
worker</var> is not null, set the <code>Document</code>'s <span data-x="concept-document-
active-worker">active worker</span> to <var>active worker</var>.</p>

<p class="note"><span data-x="concept-fetch">Fetching</span> a <span data-x"non-subresource-
request">non-subresource</span> (except a <span data-x="service-worker">service worker</span>)
triggers a <span data-x="service-worker-registration">service worker registration</span> <span
data-x="scope-match-algorithm">matching</span> in the <span data-x="on-fetch-request-
algorithm">handle fetch</span> algorithm. If the <span data-x="concept-
request">request</span>'s <span data-x="concept-request-url">url</span> is under the <span
data-x="scope-url">scope</span> of a <span data-x="service-worker-registration">service worker
registration</span>, and it has an <span data-x="active-worker">active worker</span>, the
document's <code>Window</code> object's <span>environment settings object</span> represented
by a <span data-x="window-client">window client</span> starts to be <span data-x="control">controlled</span>.</p>

</li>

<li><p>Set <span>the document's referrer</span> to the <i>address of the resource from which
Request-URIs are obtained</i> as determined when the fetch algorithm obtained the resource, if
that algorithm was used and determined such a value; otherwise, set it to the empty
Expand Down Expand Up @@ -85141,6 +85207,13 @@ interface <dfn>NavigatorOnLine</dfn> {
while removing support for a hash function or cypher suite).</p>
</dd>

<dt>An <dfn>active worker</dfn></dt>

<dd>
<p>A <span data-x="service-worker">service worker</span> that <span data-x="control">controls</span> this <span>environment settings object</span>. The value will
be either null or a <span data-x="service-worker">service worker</span>.</p>
</dd>

</dl>

<p>An <span>environment settings object</span> also has an <dfn>outstanding rejected promises
Expand Down Expand Up @@ -94490,6 +94563,10 @@ interface <dfn>WorkerGlobalScope</dfn> : <span>EventTarget</span> {
data-x="concept-WorkerGlobalScope-module-map">module map</dfn>. It is a <span>module map</span>,
initially empty.</p>

<p>A <code>WorkerGlobalScope</code> object has an associated <dfn data-dfn-for="WorkerGlobalScope"
data-x="concept-WorkerGlobalScope-active-worker">active worker</dfn> (null or a <span
data-x="service-worker">service worker</span>). It is initially null.</p>

<dl class="domintro">
<dt><var>workerGlobal</var> . <code subdfn data-x="dom-WorkerGlobalScope-self">self</code></dt>
<dd>Returns <var>workerGlobal</var>.</dd>
Expand Down Expand Up @@ -94854,6 +94931,28 @@ interface <dfn>WorkerGlobalScope</dfn> : <span>EventTarget</span> {
<li><p>Execute the <span>Initialize a <code data-x="">global object</code>'s CSP list</span>
algorithm on <var>worker global scope</var> and <var>response</var>. <ref spec="CSP"></p>

<li>

<p>If <var>url</var> <span data-x="scope-match-algorithm">matched</span> a <span data-
x="service-worker-registration">service worker registration</span> <var>registration</var> when
the fetch algorithm obtained the resource, and <var>registration</var>'s <span data-x="active-
worker">active worker</span> <var>active worker</var> is not null, set <var>worker global
scope</var>'s <span data-x="concept-WorkerGlobalScope-active-worker">active worker</span> to
<var>active worker</var>.</p>

<p class="note"><span data-x="concept-fetch">Fetching</span> a <span data-x"non-subresource-
request">non-subresource</span> (except a <span data-x="service-worker">service worker</span>)
triggers a <span data-x="service-worker-registration">service worker registration</span> <span
data-x="scope-match-algorithm">matching</span> in the <span data-x="on-fetch-request-
algorithm">handle fetch</span> algorithm. If the <span data-x="concept-request">request</span>'s
<span data-x="concept-request-url">url</span> is under the <span data-x="scope-url">scope</span>
of a <span data-x="service-worker-registration">service worker registration</span>, and it has
an <span data-x="active-worker">active worker</span>, the <code>WorkerGlobalScope</code>
object's <span>environment settings object</span> represented by a <span data-x="worker-
client">worker client</span> starts to be <span data-x="control">controlled</span>.</p>

</li>

<li><p>If <var>is shared</var> is true, and there are any <span data-x="relevant application
cache">relevant application caches</span> that are identified by a manifest URL with the
<span>same origin</span> as <var>url</var> and that have <var>url</var> as one of their
Expand Down Expand Up @@ -95179,6 +95278,14 @@ interface <dfn>AbstractWorker</dfn> {

</dd>

<dt>The <span>active worker</span></dt>
<dd>

<p>Return <var>worker global scope</var>'s <span
data-x="concept-WorkerGlobalScope-active-worker">active worker</span>.</p>

</dd>

</dl>

</li>
Expand Down