Closed Bug 1125532 Opened 9 years ago Closed 9 years ago

Tab container's "underflow" event handler doesn't correctly clear out removing tabs

Categories

(Firefox :: Tabbed Browser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 38

People

(Reporter: dao, Assigned: abdelrahman, Mentored)

Details

(Whiteboard: [good first bug][lang=js])

Attachments

(1 file)

There's this loop in the "underflow" event handler:

        for (let tab of tabs.tabbrowser._removingTabs)
          tabs.tabbrowser.removeTab(tab);

(http://hg.mozilla.org/mozilla-central/annotate/bb70f0e4a567/browser/base/content/tabbrowser.xml#l3652)

In that loop, removeTab removes the tab from the _removingTabs array, which then causes the loop to miss the next element. To catch all elements, we need to work with a copy of that array, e.g.:

        for (let tab of Array.from(tabs.tabbrowser._removingTabs))
          ...
Attachment #8554222 - Flags: review?(dao)
Comment on attachment 8554222 [details] [diff] [review]
rev 1 - maintaining loop

looks good
Attachment #8554222 - Flags: review?(dao) → review+
Dão,
when you have more new bugs, just tell me to work on :)
https://hg.mozilla.org/mozilla-central/rev/486f15ad8a97
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: