Closed Bug 1525558 Opened 6 years ago Closed 5 years ago

Calling browser.mailtabs.getSelectedMessages on a message tab throws an exception

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1575708

People

(Reporter: liliakai, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

Steps to reproduce:

Install a WebExtension with a browser action that opens a popup which calls browser.mailTabs.getSelectedMessages();

Open the debugger for the extension.

From the default 3-pane tab, double click a message to open it in its own tab. In this new tab, click the browser action button.

Actual results:

An exception is shown in the debugger:

Error: Invalid mail tab ID: 2 ExtensionUtils.jsm
uncaught exception: 2147746065 autosync.jsm:199:13

Expected results:

getSelectedMessages() should return a promise that eventually resolves. The result should contain the message displayed in the current tab.

Flags: needinfo?(geoff)

It should throw an exception. A message open in a tab is not a mail tab, as far as the APIs are concerned… but we could change that.

Or we could finally implement the message display API(s) that we need to do things like this properly.

The latter is my preferred option, and I may have time to do it one day.

Flags: needinfo?(geoff)

I'm currently working on an API to find the displayed message in bug 1575708. This will provide the same methods for 3-pane tabs, tabs that only display a message, and windows that only display a message.

Marking this bug as a dupe of that bug as it seems like the best way to resolve it.

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.