Open Bug 1498714 Opened 5 years ago Updated 11 months ago

Remove multiselectedTabsCount and replace usages with selectedTabs.length

Categories

(Firefox :: Tabbed Browser, enhancement, P5)

enhancement

Tracking

()

Tracking Status
firefox64 --- affected

People

(Reporter: jaws, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

https://searchfox.org/mozilla-central/rev/28fe656de6a022d1fc01bbd3811023fca99cf223/browser/base/content/tabbrowser.js#3976

gBrowser.multiselectedTabsCount returns the number of tabs that are selected if there are multiple tabs selected. It will only ever return 0, 2, 3, ...

gBrowser.selectedTabs.length returns the number of tabs that are selected. It will return always return numbers greater than or equal to 1.

We don't need two ways to get this value and the minor semantic difference can be confusing.
The problem is that selectedTabs sorts, which is expensive, and useless if you only care about the length.
There are also some callers that don't need order, e.g.
https://searchfox.org/mozilla-central/rev/28fe656de6a022d1fc01bbd3811023fca99cf223/browser/base/content/tabbrowser.js#3872
Maybe there should be a selectedTabs and a nondeterministicSelectedTabs, or selectedTabs and sortedSelectedTabs.
selectedTabs could be changed to a method that takes an {unsorted: true} argument for cases where order doesn't matter.
Severity: normal → S3

I am working on this.

You need to log in before you can comment on or make changes to this bug.