Open Bug 1852317 Opened 2 years ago Updated 2 years ago

Non-background sendMessage/connect calls is blocked on event page wakeup, even without listeners

Categories

(WebExtensions :: General, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: robwu, Unassigned)

References

Details

The current common logic that handled runtime.sendMessage, runtime.connect, tabs.sendMessage and tabs.connect unconditionally wakes up the event page and awaits its startup. While this is desired for the common case of extension scripts / content scripts wanting to message the background, it is not when the caller is a non-background context that attempts to communicate with a non-background context, because:

  • It results in delays when communicating between non-background extension pages/popups and non-background contexts. This is most obvious with tabs.sendMessage: The tabs.sendMessage API is never going to target the background page.
  • It causes the event page to wake up unnecessarily.
See Also: → 1474727

Extension messaging is currently independent of persistent listeners (see comments at bug 1851873).

If this bug gets resolved by making use of persistent listeners, take into account that the persistent listener mechanism is currently unable to distinguish "no listeners at all" from "uninitialized" (bug 1822735).

See Also: → 1822735, 1851873
Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.