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
* Add new section “Declaring a "serviceworker" Link header”
* Drop normative requirement to fire an error and abort if
link[workertype] value is not a valid worker type.
* Drop the partial interface IDL for the HTMLLinkElement interface (the
definitions for the IDL attributes have already been merged directly
into the HTMLLinkElement interface IDL definition in the HTML spec).
Fixes#1073
<h2 id="link-type-serviceworker">Link type "<code>serviceworker</code>"</h2>
1750
+
<h2 id="link-type-serviceworker">Link type "`serviceworker`"</h2>
1748
1751
1749
-
The <dfn id="dfn-link-type-serviceworker" lt="serviceworker link type"><code>serviceworker</code></dfn> keyword may be used with <{link}> elements. This keyword creates an <a>external resource link</a> (<dfn id="dfn-serviceworker-link">serviceworker link</dfn>) that is used to declare a [=/service worker registration=] and its [=service worker registration/scope url=].
1752
+
A [=/service worker registration=] and its [=service worker registration/scope url=] are created by a <dfn id="dfn-serviceworker-link">serviceworker link</dfn>, which is declared using a <a href="#serviceworker-link-header">"serviceworker" `Link` header</a> or a <{link}> element whose <{link/rel}> attribute contains the keyword "<code>[=html/serviceworker=]</code>".
1750
1753
1751
1754
<section>
1752
-
<h3 id="link-header-processing">Processing the <code>Link</code> header</h3>
1755
+
<h3 id="serviceworker-link-header">Declaring a "serviceworker" <code>Link</code> header</h3>
1756
+
1757
+
A <a>serviceworker link</a> can be declared using a `Link` header</a>[[!RFC5988]] with "`serviceworker`" as the value of the "`rel`" parameter and a [=service worker/script url=] as the <a>target IRI</a>, and the following optional <a>target attributes</a>:
1758
+
1759
+
: `scope`
1760
+
:: Value: A [=service worker registration/scope url=].
1761
+
1762
+
: `workertype`
1763
+
:: Value: A [=job/worker type=].
1764
+
1765
+
: `updateviacache`
1766
+
:: Value: An [=service worker registration/update via cache mode=].
<h3 id="link-header-processing">Processing a "serviceworker" <code>Link</code> header</h3>
1753
1780
1754
1781
When a user agent that supports [[!RFC5988]] processes a <code>Link</code> header that contains a <a>serviceworker link</a>, the user agent *should* run these steps:
<h3 id="link-element-processing">Processing the <{link}> element</h3>
1798
+
<h3 id="link-element-processing">Processing a "serviceworker" <{link}> element</h3>
1772
1799
1773
1800
When a <a>serviceworker link</a>'s <{link}> element is <a>inserted into a document</a>, or a <a>serviceworker link</a> is created on a <{link}> element that is already <a>in a document tree</a>, or the <{link/href}> or <{link/scope}> attributes of the <{link}> element of a <a>serviceworker link</a> is changed, the user agent *should* run these steps:
1. Let |scriptURL| be the result of <a lt="URL parser">parsing</a> the <{link/href}> attribute with the <{link}> element's <a>node document</a>'s <a>document base URL</a>.
1779
1806
1. Let |scopeURL| be null.
1780
1807
1. If the <{link/scope}> attribute is present, set |scopeURL| to the result of <a lt="URL parser">parsing</a> the <{link/scope}> attribute with the <{link}> element's <a>node document</a>'s <a>document base URL</a>.
1781
-
1. Let |workerType| be the <{link/workertype}> attribute, or "<code>classic</code>" if the <{link/workertype}> attribute is omitted.
1782
-
1. If |workerType| is not a valid {{WorkerType}} value, <a>queue a task</a> to <a>fire an event</a> named <code>error</code> at the <{link}> element, and abort these steps.
1808
+
1. Let |workerType| be the state of the <{link/workertype}> attribute.
1783
1809
1. Let |useCache| be true if the <{link}> element has a <{link/usecache}> attribute, otherwise false.
1784
1810
1. Let |promise| be a new <a>promise</a>.
1785
1811
1. Invoke [=Start Register=] with |scopeURL|, |scriptURL|, |promise|, |client|, |client|'s <a>creation URL</a>, |workerType|, and |useCache|.
0 commit comments