Closed
Bug 1472005
Opened 6 years ago
Closed 6 years ago
wait for registration state to update before resolving ready promise
Categories
(Core :: DOM: Service Workers, enhancement, P2)
Core
DOM: Service Workers
Tracking
()
RESOLVED
FIXED
mozilla63
Tracking | Status | |
---|---|---|
firefox63 | --- | fixed |
People
(Reporter: bkelly, Assigned: mrbkap)
References
Details
Attachments
(1 file, 1 obsolete file)
In IPC mode sometimes the navigator.serviceWorker.ready promise would resolve with a slightly out-of-date registration. In particular, the registration.active property would be null. This should be impossible according to the spec.
Reporter | ||
Comment 1•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ef8b7a86b61390d905637ce6754975c9224b7903
Reporter | ||
Comment 2•6 years ago
|
||
Comment on attachment 8988605 [details] [diff] [review] Don't resolve ready promise until the registration has reached the right state version. r=mrbkap Similar to how registration state triggering an updatefound event raced with the update() promise, we also have an issue with registration state changes racing with the navigator.serviceWorker.ready promise. The ready promise is resolved in step 7.2 here: https://w3c.github.io/ServiceWorker/#activation-algorithm This happens after the registration and worker state have been updated. This can break in IPC mode when the container and registration need to connect to the parent upon creation. We want to replay the version change list to make sure events are fired correctly, but a site may also immediately access the ready promise. If the ready promise resolves immediately before the change list has been replayed, then the script may see a resolved ready promise reaction before the registration.active property is set. This patch fixes the problem by making the .ready code delay resolving the promise until the binding object has reached the correct state version.
Attachment #8988605 -
Flags: review?(mrbkap)
Updated•6 years ago
|
Priority: -- → P2
Assignee | ||
Comment 3•6 years ago
|
||
Comment on attachment 8988605 [details] [diff] [review] Don't resolve ready promise until the registration has reached the right state version. r=mrbkap Review of attachment 8988605 [details] [diff] [review]: ----------------------------------------------------------------- This is really cool. It's exactly the patch I expected to see.
Attachment #8988605 -
Flags: review?(mrbkap) → review+
Comment 5•6 years ago
|
||
Patch failed to apply: mozilla@ubuntu:~/mozilla-unified$ hg qpush applying bug1472005_ready.patch patching file dom/serviceworkers/ServiceWorkerRegistration.cpp Hunk #1 FAILED at 152 Hunk #2 FAILED at 336 2 out of 2 hunks FAILED -- saving rejects to file dom/serviceworkers/ServiceWorkerRegistration.cpp.rej patching file dom/serviceworkers/ServiceWorkerRegistration.h Hunk #1 succeeded at 115 with fuzz 1 (offset 0 lines). Hunk #2 FAILED at 145 1 out of 2 hunks FAILED -- saving rejects to file dom/serviceworkers/ServiceWorkerRegistration.h.rej patch failed, unable to continue (try -v) patch failed, rejects left in working directory errors during apply, please fix and qrefresh bug1472005_ready.patch
Flags: needinfo?(ben)
Updated•6 years ago
|
Keywords: checkin-needed
Reporter | ||
Updated•6 years ago
|
Flags: needinfo?(ben)
Reporter | ||
Updated•6 years ago
|
Assignee: ben → mrbkap
Reporter | ||
Comment 6•6 years ago
|
||
Rebased
Attachment #8988605 -
Attachment is obsolete: true
Attachment #8990049 -
Flags: review+
Pushed by ben@wanderview.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/4eb950e44164 Don't resolve ready promise until the registration has reached the right state version. r=mrbkap
Comment 8•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4eb950e44164
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox63:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in
before you can comment on or make changes to this bug.
Description
•