Bug: tabs.query({highlighted: true}): Error: An unexpected error occurred undefined
Status: RESOLVED
Priority: --
Resolution: FIXED
Created: 2022-06-13 11:33:02+00:00
Resolved: 2022-07-25 20:09:00+00:00

Steps to reproduce:

`tabs.query` may throw not implemented error.  The problem may be reproduced in Thunderbird-103.0a1.
- Load the following add-on.
- Switch to some mail tab
- Click on the browser action
- Inspect messages in console
`manifest.json`
```json
{
	"manifest_version": 2,
	"name": "Get Hihlighted Tabs Test",
	"version": "0.1",
	"background": { "scripts": [ "gethigh-bg.js" ] },
	"browser_action": { "default_title": "Get Highlighted Tab Test" }
}
```
`gethigh-bg.js`
```js
"use strict";

async function ghttGetTab() {
	console.log("tabs.query({highlighted})",
		await browser.tabs.query({highlighted: true, currentWindow: true }));
}

browser.browserAction.onClicked.addListener(() => { ghttGetTab(); });
```


Actual results:

Extension console:
```
Uncaught (in promise) Error: An unexpected error occurred undefined
    ghttGetTab moz-extension://b1cc6a2b-00f0-48fc-ab31-8b838f83e7da/gethigh-bg.js:4
    AsyncFunctionThrow self-hosted:683
    (Async: async)
    <anonymous> moz-extension://b1cc6a2b-00f0-48fc-ab31-8b838f83e7da/gethigh-bg.js:8
    apply self-hosted:2716
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:627
    fire resource://gre/modules/ExtensionChild.jsm:812
    withHandlingUserInput resource://gre/modules/ExtensionCommon.jsm:118
    recvRunListener resource://gre/modules/ExtensionChild.jsm:815
    recvRunListener self-hosted:1162
    _recv resource://gre/modules/ConduitsChild.jsm:82
    receiveMessage resource://gre/modules/ConduitsChild.jsm:188
```
Error console
```
Not implemented ext-tabs-base.js:1204
    getHighlightedTabs chrome://extensions/content/parent/ext-tabs-base.js:1204
    candidates chrome://extensions/content/parent/ext-tabs-base.js:2080
    InterpretGeneratorResume self-hosted:1469
    next self-hosted:1417
    query chrome://extensions/content/parent/ext-tabs-base.js:2088
    next self-hosted:1417
    from self-hosted:473
    query chrome://messenger/content/parent/ext-tabs.js:566
    query self-hosted:1162
    result resource://gre/modules/ExtensionParent.jsm:1045
    withCallContextData resource://gre/modules/ExtensionParent.jsm:528
    result resource://gre/modules/ExtensionParent.jsm:1044
    withPendingBrowser resource://gre/modules/ExtensionParent.jsm:538
    result resource://gre/modules/ExtensionParent.jsm:1043
    callAndLog resource://gre/modules/ExtensionParent.jsm:996
    recvAPICall resource://gre/modules/ExtensionParent.jsm:1042
    InterpretGeneratorResume self-hosted:1469
    AsyncFunctionNext self-hosted:679
```


Expected results:

Current tab is returned by `browser.tabs.query`.

I tried code similar to Firefox with hope that some day tabs in Thunderbird would become real tabs preserving their state (e.g. scroll position in long message) instead of current Bug #487386.

Bonus: try to click on browser action when some message is displayed in new window.

P.S. While filing this bug I ignored the following error: "An error occurred while searching for similar issues, please try again." Response to search request was "304
Not Modified".