Using Global Search bar logs error: TypeError: can't access property "hasAttribute", window.gBrowser.selectedBrowser is null
Categories
(Thunderbird :: Search, defect)
Tracking
(thunderbird_esr78 unaffected, thunderbird82 affected)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | unaffected |
thunderbird82 | --- | affected |
People
(Reporter: lasana, Assigned: lasana)
References
(Regression)
Details
Attachments
(1 file, 1 obsolete file)
4.33 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
STR
- Enter a search term in the global search bar.
- Hit enter key.
- Open console:
Expected Result:
Search results should show with no errors in console.
Actual Result:
Search works but the following trace is observed:
Uncaught TypeError: can't access property "hasAttribute", window.gBrowser.selectedBrowser is null
AutocompleteInput chrome://global/content/elements/autocomplete-input.js:70
openTab chrome://messenger/content/glodaFacetTab.js:36
openTab chrome://messenger/content/tabmail.js:959
doSearch chrome://messenger/content/gloda-autocomplete-input.js:217
MozGlodaAutocompleteInput chrome://messenger/content/gloda-autocomplete-input.js:60
I came across this while working on bug 1658227.
Comment 1•5 years ago
|
||
https://searchfox.org/comm-central/rev/1b97640106e37ba9a0a208f937b8396de9ac89d9/mail/base/content/msgMail3PaneWindow.js#649
Though it looks like selectedBrowser would return something at that point.
![]() |
Assignee | |
Comment 2•5 years ago
|
||
This does not appear to affect 78 though I have been unable so far to determine the difference between it and 82.
The error happens when the focus()
method is called here https://searchfox.org/comm-central/source/mail/base/content/glodaFacetTab.js#36, it prematurely causes the "focus" event listener in autocomplete-input to be fired before the tab's browser property is properly initialized.
https://searchfox.org/mozilla-central/source/toolkit/content/widgets/autocomplete-input.js#64
This does not seem to happen on prior versions as far as I can tell.
![]() |
Assignee | |
Comment 3•5 years ago
|
||
Looks like this error got introduced with this commit. It sets the global gBrowser
property to tabmail causing the second part of the if condition in autocomplete-input
to be evaluated (window.gBrowser would have been undefined previously).
https://hg.mozilla.org/comm-central/rev/08e8b872695145ef325df8fee38139517d3f1be2#l3.30
![]() |
Assignee | |
Comment 4•5 years ago
|
||
I moved the call to focus()
into the xulLoadHandler()
. That way the browser is not null when autocomplete-input
does its checks.
![]() |
Assignee | |
Comment 5•5 years ago
|
||
![]() |
Assignee | |
Updated•5 years ago
|
Comment 6•5 years ago
|
||
![]() |
Assignee | |
Comment 7•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #6)
Comment on attachment 9180233 [details] [diff] [review]
1663904.patchReview of attachment 9180233 [details] [diff] [review]:
::: mail/test/browser/global-search-bar/browser_global-search-bar.js
@@ +10,5 @@
- let errorThrown = false;
- let searchInput = window.document.querySelector("#searchInput");
- window.addEventListener("error", e => {
- if (e.message.includes("window.gBrowser.selectedBrowser is null")) {
why restrict it to this specific error?
I figure it's better to be specific here in case any future bugs mislead us into thinking this bug has regressed.
Comment 8•5 years ago
|
||
![]() |
Assignee | |
Comment 9•5 years ago
|
||
Changed the test to check the searchInput has focus. Added a cleanup function so --verify
works.
![]() |
Assignee | |
Comment 10•5 years ago
•
|
||
Comment 11•5 years ago
|
||
Updated•5 years ago
|
Comment 12•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/f56b81827087
Focus global search input after browser has been loaded. r=mkmelin DONTBUILD
Description
•