Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

softwareUpdate

The softwareUpdate class simplifies the access to the software dialog and some underlying backend functions. To run all the tests for a single update the browser has to be restarted in-between the tests.

Method overview

softwareUpdate();
assertUpdateStep(in string step);
closeDialog();
download(in string updateType, in string channel, in number timeout);
forceFallback();
openDialog(in MozMillController controller);
waitForCheckFinished(in number timeout);
waitForDialogOpen(in MozMillController controller);

Attributes

Attribute Type Description
activeUpdate
nsIUpdate
The currently active update.
allowed
boolean
true if the user is allowed to run a software update.
currentStep
string
The current step of the update dialog wizard. Possible values are dummy, checking, noupdatesfound, incompatibleCheck, updatesfound, license, incompatibleList, downloading, errors, errorpatching, finished, finishedBackground, installed.
isCompleteUpdate
boolean
true if the current update is a complete update.
updateType
string
Type of the active update.

Methods

softwareUpdate()

Constructor of the class.

softwareUpdate();
Parameters

None.

assertUpdateStep()

Assert that the current wizard state matches the given step.

assertUpdateStep(
in string step
);
Parameters
step
Expected step of the Software Update wizard. For possible values, see currentStep.

closeDialog()

Closes the software update dialog.

closeDialog();
Parameters

None.

download()

Downloads an update given its type and channel.

download(
in string updateType,
in string channel,
in number timeout
);
Parameters
updateType
Type of the update. Supported values are minor and major.
channel
Update channel to use to upgrade the application. Supported values are nightly, beta, betatest, release, and releasetest.
timeout
Maximum duration of the download. This parameter is optional. The default value is 6 minutes.

forceFallback()

Forces a fallback update by modifying the update.status file. Running download() again will cause a complete update to be downloaded.

forceFallback();
Parameters

None.

openDialog()

Opens the software update dialog.

openDialog(
in MozMillController controller
);
Parameters
controller
MozMillController of the browser window.

waitForCheckFinished()

Waits until the check for new updates that happens when opening the software update dialog has completed.

waitForCheckFinished(
  int number timeout
);
Parameters
timeout
Maximum duration for the update check. The default value is 10 seconds.

waitForDialogOpen()

Waits until the software update dialog has been opened and initialized.

waitForDialogOpen(
in MozMillController controller
);
Parameters
controller
MozMillController of the browser window.

Examples

// Include necessary modules
var RELATIVE_ROOT = '../../../shared-modules';
var MODULE_REQUIRES = ['SoftwareUpdateAPI'];

var setupModule = function(module)
{
  module.controller = mozmill.getBrowserController();
  module.update = new SoftwareUpdateAPI.softwareUpdate();
}

var testUpdateDialog = function()
{
  // Open the dialog and wait until update check has been finished.
  update.openDialog(controller);
  update.waitForCheckFinished();

  // Check that an update is available
  update.assertUpdateStep('updatesfound');

  // Download the given type of update from the specified channel
  update.download(persisted.type, persisted.channel);

  // We should be ready for restart
  update.assertUpdateStep('finished');
}

Document Tags and Contributors

 Contributors to this page: Sheppy, Whimboo
 Last updated by: Sheppy,