Closed Bug 596833 Opened 14 years ago Closed 14 years ago

Refinement for bug 595943: No need to iterate over all tabs, just the ones at the beginning

Categories

(Firefox Graveyard :: Panorama, defect, P4)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 5

People

(Reporter: iangilman, Assigned: raymondlee)

References

Details

Attachments

(1 file, 2 obsolete files)

>+++ b/browser/base/content/tabview/ui.js ... >+ // Don't return to TabView if there are any app tabs >+ for (let a = 0; a < gBrowser.tabs.length; a++) { >+ let theTab = gBrowser.tabs[a]; >+ if (theTab.pinned && gBrowser._removingTabs.indexOf(theTab) == -1) >+ return; >+ } I don't think you need to iterate over the whole list of tabs... AFAIK AppTabs are always at the beginning, so you could break early. for (let a = 0; a < gBrowser.tabs.length; a++) { let theTab = gBrowser.tabs[a]; if (!theTab.pinned) break; if (gBrowser._removingTabs.indexOf(theTab) == -1) return; }
Priority: -- → P4
Target Milestone: --- → Future
Summary: refinement for bug 595943 → Refinement for bug 595943: No need to iterate over all tabs, just the ones at the beginning
Assignee: nobody → ian
Not a big deal, but might as well take care of it. Raymond, would you mind taking this on as well?
Assignee: ian → raymond
Blocks: 603789
Target Milestone: Future → ---
Attached patch v1 (obsolete) (deleted) — Splinter Review
Sent it to try and waiting for the results. http://tbpl.mozilla.org/?tree=MozillaTry&rev=146cac2a9075
Attachment #523957 - Flags: feedback?(tim.taubert)
Status: NEW → ASSIGNED
Passed Try!
Comment on attachment 523957 [details] [diff] [review] v1 I personally don't really like the break and return statements combined - it's pretty hard to read (and get what it's doing). I'd prefer the following: >-for (let a = 0; a < gBrowser.tabs.length; a++) { >+for (let a = 0; a < gBrowser._numPinnedTabs; a++) { Would you concur with that solution? We could also ask Ian to throw in his two cents :)
Attached patch v2 (obsolete) (deleted) — Splinter Review
Taking tim's suggestion.
Attachment #523957 - Attachment is obsolete: true
Attachment #524338 - Flags: feedback?(tim.taubert)
Attachment #523957 - Flags: feedback?(tim.taubert)
Attachment #524338 - Flags: feedback?(tim.taubert) → feedback+
Attachment #524338 - Flags: review?(ian)
Comment on attachment 524338 [details] [diff] [review] v2 Looks great! Thank you.
Attachment #524338 - Flags: review?(ian) → review+
Attached patch Patch for checkin (deleted) — Splinter Review
Attachment #524338 - Attachment is obsolete: true
Keywords: checkin-needed
Attachment #524576 - Attachment is patch: true
Attachment #524576 - Attachment mime type: application/octet-stream → text/plain
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Firefox4.2
Target Milestone: Firefox5 → Firefox 5
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: