From 7c4d19c9c84e3eb0042c95671d3bc521a43d6611 Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Tue, 24 Jan 2017 14:21:05 +0000 Subject: [PATCH] =?UTF-8?q?Avoid=20preload=20if=20there=E2=80=99s=20no=20f?= =?UTF-8?q?etch=20listener.=20Fixes=20#1058.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/index.bs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/index.bs b/docs/index.bs index bd0d2715..daf6cf28 100644 --- a/docs/index.bs +++ b/docs/index.bs @@ -2872,6 +2872,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. Assert: |request|'s [=request/destination=] is not "serviceworker". 1. If |request| is a potential-navigation-or-subresource request, then: 1. Return null. + 1. Let |activeWorker| be |registration|'s active worker. 1. Else if |request| is a non-subresource request, then: Note: If the non-subresource request is under the scope of a service worker registration, application cache is completely bypassed regardless of whether the non-subresource request uses the service worker registration. @@ -2884,7 +2885,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. Set |registration| to the result of running Match Service Worker Registration algorithm passing |request|'s [=request/url=] as the argument. 1. If |registration| is null or |registration|'s active worker is null, return null. 1. If |request|'s [=request/destination=] is not {{RequestDestination/"report"}}, set |reservedClient|'s active service worker to |registration|'s active worker. - 1. If |request| is a [=navigation request=] and |registration|'s [=navigation preload enabled flag=] is set, and |request|'s [=request/method=] is \`GET\`, then: + 1. If |request| is a [=navigation request=] and |registration|'s [=navigation preload enabled flag=] is set, and |request|'s [=request/method=] is \`GET\`, and |activeWorker|'s set of event types to handle contains fetch, then: + + Note: If the above is true except |activeWorker|'s set of event types to handle **does not** contain fetch, then the user agent may wish to show a console warning, as the developer's intent isn't clear. + 1. Let |preloadRequest| be the result of [=request/cloning=] the request |request|. 1. Let |preloadRequestHeaders| be |preloadRequest|'s [=request/header list=]. 1. Let |preloadResponseObject| be a new {{Response}} object associated with a new {{Headers}} object whose [=guard=] is "`immutable`". @@ -2905,7 +2909,6 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe 1. Else if |request| is a subresource request, then: 1. If |client|'s active service worker is non-null, set |registration| to |client|'s active service worker's containing service worker registration. 1. Else, return null. - 1. Let |activeWorker| be |registration|'s active worker. 1. If |activeWorker|'s set of event types to handle does not contain fetch, then: 1. Return null and continue running these steps in parallel. 1. If |request| is a non-subresource request, or |request| is a subresource request and the time difference in seconds calculated by the current time minus |registration|'s last update check time is greater than 86400, invoke Soft Update algorithm with |registration|.