Open
Bug 633158
Opened 15 years ago
Updated 3 years ago
_numPinnedTabs should exclude _removingTabs
Categories
(Firefox :: Tabbed Browser, defect)
Firefox
Tabbed Browser
Tracking
()
NEW
People
(Reporter: tabmix.onemen, Unassigned)
Details
Attachments
(1 file, 1 obsolete file)
_numPinnedTabs return
the number of pinned tab without excluding _removingTabs
it can lead to unexpected result in some cases for example:
since visibleTabs contain all visible tabs without _removingTabs then
let tab = this.tabbrowser.visibleTabs[this.tabbrowser._numPinnedTabs] can be null if _removingTabs is grater then visibleTabs.length.
also we can get different tab then the one we want.
var tabsToClose = (aAll ? this.tabs.length : this.visibleTabs.length - 1)
- gBrowser._numPinnedTabs;
tabsToClose is obviously not the correct number if _numPinnedTabs contain removingTabs
Updated•15 years ago
|
Severity: blocker → normal
No test yet; input on building a test would be appreciated, as my understanding is that the problems related to this will only occur if you get _numPinnedTabs while the browser is still clearing some pinned tabs in _removingTabs, which is timing dependent?
I haven't tested the patch, other than running the browser with it, for the same reason.
Comment 2•15 years ago
|
||
Doing this would break tabbrowser.tabs[tabbrowser._numPinnedTabs]...
Note that pinned tabs are removed synchronously, so this affects only _numPinnedTabs users that respond to events that are dispatched when closing a pinned tab (e.g. TabClose, possibly TabOpen / TabSelect).
Thanks for the feedback. Based on that, it looks like there is need for a separate property, this patch calls it _numVisiblePinnedTabs. Might need a better name than _numVisiblePinnedTabs, though the name does somewhat indicate it's the counterpart to visibleTabs.
Passes all tests that are passed without it.
Attachment #533793 -
Attachment is obsolete: true
Comment 4•15 years ago
|
||
It's not clear to me what this bug is concerned about, exactly. Why would TabContextMenu.updateContextMenu be called while a pinned tab is being removed? Same question for gBrowser.warnAboutClosingTabs.
Thanks for the feedback and patience. I was tilting at a windmill here. Sorry for that.
I was still under the impression that there could be cases where having a separate count of pinned tabs would be useful. But, as you said in Comment 2, the only cases would be a small number of event consumers.
Having the separate property for just those few cases doesn't gain enough to justify the additional code when it's easy enough for users to handle it themselves.
Some kind of auto-browser extension might call updateContextMenu under a handler, but I doubt it would call warnAboutClosingTabs, and although it might trigger the same, it would probably disable it first. In either case, it could handle the cleanup itself.
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•