Bug 760290 - The update UI needs to be aware of the possibility that the update cannot be staged in the background; r=rstrong
--- a/browser/base/content/aboutDialog.js
+++ b/browser/base/content/aboutDialog.js
@@ -189,17 +189,17 @@ appUpdater.prototype =
}
catch (e) { }
return true; // Firefox default is true
},
// 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.
get updateAuto() {
try {
return Services.prefs.getBoolPref("app.update.auto");
}
catch (e) { }
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -10,17 +10,16 @@ Components.utils.import("resource://gre/
// Firefox's macBrowserOverlay.xul includes scripts that define Cc, Ci, and Cr
// so we have to use different names.
const CoC = Components.classes;
const CoI = Components.interfaces;
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";
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
const PREF_APP_UPDATE_LOG = "app.update.log";
const PREF_APP_UPDATE_MANUAL_URL = "app.update.url.manual";
const PREF_APP_UPDATE_NEVER_BRANCH = "app.update.never.";
const PREF_APP_UPDATE_TEST_LOOP = "app.update.test.loop";
@@ -1576,17 +1575,19 @@ var gDownloadingPage = {
case CoR.NS_BINDING_ABORTED:
LOG("gDownloadingPage", "onStopRequest - pausing download");
// Do not remove UI listener since the user may resume downloading again.
break;
case CoR.NS_OK:
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();
gUpdates.wiz.goTo("finished");
}
break;
default:
LOG("gDownloadingPage", "onStopRequest - transfer failed");
--- a/toolkit/mozapps/update/nsIUpdateService.idl
+++ b/toolkit/mozapps/update/nsIUpdateService.idl
@@ -347,17 +347,17 @@ interface nsIUpdateChecker : nsISupports
void stopChecking(in unsigned short duration);
};
/**
* An interface describing a global application service that handles performing
* 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
{
/**
* The Update Checker used for background update checking.
*/
readonly attribute nsIUpdateChecker backgroundChecker;
/**
@@ -417,16 +417,21 @@ interface nsIApplicationUpdateService :
readonly attribute boolean canCheckForUpdates;
/**
* Whether or not the Update Service can download and install updates.
* This is a function of whether or not the current user has access
* privileges to the install directory.
*/
readonly attribute boolean canApplyUpdates;
+
+ /**
+ * Whether the Update Service is able to stage updates.
+ */
+ readonly attribute boolean canStageUpdates;
};
/**
* An interface describing a component which handles the job of processing
* an update after it's been downloaded.
*/
[scriptable, uuid(74439497-d796-4915-8cef-3dfe43027e4d)]
interface nsIUpdateProcessor : nsISupports
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -2044,16 +2044,23 @@ UpdateService.prototype = {
*/
get canApplyUpdates() {
return gCanApplyUpdates;
},
/**
* See nsIUpdateService.idl
*/
+ get canStageUpdates() {
+ return gCanStageUpdates;
+ },
+
+ /**
+ * See nsIUpdateService.idl
+ */
addDownloadListener: function AUS_addDownloadListener(listener) {
if (!this._downloader) {
LOG("UpdateService:addDownloadListener - no downloader!");
return;
}
this._downloader.addDownloadListener(listener);
},