Extension Manager:Overview

Revision as of 03:19, 1 May 2009 by Mossop (talk | contribs) (Created page with 'This page gives an overview of the extension manager component focusing on the elements in [http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/src/nsExtensi...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page gives an overview of the extension manager component focusing on the elements in nsExtensionManager.js.in and proposes some refactorings that can help improve performance, reduce code complexity and expose more functionality to developers.

The goals of the extension manager are:

  • To allow the user to install add-ons
  • To allow third-party applications to integrate add-ons
  • To allow the user to enable/disable/uninstall add-ons
  • To let the user know that updates are available to add-ons and to install them.
  • To tell the XUL runtime what add-ons are installed so that it can load components and chrome from them

This overview is correct as of Gecko 1.9.1 though it should go without saying that it is in some places a simplification to ease understanding and the source code is the definitive guide to specific behaviours.

Dramatis Personæ

Code Players

ExtensionManager plays the main role of nsIExtensionManager as well as the lesser roles nsIObserver and nsITimerCallback

ExtensionsDataSource is a tour de force as the middle-man between the rest of the code and the RDF based datasource holding the add-on meta-data.

DirectoryInstallLocation and WinRegInstallLocation play the lesser parts of nsIInstallLocations, the latter only appearing in the Windows performance of this piece.

InstallLocations plays a singleton role maintaining a list of known install locations.

PendingOperations, also a singleton, remembers any operation that is waiting to be performed for each add-on.

StartupCache is a singleton as well and is used to read and write the extensions.cache file.

File Players

extensions.rdf appears in the profile and holds all known meta-data about installed add-ons, drawn from their install manifests as well as subsequent update checks and disabled state.

extensions.cache also appears in the profile and remembers the last modification time of each known add-on as well as any operations waiting to be performed.

extensions.ini is in the profile as well and keeps the final list of what add-ons are enabled, allowing libxul to know where to load components and chrome from.

Character Interactions

Actions During Startup

Add-on Management Stories

Add-on Install

Add-on Enable

Add-on Disable

Add-on Upgrade

Add-on Uninstall