Closed Bug 1934478 Opened 2 months ago Closed 2 months ago

Unable to resend a network request when debugging extensions

Categories

(WebExtensions :: Developer Tools, defect, P2)

Firefox 135
defect

Tracking

(firefox-esr128 unaffected, firefox133 unaffected, firefox134 verified, firefox135 verified)

VERIFIED FIXED
135 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox133 --- unaffected
firefox134 --- verified
firefox135 --- verified

People

(Reporter: eight04, Assigned: ochameau)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0

Steps to reproduce:

  1. Download, extract, and side-load the extension: https://github.com/eight04/webextension-test/archive/refs/heads/request.zip
  2. Go to about:debugging#/runtime/this-firefox and inspect the extension.
  3. Switch to the network panel.
  4. Click browser action.
  5. Verify the request in the network panel.
  6. Right click on the request and select "Resend"

Actual results:

Nothing happened.

Expected results:

Resend the request.

"Edit and resend" doesn't work either.

The Bugbug bot thinks this bug should belong to the 'WebExtensions::Untriaged' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Product: Firefox → WebExtensions
Component: Untriaged → Developer Tools
Flags: needinfo?(lgreco)

Hello,

I reproduced the issue on the latest Beta (134.0b4/20241202091515) and Nightly (135.0a1/20241203214041) under Windows 10 x64 and Ubuntu 24.04 LTS. The issue does NOT reproduce on the latest Release (133.0/20241121140525).

The following errors are logged to console when trying to resend the network request:

`Error occurred while creating actor' server0.conn1.process5//networkContentActor15: Error: Unable to load actor module 'devtools/server/actors/network-monitor/network-content'
ChromeUtils.importESModule: global option is required in DevTools distinct global
@resource://devtools/server/actors/network-monitor/network-content.js:14:13
load@resource://devtools/shared/loader/base-loader.sys.mjs:184:27
_require@resource://devtools/shared/loader/base-loader.sys.mjs:372:23
requireHook@resource://devtools/shared/loader/Loader.sys.mjs:108:14
require@resource://devtools/shared/loader/base-loader.sys.mjs:324:14
loadModule@resource://devtools/shared/protocol/lazy-pool.js:155:14
getConstructor@resource://devtools/shared/protocol/lazy-pool.js:175:25
createActor@resource://devtools/shared/protocol/lazy-pool.js:207:30
getActorByID@resource://devtools/shared/protocol/lazy-pool.js:31:22
getActor@resource://devtools/server/devtools-server-connection.js:174:19
_getOrCreateActor@resource://devtools/server/devtools-server-connection.js:186:26
onPacket@resource://devtools/server/devtools-server-connection.js:354:24
_onPacketReceived@resource://devtools/shared/transport/js-window-actor-transport.js:53:18
emit@resource://gre/modules/EventEmitter.sys.mjs:148:20
receiveMessage@resource://devtools/server/connectors/js-process-actor/DevToolsProcessChild.sys.mjs:339:21

Stack: loadModule@resource://devtools/shared/protocol/lazy-pool.js:158:13
getConstructor@resource://devtools/shared/protocol/lazy-pool.js:175:25
createActor@resource://devtools/shared/protocol/lazy-pool.js:207:30
getActorByID@resource://devtools/shared/protocol/lazy-pool.js:31:22
getActor@resource://devtools/server/devtools-server-connection.js:174:19
_getOrCreateActor@resource://devtools/server/devtools-server-connection.js:186:26
onPacket@resource://devtools/server/devtools-server-connection.js:354:24
_onPacketReceived@resource://devtools/shared/transport/js-window-actor-transport.js:53:18
emit@resource://gre/modules/EventEmitter.sys.mjs:148:20
receiveMessage@resource://devtools/server/connectors/js-process-actor/DevToolsProcessChild.sys.mjs:339:21
Line: 158, column: 13

devtools-server-connection.js:224:15`

