mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
fix js error in update service
This commit is contained in:
parent
f055d2e681
commit
372e50a09b
@ -240,7 +240,7 @@ var gUpdates = {
|
||||
// If the first argument is a nsIUpdate object, we are notifying the
|
||||
// user that the background checking found an update that requires
|
||||
// their permission to install, and it's ready for download.
|
||||
this.update = arg0;
|
||||
this.setUpdate(arg0);
|
||||
var p = this.update.selectedPatch;
|
||||
if (p) {
|
||||
switch (p.state) {
|
||||
@ -261,13 +261,26 @@ var gUpdates = {
|
||||
Components.classes["@mozilla.org/updates/update-manager;1"].
|
||||
getService(Components.interfaces.nsIUpdateManager);
|
||||
if (um.activeUpdate) {
|
||||
this.update = um.activeUpdate;
|
||||
this.setUpdate(um.activeUpdate);
|
||||
return document.getElementById("downloading");
|
||||
}
|
||||
}
|
||||
return document.getElementById("checking");
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the Update object for this wizard
|
||||
* @param update
|
||||
* The update object
|
||||
*/
|
||||
setUpdate: function(update) {
|
||||
this.update = update;
|
||||
this.update.QueryInterface(Components.interfaces.nsIWritablePropertyBag);
|
||||
var p = this.update.selectedPatch;
|
||||
if (p)
|
||||
p.QueryInterface(Components.interfaces.nsIWritablePropertyBag);
|
||||
},
|
||||
|
||||
/**
|
||||
* Registers a timer to nag the user about something relating to update
|
||||
* @param timerID
|
||||
@ -385,7 +398,7 @@ var gCheckingPage = {
|
||||
onCheckComplete: function(request, updates, updateCount) {
|
||||
var aus = Components.classes["@mozilla.org/updates/update-service;1"]
|
||||
.getService(Components.interfaces.nsIApplicationUpdateService);
|
||||
gUpdates.update = aus.selectUpdate(updates, updates.length);
|
||||
gUpdates.setUpdate(aus.selectUpdate(updates, updates.length));
|
||||
if (!gUpdates.update) {
|
||||
LOG("UI:CheckingPage",
|
||||
"Could not select an appropriate update, either because there " +
|
||||
@ -402,7 +415,7 @@ var gCheckingPage = {
|
||||
onError: function(request, update) {
|
||||
LOG("UI:CheckingPage", "UpdateCheckListener: error");
|
||||
|
||||
gUpdates.update = update;
|
||||
gUpdates.setUpdate(update);
|
||||
|
||||
gUpdates.wiz.currentPage = document.getElementById("errors");
|
||||
},
|
||||
@ -500,7 +513,18 @@ var gUpdatesAvailablePage = {
|
||||
* Downloading page, whichever is appropriate.
|
||||
*/
|
||||
onInstallNow: function() {
|
||||
var nextPageID = gUpdates.update.licenseURL ? "license" : "downloading";
|
||||
var nextPageID = "downloading";
|
||||
if (gUpdates.update.licenseURL) {
|
||||
try {
|
||||
var licenseAccepted = gUpdates.update.getProperty("licenseAccepted");
|
||||
}
|
||||
catch(e) {
|
||||
// |getProperty| throws NS_ERROR_FAILURE if the property is not
|
||||
// defined on the property bag.
|
||||
}
|
||||
if (licenseAccepted != "true")
|
||||
nextPageID = "license";
|
||||
}
|
||||
gUpdates.wiz.currentPage = document.getElementById(nextPageID);
|
||||
},
|
||||
|
||||
@ -561,8 +585,6 @@ var gLicensePage = {
|
||||
|
||||
this._licenseContent.addEventListener("load", this.onLicenseLoad, false);
|
||||
this._licenseContent.url = gUpdates.update.licenseURL;
|
||||
|
||||
gUpdates.wiz._wizardButtons.removeAttribute("type");
|
||||
},
|
||||
|
||||
/**
|
||||
@ -574,6 +596,13 @@ var gLicensePage = {
|
||||
gUpdates.wiz.getButton("next").disabled = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* When the user accepts the license
|
||||
*/
|
||||
onWizardNext: function() {
|
||||
gUpdates.update.setProperty("licenseAccepted", "true");
|
||||
},
|
||||
|
||||
/**
|
||||
* When the user cancels the wizard
|
||||
*/
|
||||
@ -842,8 +871,6 @@ var gDownloadingPage = {
|
||||
* Initialize
|
||||
*/
|
||||
onPageShow: function() {
|
||||
gUpdates.wiz._wizardButtons.removeAttribute("type");
|
||||
|
||||
this._downloadName = document.getElementById("downloadName");
|
||||
this._downloadStatus = document.getElementById("downloadStatus");
|
||||
this._downloadProgress = document.getElementById("downloadProgress");
|
||||
@ -859,7 +886,7 @@ var gDownloadingPage = {
|
||||
getService(Components.interfaces.nsIUpdateManager);
|
||||
var activeUpdate = um.activeUpdate;
|
||||
if (activeUpdate) {
|
||||
gUpdates.update = activeUpdate;
|
||||
gUpdates.setUpdate(activeUpdate);
|
||||
this._togglePausedState(!updates.isDownloading);
|
||||
}
|
||||
|
||||
@ -963,7 +990,6 @@ var gDownloadingPage = {
|
||||
updates.downloadUpdate(gUpdates.update, false);
|
||||
else {
|
||||
var patch = gUpdates.update.selectedPatch;
|
||||
patch.QueryInterface(Components.interfaces.nsIWritablePropertyBag);
|
||||
patch.setProperty("status",
|
||||
gUpdates.strings.getFormattedString("pausedStatus",
|
||||
[this.statusFormatter.progress]));
|
||||
@ -1046,7 +1072,6 @@ var gDownloadingPage = {
|
||||
"/" + maxProgress);
|
||||
|
||||
var p = gUpdates.update.selectedPatch;
|
||||
p.QueryInterface(Components.interfaces.nsIWritablePropertyBag);
|
||||
p.setProperty("progress", Math.round(100 * (progress/maxProgress)));
|
||||
p.setProperty("status",
|
||||
this.statusFormatter.formatStatus(progress, maxProgress));
|
||||
|
@ -125,7 +125,8 @@
|
||||
|
||||
<wizardpage id="license" pageid="license" next="downloading"
|
||||
object="gLicensePage" label="&license.title;"
|
||||
onpageshow="gLicensePage.onPageShow();">
|
||||
onpageshow="gLicensePage.onPageShow();"
|
||||
onwizardnext="gLicensePage.onWizardNext();">
|
||||
<label>&license.intro;</label>
|
||||
<separator class="thin"/>
|
||||
<license id="licenseContent" flex="1"/>
|
||||
|
@ -525,6 +525,7 @@ function UpdateService() {
|
||||
// Observe xpcom-shutdown to unhook pref branch observers above to avoid
|
||||
// shutdown leaks.
|
||||
gOS.addObserver(this, "xpcom-shutdown", false);
|
||||
|
||||
/*
|
||||
// Detect installation failures and notify
|
||||
var status = readStatusFile(getUpdatesDir());
|
||||
@ -553,7 +554,7 @@ function UpdateService() {
|
||||
update.statusText = "goats";
|
||||
// XXXben todo: synthesize the best message
|
||||
//prompter.showUpdateError(update);
|
||||
}*/
|
||||
}
|
||||
|
||||
// Move the update from the Active Update list into the Past Updates list.
|
||||
um.activeUpdate = null;
|
||||
@ -562,6 +563,7 @@ function UpdateService() {
|
||||
// Now trash the updates directory, since we're done with it
|
||||
cleanUpUpdatesDir();
|
||||
}
|
||||
*/
|
||||
|
||||
this._initLoggingPrefs();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user