Skip to content

Commit

Permalink
Backport c5fae3b to V1
Browse files Browse the repository at this point in the history
  • Loading branch information
jungkees committed Nov 7, 2016
1 parent ef69382 commit ddad77d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 100 deletions.
88 changes: 11 additions & 77 deletions docs/v1/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ Markup Shorthands: css no

<pre class=biblio>
{
"promises-guide": {
"href": "https://www.w3.org/2001/tag/doc/promises-guide",
"title": "Writing Promise-Using Specifications",
"date": "24 July 2015",
"status": "Finding of the W3C TAG",
"publisher": "W3C TAG"
},
"unsanctioned-tracking": {
"href": "https://www.w3.org/2001/tag/doc/unsanctioned-tracking/",
"title": "Unsanctioned Web Tracking",
Expand All @@ -40,13 +33,15 @@ Markup Shorthands: css no
</pre>

<pre class=link-defaults>
spec: dom; type: interface; text: Document
spec: html; type: element; text: link
spec: url; type: dfn; text: is local
spec: dom;
type: interface; text: Document
spec: html;
type: element; text: link
type: dfn; text: task queues; for: /
</pre>

<pre class=anchors>
spec: dom-ls; urlPrefix: https://dom.spec.whatwg.org/
spec: DOM; urlPrefix: https://dom.spec.whatwg.org/
type: dfn; text: ASCII case-insensitive; url: ascii-case-insensitive

spec: ecma-262; urlPrefix: http://tc39.github.io/ecma262/
Expand All @@ -66,29 +61,20 @@ spec: csp2; urlPrefix: https://w3c.github.io/webappsec-csp/2/

spec: fetch; urlPrefix: https://fetch.spec.whatwg.org/
type: dfn
text: basic filtered response; url: concept-filtered-response-basic
text: cancel a ReadableStream; url: concept-cancel-readablestream
text: close ReadableStream; url: concept-close-readablestream
text: construct a ReadableStream; url: concept-construct-readablestream
text: CORS filtered response; url: concept-filtered-response-cors
text: disturbed; url: concept-body-disturbed
text: empty; url: concept-empty-readablestream
text: enqueue a chunk to ReadableStream; url: concept-enqueue-readablestream
text: error ReadableStream; url: concept-error-readablestream
text: errored; url: concept-readablestream-errored
text: extract a mime type; url: concept-header-extract-mime-type
text: fetch; url: concept-fetch
text: filtered response; url: concept-filtered-response
text: get a reader; url: concept-get-reader
text: header; url: concept-header
text: http fetch; url: concept-http-fetch
text: HTTPS state value; url: concept-https-state-value
text: internal response; url: concept-internal-response
text: locked; url: concept-body-locked
text: navigation request
text: network error; url: concept-network-error
text: non-subresource request
text: ok status; url: ok-status
text: opaque filtered response; url: concept-filtered-response-opaque
text: potential-navigation-or-subresource request
text: process response
Expand All @@ -100,8 +86,6 @@ spec: fetch; urlPrefix: https://fetch.spec.whatwg.org/
text: response; for: fetch; url: concept-response
text: skip service worker flag
text: stream; url: concept-body-stream
text: subresource request
text: synchronous flag
text: terminate; url: concept-fetch-terminate
text: guard; for: headers; url: concept-headers-guard
for: Body; urlPrefix: #concept-body-
Expand All @@ -110,61 +94,16 @@ spec: fetch; urlPrefix: https://fetch.spec.whatwg.org/
text: name
text: parsing; url: parse
for: request; urlPrefix: #concept-request-
text: cache mode
text: client
text: destination
text: header list
text: initiator
text: method
text: redirect mode
text: request
text: reserved client
text: target client id
text: url
text: origin
for: response; urlPrefix: #concept-response-
text: body
text: cache state
text: header list
text: https state
text: response
text: status
text: termination reason
text: type
type: interface
text: Headers
text: Request
text: RequestInfo
text: Response
type: attribute; for: Request
text: headers; url: dom-request-headers
type: method
text: get(name); for: Headers; url: dom-headers-get
text: fetch(input, init); for: GlobalFetch; url: dom-global-fetch

spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/
type: dfn
urlPrefix: browsers.html
text: ancestor origins array; for: Location; url: concept-location-ancestor-origins-array
text: origin; for: resource; url: origin-2
urlPrefix: interaction.html
text: has focus steps
urlPrefix: webappapis.html
text: dom manipulation task source
text: environment
text: run a classic script
text: run a module script
text: task queue; for: event loop
for: environment; urlPrefix: #concept-environment-
text: active service worker
text: creation URL
text: id
urlPrefix: workers.html
text: shared workers
text: web worker; url: workers
type: event
urlPrefix: indices.html
text: DOMContentLoaded; for: Document; url: event-domcontentloaded
text: message; for: Window; url: event-message

spec: page-visibility; urlPrefix: https://www.w3.org/TR/page-visibility/
type: enum; text: VisibilityState; url: VisibilityState
Expand All @@ -177,11 +116,6 @@ spec: secure-contexts; urlPrefix: https://w3c.github.io/webappsec-secure-context
text: risks associated with insecure contexts; url: threat-risks
text: secure context

spec: promises-guide; urlPrefix: https://www.w3.org/2001/tag/doc/promises-guide#
type: dfn
text: waiting for all
text: transforming; url: transforming-by

spec: quota-api; urlPrefix: http://www.w3.org/TR/quota-api/
type: attribute; for: ServiceWorkerGlobalScope
text: onbeforeevicted; url: widl-ServiceWorkerGlobalScope-onbeforeevicted
Expand Down Expand Up @@ -256,7 +190,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
<p>A <a href="#dfn-service-worker-registration">service worker registration</a> has an associated <dfn export id="dfn-active-worker">active worker</dfn> (a <a href="#dfn-service-worker">service worker</a> or null) whose <a href="#dfn-state">state</a> is either <em>activating</em> or <em>activated</em>. It is initially set to null.</p>
<p>A <a href="#dfn-service-worker-registration">service worker registration</a> has an associated <dfn id="dfn-last-update-check-time">last update check time</dfn>. It is initially set to null.</p>
<p>A <a href="#dfn-service-worker-registration">service worker registration</a> has an associated <dfn id="dfn-uninstalling-flag">uninstalling flag</dfn>. It is initially unset.</p>
<p>A <a href="#dfn-service-worker-registration">service worker registration</a> has one or more <dfn id="dfn-service-worker-registration-task-queue" for="service worker registration">task queues</dfn> that back up the <a>tasks</a> from its <a href="#dfn-active-worker">active worker</a>'s <a>event loop</a>'s corresponding <a for="event loop">task queues</a>. (The target task sources for this back up operation are the <a href="#dfn-handle-fetch-task-source">handle fetch task source</a> and the <a href="#dfn-handle-functional-event-task-source">handle functional event task source</a>.) The user agent dumps the <a href="#dfn-active-worker">active worker</a>'s <a>tasks</a> to the <a href="#dfn-service-worker-registration">service worker registration</a>'s <a for="service worker registration">task queues</a> when the <a href="#dfn-active-worker">active worker</a> is <a href="#terminate-service-worker-algorithm">terminated</a> and <a lt="queue a task">re-queues those tasks</a> to the <a href="#dfn-active-worker">active worker</a>'s <a>event loop</a>'s corresponding <a for="event loop">task queues</a> when the <a href="#dfn-active-worker">active worker</a> spins off. Unlike the <a for="event loop">task queues</a> owned by <a>event loops</a>, the <a href="#dfn-service-worker-registration">service worker registration</a>'s <a for="service worker registration">task queues</a> are not processed by any <a>event loops</a> in and of itself.</p>
<p>A <a href="#dfn-service-worker-registration">service worker registration</a> has one or more <dfn id="dfn-service-worker-registration-task-queue" for="service worker registration">task queues</dfn> that back up the <a>tasks</a> from its <a href="#dfn-active-worker">active worker</a>'s <a>event loop</a>'s corresponding <a for="/">task queues</a>. (The target task sources for this back up operation are the <a href="#dfn-handle-fetch-task-source">handle fetch task source</a> and the <a href="#dfn-handle-functional-event-task-source">handle functional event task source</a>.) The user agent dumps the <a href="#dfn-active-worker">active worker</a>'s <a>tasks</a> to the <a href="#dfn-service-worker-registration">service worker registration</a>'s <a for="service worker registration">task queues</a> when the <a href="#dfn-active-worker">active worker</a> is <a href="#terminate-service-worker-algorithm">terminated</a> and <a lt="queue a task">re-queues those tasks</a> to the <a href="#dfn-active-worker">active worker</a>'s <a>event loop</a>'s corresponding <a for="/">task queues</a> when the <a href="#dfn-active-worker">active worker</a> spins off. Unlike the <a for="/">task queues</a> owned by <a>event loops</a>, the <a href="#dfn-service-worker-registration">service worker registration</a>'s <a for="service worker registration">task queues</a> are not processed by any <a>event loops</a> in and of itself.</p>

<section>
<h4 id="service-worker-registration-lifetime">Lifetime</h4>
Expand Down Expand Up @@ -1781,7 +1715,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
<tr>
<td><dfn event id="service-worker-global-scope-fetch-event"><code>fetch</code></dfn></td>
<td>{{FetchEvent}}</td>
<td>[<a href="#dfn-functional-events">Functional event</a>] The <a>http fetch</a> invokes <a href="#on-fetch-request-algorithm">Handle Fetch</a> with <var>request</var>. As a result of performing <a href="#on-fetch-request-algorithm">Handle Fetch</a>, the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a> returns a <a for="fetch">response</a> to the <a>http fetch</a>. The <a for="fetch">response</a>, represented by a {{Response}} object, can be retrieved from a {{Cache}} object or directly from network using {{GlobalFetch/fetch(input, init)|self.fetch(input, init)}} method. (A custom {{Response}} object can be another option.)</td>
<td>[<a href="#dfn-functional-events">Functional event</a>] The <a>http fetch</a> invokes <a href="#on-fetch-request-algorithm">Handle Fetch</a> with <var>request</var>. As a result of performing <a href="#on-fetch-request-algorithm">Handle Fetch</a>, the <a href="#dfn-service-worker-global-scope-service-worker">service worker</a> returns a <a for="fetch">response</a> to the <a>http fetch</a>. The <a for="fetch">response</a>, represented by a {{Response}} object, can be retrieved from a {{Cache}} object or directly from network using {{WindowOrWorkerGlobalScope/fetch(input, init)|self.fetch(input, init)}} method. (A custom {{Response}} object can be another option.)</td>
</tr>
<tr>
<td><dfn event id="service-worker-global-scope-message-event"><code>message</code></dfn></td>
Expand Down Expand Up @@ -3115,7 +3049,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
<li>Set <var>workerGlobalScope</var>'s <a for="WorkerGlobalScope">referrer policy</a> to <var>serviceWorker</var>'s <a>script resource</a>'s <a href="#dfn-referrer-policy">referrer policy</a>.</li>
<li>Set <var>workerGlobalScope</var>'s <a for="WorkerGlobalScope">type</a> to <var>serviceWorker</var>'s <a href="#dfn-type">type</a>.</li>
<li>Create a new {{WorkerLocation}} object and associate it with <var>workerGlobalScope</var>.</li>
<li>If <var>serviceWorker</var> is an <a href="#dfn-active-worker">active worker</a>, and there are any <a>tasks</a> queued in <var>serviceWorker</var>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>'s <a for="service worker registration">task queues</a>, <a lt="queue a task">queue</a> them to <var>serviceWorker</var>'s <a>event loop</a>'s <a for="event loop">task queues</a> in the same order using their original <a>task sources</a>.</li>
<li>If <var>serviceWorker</var> is an <a href="#dfn-active-worker">active worker</a>, and there are any <a>tasks</a> queued in <var>serviceWorker</var>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>'s <a for="service worker registration">task queues</a>, <a lt="queue a task">queue</a> them to <var>serviceWorker</var>'s <a>event loop</a>'s <a for="/">task queues</a> in the same order using their original <a>task sources</a>.</li>
<li>If <var>script</var> is a <a>classic script</a>, then <a lt="run a classic script">run the classic script</a> <var>script</var>. Otherwise, it is a <a>module script</a>; <a lt="run a module script">run the module script</a> <var>script</var>.
<p class="note">In addition to the usual possibilities of returning a value or failing due to an exception, this could be prematurely aborted by the <a>kill a worker</a> or <a>terminate a worker</a> algorithms.</p>
</li>
Expand Down Expand Up @@ -3145,7 +3079,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
<li>If <var>serviceWorker</var> is not running, abort these steps.</li>
<li>Let <var>serviceWorkerGlobalScope</var> be <var>serviceWorker</var>'s <a>environment settings object</a>'s <a for="environment settings object">global object</a>.</li>
<li>Set <var>serviceWorkerGlobalScope</var>'s closing flag to true.</li>
<li>If there are any <a>tasks</a>, whose <a>task source</a> is either the <a href="#dfn-handle-fetch-task-source">handle fetch task source</a> or the <a href="#dfn-handle-functional-event-task-source">handle functional event task source</a>, queued in <var>serviceWorkerGlobalScope</var>'s <a>event loop</a>'s <a for="event loop">task queues</a>, <a lt="queue a task">queue</a> them to <var>serviceWorker</var>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>'s corresponding <a for="service worker registration">task queues</a> in the same order using their original <a>task sources</a>, and discard all the <a>tasks</a> (including <a>tasks</a> whose <a>task source</a> is neither the <a href="#dfn-handle-fetch-task-source">handle fetch task source</a> nor the <a href="#dfn-handle-functional-event-task-source">handle functional event task source</a>) from <var>serviceWorkerGlobalScope</var>'s <a>event loop</a>'s <a for="event loop">task queues</a> without processing them.
<li>If there are any <a>tasks</a>, whose <a>task source</a> is either the <a href="#dfn-handle-fetch-task-source">handle fetch task source</a> or the <a href="#dfn-handle-functional-event-task-source">handle functional event task source</a>, queued in <var>serviceWorkerGlobalScope</var>'s <a>event loop</a>'s <a for="/">task queues</a>, <a lt="queue a task">queue</a> them to <var>serviceWorker</var>'s <a href="#dfn-containing-service-worker-registration">containing service worker registration</a>'s corresponding <a for="service worker registration">task queues</a> in the same order using their original <a>task sources</a>, and discard all the <a>tasks</a> (including <a>tasks</a> whose <a>task source</a> is neither the <a href="#dfn-handle-fetch-task-source">handle fetch task source</a> nor the <a href="#dfn-handle-functional-event-task-source">handle functional event task source</a>) from <var>serviceWorkerGlobalScope</var>'s <a>event loop</a>'s <a for="/">task queues</a> without processing them.
<p class="note">This effectively means that the fetch events and the other functional events such as push events are backed up by the registration's task queues while the other tasks including message events are discarded.</p>
</li>
<li>Abort the script currently running in <var>serviceWorker</var>.</li>
Expand Down
Loading

0 comments on commit ddad77d

Please sign in to comment.