Firefox/Cleanup

From MozillaWiki
Jump to: navigation, search

These are areas of code that have been identified by various people as being desirable to look at for cleanup. Some of these are bigger chunks than others; some are also more vague than others, but there is some great fodder in here for sprints.

exthandler

  • big and ugly

browser.js

  • big and ugly
  • split up into multiple files, examine code/timers/etc.

XBL2

  • would simplify/clean up code
  • fix many bugs

autocomplete & formfill

  • unnecessarily complicated
  • needs to be more extensible (should be able to apply to any text)

prompt-related code (alert(), HTTP auth)

Startup & Shutdown

  • ability to bring up a few components required to check if things have changed (e.g. extension install, upgrade, etc.), register these changes (might require a managed teardown at this point), and then startup without restarting the application
  • XRE_main is big and complicated, needs testing
  • shutdown code is confusing and fragile, has known bugs

Prefs System

  • migrating/deprecating existing prefs
  • Why do I have to cache things and set up observers? Isn't the point of a separate preferences module to do that for me? Shouldn't the preferences we need most often just be in a structure somewhere?

Safe Browsing/URL Classifier

  • lots of dead code and premature componentization
  • browser impl could be a module and less code

Migration

  • Rot
    • old migrators make no sense (icab/omniweb)
    • no migration from Chrome
    • no password migration since IE6
    • unclear whether Safari/etc. migration works well with latest versions
  • Should rewrite/port to JS

Clipboard

  • transferables, flavours, data, etc.
  • missing potential easy helpers (only set string helper exists)
  • lots of confusing use of mime types

Events

  • consistency in naming/usage
    • "domwindowclosed", "TabOpen", "browser:purge-session-history", "quit-application"

Code organization

  • correct use of public and src, etc.

Theme Work

  • Features
    • OS theme detection
    • Better set of extracted platform colors/textures
    • Drawing title bar ourselves
  • Toolbar customization
    • Grouping controls
    • Multiple instances of same control
  • Ship with multiple themes
  • Winstripe cleanup
    • CSS defaults aren't in line with native theme values, so css can't be inspected to verify correctness
  • Overall CSS and image cleanup (remove dependency on image atlases)

JS/XPConnect improvements

  • Simplify access to known class/service objects
    • Components.classes[blah].createInstance(IBlah) -> new Blah()
    • Components.classes[blah].getService(IBlah).foo() -> BlahService.foo()

Editor

  • .. is horrible.

Module Overload

  • One of each of these is created for every window, many for each child window as well:
    • PresShell, PresContext, Inner GlobalWindow, Outer Global Window, GlobalWindowChrome, FocusController, WindowRoot, DocShell, WebShellWindow, XULWindow, EventStateManager, EventListenerManager, FrameConstructor, View, ViewManager, Widget, DocumentViewer
  • These interfaces and many more are used to access them:
    • nsIDocumentViewer, nsIDOMWindow, nsIDOMWindowInternal, nsIDOMJSWindow, nsIDOMWindow2, nsIPresShell, nsIDocShell, nsIWebShell, nsIWidget, nsIXULWindow, nsIBaseWindow, nsIContentViewer, nsIContentViewerEdit, nsIContentViewerFile, nsIWebNavigation, nsIMarkupDocumentViewer, nsIBrowserDOMWindow, nsIDOMChromeWindow, nsIDocShellTreeItem, nsIDocShellTreeNode, nsIDocShellTreeOwner, plus ten or so interfaces than begin with nsIWebBrowser*
  • Can we simplify/reduce?

Docshell

  • Even just code cleanup would help (brekaing up into multiple files)

ViewSourceHTML

  • code cleanup, simplifying nested if/else for memory handling (should probably wait until memory alloc rework soon)