Closed Bug 1452244 Opened 6 years ago Closed 6 years ago

don't write broken waiting worker records to serviceworker.txt

Categories

(Core :: DOM: Service Workers, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: bkelly, Assigned: bkelly)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

Currently we call StoreRegistration() in ServiceWorkerRegistrationInfo::TransitionInstallingToWaiting().  This is in anticipation of actually implementating bug 1426401.  Until we implement that bug, though, calling StoreRegistration() is just a waste of resources.  The entries it produces are not correct and won't result anything being usefully read.
Comment on attachment 8966213 [details] [diff] [review]
Avoid empty entries in serviceworker.txt. r=asuth

Andrew, I realized recently that we are stacking up a lot of service worker changes at once.  Each one tries to trigger its own write to the serviceworker.txt file.  This is probably exacerbating write failures on windows.

This patch is a first step to trying to calm the situation down.  Currently we try to write out some entries that can't be useful read in yet.  In particular:

1. We are writing out when installing transitions to waiting.  We haven't implemented bug 1426401, though, so we don't really handle this case yet and the entry in the file doesn't have a script URL.
2. When we resurrect a service worker we write out the file again to reflect that the registration is back.  We don't check to see if we are resurrecting a registration with an active worker, though.  In theory it could just have an installing/waiting worker.

This patch tries to close these loop holes and add some debug-only assertions.  I also added some read/write validation code as a safe guard to avoid actually writing this stuff to disk and to immediately ignore it if its read.
Attachment #8966213 - Flags: review?(bugmail)
Stacking up a lot of writes is bad because of the overlapping runnables on STS.  See bug 1452373.
See Also: → 1452373
Priority: -- → P2
Comment on attachment 8966213 [details] [diff] [review]
Avoid empty entries in serviceworker.txt. r=asuth

Review of attachment 8966213 [details] [diff] [review]:
-----------------------------------------------------------------

Great cleanup, and great catch on the STS snafu in bug 1452373... I feel like anytime DOM code uses it without a TaskQueue we're usually mis-using...
Attachment #8966213 - Flags: review?(bugmail) → review+
Pushed by bkelly@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c913924064a5
Avoid empty entries in serviceworker.txt. r=asuth
https://hg.mozilla.org/mozilla-central/rev/c913924064a5
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: