_getVisibleTabs() may return tab instead of array
Categories
(Firefox :: Tabbed Browser, defect)
Tracking
()
People
(Reporter: Oriol, Assigned: Oriol)
References
(Regression)
Details
(Keywords: regression)
Consumers of _getVisibleTabs()
expect it to return an array, e.g. they use .length
and such.
However, it may return a tab instead of an array: https://searchfox.org/mozilla-central/rev/d6a131ceb435c03ccab2592578f6e2ebf12c1644/browser/base/content/tabbrowser-tabs.js#1201-1208
_getVisibleTabs() {
// Cannot access gBrowser before it's initialized.
if (!gBrowser) {
return this.allTabs[0];
}
return gBrowser.visibleTabs;
}
Unless I'm missing something, gBrowser.tabContainer.allTabs[0]
is a tab, not an array.
Seems a regression from https://phabricator.services.mozilla.com/D32855, since previously it was https://searchfox.org/mozilla-central/rev/f1d137eff50a5dfa45fc93def1e91cb4e3c34214/browser/base/content/tabbrowser.xml#269-278
<method name="_getVisibleTabs">
<body><![CDATA[
// Cannot access gBrowser before it's initialized.
if (!gBrowser) {
return [ this.firstElementChild ];
}
return gBrowser.visibleTabs;
]]></body>
</method>
I don't know if it causes problems in practice, though.
Also, I'm not sure it makes sense to only return the 1st tab, nor why gBrowser
is needed at all. Why not let gBrowser.visibleTabs
redirect to gBrowser.tabContainer._getVisibleTabs()
instead of the other way around, and cache _visibleTabs
in gBrowser.tabContainer
?
Updated•2 years ago
|
Comment 1•2 years ago
|
||
Set release status flags based on info from the regressing bug 1555060
:aswan, since you are the author of the regressor, bug 1555060, could you take a look? Also, could you set the severity field?
For more information, please visit auto_nag documentation.
Comment 2•2 years ago
|
||
Redirecting the NI to the triage owner since aswan is no longer at Mozilla.
Assignee | ||
Comment 3•2 years ago
|
||
It's worth noting that tabContainer.allTabs
uses tabContainer.arrowScrollbox
, which is initialized in MozTabbrowserTabs#init
.
So trying to use _getVisibleTabs
before that will throw anyways.
And just one tick later, gBrowser
will have been initialized.
So I think it's likely that there is nothing hitting that code-path.
Assignee | ||
Comment 5•2 years ago
|
||
Yes, I forgot to close this.
Updated•2 years ago
|
Description
•