From c5d899cf9b04e8166ffb1f1a7ea2cb8cf8f5d0ca Mon Sep 17 00:00:00 2001 From: Matt Giuca Date: Wed, 26 Jul 2017 17:16:41 +1000 Subject: [PATCH 1/2] Navigation scope: Avoid using pathname field. Fixes a definitional issue only (same behaviour). pathname is a field of the URL interface, *not* the URL concept which has path as a list of strings. This defines the same algorithm but in terms of the URL concept instead. --- index.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 764aad54..5f5ae444 100644 --- a/index.html +++ b/index.html @@ -775,9 +775,17 @@

  • Let target be a new URL using targetURL as input. If target is failure, return false.
  • +
  • Let scopePath be the elements of scopes's + path, separated by + U+002F (/). +
  • +
  • Let targetPath be the elements of target's + path, separated by + U+002F (/). +
  • If target is same origin as scope and - target's pathname starts with - scope's pathname, return true. + targetPath starts with scopePath, return + true.
  • Otherwise, return false.
  • From 353336c45666de179bbd49550fe9b90f33c5744e Mon Sep 17 00:00:00 2001 From: Matt Giuca Date: Wed, 26 Jul 2017 17:23:51 +1000 Subject: [PATCH 2/2] Added a note explaining this strange behaviour. Closes #554. --- index.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/index.html b/index.html index 5f5ae444..246fe175 100644 --- a/index.html +++ b/index.html @@ -790,6 +790,15 @@

  • Otherwise, return false.
  • +
    + The URL string matching in this algorithm is prefix-based rather than + path-structural (e.g. a target URL string + /prefix-of/resource.html will match an app with scope + /prefix, even though the path segment name is not an exact + match). This is intentional for consistency with Service Workers. To + avoid unexpected behavior, use a scope ending in a /. +

    Enforcing the navigation scope depends on [[!HTML]]'s navigate