Closed Bug 381210 Opened 17 years ago Closed 12 years ago

browser.js should be split up in smaller entities

Categories

(Firefox :: General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 758812

People

(Reporter: Gijs, Unassigned)

References

()

Details

According to Sayrer, we should be able to split up browser.js now that we have C.u.import, which should prevent performance regressions due to loading multiple js files.

Exactly what would need to be moved where is TBD, as far as I know. Things that could be separated out would include (from a quick glance) browser startup/shutdown handling, browser context handling (clicks, back/forward, etc.), browser search, bookmark handling, tab creation/moving/loading, plugins, feeds, etc. etc.

Advantages are mainly in code maintainability (finding stuff in a file that large is painful) and extendability (including a 240k file in any extension window that might need a function or two currently in browser.js is a bit annoying to say the least).
Asking for blocking, as this would really improve extensibility for Fx 3 and is not *that* hard to fix.
Flags: blocking-firefox3?
Not blocking, but wanted, and adding shaver and finkle who might be able to help tell us how badly it's wanted and what sort of divisions would be most useful to add on authors.
Flags: blocking-firefox3? → blocking-firefox3-
Whiteboard: [wanted-firefox3]
I don't agree with the assertion that a big file makes it harder to find somehting. In fact, using multiple files usually takes more time cause you're looking in each file instead of quickly using 'Find' to jump to the right spot.

Anyway, there are things that should be moved out of browser.js, especially code that is totally independent of the browser window. Best example may be toOpenWindowByType (and friends). This function is actually used by extensions, which makes it hard to re-use those extensions in other apps. 
Moving code like that to utilityOverlay.js seems like a good idea.

Beyond that, some of the stuff Gijs mentions could be moved out, but in the process should be made more generic (f.e. pass the browser into the function/object instead of assume gBrowser is present). Lots of other apps use <browser> elements and could benefit from the existing code.

Summing up - move out the generic code so other apps can use it. move out the browser specific code only if the code can be made more generic.
Flags: wanted-firefox3+
Whiteboard: [wanted-firefox3]
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.