canmove, Confirmed users
1,570
edits
| Line 53: | Line 53: | ||
The XUL platform interacts with the extension manager during startup to allow any pending operations to complete and so to update the working set of add-ons. More specifically the following sequence occurs during a startup: | The XUL platform interacts with the extension manager during startup to allow any pending operations to complete and so to update the working set of add-ons. More specifically the following sequence occurs during a startup: | ||
# nsAppRunner selects the profile for this run of the application and dispatches profile-after-change to the EM | # <code>nsAppRunner</code> selects the profile for this run of the application and dispatches profile-after-change to the EM | ||
# This initialises the EM, loads registered install locations and necessary settings from the preferences. | # This initialises the EM, loads registered install locations and necessary settings from the preferences. | ||
# nsAppRunner checks the command line for -install-global-extension and -install-global-extension, if either are present it calls the EM to install the items into the application install location. | # <code>nsAppRunner</code> checks the command line for -install-global-extension and -install-global-extension, if either are present it calls the EM to install the items into the application install location. | ||
# If the application version has changed since the last run with the current profile then nsAppRunner calls <code>checkForMismatches</code> so the EM can perform any necessary migration and check whether any items should be enabled or disabled due to the application version change. | # If the application version has changed since the last run with the current profile then <code>nsAppRunner</code> calls <code>checkForMismatches</code> so the EM can perform any necessary migration and check whether any items should be enabled or disabled due to the application version change. | ||
# nsAppRunner calls <code>start</code> for the EM to perform any pending operations. Depending on the result of this startup will either continue or a restart will be performed. | # <code>nsAppRunner</code> calls <code>start</code> for the EM to perform any pending operations. Depending on the result of this startup will either continue or a restart will be performed. | ||
==XPInstall Interactions== | ==XPInstall Interactions== | ||
XPInstall is the component used to download <code>XPI</code> files and if they are signed to verify that the file has not been tampered with. It is also the component that detects initial attempts to install <code>XPI</code> files by websites. | |||
===Installs From Content=== | |||
When a new item is to be installed from content, either by a call to <code>InstallTrigger.install</code> or by browsing to an file with the <code>XPI</code> mimetype the <code>nsXPInstallManager</code> component is loaded to offer the new item to the user. A new instance of this component is created for each install (a group of <code>XPI</code> files installed with a single <code>InstallTrigger.install</code> call counts as a single install). | |||
When the user agrees to the install <code>nsXPInstallmanager</code> checks for the presence of an already visible install progress dialog. If one doesn't exist then a dialog will be opened, passing the details of the new item to be downloaded. If a dialog is already installed then an observer notification with the topic <code>xpinstall-download-started</code> will be dispatched. The progress dialog is expected to have registered an observer for this topic. | |||
The progress dialog should then call <code>nsIExtensionManager.addDownloads</code>. This will register the new downloads in the datasource. It will also call the <code>nsXPInstallManager</code> with the observer notification <code>xpinstall-progress</code> to tell it that the progress dialog is visible, to start the actual download and to pass progress notifications to the EM. | |||
The EM will then receive progress notifications until the download is complete, updating the download state in the RDF. | |||
Once download is complete <code>nsXPInstallManager</code> will call <code>nsIExtensionManager.installItemFromFile</code> to perform the actual install of the <code>XPI</code> file. | |||
==User Interactions== | ==User Interactions== | ||