Closed Bug 1631771 Opened 4 years ago Closed 4 years ago

"TypeError: extension.persistentListeners is undefined" in clearPrimedListeners

Categories

(WebExtensions :: General, defect)

defect

Tracking

(firefox77 fixed)

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: robwu, Assigned: robwu)

Details

Attachments

(1 file)

I just encountered the following stack when I reloaded an add-on while on a breakpoint at the end of the ExtensionPageContextParent constructor.

1587473570728	addons.xpi	WARN	Exception running bootstrap method startup on c3b8486e21ebdc05056c457ae86645f9edca0572@temporary-addon: TypeError: extension.persistentListeners is undefined(resource://gre/modules/ExtensionCommon.jsm:2359:39) JS Stack trace: clearPrimedListeners@ExtensionCommon.jsm:2359:39
build@ext-backgroundPage.js:73:20
enter@event-loop.js:79:18
_pushThreadPause@thread.js:259:15
_pauseAndRespond@thread.js:854:12
hit@breakpoint.js:238:29
ExtensionPageContextParent@ExtensionParent.jsm:820:3
recvCreateProxyContext@ExtensionParent.jsm:1002:19
_recv@ConduitsChild.jsm:78:20
receiveMessage@ConduitsParent.jsm:283:20

The caller is https://searchfox.org/mozilla-central/rev/d2cec90777d573585f8477d5170892e5dcdfb0ab/toolkit/components/extensions/parent/ext-backgroundPage.js#73 , and the error could happen in two situations:

  • when EventManager.clearPrimedListeners is called twice (e.g. in onShutdown and then in the build).
  • when the background startup is interrupted when an extension doesn't have primed listeners (i.e. no delayed startup).

To fix this we should check whether extension.persistentListeners is set before using it in https://searchfox.org/mozilla-central/rev/d2cec90777d573585f8477d5170892e5dcdfb0ab/toolkit/components/extensions/parent/ext-backgroundPage.js#73

Assignee: nobody → rob
Status: NEW → ASSIGNED
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/ea96d2bd46e6
Add guard to clearPrimedListeners in ext-backgroundPage.js r=rpl
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: