Closed Bug 453095 Opened 16 years ago Closed 16 years ago

gBrowser.browsers shouldn't try to look like a node list

Categories

(Firefox :: Tabbed Browser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 3.1b1

People

(Reporter: dao, Assigned: dao)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
We shouldn't add an "item" method to the browsers array -- it's unneeded, doesn't work like NodeList.item() and breaks |for each| and |for ... in| loops.
Furthermore, creating the browsers array can be simplified.
Attachment #336312 - Flags: review?(gavin.sharp)
Attachment #336312 - Flags: review?(gavin.sharp) → review+
Comment on attachment 336312 [details] [diff] [review]
patch

>diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
>--- a/browser/base/content/browser.js
>+++ b/browser/base/content/browser.js

>+            return this._browsers ||
>+                   (this._browsers = Array.map(this.mTabs, function (tab) tab.linkedBrowser));

Array.map(this.mTabs, function (tab) tab.linkedBrowser) is throwing a strange exception in the latest trunk nightly, but I can't reproduce in my own build (I suspected it was a regression caused by bug 407216). Please make sure things work OK with an up to date build before landing?
http://hg.mozilla.org/mozilla-central/rev/6581c3d25d3d

Built with an updated tree and everything worked fine. I think I've seen that exception several times when doing something like Array.slice(gBrowser.mTabs) in the DOM inspector, but long before bug 407216 landed.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 3.1b1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: