From f95efb0b36b96ac3522fe76dc32fa989927ac4cd Mon Sep 17 00:00:00 2001 From: "rob_strong%exchangecode.com" Date: Tue, 20 Jun 2006 02:58:31 +0000 Subject: [PATCH] Bug 307358 - Missing notification after auto-check finds updates to Extensions. patch=michael.wu, r=rob_strong --- browser/app/profile/firefox.js | 2 +- .../chrome/mozapps/extensions/extensions.dtd | 7 ++ .../mozapps/extensions/extensions.properties | 5 +- .../mozapps/extensions/content/extensions.css | 4 + .../mozapps/extensions/content/extensions.js | 78 +++++++++++++++---- .../mozapps/extensions/content/extensions.xml | 6 ++ .../mozapps/extensions/content/extensions.xul | 8 ++ .../extensions/src/nsExtensionManager.js.in | 66 +++++++++++----- .../mozapps/extensions/extensions.css | 17 ++++ 9 files changed, 156 insertions(+), 37 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index e271cd5bca56..94e385a1259f 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -146,7 +146,7 @@ pref("app.update.incompatible.mode", 0); pref("extensions.update.enabled", true); pref("extensions.update.url", "chrome://mozapps/locale/extensions/extensions.properties"); pref("extensions.update.interval", 86400); // Check for updates to Extensions and - // Themes every week + // Themes every day // Non-symmetric (not shared by extensions) extension-specific [update] preferences pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties"); pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties"); diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd index ab20f5455595..3747a9646404 100644 --- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd +++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd @@ -31,6 +31,12 @@ + + + + + + @@ -100,6 +106,7 @@ + diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties index 79ea222f99c7..6f594f01a6f4 100644 --- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties +++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties @@ -32,7 +32,7 @@ disableTitle=Disable %S disableWarningDependMessage=If you disable %S, the following items that require this extension will also be disabled: disableQueryMessage=Do you want to disable %S? -extensions.update.url=https://addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI% +extensions.update.url=https://addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI% extensions.getMoreExtensionsURL=https://addons.mozilla.org/extensions/?application=%APPID% extensions.getMoreThemesURL=https://addons.mozilla.org/themes/?application=%APPID% @@ -129,3 +129,6 @@ enableButtonLabel=Enable enableButtonAccesskey=n goOnlineButtonLabel=Go Online goOnlineButtonAccesskey=G + +newUpdateWindowTitle=%S Add-on Updates +newUpdatesAvailableMsg=There are new updates available for your add-ons. diff --git a/toolkit/mozapps/extensions/content/extensions.css b/toolkit/mozapps/extensions/content/extensions.css index 63412216adc8..1fb3c1c6261d 100644 --- a/toolkit/mozapps/extensions/content/extensions.css +++ b/toolkit/mozapps/extensions/content/extensions.css @@ -46,6 +46,10 @@ richlistitem[state="success"][opType="none"] hbox.addon-install-status { -moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#addon-install-success"); } +richlistbox[norestart] richlistitem[state="success"] hbox.addon-install-status { + -moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#addon-install-updated"); +} + richlistitem[state="failure"] hbox.addon-install-status { -moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#addon-install-fail"); } diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 2439c7f175f8..9cb51809234c 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -54,6 +54,7 @@ var gDownloadManager = null; var gObserverIndex = -1; var gInSafeMode = false; var gCheckCompat = true; +var gUpdatesOnly = false; var gAppID = ""; var gPref = null; @@ -64,6 +65,7 @@ const PREF_EXTENSIONS_DSS_ENABLED = "extensions.dss.enabled"; const PREF_EXTENSIONS_DSS_SWITCHPENDING = "extensions.dss.switchPending"; const PREF_EM_LAST_SELECTED_SKIN = "extensions.lastSelectedSkin"; const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin"; +const PREF_UPDATE_NOTIFYUSER = "extensions.update.notifyUser"; const RDFURI_ITEM_ROOT = "urn:mozilla:item:root"; const PREFIX_ITEM_URI = "urn:mozilla:item:"; @@ -229,6 +231,8 @@ function showView(aView) { var showCheckUpdatesAll = true; var showInstallUpdatesAll = false; var showRestartApp = false; + var showSkip = false; + var showContinue = false; switch (aView) { case "extensions": var types = [ [ ["type", nsIUpdateItem.TYPE_EXTENSION, "Integer" ] ] ]; @@ -247,6 +251,8 @@ function showView(aView) { showInstallFile = false; showCheckUpdatesAll = false; showInstallUpdatesAll = true; + if (gUpdatesOnly) + showSkip = true; bindingList = [ ["aboutURL", "?aboutURL"], ["availableUpdateURL", "?availableUpdateURL"], ["availableUpdateVersion", "?availableUpdateVersion"], @@ -270,7 +276,10 @@ function showView(aView) { showInstallFile = false; showCheckUpdatesAll = false; showInstallUpdatesAll = false; - showRestartApp = true; + if (gUpdatesOnly) + showContinue = true; + else + showRestartApp = true; bindingList = [ ["aboutURL", "?aboutURL"], ["addonID", "?addonID"], ["availableUpdateURL", "?availableUpdateURL"], @@ -342,8 +351,23 @@ function showView(aView) { document.getElementById("checkUpdatesAllButton").hidden = !showCheckUpdatesAll; document.getElementById("installUpdatesAllButton").hidden = !showInstallUpdatesAll; document.getElementById("restartAppButton").hidden = !showRestartApp; + document.getElementById("skipDialogButton").hidden = !showSkip; + document.getElementById("continueDialogButton").hidden = !showContinue; document.getElementById("themePreviewArea").hidden = !isThemes; document.getElementById("themeSplitter").hidden = !isThemes; + + if (showSkip) { + var button = document.getElementById("installUpdatesAllButton"); + button.setAttribute("default", "true"); + window.setTimeout(function () { button.focus(); }, 0); + } else + document.getElementById("installUpdatesAllButton").removeAttribute("default"); + + if (showContinue) + document.getElementById("continueDialogButton").setAttribute("default", "true"); + else + document.getElementById("continueDialogButton").removeAttribute("default"); + if (isThemes) onAddonSelect(); updateGlobalCommands(); @@ -502,20 +526,6 @@ function Startup() gObserverIndex = gExtensionManager.addUpdateListener(gDownloadManager); - if ("arguments" in window) { - try { - var params = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock); - gDownloadManager.addDownloads(params); - } - catch (e) { - if (window.arguments[0] == "updatecheck") - checkUpdatesAll(); - } - } - - if (gExtensionsView.selectedItem) - gExtensionsView.scrollBoxObject.scrollToElement(gExtensionsView.selectedItem); - if (!gCheckCompat) { var msgText = getExtensionString("disabledCompatMsg"); var buttonLabel = getExtensionString("enableButtonLabel"); @@ -532,6 +542,33 @@ function Startup() getExtensionString("safeModeMsg"), null, null, true, null); } + + if ("arguments" in window) { + try { + var params = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock); + gDownloadManager.addDownloads(params); + } + catch (e) { + if (window.arguments[0] == "updatecheck") + checkUpdatesAll(); + else if (window.arguments[0] == "updates-only") { + gUpdatesOnly = true; + document.getElementById("viewGroup").hidden = true; + document.getElementById("extensionsView").setAttribute("norestart", ""); + showView('updates'); + var addonsMsg = document.getElementById("addonsMsg"); + addonsMsg.showMessage("chrome://mozapps/skin/extensions/question.png", + getExtensionString("newUpdatesAvailableMsg"), + null, null, true, null); + document.title = getExtensionString("newUpdateWindowTitle", [getBrandShortName()]); + } + } + } + + if (gExtensionsView.selectedItem) + gExtensionsView.scrollBoxObject.scrollToElement(gExtensionsView.selectedItem); + + gPref.setBoolPref(PREF_UPDATE_NOTIFYUSER, false); } function Shutdown() @@ -1298,6 +1335,10 @@ function updateGlobalCommands() { setElementDisabledByID("cmd_installUpdatesAll", disableInstallUpdate); setElementDisabledByID("cmd_restartApp", disableAppRestart); setElementDisabledByID("cmd_installFile", disableInstallFile); + + var button = document.getElementById("continueDialogButton"); + if (!button.hidden && !disableAppRestart) + button.focus(); } function checkUpdatesAll() { @@ -1320,6 +1361,8 @@ function checkUpdatesAll() { } if (gExtensionsView.selectedItem) gExtensionsView.selectedItem.focus(); + + gPref.setBoolPref(PREF_UPDATE_NOTIFYUSER, false); } function installUpdatesAll() { @@ -1329,6 +1372,11 @@ function installUpdatesAll() { if (!isXPInstallEnabled()) return; + if (gUpdatesOnly) { + var addonsMsg = document.getElementById("addonsMsg"); + addonsMsg.hideMessage(); + } + var items = []; var children = gExtensionsView.children; for (var i = 0; i < children.length; ++i) { diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml index 153da364eb9d..9d89c9b47151 100644 --- a/toolkit/mozapps/extensions/content/extensions.xml +++ b/toolkit/mozapps/extensions/content/extensions.xml @@ -464,6 +464,12 @@ + + + + + + diff --git a/toolkit/mozapps/extensions/content/extensions.xul b/toolkit/mozapps/extensions/content/extensions.xul index 044483ec4c0a..40a9c3ab5dee 100644 --- a/toolkit/mozapps/extensions/content/extensions.xul +++ b/toolkit/mozapps/extensions/content/extensions.xul @@ -210,6 +210,14 @@ accesskey="&cmd.restartApp.accesskey;" tooltiptext="&cmd.restartApp.tooltip;" command="cmd_restartApp"/> +