Closed Bug 2036435 Opened 2 months ago Closed 1 month ago

filterResponseData throws if the site uses service worker

Categories

(WebExtensions :: Request Handling, defect)

Firefox 152
defect

Tracking

(firefox152 affected)

RESOLVED DUPLICATE of bug 1817450
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:

  1. Load this webextension: https://github.com/eight04/webextension-test/archive/refs/heads/filterResponseData.zip
  2. Visit https://mdn.github.io/dom-examples/service-worker/simple-service-worker/
  3. Press F12 -> Application -> make sure the service worker is registered. You may have to refresh the tab multiple times.
  4. Check the extension log by inspecting the background script at about:debugging#/runtime/this-firefox
  5. Go to about:config, disable dom.serviceWorkers.enabled
  6. 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.

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.

Component: Untriaged → DOM: Service Workers
Product: Firefox → Core

filterResponseData is WebExtensions thing, so I wonder they have some quick idea.

Component: DOM: Service Workers → General
Flags: needinfo?(rob)
Product: Core → WebExtensions

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.

Flags: needinfo?(rob)
Component: General → Request Handling

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

Status: UNCONFIRMED → NEW
Ever confirmed: true

(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.

Status: NEW → RESOLVED
Closed: 1 month ago
Duplicate of bug: 1817450
Resolution: --- → DUPLICATE
See Also: → 1683862
You need to log in before you can comment on or make changes to this bug.