canmove, Confirmed users
1,570
edits
m (typo fix) |
No edit summary |
||
| Line 10: | Line 10: | ||
=High Level View= | =High Level View= | ||
The new API is accessed through a global [[Extension Manager:API Rewrite:API#AddonManager|AddonManager]] object that is included in a JavaScript module. There will also be a limited amount of access provided through an XPCOM component but this is intended for | The new API is accessed through a global [[Extension Manager:API Rewrite:API#AddonManager|AddonManager]] object that is included in a JavaScript module. There will also be a limited amount of access provided through an XPCOM component but this is intended for platform integration only. The API makes no assumptions about what different types of add-ons do and how they are used, it does make some basic assumptions about the information available about them and the install process. Users of the API can register to receive events about all add-ons and installs. | ||
==Add-on Providers== | ==Add-on Providers== | ||
Underneath the manager (and essentially invisible through the API) are a set of add-on providers. Each one manages a | Underneath the manager (and essentially invisible through the API) are a set of add-on providers. Each one manages a set of types of add-on, for example there can be a provider for XPI style add-ons, a provider for plugins, a provider for lightweight themes, etc. There will probably be a hardcoded set of providers for the application and then some means for add-ons to register their own providers. It is up to the providers to maintain their lists of installed add-ons, perform installation and uninstallation and send appropriate notifications out to registered listeners. | ||
==Addon== | ==Addon== | ||
The [[Extension Manager:API Rewrite:API#Addon|Addon]] object represents an add-on that is installed on the local system. This is a loose term since it also includes add-ons that have been downloaded and will be installed when the application is restarted. It is possible that the API will hand out multiple instances of Addon for the same underlying add-on. There are a set of properties that will be available for all types of add-ons and then each type of add-on may have additional properties. The same goes for operations that can be performed on the add-on. | The [[Extension Manager:API Rewrite:API#Addon|Addon]] object represents an add-on that is installed on the local system. This is a loose term since it also includes add-ons that have been downloaded and will be installed when the application is restarted. It is possible that the API will hand out multiple instances of Addon for the same underlying add-on. There are a set of properties that will be available for all types of add-ons and then each type of add-on may have additional properties. The same goes for operations that can be performed on the add-on. | ||
Certain add-ons may have restrictions over what operations can be performed. These restrictions could be just down to the nature of the add-on (themes cannot be disabled normally) or down to system policies ( | Certain add-ons may have restrictions over what operations can be performed. These restrictions could be just down to the nature of the add-on (themes cannot be disabled normally) or down to system policies (users may not have access to uninstall some add-ons for example). Each Addon has a permissions property that indicates what operations can currently be performed. | ||
Some types of add-ons may require restarts for certain operations. XPI style extensions for example require restarts for almost all operations. The API exposes the operations that are pending in the pendingOperations property | Some types of add-ons may require restarts for certain operations. XPI style extensions for example require restarts for almost all operations. The API exposes the operations that are pending in the pendingOperations property. Pending operations can make it hard to tell what state an actual add-on is in. To help solve this the isActive property indicates whether the add-on is currently active. This is separate to and may be different to the various userDisabled, isCompatible and other properties that indicate whether an add-on can be active or not. | ||
Addon objects are live views of the underlying add-on. The properties are always guaranteed to be up to date. | Addon objects are live views of the underlying add-on. The properties are always guaranteed to be up to date. | ||
| Line 28: | Line 28: | ||
The AddonInstall goes through a set of states: | The AddonInstall goes through a set of states: | ||
;Available :Represents an add-on that is known to be available for install. Depending on where the AddonInstall came from there may be very little information about the add-on available. | ;Available :Represents an add-on that is known to be available for install. Depending on where the AddonInstall came from there may be very little information about the add-on available. | ||
;Downloading :This state is used to show that downloads are in progress for the add-on. | ;Downloading :This state is used to show that downloads are in progress for the add-on. During download progress information will be available but again very little information my be available about an add-on. | ||
; | ;Downloaded :This state is entered if installation does not proceed after downloading completes. At this point all information about an add-on is available. | ||
;Installing :Here the add-on is being installed by its provider. This may cover file extraction etc. | ;Installing :Here the add-on is being installed by its provider. This may cover file extraction etc. | ||
;Installed :Here the add-on has been installed and its Addon object will appear in AddonManager.getAddons. The add-on itself however may not be active until after an application restart. | ;Installed :Here the add-on has been installed and its Addon object will appear in AddonManager.getAddons. The add-on itself however may not be active until after an application restart. | ||
;Cancelled :If the install or download process is cancelled then the install object goes into a Cancelled state and cannot be restarted. | |||
;Failed :There are failure states for download and install, once in these states the install cannot be restarted. | |||
Once the install process for an AddonInstall is started with <code> | Once the install process for an AddonInstall is started with <code>install</code> it will move through all of the states naturally sending out notifications at each transition and some progress events in between until either an error is encountered or the install is stopped by an install listener returning <code>false</code> from one of the notifications. | ||
Certain types on installs may skip steps. Installing an add-on from the file system for example may jump straight to the Downloaded | Certain types on installs may skip steps. Installing an add-on from the file system for example may jump straight to the Downloaded state since there is no need to download it. | ||
==Dependencies and Bootstrapping== | ==Dependencies and Bootstrapping== | ||
| Line 46: | Line 45: | ||
If there is a repository to handle the add-on then it is used to check for compatibility, updates and dependency information. And dependent items will be downloaded before the AddonInstall moves to the Downloaded state, allowing the item to be installed and usable with minimal delay after that point. | If there is a repository to handle the add-on then it is used to check for compatibility, updates and dependency information. And dependent items will be downloaded before the AddonInstall moves to the Downloaded state, allowing the item to be installed and usable with minimal delay after that point. | ||