Closed Bug 1837185 Opened 2 years ago Closed 2 years ago

web-ext run -f nightly cannot start Nightly 116 with add-ons

Categories

(WebExtensions :: General, defect, P1)

defect

Tracking

(firefox-esr102 unaffected, firefox114 unaffected, firefox115 fixed, firefox116 fixed)

RESOLVED FIXED
116 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox114 --- unaffected
firefox115 --- fixed
firefox116 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [addons-jira])

Attachments

(3 files, 2 obsolete files)

Original report at https://github.com/mozilla/web-ext/issues/2780; I confirmed that this is happening.

After starting Firefox Nightly 116 (latest version, buildid 20230607033033), I get web-ext run -f nightly

Error: Could not install add-on at '/private/tmp/shared-worker-port': [Exception... "AddonManager is not initialized" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: resource://gre/modules/AddonManager.sys.mjs :: installTemporaryAddon :: line 2658" data: no]

mozregression output:

5:21.62 INFO: Last good revision: 81afd61afe48ea4877eff969a6eda908bcf79231
5:21.62 INFO: First bad revision: 8a4b7b46101dab1ab91d388939059d21319cd034
5:21.62 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=81afd61afe48ea4877eff969a6eda908bcf79231&tochange=8a4b7b46101dab1ab91d388939059d21319cd034

So rewriting one of the imports has resulted in this bug.

Keywords: regression
Priority: -- → P1
Regressed by: 1836482

Note that the regression is associated with the commit that changed the imports from .jsm to .sys.mjs: https://hg.mozilla.org/integration/autoland/rev/8a4b7b46101dab1ab91d388939059d21319cd034
( not the preceding one that rewrote the file itself from .jsm to .sys.mjs )

Blocks: 1837245
Whiteboard: [addons-jira]

I have manually verified that the above fixes the issue; I'm trying to reproduce the issue in a unit test, but want to already get the fix out without being blocked on the unit test.

Importing JSM as before, instead of ESM fixes the regression.
This effectively reverts the changes in devtools/ starting from
https://hg.mozilla.org/mozilla-central/rev/8a4b7b46101d#l43.1

This commit may be reverted again when the root cause has been
addressed, in bug 1837245.

Assignee: nobody → rob
Status: NEW → ASSIGNED

test_webext_apis.js was not realistic because it did not use a dedicated
loader like DevToolsStartup. That prevented the test from catching the
regression. This patch fixes that by replicating the logic at
https://searchfox.org/mozilla-central/rev/aec3a901e6f6b3041b5ec457c9111a042cef1fb1/devtools/startup/DevToolsStartup.sys.mjs#1075-1101

Attachment #9337932 - Attachment description: Bug 1837185 - Use realistic loader in test_webext_apis.js → Bug 1837185 - Use realistic loader in test_webext_apis.js + fix failures

The WebExtensionDescriptorActor loaded extension modules with the
dedicated devtools loader, which returns a different instance than
the real module in the browser. Besides the code not being designed to
be loaded twice in the same browser instance, this has the following
devtools-protocol-observable consequences:

  • Uninitialized AddonManager -> Unable to detect addon updates/uninstalls.
  • Detached ExtensionParent -> Unable to observe the actual extension,
    including not seeing extension state such as warnings.

Extension modules are singletons and must never be loaded through the
dedicated DevTools loader. This happens when --start-debugger-server is
used.

These files in question are primarily designed to support the Firefox
devtools, so I haven't created separate unit tests for these cases.
The kind of problem associated with this import pattern has been covered
by other patches in this bug.

Attachment #9337918 - Attachment is obsolete: true
Attachment #9337995 - Attachment description: Bug 1837185 - Correct extension imports for remaining server modules → Bug 1837185 - Correct remaining extension imports in devtools modules
No longer blocks: 1837245
Duplicate of this bug: 1837245
See Also: → 1837394
Attachment #9338040 - Attachment is obsolete: true
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/8f0425e45173 Use realistic loader in test_webext_apis.js + fix failures r=devtools-reviewers,jdescottes https://hg.mozilla.org/integration/autoland/rev/a8aefc39fedd Correct loader for extension imports in WebExtension descriptor +tests r=rpl,devtools-reviewers,jdescottes https://hg.mozilla.org/integration/autoland/rev/54b03590d32a Correct remaining extension imports in devtools modules r=rpl,devtools-reviewers,jdescottes

Comment on attachment 9337932 [details]
Bug 1837185 - Use realistic loader in test_webext_apis.js

Beta/Release Uplift Approval Request

  • User impact if declined: Users cannot install add-ons through remote debugging / web-ext.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Targeted fix in devtools/, to effectively revert to the behavior before the regression without side effects. Problem is well-understood and covered by automated tests. I have also verified the behavior manually before landing the patch.
  • String changes made/needed: none
  • Is Android affected?: Unknown
Attachment #9337932 - Attachment description: Bug 1837185 - Use realistic loader in test_webext_apis.js + fix failures → Bug 1837185 - Use realistic loader in test_webext_apis.js
Attachment #9337932 - Flags: approval-mozilla-beta?
Attachment #9337994 - Flags: approval-mozilla-beta?
Attachment #9337995 - Flags: approval-mozilla-beta?

Comment on attachment 9337932 [details]
Bug 1837185 - Use realistic loader in test_webext_apis.js

Approved for 115.0b4.

Attachment #9337932 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Comment on attachment 9337994 [details]
Bug 1837185 - Correct loader for extension imports in WebExtension descriptor +tests

Approved for 115.0b4.

Attachment #9337994 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Comment on attachment 9337995 [details]
Bug 1837185 - Correct remaining extension imports in devtools modules

Approved for 115.0b4.

Attachment #9337995 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: