Hi,--I am working on a project that uses the awesome serviceworker! But I meet with some race condition when I try to register a new service worker.After some investigation, I find navigator.serviceworker.ready does not really reflect the correct status of the controlled page. So I turned to use event-based method: controllerchange. And I want to make sure fetch event is fired after controllerchange.From online resource:"The oncontrollerchange property of the ServiceWorkerContainer interface is an event handler fired whenever a controllerchange event occurs — when the document's associated ServiceWorkerRegistration acquires a new ServiceWorkerRegistration.active worker."And"A service worker won't receive events like fetch and push until it successfully finishes installing and becomes "active"."I guess it is the case as I mentioned above. Could you please tell me whether controllerchange is always fired before the service worker is active (i.e. before fetch event?) when installing a new service worker?Thanks!Jacob
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/f144df03-6d62-4e8d-84d1-be06cd423c4e%40chromium.org.
Thanks Stefan! Your step of reproducing the issue is similar to mine.JacobOn Wed, Oct 17, 2018 at 11:18 AM Stefan Zager <sza...@google.com> wrote:I have noticed similar behavior while developing some service worker code; reproduction steps:- open an incognito window- load a client page that installs a SW that has a bug which results in an uncaught exception- In chrome://serviceworker-internals, 'Stop' and 'Unregister' the SW- Fix the bug- Reload the client pageOn second load, the SW gets reinstalled, but the controllerchange event never fires in the client page.I haven't filed a bug yet because I'm a bit busy, and I want to see if I can reduce it any further.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CA%2BcnNbgYZF%2BihFq5XPzdAZ0tV%3D4ArMV5WTZSAPUo7_zjXYOSYg%40mail.gmail.com.
On Wed, Oct 17, 2018 at 9:30 PM Matt Falkenhagen <fal...@chromium.org> wrote:bcc: chromium-dev, cc: service-worker-discussAs described above, the second load isn't expected to get a controllerchange unless the service worker calls claim() after it activates.
Although I didn't mention it in my description, my SW code *does* call clients.claim() in its 'install' event handler.