From 6049b9b6a4bcf4f60a8fd4a7f55c20398677579f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Wed, 15 Oct 2008 15:56:25 +0200 Subject: [PATCH] Bug 397493 - Add-ons Update should skip "Continue" if all updates have been successful. ui-r=boriss, r=dtownsend --- .../mozapps/extensions/content/extensions.js | 24 ++++++++++--------- .../mozapps/extensions/content/extensions.xul | 6 +++-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index a4977893219a..107eb8b275f4 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -329,7 +329,6 @@ function showView(aView) { var showCheckUpdatesAll = true; var showInstallUpdatesAll = false; var showSkip = false; - var showContinue = false; switch (aView) { case "search": var bindingList = [ [ ["action", "?action"], @@ -406,8 +405,6 @@ function showView(aView) { showInstallFile = false; showCheckUpdatesAll = false; showInstallUpdatesAll = false; - if (gUpdatesOnly) - showContinue = true; bindingList = [ [ ["aboutURL", "?aboutURL"], ["addonID", "?addonID"], ["availableUpdateURL", "?availableUpdateURL"], @@ -469,7 +466,6 @@ function showView(aView) { document.getElementById("checkUpdatesAllButton").hidden = !showCheckUpdatesAll; document.getElementById("installUpdatesAllButton").hidden = !showInstallUpdatesAll; document.getElementById("skipDialogButton").hidden = !showSkip; - document.getElementById("continueDialogButton").hidden = !showContinue; document.getElementById("themePreviewArea").hidden = !isThemes; document.getElementById("themeSplitter").hidden = !isThemes; document.getElementById("showUpdateInfoButton").hidden = aView != "updates"; @@ -488,11 +484,6 @@ function showView(aView) { } else document.getElementById("installUpdatesAllButton").removeAttribute("default"); - if (showContinue) - document.getElementById("continueDialogButton").setAttribute("default", "true"); - else - document.getElementById("continueDialogButton").removeAttribute("default"); - if (isThemes) onAddonSelect(); updateGlobalCommands(); @@ -1342,8 +1333,12 @@ XPInstallDownloadManager.prototype = { { }, + _failed: false, onInstallEnded: function(aAddon, aStatus) { + if (aStatus < 0) + this._failed = true; + // From nsInstall.h // USER_CANCELLED = -210 // All other xpinstall errors are <= -200 @@ -1371,8 +1366,15 @@ XPInstallDownloadManager.prototype = { gInstalling = false; gExtensionManager.sortTypeByProperty(nsIUpdateItem.TYPE_ANY, "name", true); if (gUpdatesOnly) { - setElementDisabledByID("cmd_continue", false); - document.getElementById("continueDialogButton").focus(); + if (this._failed) { + let continueButton = document.getElementById("continueDialogButton"); + setElementDisabledByID("cmd_continue", false); + continueButton.hidden = false; + continueButton.setAttribute("default", "true"); + continueButton.focus(); + } else { + setTimeout(closeEM, 2000); + } } else { updateOptionalViews(); diff --git a/toolkit/mozapps/extensions/content/extensions.xul b/toolkit/mozapps/extensions/content/extensions.xul index ee3d4b42df5b..cfcbcbbb9086 100644 --- a/toolkit/mozapps/extensions/content/extensions.xul +++ b/toolkit/mozapps/extensions/content/extensions.xul @@ -267,7 +267,8 @@