Closed Bug 1894618 Opened 2 months ago Closed 2 months ago

c-c perma xpcshell-remote.toml:toolkit/components/extensions/test/xpcshell/test_ext_runtime_getContexts.js | xpcshell return code: 0

Categories

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

Tracking

(thunderbird_esr115 unaffected)

RESOLVED FIXED
127 Branch
Tracking Status
thunderbird_esr115 --- unaffected

People

(Reporter: intermittent-bug-filer, Assigned: TbSync)

References

Details

(Keywords: intermittent-failure, intermittent-testcase, Whiteboard: [stockwell disable-recommended])

Attachments

(1 file)

The test was added in bug 1875480

See Also: → 1875480
[task 2024-05-02T05:14:37.652Z] 05:14:37     INFO -  TEST-PASS | xpcshell-remote.toml:toolkit/components/extensions/test/xpcshell/test_ext_runtime_getContexts.js | test_runtime_getContexts - [test_runtime_getContexts : 100] Got the expected error message - "Error: Incorrect argument types for runtime.getContexts." == "Error: Incorrect argument types for runtime.getContexts."
[task 2024-05-02T05:14:37.652Z] 05:14:37     INFO -  "Test runtime.getContext resolved when called with an empty filter parameter"
[task 2024-05-02T05:14:37.652Z] 05:14:37     INFO -  "CONSOLE_MESSAGE: (error) [JavaScript Error: "tabTracker.getBrowserDataForContext is not a function" {file: "resource://gre/modules/ExtensionParent.sys.mjs" line: 786}]
[task 2024-05-02T05:14:37.652Z] 05:14:37     INFO -  toExtensionContext@resource://gre/modules/ExtensionParent.sys.mjs:786:44
[task 2024-05-02T05:14:37.653Z] 05:14:37     INFO -  getContexts@chrome://extensions/content/parent/ext-runtime.js:151:28

https://searchfox.org/mozilla-central/rev/f1532761de0b60337e42c6c3f525288a523dabef/toolkit/components/extensions/ExtensionParent.sys.mjs#786 -- getBrowserDataForContext is from ext-browser.js. Thunderbird doesn't have an ext-browser.js

John, what do you suggest?

Flags: needinfo?(john)
Summary: cc perma xpcshell-remote.toml:toolkit/components/extensions/test/xpcshell/test_ext_runtime_getContexts.js | xpcshell return code: 0 → c-c perma xpcshell-remote.toml:toolkit/components/extensions/test/xpcshell/test_ext_runtime_getContexts.js | xpcshell return code: 0

We have to add it to our own TabTracker:
https://searchfox.org/comm-central/source/mail/components/extensions/parent/ext-mail.js#626

But at the moment I do not even know what this is supposed to return. I can look at this tomorrow.

Flags: needinfo?(john)

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

We have to add it to our own TabTracker:
https://searchfox.org/comm-central/source/mail/components/extensions/parent/ext-mail.js#626

But at the moment I do not even know what this is supposed to return. I can look at this tomorrow.

I confirm that to be the case: Thunderbird tabTracker subclass will have to implement the getBrowserDataForContext as we did for Firefox Desktop in ext-browser.js and for Fenix in ext-android.js of the original patch.

I guess for tabs and background the implementation for Thunderbird may likely match the one that we have for Firefox desktop (given that in that case we just use the pre-existing getBrowserData method internally), for popup and sidebar I'm not sure (it may be the same as Firefox Desktop if the browser elements where the popup and sidebar extension pages are loaded are at the same level of nesting from the chrome privileged window document as the ones we use in Firefox Desktop).

Feel free to ping me here or on phabricator if turns out that isn't the case and I may be able to help to determine how the corresponding implementation for Thunderbird may have to look like.

On it.

Assignee: nobody → john

@Luca : I have two issues:

  1. Currently, we do return a windowId for the contextType: TAB case in the xpcshell test, and not -1, which fails the test. Will try to find a different implementation to make it return -1, but if that does not work, could we exclude the -1 check in the test?

  2. We do not (!) see the contextType: TAB case returned by browser.runtime.getContexts({}); in the actual app. In the xpcshell test, the tab is loaded via ExtensionTestUtils.loadContentPage() which creates the browser in ContentPage().

Our own openTab() implementation seems to be missing something, and recvCreateProxyContext is never called. Do you happen to know what magic piece is needed to get it called when the browser is created?

I saw that we do not set initialBrowsingContextGroupId, but even after adding that it does not work.

I found the answer for #2.

This is adding the required changes to make runtime.getContexts() work
in Thunderbird.

This also adds a mochitest, which is based on this m-c test:
/browser/components/extensions/test/browser/browser_ext_runtime_getContexts.js

Status: NEW → ASSIGNED
Target Milestone: --- → 127 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/fc5cccd4bb60
Add support for browser.runtime.getContexts(). r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: