From 959067b4fc692904e4e75aa314791d125848d47d Mon Sep 17 00:00:00 2001 From: "Michael[tm] Smith" Date: Sun, 9 Apr 2017 10:30:11 +0900 Subject: [PATCH] =?UTF-8?q?Update=20the=20=E2=80=9CLink=20type=20"servicew?= =?UTF-8?q?orker"=E2=80=9D=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- docs/index.bs | 56 +++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/docs/index.bs b/docs/index.bs index 6d7969dd..d39f0425 100644 --- a/docs/index.bs +++ b/docs/index.bs @@ -74,6 +74,8 @@ spec: html; urlPrefix: https://html.spec.whatwg.org/multipage/ text: ancestor origins list; for: Location; url: concept-location-ancestor-origins-list urlPrefix: syntax.html text: delay the load event; for: document; url: delay-the-load-event + urlPrefix: semantics.html + text: serviceworker; for: html; url: link-type-serviceworker spec: fetch; urlPrefix: https://fetch.spec.whatwg.org/ type: dfn @@ -85,6 +87,7 @@ spec: rfc5988; urlPrefix: https://tools.ietf.org/html/rfc5988 type: dfn text: context IRI; url: section-5.2 text: target attribute; url: section-5.4 + text: target attributes; url: section-5.4 text: target IRI; url: section-5.1 spec: rfc7230; urlPrefix: https://tools.ietf.org/html/rfc7230 @@ -1744,12 +1747,36 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
- + - The serviceworker keyword may be used with <{link}> elements. This keyword creates an external resource link (serviceworker link) that is used to declare a [=/service worker registration=] and its [=service worker registration/scope url=]. + A [=/service worker registration=] and its [=service worker registration/scope url=] are created by a serviceworker link, which is declared using a "serviceworker" `Link` header or a <{link}> element whose <{link/rel}> attribute contains the keyword "[=html/serviceworker=]".
- + + + A serviceworker link can be declared using a `Link` header [[!RFC5988]] with "`serviceworker`" as the value of the "`rel`" parameter and a [=service worker/script url=] as the target IRI, and the following optional target attributes: + + : `scope` + :: Value: A [=service worker registration/scope url=]. + + : `workertype` + :: Value: A [=job/worker type=]. + + : `updateviacache` + :: Value: An [=service worker registration/update via cache mode=]. + + The "`anchor`" parameter must not be specified. + +
+
+        Link: <sw.js>; rel="serviceworker"; scope="/"; workertype="module"; updateviacache="all"
+      
+
+ +
+ +
+ When a user agent that supports [[!RFC5988]] processes a Link header that contains a serviceworker link, the user agent *should* run these steps: @@ -1768,7 +1795,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
- + When a serviceworker link's <{link}> element is inserted into a document, or a serviceworker link is created on a <{link}> element that is already in a document tree, or the <{link/href}> or <{link/scope}> attributes of the <{link}> element of a serviceworker link is changed, the user agent *should* run these steps: @@ -1778,8 +1805,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. Let |scriptURL| be the result of parsing the <{link/href}> attribute with the <{link}> element's node document's document base URL. 1. Let |scopeURL| be null. 1. If the <{link/scope}> attribute is present, set |scopeURL| to the result of parsing the <{link/scope}> attribute with the <{link}> element's node document's document base URL. - 1. Let |workerType| be the <{link/workertype}> attribute, or "classic" if the <{link/workertype}> attribute is omitted. - 1. If |workerType| is not a valid {{WorkerType}} value, queue a task to fire an event named error at the <{link}> element, and abort these steps. + 1. Let |workerType| be the state of the <{link/workertype}> attribute. 1. Let |useCache| be true if the <{link}> element has a <{link/usecache}> attribute, otherwise false. 1. Let |promise| be a new promise. 1. Invoke [=Start Register=] with |scopeURL|, |scriptURL|, |promise|, |client|, |client|'s creation URL, |workerType|, and |useCache|. @@ -1811,24 +1837,6 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
- -
- - -
-      partial interface HTMLLinkElement {
-        [CEReactions] attribute USVString scope;
-        [CEReactions] attribute WorkerType workerType;
-        [CEReactions] attribute boolean useCache;
-      };
-    
- - The scope IDL attribute must reflect the element's scope content attribute. - - The workerType IDL attribute must reflect the element's workertype content attribute. - - The useCache IDL attribute must reflect the element's usecache content attribute. -