Closed Bug 1136044 Opened 9 years ago Closed 9 years ago

Service Worker getRegistration returns wrong registration

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: albert, Unassigned)

References

Details

Steps to reproduce:

* Run https://acperez.github.io/sw-getregistration-test/ on top of the latest build at https://blog.wanderview.com/sw-builds/

Actual results:

* Client registers a service worker with scope 'something'.
* Once registered it call getRegistration with clientURL 'somethingelse'.
* getRegistration returns the 'something' registration.

Expected results:

* Client registers a service worker with scope 'something'.
* Once registered it call getRegistration with clientURL 'somethingelse'.
* getRegistration returns undefined.
I don't think this is a bug. The spec says that getRegistration() uses a longest prefix matching, and not exact matching. Please re-open if the interpretation seems wrong.

The intention is to use getRegistration() with 'urls', and not 'scopes'. i.e. a dev will say "hey, does this page have a registration?" - navigator.serviceWorker.getRegistration(document.baseURI)

http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#scope-match-algorithm
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.