Closed Bug 1643176 Opened 1 year ago Closed 2 months ago

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

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

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

RESOLVED 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

People

(Reporter: robwu, Assigned: rpl, Mentored)

References

(Regression)

Details

(Keywords: good-first-bug, regression)

Attachments

(2 files)

STR:

  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.

Expected:

  • 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'

Actual:

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

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
Status: NEW → ASSIGNED
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/3f11243214c4
Reject ERROR_NO_RECEIVERS if target extension is not found. r=robwu
Status: ASSIGNED → RESOLVED
Closed: 2 months 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)
You need to log in before you can comment on or make changes to this bug.