Open Bug 1643186 Opened 4 years ago Updated 2 years ago

runtime.onMessage: Error: Promised response from onMessage listener went out of scope

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: robwu, Assigned: robwu)

References

Details

Attachments

(1 file, 1 obsolete file)

When an extension has multiple runtime.onMessage handlers, where one handles the message and another claims to handle the message without actually handling it, then the runtime.sendMessage call can be resolved early with a rejected message, instead of waiting until the other message handler has completed its async handling.

STR:

  1. Load attached extension at about:debugging. It will open a new extension tab.
  2. Open the global JS console (ensure that it logs messages from content).
  3. Click on the button inside the extension page.
  4. Wait a bit (or go to about:memory and "Minimize memory usage" to force GC)
  5. Click on the extension button to manually send the response.
  6. Look at the global JS console, after "Listener 2 - resolve when browserAction is clicked"

Expected:

  • "Listener 2 will be handled"
  • "MSG: response is want reply"

Actual:

  • "MSG: sendMessage rejected Error: Promised response from onMessage listener went out of scope" (after step 4)
  • "Listener 2 will be handled"

Note: To see the expected behavior (in Chrome, tested with 83), start Chrome with --js-flags=--expose-gc and call gc(); from the background page's console.

PS. I originally posted a promise-based handler in https://bugzilla.mozilla.org/show_bug.cgi?id=1642967#c3 , but changed it to an equivalent callback-based test to be able to test the behavior in Chrome.

Assignee: nobody → tomica

According to bug 1643214, bisect of a very similar issue points to a range that includes bug 1583484. So although the issue was already pre-existing, it could be that the changes from bug 1583484 increased the likelihood of triggering this bug.

See Also: → 1583484
Assignee: tomica → nobody

The severity field is not set for this bug.
:mixedpuppy, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(mixedpuppy)
Severity: -- → S3
Priority: -- → P3

(putting it in my queue)

Assignee: nobody → rob
Flags: needinfo?(mixedpuppy)

I get the following error when I try to take a screenshot of a full (big) page in simulated mobile mode ("Drag or click on the page to select a region. Press ESC to cancel."):

Whoa! Firefox Screenshots went haywire.
We're not sure whatjust happened. Care to try again ortake a shot of a different page?
Error: Promised response from onMessage listener went out of scope.

Responsive: 3000 x 9999
DPR: 1
No Throttling

When I reduce the width of the page, the screenshot is taken correctly.

Mozilla Firefox 103.0b5 (64-bit)
Microsoft Windows 10.0.19043.1806

Should I create a separate ticket, or would it be appropriate to supplement this one?

Hi,

I have this error too, while screenshoting a full web page on windows 11.

Error : Promised response from onMessage listener went out of scope

Worked fine up to now. I tried to reduce the width of the page but it doesn't solve the issue.

Flags: needinfo?(rob)

The two comments above report are not issues with the extension framework, but a bug in the Screenshots component.

comment 10 (screenshotting on large pages) is likely covered by bug 1743887.

comment 11 may be the same or something different. If you can consistently reproduce the issue, open a bug report with the reproduction steps in Firefox::Screenshots (https://bugzilla.mozilla.org/enter_bug.cgi?product=Firefox&component=Screenshots).

Flags: needinfo?(rob)
See Also: → 1743887
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: