Re: [w3c/ServiceWorker] Scope matching algorithm breaks sites that don't end in a slash (#1272)

Sorry for the slow response. Was discussing with others on another team here, as well as @jungkees. I can imagine a few extensions that would address the full range of issues I'm seeing:

 1.) An extension for controlled scopes that marks them as "pathComponent" matches to solve the `/` issue. This might be an option to registrations.
 2.) An extension that marks scopes as "exact"; not matching `/foo/*` when you only mean to handle `/foo`. How this and the first intersect is an interesting question.
 3.) An extension for auxiliary scopes (as previously discussed, but I can't recall where.

These might come together like:

```html
<html>
<script>
  navigator.serviceWorker.register("/sw.js", { 
    scope: "/thinger", 
    exact: true 
  }).then(...);
</script>
</html>```

```js
// sw.js
self.onactivate = (e) => {
  // Auxiliaries don't affect the registration 
  e.addAuxiliaryScope({
    // handle all navigations to `/whatevs/*` but not `/whatevslol` (e.g.)
    scope: "/whatevs",
    pathComponent: true
  });
  // ...    
};```

Thoughts?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1272#issuecomment-364316574

Received on Friday, 9 February 2018 02:30:43 UTC