Closed Bug 1650897 Opened 4 years ago Closed 4 years ago

tabs.query failing (returning undefined) in browser action popup

Categories

(GeckoView :: Extensions, defect, P1)

Unspecified
All

Tracking

(firefox80 fixed)

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: csadilek, Assigned: agi)

References

Details

(Whiteboard: [geckoview:m80][fenix:p1])

Attachments

(5 files)

Not clear if a general problem or specific to Youtube High Definition add-on.

Fenix bug: https://github.com/mozilla-mobile/fenix/issues/12305

can't access property "id", tabs[0] is undefined popup.js:41
    requestVideoQualitySizeChange moz-extension://00a47bb7-8a3c-4fea-9c35-c1134b18cb41/popup.js:41
    apply self-hosted:2159
    applySafeWithoutClone resource://gre/modules/ExtensionCommon.jsm:614
    wrapPromise resource://gre/modules/ExtensionCommon.jsm:823
    (Async: promise callback)
    wrapPromise resource://gre/modules/ExtensionCommon.jsm:813
    callParentAsyncFunction resource://gre/modules/ExtensionChild.jsm:845
    callAsyncFunction resource://gre/modules/ExtensionChild.jsm:602
    stub resource://gre/modules/Schemas.jsm:2679
    requestVideoQualitySizeChange moz-extension://00a47bb7-8a3c-4fea-9c35-c1134b18cb41/popup.js:37
    _dispatchEvents resource://gre/modules/GeckoViewPrompt.jsm:194
    _handleSelect resource://gre/modules/GeckoViewPrompt.jsm:156
    onResponse resource://gre/modules/GeckoViewPrompter.jsm:103

Querying code:

chrome.tabs.query({
            active: true,
            currentWindow: true
        }, function(tabs) {
            chrome.tabs.sendMessage(tabs[0].id, { action: 'video_qualitysize_change', 'quality': q, 'size': s, 'speed': ss, "volume": volume, "volumelevel": volumelevel, suggestedautoplay: suggestedautoplay, autoexpanddescription: autoexpanddescription, "isOptionHandle": true }, function(response) {
      
            });
        });

I think the problem here is that the popup is in a separate window in GV and so requesting the "currentWindow" doesn't work. We need to work around this somehow.

Severity: -- → S3
Priority: -- → P1
Whiteboard: [geckoview:m80][fenix:p1]

I heard that you were working on it Agi. I'll be on the lookout for your patch to verify whether the fix conforms to the definition of the extension API.

Assignee: nobody → agi
Status: NEW → ASSIGNED

We use this object on the Java side to open the popup and without this change
we don't look at the default popup URL when the tab-specific one is not
defined.

When using the tabs.query API in a popup (e.g. a browserAction popup)
extensions expects to refer to the window where the popup is.

On mobile we don't really have a concept of window in the way that extensions
expect us to have, we also treat all tabs as belonging to separate tabs.

To make the behavior of the extension API more consistent with desktop, we
pretend that the popup belongs to whatever the top tab is at the time.

Pushed by asferro@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2340ac8f960f
Remove empty delegate methods in TestRunnerActivity. r=owlish
https://hg.mozilla.org/integration/autoland/rev/e904e980b556
Send the entire Action object for openPopup. r=owlish
https://hg.mozilla.org/integration/autoland/rev/2f2aa2cc7654
Support browser action popups in TestRunnerActivity. r=owlish
https://hg.mozilla.org/integration/autoland/rev/d2fb87bfa361
Track active tab in a Deque in TestRunnerActivity. r=esawin
https://hg.mozilla.org/integration/autoland/rev/ed799c847e3f
Return the top window for extension popups. r=robwu,owlish
Regressions: 1652664
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: