Open
Bug 1459781
Opened 7 years ago
Updated 28 days ago
service worker fetch event not happen when html generated from document.write
Categories
(Core :: DOM: Service Workers, defect, P3)
Tracking
()
NEW
People
(Reporter: jamesyang999, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: dom-lws-bugdash-triage)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Steps to reproduce:
Using the code below:
https://gist.github.com/futurist/697b9d7153042dba4e53e9404509cf38
Online demo:
https://service-worker-fail-urzkvexbkh.now.sh/
Actual results:
The console log did not show the fetch event for `b.js`, since the url is generated by `document.write`
Expected results:
The console log should show the fetch event for `b.js`.
Reporter | ||
Comment 1•7 years ago
|
||
the tested firefox UA is "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:59.0) Gecko/20100101 Firefox/59.0"
Updated•7 years ago
|
Priority: -- → P3
Comment 2•7 years ago
|
||
Currently firefox implements the part of the html spec that creates a new window global on document.open(). There is nothing in the spec AFAICT, though, that causes the service worker controller from the original window to be inherited by the new window.
This would be fixed by aligning the spec and firefox to other browsers in bug 1456313.
Depends on: 1456313
Reporter | ||
Comment 3•7 years ago
|
||
I see, may I ask how to get around with this problem when have to use `document.open`? Any solution for current version of FF?
Comment 4•7 years ago
|
||
NI myself to file a spec issue to determine what the correct service worker behavior should be here. If the group agrees inheriting the service worker is desired we can possibly do a work around in gecko code to make it work that way.
Until then, though, I think the only work around would be to have your service worker provide the final html content directly via FetchEvent handling instead of using document.write().
Flags: needinfo?(bkelly)
Comment 5•7 years ago
|
||
I wrote a demo of the problem here:
https://sw-document-open.glitch.me/
Chrome and safari inherit the controller, but edge matches firefox behavior.
I wrote a spec issue to discuss what the desired behavior should be:
https://github.com/w3c/ServiceWorker/issues/1313
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(bkelly)
Updated•7 years ago
|
Blocks: ServiceWorkers-compat
Updated•2 years ago
|
Severity: normal → S3
Updated•28 days ago
|
Whiteboard: dom-lws-bugdash-triage
You need to log in
before you can comment on or make changes to this bug.
Description
•