mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 10:27:03 +00:00
Backed out changeset 43d16a0ca410
This commit is contained in:
parent
4bd0730265
commit
b2e1a3355c
@ -106,6 +106,11 @@ function appUpdater()
|
||||
this.bundle = Services.strings.
|
||||
createBundle("chrome://browser/locale/browser.properties");
|
||||
|
||||
this.updateBtn = document.getElementById("updateButton");
|
||||
|
||||
// The button label value must be set so its height is correct.
|
||||
this.setupUpdateButton("update.checkInsideButton");
|
||||
|
||||
let manualURL = Services.urlFormatter.formatURLPref("app.update.url.manual");
|
||||
let manualLink = document.getElementById("manualLink");
|
||||
manualLink.value = manualURL;
|
||||
@ -118,7 +123,8 @@ function appUpdater()
|
||||
}
|
||||
|
||||
if (this.isPending || this.isApplied) {
|
||||
this.selectPanel("apply");
|
||||
this.setupUpdateButton("update.restart." +
|
||||
(this.isMajor ? "upgradeButton" : "updateButton"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -129,19 +135,15 @@ function appUpdater()
|
||||
|
||||
if (this.isDownloading) {
|
||||
this.startDownload();
|
||||
// selectPanel("downloading") is called from setupDownloadingUI().
|
||||
return;
|
||||
}
|
||||
|
||||
// If app.update.enabled is false, we don't pop up an update dialog
|
||||
// automatically, but opening the About dialog is considered manually
|
||||
// checking for updates, so we always check.
|
||||
// If app.update.auto is false, we ask before downloading though,
|
||||
// in onCheckComplete.
|
||||
this.selectPanel("checkingForUpdates");
|
||||
this.isChecking = true;
|
||||
this.checker.checkForUpdates(this.updateCheckListener, true);
|
||||
// after checking, onCheckComplete() is called
|
||||
if (this.updateEnabled && this.updateAuto) {
|
||||
this.selectPanel("checkingForUpdates");
|
||||
this.isChecking = true;
|
||||
this.checker.checkForUpdates(this.updateCheckListener, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
appUpdater.prototype =
|
||||
@ -178,6 +180,13 @@ appUpdater.prototype =
|
||||
this.um.activeUpdate.state == "downloading";
|
||||
},
|
||||
|
||||
// true when the update type is major.
|
||||
get isMajor() {
|
||||
if (this.update)
|
||||
return this.update.type == "major";
|
||||
return this.um.activeUpdate.type == "major";
|
||||
},
|
||||
|
||||
// true when updating is disabled by an administrator.
|
||||
get updateDisabledAndLocked() {
|
||||
return !this.updateEnabled &&
|
||||
@ -209,55 +218,36 @@ appUpdater.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the panel of the updateDeck.
|
||||
* Sets the deck's selected panel.
|
||||
*
|
||||
* @param aChildID
|
||||
* The id of the deck's child to select, e.g. "apply".
|
||||
* The id of the deck's child to select.
|
||||
*/
|
||||
selectPanel: function(aChildID) {
|
||||
let panel = document.getElementById(aChildID);
|
||||
|
||||
let button = panel.querySelector("button");
|
||||
if (button) {
|
||||
let button = panel.firstChild;
|
||||
if (aChildID == "downloadAndInstall") {
|
||||
let updateVersion = gAppUpdater.update.displayVersion;
|
||||
button.label = this.bundle.formatStringFromName("update.downloadAndInstallButton.label", [updateVersion], 1);
|
||||
button.accessKey = this.bundle.GetStringFromName("update.downloadAndInstallButton.accesskey");
|
||||
}
|
||||
this.updateDeck.selectedPanel = panel;
|
||||
if (!document.commandDispatcher.focusedElement || // don't steal the focus
|
||||
document.commandDispatcher.focusedElement.localName == "button") // except from the other buttons
|
||||
button.focus();
|
||||
|
||||
} else {
|
||||
this.updateDeck.selectedPanel = panel;
|
||||
}
|
||||
this.updateDeck.selectedPanel = document.getElementById(aChildID);
|
||||
this.updateBtn.disabled = (aChildID != "updateButtonBox");
|
||||
},
|
||||
|
||||
/**
|
||||
* Check for addon compat, or start the download right away
|
||||
* Sets the update button's label and accesskey.
|
||||
*
|
||||
* @param aKeyPrefix
|
||||
* The prefix for the properties file entry to use for setting the
|
||||
* label and accesskey.
|
||||
*/
|
||||
doUpdate: function() {
|
||||
// skip the compatibility check if the update doesn't provide appVersion,
|
||||
// or the appVersion is unchanged, e.g. nightly update
|
||||
if (!this.update.appVersion ||
|
||||
Services.vc.compare(gAppUpdater.update.appVersion,
|
||||
Services.appinfo.version) == 0) {
|
||||
this.startDownload();
|
||||
} else {
|
||||
this.checkAddonCompatibility();
|
||||
}
|
||||
setupUpdateButton: function(aKeyPrefix) {
|
||||
this.updateBtn.label = this.bundle.GetStringFromName(aKeyPrefix + ".label");
|
||||
this.updateBtn.accessKey = this.bundle.GetStringFromName(aKeyPrefix + ".accesskey");
|
||||
if (!document.commandDispatcher.focusedElement ||
|
||||
document.commandDispatcher.focusedElement == this.updateBtn)
|
||||
this.updateBtn.focus();
|
||||
},
|
||||
|
||||
/**
|
||||
* Handles oncommand for the "Restart to Update" button
|
||||
* which is presented after the download has been downloaded.
|
||||
* Handles oncommand for the update button.
|
||||
*/
|
||||
buttonRestartAfterDownload: function() {
|
||||
if (!this.isPending && !this.isApplied)
|
||||
return;
|
||||
|
||||
buttonOnCommand: function() {
|
||||
if (this.isPending || this.isApplied) {
|
||||
// Notify all windows that an application quit has been requested.
|
||||
let cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"].
|
||||
createInstance(Components.interfaces.nsISupportsPRBool);
|
||||
@ -278,21 +268,27 @@ appUpdater.prototype =
|
||||
|
||||
appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
|
||||
Components.interfaces.nsIAppStartup.eRestart);
|
||||
},
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles oncommand for the "Apply Update…" button
|
||||
* which is presented if we need to show the billboard or license.
|
||||
*/
|
||||
buttonApplyBillboard: function() {
|
||||
const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul";
|
||||
var ary = null;
|
||||
ary = Components.classes["@mozilla.org/supports-array;1"].
|
||||
createInstance(Components.interfaces.nsISupportsArray);
|
||||
ary.AppendElement(this.update);
|
||||
var openFeatures = "chrome,centerscreen,dialog=no,resizable=no,titlebar,toolbar=no";
|
||||
Services.ww.openWindow(null, URI_UPDATE_PROMPT_DIALOG, "", openFeatures, ary);
|
||||
window.close(); // close the "About" window; updates.xul takes over.
|
||||
// Firefox no longer displays a license for updates and the licenseURL check
|
||||
// is just in case a distibution does.
|
||||
if (this.update && (this.update.billboardURL || this.update.licenseURL ||
|
||||
this.addons.length != 0)) {
|
||||
var ary = null;
|
||||
ary = Components.classes["@mozilla.org/supports-array;1"].
|
||||
createInstance(Components.interfaces.nsISupportsArray);
|
||||
ary.AppendElement(this.update);
|
||||
var openFeatures = "chrome,centerscreen,dialog=no,resizable=no,titlebar,toolbar=no";
|
||||
Services.ww.openWindow(null, URI_UPDATE_PROMPT_DIALOG, "", openFeatures, ary);
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
|
||||
this.selectPanel("checkingForUpdates");
|
||||
this.isChecking = true;
|
||||
this.checker.checkForUpdates(this.updateCheckListener, true);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -330,14 +326,21 @@ appUpdater.prototype =
|
||||
// Firefox no longer displays a license for updates and the licenseURL
|
||||
// check is just in case a distibution does.
|
||||
if (gAppUpdater.update.billboardURL || gAppUpdater.update.licenseURL) {
|
||||
gAppUpdater.selectPanel("applyBillboard");
|
||||
gAppUpdater.selectPanel("updateButtonBox");
|
||||
gAppUpdater.setupUpdateButton("update.openUpdateUI." +
|
||||
(this.isMajor ? "upgradeButton"
|
||||
: "applyButton"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (gAppUpdater.updateAuto) // automatically download and install
|
||||
gAppUpdater.doUpdate();
|
||||
else // ask
|
||||
gAppUpdater.selectPanel("downloadAndInstall");
|
||||
if (!gAppUpdater.update.appVersion ||
|
||||
Services.vc.compare(gAppUpdater.update.appVersion,
|
||||
Services.appinfo.version) == 0) {
|
||||
gAppUpdater.startDownload();
|
||||
return;
|
||||
}
|
||||
|
||||
gAppUpdater.checkAddonCompatibility();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -471,7 +474,9 @@ appUpdater.prototype =
|
||||
return;
|
||||
}
|
||||
|
||||
this.selectPanel("apply");
|
||||
this.selectPanel("updateButtonBox");
|
||||
this.setupUpdateButton("update.openUpdateUI." +
|
||||
(this.isMajor ? "upgradeButton" : "applyButton"));
|
||||
},
|
||||
|
||||
/**
|
||||
@ -548,9 +553,11 @@ appUpdater.prototype =
|
||||
if (status == "applied" || status == "applied-service" ||
|
||||
status == "pending" || status == "pending-service") {
|
||||
// If the update is successfully applied, or if the updater has
|
||||
// fallen back to non-staged updates, show the "Restart to Update"
|
||||
// fallen back to non-staged updates, show the Restart to Update
|
||||
// button.
|
||||
self.selectPanel("apply");
|
||||
self.selectPanel("updateButtonBox");
|
||||
self.setupUpdateButton("update.restart." +
|
||||
(self.isMajor ? "upgradeButton" : "updateButton"));
|
||||
} else if (status == "failed") {
|
||||
// Background update has failed, let's show the UI responsible for
|
||||
// prompting the user to update manually.
|
||||
@ -565,7 +572,9 @@ appUpdater.prototype =
|
||||
Services.obs.removeObserver(arguments.callee, "update-staged");
|
||||
}, "update-staged", false);
|
||||
} else {
|
||||
this.selectPanel("apply");
|
||||
this.selectPanel("updateButtonBox");
|
||||
this.setupUpdateButton("update.restart." +
|
||||
(this.isMajor ? "upgradeButton" : "updateButton"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -573,6 +582,7 @@ appUpdater.prototype =
|
||||
this.selectPanel("downloadFailed");
|
||||
break;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -50,29 +50,17 @@
|
||||
<vbox id="updateBox">
|
||||
#ifdef MOZ_UPDATER
|
||||
<deck id="updateDeck" orient="vertical">
|
||||
<hbox id="downloadAndInstall" align="center">
|
||||
<button id="downloadAndInstallButton" align="start"
|
||||
oncommand="gAppUpdater.doUpdate();"/>
|
||||
<!-- label and accesskey will be filled by JS -->
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
<hbox id="apply" align="center">
|
||||
<hbox id="updateButtonBox" align="center">
|
||||
<button id="updateButton" align="start"
|
||||
label="&update.updateButton.label;"
|
||||
accesskey="&update.updateButton.accesskey;"
|
||||
oncommand="gAppUpdater.buttonRestartAfterDownload();"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
<hbox id="applyBillboard" align="center">
|
||||
<button id="applyButtonBillboard" align="start"
|
||||
label="&update.applyButtonBillboard.label;"
|
||||
accesskey="&update.applyButtonBillboard.accesskey;"
|
||||
oncommand="gAppUpdater.buttonApplyBillboard();"/>
|
||||
oncommand="gAppUpdater.buttonOnCommand();"/>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
<hbox id="checkingForUpdates" align="center">
|
||||
<image class="update-throbber"/><label>&update.checkingForUpdates;</label>
|
||||
</hbox>
|
||||
<hbox id="checkingAddonCompat" align="center">
|
||||
<image class="update-throbber"/><label>&update.checkingAddonCompat;</label>
|
||||
</hbox>
|
||||
<hbox id="downloading" align="center">
|
||||
<image class="update-throbber"/><label>&update.downloading.start;</label><label id="downloadStatus"/><label>&update.downloading.end;</label>
|
||||
</hbox>
|
||||
|
@ -3,17 +3,6 @@
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<!ENTITY aboutDialog.title "About &brandFullName;">
|
||||
|
||||
<!-- LOCALIZATION NOTE update.applyButton.*, update.upgradeButton.*):
|
||||
# Only one button is present at a time.
|
||||
# The button when displayed is located directly under the Firefox version in
|
||||
# the about dialog (see bug 596813 for screenshots).
|
||||
-->
|
||||
<!ENTITY update.updateButton.label "Restart to Update">
|
||||
<!ENTITY update.updateButton.accesskey "R">
|
||||
<!ENTITY update.applyButtonBillboard.label "Apply Update…">
|
||||
<!ENTITY update.applyButtonBillboard.accesskey "A">
|
||||
|
||||
|
||||
<!-- LOCALIZATION NOTE (warningDesc.version): This is a warning about the experimental nature of Nightly and Aurora builds. It is only shown in those versions. -->
|
||||
<!ENTITY warningDesc.version "&brandShortName; is experimental and may be unstable.">
|
||||
<!-- LOCALIZATION NOTE (warningDesc.telemetryDesc): This is a notification that Nightly/Aurora builds automatically send Telemetry data back to Mozilla. It is only shown in those versions. "It" refers to brandShortName. -->
|
||||
@ -52,6 +41,8 @@
|
||||
|
||||
<!-- LOCALIZATION NOTE (update.checkingForUpdates): try to make the localized text short (see bug 596813 for screenshots). -->
|
||||
<!ENTITY update.checkingForUpdates "Checking for updates…">
|
||||
<!-- LOCALIZATION NOTE (update.checkingAddonCompat): try to make the localized text short (see bug 596813 for screenshots). -->
|
||||
<!ENTITY update.checkingAddonCompat "Checking Add-on compatibility…">
|
||||
<!-- LOCALIZATION NOTE (update.noUpdatesFound): try to make the localized text short (see bug 596813 for screenshots). -->
|
||||
<!ENTITY update.noUpdatesFound "&brandShortName; is up to date">
|
||||
<!-- LOCALIZATION NOTE (update.adminDisabled): try to make the localized text short (see bug 596813 for screenshots). -->
|
||||
|
@ -191,10 +191,24 @@ sanitizeEverythingWarning2=All history will be cleared.
|
||||
# provided that the user has modified the default set of history items to clear.
|
||||
sanitizeSelectedWarning=All selected items will be cleared.
|
||||
|
||||
# LOCALIZATION NOTE (downloadAndInstallButton.label): %S is replaced by the
|
||||
# version of the update: "Update to 28.0".
|
||||
update.downloadAndInstallButton.label=Update to %S
|
||||
update.downloadAndInstallButton.accesskey=U
|
||||
# Check for Updates in the About Dialog - button labels and accesskeys
|
||||
# LOCALIZATION NOTE - all of the following update buttons labels will only be
|
||||
# displayed one at a time. So, if a button is displayed nothing else will
|
||||
# be displayed alongside of the button. The button when displayed is located
|
||||
# directly under the Firefox version in the about dialog (see bug 596813 for
|
||||
# screenshots).
|
||||
update.checkInsideButton.label=Check for Updates
|
||||
update.checkInsideButton.accesskey=C
|
||||
update.resumeButton.label=Resume Downloading %S…
|
||||
update.resumeButton.accesskey=D
|
||||
update.openUpdateUI.applyButton.label=Apply Update…
|
||||
update.openUpdateUI.applyButton.accesskey=A
|
||||
update.restart.updateButton.label=Restart to Update
|
||||
update.restart.updateButton.accesskey=R
|
||||
update.openUpdateUI.upgradeButton.label=Upgrade Now…
|
||||
update.openUpdateUI.upgradeButton.accesskey=U
|
||||
update.restart.upgradeButton.label=Upgrade Now
|
||||
update.restart.upgradeButton.accesskey=U
|
||||
|
||||
# RSS Pretty Print
|
||||
feedShowFeedNew=Subscribe to '%S'…
|
||||
|
Loading…
x
Reference in New Issue
Block a user