New issue
Advanced search Search tips

Issue 623742 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Jun 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

navigator.serviceWorker.register resolves even if installation fails

Reported by guiller...@netnotion.com, Jun 27 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36

Steps to reproduce the problem:
1. In a Service Worker use cache.addAll to add a non-existing asset URL (404).
2. Try to install the service worker, in Developers tools it will show as failed
3. navigator.serviceWorker.register will not catch the problem, and will execute the then() Promise.

What is the expected behavior?
Should catch the SW registration, since it failed.

What went wrong?
It did not catch it, even though the SW registration failed.

Did this work before? N/A 

Chrome version: 51.0.2704.103  Channel: n/a
OS Version: OS X 10.11.1
Flash Version: Shockwave Flash 22.0 r0

https://gist.github.com/helloguille/466e61a9b5ea8d6632542a4b41ce7192
 
Screenshot 2016-06-28 00.25.29.png
263 KB View Download
Screenshot 2016-06-28 00.19.33.png
127 KB View Download

Comment 1 by eroman@chromium.org, Jun 28 2016

Components: Blink>ServiceWorker
I think this is working as intended. The spec defines that a promise returned by register() should be resolved before an install event is fired.

In the Install algorithm on the spec:
  7. Invoke Resolve Job Promise with job and the ServiceWorkerRegistration object which represents registration.
  11. Queue a task task to run the following substeps:
    1. Create a trusted event e that uses the InstallEvent interface, with the event type install, which does not bubble, is not cancelable, and has no default action.
https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#installation-algorithm
In my understanding, installation is considered separately from registration, and a promise returned by register() indicates a result of registration, not installation.

Please file an issue on spec's bug tracker if you have a question about this behavior:
https://github.com/slightlyoff/ServiceWorker

Comment 4 by falken@chromium.org, Jun 29 2016

Labels: -OS-Mac OS-All
Status: WontFix (was: Unconfirmed)
Summary: navigator.serviceWorker.register resolves even if installation fails (was: Service Worker failed installation not catched)
Yep, register() resolves once there is an installing worker. It doesn't mean the worker installed yet.

You can use ServiceWorker.onstatechange to see if it reaches 'installed' or 'redundant'.
Hi!
Sorry for the false alarm, I should have a better look of the spec.
No problem! :)

Sign in to add a comment