Closed Bug 1607859 Opened 4 years ago Closed 3 years ago

Experiment function throws Error: Unknown sender or wrong actor for recvAPICall


(WebExtensions :: General, defect, P5)



(Not tracked)



(Reporter: alta88, Unassigned)




(Keywords: regression)


(1 obsolete file)

My extension has an experiment function invoked from the addons manager Options html page, which has access to but needs the experiment to notify the data to an observer in the extension's chrome code (Thunderbird).

In debugging, it seems the receiveMessage() |sender| is in the form while the Hub.remotes map has the entry in the form, thus the error. Is this intentional?

Can you post your code somewhere, it's hard to figure out what's happening without it.

Flags: needinfo?(alta88)

An example extension is AttachmentCount. The experiments.js contains the function notifyStorageLocal(); the addons manager Options/Preferences page script options.js calls browser.attachmentcount.notifyStorageLocal() and the problem happens. Thanks for looking.

Flags: needinfo?(alta88)
Priority: -- → P5
Flags: needinfo?(tomica)

I don't actually have time to setup a Thunderbird dev environment to test, but if there are any errors/logs from the browser console you can post, i could look into them.

Flags: needinfo?(tomica)

This happens because of the way the code in bug 1604058 interacts with Thunderbird's Add-ons Manager.

In Firefox, extensions are multiprocess. Well, unless you use MOZ_FORCE_DISABLE_E10S I guess. In particular this means that the options page has no same-process parent.

However, Thunderbird is still single process. This means that the options page has the Thunderbird Add-ons Manager as its parent. The code in bug 1604058 doesn't approve of this. Because it's not expecting to see a system principal ancestor page, it gets so confused that it ends up throwing an exception in an attempt to throw an exception.

I don't know whether it helps anyone else out, but I've found that I can work around the problem by adding the following line of code to my options script:

window.browser = window.browser.extension.getBackgroundPage().browser;

I'm not convinced this is right in all cases, but it does fix the problem here.

Assignee: nobody → geoff
Attachment #9177078 - Attachment is obsolete: true
Assignee: geoff → nobody
Closed: 3 years ago
Resolution: --- → DUPLICATE
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.