Visit Mozilla.org

nsIApplicationUpdateService

From MDC

The nsIApplicationUpdateService interface describes a global application service that handles performing background update checks. It also provides utilities for selecting and downloading update patches.

Contents

nsIApplicationUpdateService is defined in toolkit/mozapps/update/public/nsIUpdateService.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.9).

Inherits from: nsISupports

[edit] Method overview

void addDownloadListener(in nsIRequestObserver listener);
AString downloadUpdate(in nsIUpdate update, in boolean background]] listener);
void pauseDownload();
void removeDownloadListener(in nsIRequestObserver listener);
nsIUpdate selectUpdate([array, size_is(updateCount)] in nsIUpdate updates, in unsigned long updateCount);

[edit] Attributes

Attribute Type Description
backgroundChecker nsIUpdateChecker The update checker being used for background update checking; read only.
isDownloading boolean true if a download is in progress, otherwise false. Read only.
canUpdate boolean true if the update service is able to download and install updates. This depends on whether or not the current user has the necessary access privileges for the install directory.

[edit] Methods

[edit] addDownloadListener()

Adds a listener that receives progress and state information about the update that is currently being downloaded. This information is most commonly used to update a user interface that informs the user as to the status of an update.

 void addDownloadListener(
   in nsIRequestObserver listener
 );
[edit] Parameters
listener
An object implementing nsIRequestObserver and optionally nsIProgressEventSink that will be notified of state and progress information as the update is downloaded.

[edit] downloadUpdate()

Starts downloading a software update.

 AString downloadUpdate(
   in nsIUpdate update,
   in boolean background
 );
[edit] Parameters
update
An nsIUpdate object indicating the update to download.
background
true to download the update in the background or false to download it in the foreground.
[edit] Return value

A string indicating the status of the update upon return:

"downloading"
The update is being downloaded.
"pending"
The update is ready to be applied.
"applying"
The update is in the process of being applied.
"succeeded"
The update has been installed successfully.
"download-failed"
The update failed to be downloaded.
"failed"
Installing the update failed.

[edit] pauseDownload()

Pauses the currently active update download.

 void pauseDownload();
[edit] Parameters

None.

[edit] selectUpdate()

Selects the best update to install from a provided list of available updates.

 nsIUpdate selectUpdate(
   [array, size_is(updateCount)] in nsIUpdate updates,
   in unsigned long updateCount
 );
[edit] Parameters
updates
An array of updates that are available to install.
updateCount
The number of updates in the updates array.
[edit] Return value

An nsIUpdate object indicating the most appropriate update to install.

[edit] See also