`Error: Protocol error (unknownError): Error occurred while creating actor' server0.conn1.process5//networkContentActor15: Error: Unable to load actor module 'devtools/server/actors/network-monitor/network-content'
ChromeUtils.importESModule: global option is required in DevTools distinct global
@resource://devtools/server/actors/network-monitor/network-content.js:14:13
load@resource://devtools/shared/loader/base-loader.sys.mjs:184:27
_require@resource://devtools/shared/loader/base-loader.sys.mjs:372:23
requireHook@resource://devtools/shared/loader/Loader.sys.mjs:108:14
require@resource://devtools/shared/loader/base-loader.sys.mjs:324:14
loadModule@resource://devtools/shared/protocol/lazy-pool.js:155:14
getConstructor@resource://devtools/shared/protocol/lazy-pool.js:175:25
createActor@resource://devtools/shared/protocol/lazy-pool.js:207:30
getActorByID@resource://devtools/shared/protocol/lazy-pool.js:31:22
getActor@resource://devtools/server/devtools-server-connection.js:174:19
_getOrCreateActor@resource://devtools/server/devtools-server-connection.js:186:26
onPacket@resource://devtools/server/devtools-server-connection.js:354:24
_onPacketReceived@resource://devtools/shared/transport/js-window-actor-transport.js:53:18
emit@resource://gre/modules/EventEmitter.sys.mjs:148:20
receiveMessage@resource://devtools/server/connectors/js-process-actor/DevToolsProcessChild.sys.mjs:339:21

Stack: loadModule@resource://devtools/shared/protocol/lazy-pool.js:158:13
getConstructor@resource://devtools/shared/protocol/lazy-pool.js:175:25
createActor@resource://devtools/shared/protocol/lazy-pool.js:207:30
getActorByID@resource://devtools/shared/protocol/lazy-pool.js:31:22
getActor@resource://devtools/server/devtools-server-connection.js:174:19
_getOrCreateActor@resource://devtools/server/devtools-server-connection.js:186:26
onPacket@resource://devtools/server/devtools-server-connection.js:354:24
_onPacketReceived@resource://devtools/shared/transport/js-window-actor-transport.js:53:18
emit@resource://gre/modules/EventEmitter.sys.mjs:148:20
receiveMessage@resource://devtools/server/connectors/js-process-actor/DevToolsProcessChild.sys.mjs:339:21
Line: 158, column: 13 from: server0.conn1.process5//networkContentActor15

Front.js:382:31`

I also performed a mozregression with the following results:

2024-12-04T10:27:15.917000: DEBUG : Found commit message:
Bug 1754452 - [devtools] Select the hovered document when using the node picker on Web Extensions. r=devtools-reviewers,nchevobbe

Before, we used to have a unique target, using internal frame switching.
Now that we have one real target actor per document, we should rather select
each newly hovered target at the TargetCommand level, so that the inspector's
markup view will switch to this document.

We are applying this logic only to Web Extensions as all targets in a tab
will be a children of the top level one, so that node picking's hovering
will always be able to select the hovered node in the markup view.
We may later extand this logic to the browser toolbox, once it supports one target per WindowGlobal.

Differential Revision: https://phabricator.services.mozilla.com/D220596

2024-12-04T10:27:15.917000: DEBUG : Did not find a branch, checking all integration branches
2024-12-04T10:27:15.919000: INFO : The bisection is done.
2024-12-04T10:27:15.921000: INFO : Stopped

Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=b0ee34e44bb01bbeb0074d1f33533f3ad596f315&tochange=e764e06e70f5f424911c00e4b5368f8fc5fe6f0b

Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Regressed by: 1754452

Set release status flags based on info from the regressing bug 1754452

Hi Alex,
based on mozregression bisect from comment 2 this seems to be a regression we have introduced as a side effect of Bug 1754452 changes, and so the regression didn't get to release yet but it can be reproduced in beta builds, it would be good if we could request an uplift to beta once we have fixed it in nightly, would you mind to take a look into this?

