this.tabmail is null error with browser.windows.getCurrent()
Categories
(Thunderbird :: Add-Ons: Extensions API, defect)
Tracking
(thunderbird_esr6869+ fixed, thunderbird70 fixed, thunderbird71 fixed)
People
(Reporter: alta88, Assigned: darktrojan)
Details
Attachments
(1 file, 1 obsolete file)
1.99 KB,
patch
|
mkmelin
:
review+
jorgk-bmo
:
approval-comm-beta+
jorgk-bmo
:
approval-comm-esr68+
|
Details | Diff | Splinter Review |
background.js contains:
function getCurrentWindow() {
return browser.windows.getCurrent();
}
getCurrentWindow().then((currentWindow) => {
console.dir(currentWindow);
});
and the result is:
11:06:37.927 this.tabmail is null ext-mail.js:967
get activeTab chrome://messenger/content/parent/ext-mail.js:967
get title chrome://messenger/content/parent/ext-mail.js:824
convert chrome://extensions/content/parent/ext-tabs-base.js:915
convert chrome://extensions/content/parent/ext-tabs-base.js:2053
getCurrent chrome://messenger/content/parent/ext-windows.js:70
getCurrent self-hosted:1019
result resource://gre/modules/ExtensionParent.jsm:1160
withPendingBrowser resource://gre/modules/ExtensionParent.jsm:771
result resource://gre/modules/ExtensionParent.jsm:1160
callAndLog resource://gre/modules/ExtensionParent.jsm:1119
call resource://gre/modules/ExtensionParent.jsm:1159
InterpretGeneratorResume self-hosted:1300
AsyncFunctionNext self-hosted:839
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Looks like we're in a state of "extension ready, window not ready". Somehow Firefox avoids this happening.
I think the right thing to do is return null, or we could throw an error.
I'm working on some other window API stuff, so I'll look at this again once that's done.
Assignee | ||
Comment 2•5 years ago
|
||
Yes, I think we should return null if the window isn't completely loaded.
Comment 3•5 years ago
|
||
Assignee | ||
Comment 4•5 years ago
|
||
I hadn't considered waiting, but I suppose it is acceptable, as I can't see any use case where returning immediately with null
is better than returning soon with a result.
And yeah, the WE magic code handles just returning the result instead of a Promise.
Assignee | ||
Comment 5•5 years ago
|
||
Do you like this one better?
Comment 6•5 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/d7405123c5b2
Wait for windows to load before returning from windows.getCurrent and .getLastFocused. r=mkmelin DONTBUILD
Comment 8•5 years ago
|
||
Updated•5 years ago
|
It's important the api resolves for the load otherwise it would be useless. And background.js runs very early at startup, and also when there is an install/undo disable or remove, which made for the extension having to figure these things out. Uplift to 68 would be great.
Comment 10•5 years ago
|
||
Will be pushed to beta today, then TB 68.x with x > 1.
Comment 11•5 years ago
|
||
TB 70 beta 1:
https://hg.mozilla.org/releases/comm-beta/rev/7ebbba95ac1a5d7f94dbb6287c64249cf3f15d69
Updated•5 years ago
|
Comment 12•5 years ago
|
||
TB 68.1.1 ESR:
https://hg.mozilla.org/releases/comm-esr68/rev/0f180c4b528ce17f06daa7191f84a1e6f23bb4d9
Description
•