Closed Bug 1773977 Opened 3 years ago Closed 3 years ago

tabs.query({highlighted: true}): Error: An unexpected error occurred undefined

Categories

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

Thunderbird 91
defect

Tracking

(thunderbird_esr91 wontfix, thunderbird_esr102? fixed, thunderbird103 fixed)

RESOLVED FIXED
104 Branch
Tracking Status
thunderbird_esr91 --- wontfix
thunderbird_esr102 ? fixed
thunderbird103 --- fixed

People

(Reporter: manikulin, Assigned: john)

Details

Attachments

(1 file)

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
{
	"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

"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".

Component: Untriaged → Add-Ons: Extensions API

Indeed, we have not implemented support for {highlighted: true}, can you try {active: true}?

I cannot fix this for 91, but will do for 102.

Assignee: nobody → john
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/2645f5fa8e06
Add missing implementation for WindowBase.getHighlightedTabs(). r=mkmelin.

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch

(In reply to John Bieling (:TbSync) from comment #1)

Indeed, we have not implemented support for {highlighted: true}, can you try {active: true}?

Thank you, certainly I have a fallback with {active: true} selector. Originally I had a hope that multiple tabs may be selected similar to Firefox even though I knew that tabs in Thunderbird are quite peculiar creatures.

Since Thunderbird-91 (unlike e.g. 103) has a problem with getting of current window, I have to ask whether your patch correctly handles the case of messageDisplay windows.

Since Thunderbird-91 (unlike e.g. 103) has a problem with getting of current window, I have to ask whether your patch correctly handles the case of messageDisplay windows.

I will not be able to fix this bug for Thunderbird 91 (uplift to Thunderbird 102 is scheduled).

If there is another issue with messageDisplay windows, please create a new bug. However, if that would be a 91-only issue (not happening in Thunderbird 102), then I most likely will not be able to fix it.

Comment on attachment 9285305 [details]
Bug 1773977 - Add missing implementation for WindowBase.getHighlightedTabs(). r=mkmelin.

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined:
The highlighted feature was never implemented, but should be, to stay compatible with Firefox.

Testing completed (on c-c, etc.):
1 day on Daily and manual testing
Risk to taking this patch (and alternatives if risky):
Low, this is not affecting other code and is covered by a test.

Attachment #9285305 - Flags: approval-comm-beta?

Comment on attachment 9285305 [details]
Bug 1773977 - Add missing implementation for WindowBase.getHighlightedTabs(). r=mkmelin.

[Triage Comment]
Approved for beta

Attachment #9285305 - Flags: approval-comm-beta? → approval-comm-beta+

Comment on attachment 9285305 [details]
Bug 1773977 - Add missing implementation for WindowBase.getHighlightedTabs(). r=mkmelin.

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined:
The highlighted feature was never implemented, but should be, to stay compatible with Firefox.

Testing completed (on c-c, etc.):
1 day on Beta and manual testing
Risk to taking this patch (and alternatives if risky):
Low, this is not affecting other code and is covered by a test.

Attachment #9285305 - Flags: approval-comm-esr102?

(In reply to John Bieling (:TbSync) from comment #5)

Since Thunderbird-91 (unlike e.g. 103) has a problem with getting of current window, I have to ask whether your patch correctly handles the case of messageDisplay windows.

If there is another issue with messageDisplay windows, please create a new bug. However, if that would be a 91-only issue (not happening in Thunderbird 102), then I most likely will not be able to fix it.

I have tried thunderbird-104.0a1 and at least at first glance getting of highlighted tabs works correctly. I was worrying because earlier I noticed that messageDisplay window are more special creatures than I expected, so I was afraid that handling of them might require dedicated code.

Thank you for the fix.

Patch applies cleanly to comm-esr102.

Comment on attachment 9285305 [details]
Bug 1773977 - Add missing implementation for WindowBase.getHighlightedTabs(). r=mkmelin.

[Triage Comment]
approved for esr102

Attachment #9285305 - Flags: approval-comm-esr102? → approval-comm-esr102+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: