This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27482 - Have appcache be bypassed when the navigation is under the scope of a service worker
Summary: Have appcache be bypassed when the navigation is under the scope of a service...
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P2 normal
Target Milestone: Unsorted
Assignee: Jungkee Song
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-02 13:10 UTC by Jungkee Song
Modified: 2015-09-29 16:21 UTC (History)
3 users (show)

See Also:


Attachments

Description Jungkee Song 2014-12-02 13:10:51 UTC
Service worker folks have had a discussion about what the UA should do when both a service worker registration and an application cache are available for the navigation of resources:
https://github.com/slightlyoff/ServiceWorker/issues/275

Particularly for the following requirement:
> If the navigation is under the scope of a SW, appcache is completely bypassed, regardless of whether the navigation uses the SW.

I presume the following condition in brackets added to the otherwise-branch of the below algorithm will satisfy that:
https://html.spec.whatwg.org/multipage/syntax.html#the-before-html-insertion-mode
- A start tag whose tag name is "html"

"; otherwise, if there is no such attribute, or its value is the empty string, or resolving its value fails, [or the result of running Match Scope algorithm passing the Document's address (url) is non-null], run the application cache selection algorithm with no manifest."

Match Scope returns a matching service worker registration taking a url as an argument, and is defined here: https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#scope-match-algorithm

Could you comment on it?
Comment 1 Ian 'Hixie' Hickson 2014-12-03 19:56:00 UTC
Seems fine to me in principle.

Could we rename "match scope" to something that explicitly references Service Workers, so it's more clear what it means?

Also, why would we run the match scope algorithm, rather than just checking whether there's an assigned service worker?
Comment 2 Jungkee Song 2014-12-04 02:51:15 UTC
(In reply to Ian 'Hixie' Hickson from comment #1)
> Seems fine to me in principle.
> 
> Could we rename "match scope" to something that explicitly references
> Service Workers, so it's more clear what it means?
> 

Yes, I'll rename it to "match service worker registration". Actually, a service worker registration is keyed by scope, so it not only clarify the name to the external caller context but also explains what it exactly does.

> Also, why would we run the match scope algorithm, rather than just checking
> whether there's an assigned service worker?

The "match service worker registration"algorithm given a url actually checks whether there exists a service worker registration that can cover the url space. The part that makes this matching registration's active service worker be the service worker controlling the given client is defined elsewhere (in handle fetch algorithm).
Comment 3 Jungkee Song 2014-12-04 04:13:39 UTC
(In reply to Jungkee Song from comment #2)
> (In reply to Ian 'Hixie' Hickson from comment #1)
> > Seems fine to me in principle.
> > 
> > Could we rename "match scope" to something that explicitly references
> > Service Workers, so it's more clear what it means?
> > 
> 
> Yes, I'll rename it to "match service worker registration". Actually, a
> service worker registration is keyed by scope, so it not only clarify the
> name to the external caller context but also explains what it exactly does.
> 

Addressed: https://github.com/slightlyoff/ServiceWorker/commit/2b123e8177a2dd1e56a41c0fe2ea29c8fb97d731
Comment 4 Domenic Denicola 2015-09-02 19:03:41 UTC
Assigning to Jungkee since in https://www.w3.org/Bugs/Public/show_bug.cgi?id=28737#c3 he said he'd be willing to make a PR.
Comment 5 Domenic Denicola 2015-09-29 16:21:54 UTC
https://github.com/whatwg/html/pull/184