Service worker does not immediately activate in iframe
Categories
(Core :: DOM: Service Workers, defect, P2)
Tracking
()
People
(Reporter: crichton.will, Unassigned)
Details
Attachments
(1 file)
|
2.39 MB,
video/mp4
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:144.0) Gecko/20100101 Firefox/144.0
Steps to reproduce:
All files and steps needed to reproduce the bug are here: https://github.com/willcrichton/service-worker-iframe-bug
===========
I have a site that wants to register a service worker, and then load an iframe of a file whose requests are routed through that service worker. However, in Firefox only (not Chrome or Safari), the service worker is only activated on subsequent page reloads, not the first visit.
A minimal example of the outer frame, the inner frame, and the service worker are provided in the linked repo above. You can reproduce the bug using those files by doing:
- Run a static file server in this directory (e.g.
python3 -m http.server). - Open
index.htmlvia the server (e.g. http://localhost:8000). - Inspect console logs.
- Refresh the page.
- Inspect console logs.
Actual results:
I ran this on aarch64 builds via my M1 Macbook Pro. Chrome v142.0.7444.60 and Safari 18.6 (20621.3.11.11.3). On both browsers, the scripts succeed in fetching hello.txt via the service worker within the outer and inner frames on both the first and second visits.
In Firefox 144.0.2, on the first visit, the outer frame gets a 200 but the inner frame gets a 404 because its request does not hit the service worker. On reload, the inner frame hits the service worker.
Expected results:
I expect the iframe to immediately hit the service worker upon first visit.
Comment 1•4 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Service Workers' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•4 months ago
|
Comment 2•4 months ago
|
||
I attempted to reproduce the issue using the provided test case on my M1 MacBook Pro, but unfortunately, I was unable to replicate it with the nightly, beta, release, and local build versions.
Will, does the test case always cause the problem? Or it sometimes works.
I will conduct further investigation to determine if we can obtain more information for debugging.
| Reporter | ||
Comment 3•4 months ago
|
||
| Reporter | ||
Comment 4•4 months ago
|
||
Hi Eden, sorry I believe I underspecified the repro steps. Once you unregister all current service workers, hard refresh the page and then this bug should occur. I've attached a video demonstrating the behavior on my local machine.
Description
•