Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec: Longest-prefix-match vs. Exact-match #287

Closed
nhiroki opened this issue May 21, 2014 · 5 comments
Closed

Spec: Longest-prefix-match vs. Exact-match #287

nhiroki opened this issue May 21, 2014 · 5 comments

Comments

@nhiroki
Copy link
Contributor

nhiroki commented May 21, 2014

For a document "/foo", how do we prioritize scopes "/fo_", "/foo" and "/foo_"?

1) "fo*" < "foo" or "foo" < "fo*" ?
2) "foo*" < "foo" or "foo" < "foo*" ?
@jakearchibald
Copy link
Contributor

Good point. I think exact-match wins always. Rough spec:

  1. Let pathname be the request url's pathname
  2. For each scope in _ScopeToServiceWorkerRegistrationMap for this origin
    1. If scope is an exact match for pathname
      1. Let serviceWorkerRegistration be _GetRegistration(matchingScope)
  3. If serviceWorkerRegistration is null
    1. For each scope in _ScopeToServiceWorkerRegistrationMap for this origin
      1. If scope ends "" is a prefix match for pathname (minus the "")
        1. Let serviceWorkerRegistration be _GetRegistration(matchingScope)

Having said that, @slightlyoff, I'm still not convinced exact-path matches are useful. I'd rather get rid of "*" and assume it's a prefix match. Removes a lot of this complication.

@michael-nordman
Copy link
Collaborator

Good question. Is their practical use case for an exact-path only registration? If not, +1 removing complexity.

@jakearchibald
Copy link
Contributor

Agreed in hangout to remove "*" from scope urls to make the matching longest-prefix-match.

Need to update spec.

@slightlyoff
Copy link
Contributor

Discussed this today with @annevk, @jakearchibald, and @tobie. The current thinking is that we'll drop the globbing vs. exact semantics and always make matches longest-prefix matches. That means we can remove the "*"

momchil-velikov pushed a commit to eth-sri/ChromeER that referenced this issue Aug 8, 2014
Wildcard '*' was removed from scope matching algorithm in the spec.
After this patch, a scope always does a prefix match.

Issue: w3c/ServiceWorker#287


BUG=398892
TEST=content_unittests --gtest_filter=ServiceWorker*

Review URL: https://codereview.chromium.org/435873002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287501 0039d316-1c4b-4281-b951-d872f2087c98
@KenjiBaheux
Copy link
Collaborator

Done in Blink (http://crbug.com/398892)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants