Open Bug 1426397 Opened 7 years ago Updated 2 years ago

PopulateRegistrationData should not populate registrations with empty data (which can lead to serviceworker.txt entries with blank currentWorkerURL values)

Categories

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

enhancement

Tracking

()

People

(Reporter: asuth, Unassigned)

References

(Blocks 1 open bug)

Details

As discussed with :bkelly on IRC, I was just seeing entries in serviceworker.txt which lacked a currentWorkerURL, for example:
"""
#

https://www.magicleap.com/

false

0
0
0
1513783175589514
#
"""

As investigated by bkelly, the root of the problem is that PopulateRegistrationData only fully populates the registration if there is an active SW instance:
https://searchfox.org/mozilla-central/rev/ff462a7f6b4dd3c3fdc53c9bc0b328f42a5b3d2b/dom/workers/ServiceWorkerManager.cpp#202

And is mitigated from too much trouble by us ignoring empty entries, although we will of course leak the DOM cache storage if the install did complete enough to hit disk:
https://searchfox.org/mozilla-central/rev/ff462a7f6b4dd3c3fdc53c9bc0b328f42a5b3d2b/dom/workers/ServiceWorkerManager.cpp#1995


bkelly also said:
bkelly> we can fix (1) for now by fixing PopulateRegistrationData to error if it doesn't find the worker type it wants
bkelly> also, we can probably remove this for now: https://searchfox.org/mozilla-central/source/dom/workers/ServiceWorkerRegistrationInfo.cpp#582
bkelly> since we don't store waiting worker info in the registrar
Avoiding useless disk writes is a perf issue.
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.