filterResponseData throws if the site uses service worker
Categories
(WebExtensions :: Request Handling, defect)
Tracking
(firefox152 affected)
| Tracking | Status | |
|---|---|---|
| firefox152 | --- | affected |
People
(Reporter: eight04, Unassigned)
References
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0
Steps to reproduce:
- Load this webextension: https://github.com/eight04/webextension-test/archive/refs/heads/filterResponseData.zip
- Visit https://mdn.github.io/dom-examples/service-worker/simple-service-worker/
- Press F12 -> Application -> make sure the service worker is registered. You may have to refresh the tab multiple times.
- Check the extension log by inspecting the background script at about:debugging#/runtime/this-firefox
- Go to about:config, disable
dom.serviceWorkers.enabled - Go back to the demo, refresh the tab.
Actual results:
When the site uses a service worker, the filter throws an Invalid request ID error.
Expected results:
When service worker is disabled, the filter intercepts the data correctly.
Comment 1•2 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.
Comment 2•1 month ago
|
||
filterResponseData is WebExtensions thing, so I wonder they have some quick idea.
Comment 3•1 month ago
|
||
I haven't verified but this is likely bug 1817450 (explained at https://bugzilla.mozilla.org/show_bug.cgi?id=1817450#c5 ).
The error being "Invalid request ID" instead of "Channel redirected" is bug 1683862.
Updated•1 month ago
|
Modified the repro to log more events:
https://github.com/eight04/webextension-test/commit/a427a767451d216bac9b6e7bf36d16080a224445
Here is the result:
intercept request 371 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ background.js:25:13
intercept error Invalid request ID background.js:33:15
onBeforeRequest 371 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onBeforeRedirect 371 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
intercept request 372 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ background.js:25:13
onBeforeRequest 372 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onErrorOccurred 372 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ NS_BINDING_ABORTED background.js:17:15
It seems that an NS_BINDING_ABORTED error is thrown in the redirected request, and the response filter doesn't get any events anymore.
Also the timing of the error may vary:
intercept request 395 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ background.js:25:13
intercept error Invalid request ID background.js:33:15
onBeforeRequest 395 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onBeforeRedirect 395 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
intercept request 396 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ background.js:25:13
onBeforeRequest 396 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onBeforeSendHeaders 396 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onSendHeaders 396 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onErrorOccurred 396 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ NS_BINDING_ABORTED
Sometimes it throws after onSendHeaders.
I am able to reproduce the issue described here:
intercept request 461 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ background.js:25:13
intercept error Invalid request ID background.js:33:15
onBeforeRequest 461 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onBeforeRedirect 461 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
intercept request 462 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ background.js:25:13
onBeforeRequest 462 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onBeforeSendHeaders 462 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onSendHeaders 462 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ undefined background.js:17:15
onErrorOccurred 462 https://mdn.github.io/dom-examples/service-worker/simple-service-worker/ NS_BINDING_ABORTED
I will mark the issue as NEW
Comment 6•1 month ago
|
||
(In reply to Rob Wu [:robwu] from comment #3)
I haven't verified but this is likely bug 1817450 (explained at https://bugzilla.mozilla.org/show_bug.cgi?id=1817450#c5 ).
The error being "Invalid request ID" instead of "Channel redirected" is bug 1683862.
After reading the provided extension, test case and logs, I can confirm that this is a duplicate of the bugs I mentioned before.
Description
•