Flags: needinfo?(lgreco) → needinfo?(poirot.alex)

Follows a couple more details I noticed, in case they may be relevant to determine the appropriate fix:

  • it looks like I can also hit the exact same exception (global option is required in DevTools distinct global) if I try to resend a network request originated from a webpage from the Browser Toolbox's network panel

  • On the contrary it works as expected when I try the same from the tab's network panel that belongs to the webpage originating the request being resend from the network panel

  • Adding { global: "contextual" } to the ChromeUtils.defineESModuleGetters call from line 14 of devtools/server/actors/network-monitor/network-content.js did make both the network panel from the Addon Debugging toolbox and the network panel from the Browser Toolbox to not be hitting the same issue anymore (and in both cases it looked like the request was resend as expected)

    • resend the request from the tab's developer toolbox also seems to be still working with that addition

I'm not sure if adding { global: "contextual" } option is the appropriate way to fix the underlying issue (or if it would be more like workarounding it, or if it does break anything else that I may not have tried nor noticed), but it felt still potentially relevant detail (along with the fact that the Browser Toolbox seems to also be hitting the same issue).

The source of trouble here is the Web Extension Fallback Document,
which is loaded via the system principal and used by DevTools
as the top level target.

Because of it being system principal, we use the special "devtools loader" for ESM.
This is what cause the exception about the "global" option.
Using global attribute set to contextual fixes this exception.

Because of it being the top level target, we are trying to send the request
from its document. But as it is a system principal, it is ignored by the Network Observer.
So that the resent request is sent, but isn't shown.

Using the currently selected target in Network Command helps circumvent that
by sending the request with a real extension document and the request
is then shown in the network monitor.
But this change also impact web page and browser debugging.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P2
Blocks: 1937611
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fec5b5976f94 Fix sending request from Web Extension and Browser toolboxes. r=extension-reviewers,devtools-reviewers,nchevobbe,rpl
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch

Verified as Fixed. Tested on the latest Nightly (135.0a1/20241218042740 from https://treeherder.mozilla.org/jobs?repo=mozilla-central&revision=d15f84756dc8feca1636cce4a0d164d0f2afd637) under Windows 10 and Ubuntu 24.04 LTS.

Both “Resend” and “Edit and Resend” options now work as expected.

Status: RESOLVED → VERIFIED
Flags: needinfo?(poirot.alex)

Comment on attachment 9442535 [details]
Bug 1934478 - Fix sending request from Web Extension and Browser toolboxes.

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: Resending addons requests when debugging the addon is broken
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce: See comment 0
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): I tried to be conservative and extracted more involved changes in a followup.
  • String changes made/needed:
  • Is Android affected?: No
Attachment #9442535 - Flags: approval-mozilla-beta?

Comment on attachment 9442535 [details]
Bug 1934478 - Fix sending request from Web Extension and Browser toolboxes.

We're out of Betas this cycle. Let's aim for the planned dot release instead.

Attachment #9442535 - Flags: approval-mozilla-beta? → approval-mozilla-release?

The patch landed in nightly and beta is affected.
:ochameau, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox134 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(poirot.alex)

Comment on attachment 9442535 [details]
Bug 1934478 - Fix sending request from Web Extension and Browser toolboxes.

Approved for 134.0.2, thanks.

Attachment #9442535 - Flags: approval-mozilla-release? → approval-mozilla-release+

Verified as Fixed. Tested on the latest Release (134.0.2/20250120112154 from https://treeherder.mozilla.org/jobs?repo=mozilla-release&revision=d0df2abd013e6be56b5502b778871babd6f9022a) under Windows 10 and Ubuntu 24.04 LTS.

Both “Resend” and “Edit and Resend” options now work as expected.

Flags: needinfo?(poirot.alex)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: