Closed Bug 1643176 Opened 3 years ago Closed 2 years ago

runtime.sendMessage(badid, msg) = Error: can't access property "wakeupBackground", extension is undefined


(WebExtensions :: General, defect, P3)



(firefox-esr68 unaffected, firefox-esr78 unaffected, firefox77 unaffected, firefox78 unaffected, firefox79 wontfix, firefox86 wontfix, firefox87 wontfix, firefox88 wontfix, firefox89 fixed)

89 Branch
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- unaffected
firefox77 --- unaffected
firefox78 --- unaffected
firefox79 --- wontfix
firefox86 --- wontfix
firefox87 --- wontfix
firefox88 --- wontfix
firefox89 --- fixed


(Reporter: robwu, Assigned: rpl, Mentored)




(Keywords: good-first-bug, regression)


(2 files)


  1. Load the attached extension.
  2. Open the global JS console or inspect the extension's background page at about:debugging.
  3. Click the extension button.
  4. Look at the console.


  • Firefox 78: Error : Could not establish connection. Receiving end does not exist.
  • Chrome 83: Error in event handler: TypeError: Error in invocation of runtime.sendMessage(optional string extensionId, any message, optional object options, optional function responseCallback): Invalid extension id: 'SOME_BAD_ID'


  • Firefox 79: Error : can't access property "wakeupBackground", extension is undefined

There are two unexpected results here:

  • The error message changed to something non-sensical (to extension devs).
  • The internal error message from the browser process is leaked to extensions. At the very least it should have been "An unexpected error occurred", together with the actual error dumped to the global JS console, to be consistent with how we handle other unexpected errors in our extension API handlers.

To get a sensible error message, the error should be handled here: toolkit/components/extensions/ExtensionParent.jsm #321
plus a regression test at xpcshell/test_ext_runtime_sendMessage_args.js.

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

Assignee: nobody → tomica
Severity: -- → S3
Priority: -- → P1
Priority: P1 → P2

This bug is similar to bug 1665568, to fix this bug a !extension check needs to be added as explained in the report above.

The leakage of the internal error message had been fixed in bug 1655624, now it's just "An unexpected error has occurred".

Assignee: tomica → nobody
Mentor: rob
Depends on: 1655624
Keywords: good-first-bug
Priority: P2 → P3
See Also: → 1665568
Assignee: nobody → lgreco
Pushed by
Reject ERROR_NO_RECEIVERS if target extension is not found. r=robwu
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
Flags: in-testsuite+

The patch landed in nightly and beta is affected.
:rpl, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(lgreco)
Flags: needinfo?(lgreco)
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.