Bug 760290 - The update UI needs to be aware of the possibility that the update cannot be staged in the background; r=rstrong

This commit is contained in:
Ehsan Akhgari 2012-05-31 20:28:32 -04:00
parent d98ade3af7
commit 3cb1fce0b2
4 changed files with 17 additions and 4 deletions

View File

@ -194,7 +194,7 @@ appUpdater.prototype =
// true when updating in background is enabled.
get backgroundUpdateEnabled() {
return this.updateEnabled &&
Services.prefs.getBoolPref("app.update.stage.enabled");
gAppUpdater.aus.canStageUpdates;
},
// true when updating is automatic.

View File

@ -15,7 +15,6 @@ const CoR = Components.results;
const XMLNS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const PREF_APP_UPDATE_BACKGROUND = "app.update.stage.enabled";
const PREF_APP_UPDATE_BACKGROUNDERRORS = "app.update.backgroundErrors";
const PREF_APP_UPDATE_BILLBOARD_TEST_URL = "app.update.billboard.test_url";
const PREF_APP_UPDATE_CERT_ERRORS = "app.update.cert.errors";
@ -1581,7 +1580,9 @@ var gDownloadingPage = {
LOG("gDownloadingPage", "onStopRequest - patch verification succeeded");
// If the background update pref is set, we should wait until the update
// is actually staged in the background.
if (getPref("getBoolPref", PREF_APP_UPDATE_BACKGROUND, false)) {
var aus = CoC["@mozilla.org/updates/update-service;1"].
getService(CoI.nsIApplicationUpdateService);
if (aus.canStageUpdates) {
this._setUpdateApplying();
} else {
this.cleanUp();

View File

@ -352,7 +352,7 @@ interface nsIUpdateChecker : nsISupports
* background update checks and provides utilities for selecting and
* downloading update patches.
*/
[scriptable, uuid(7bd62f69-f604-484b-b97c-e7229d7a3ee8)]
[scriptable, uuid(900b4a18-3bef-4f3e-bcf5-84dce0021c6d)]
interface nsIApplicationUpdateService : nsISupports
{
/**
@ -422,6 +422,11 @@ interface nsIApplicationUpdateService : nsISupports
* privileges to the install directory.
*/
readonly attribute boolean canApplyUpdates;
/**
* Whether the Update Service is able to stage updates.
*/
readonly attribute boolean canStageUpdates;
};
/**

View File

@ -2046,6 +2046,13 @@ UpdateService.prototype = {
return gCanApplyUpdates;
},
/**
* See nsIUpdateService.idl
*/
get canStageUpdates() {
return gCanStageUpdates;
},
/**
* See nsIUpdateService.idl
*/