diff --git a/browser/base/content/baseMenuOverlay.xul b/browser/base/content/baseMenuOverlay.xul index e277970b297b..2e53454f795d 100644 --- a/browser/base/content/baseMenuOverlay.xul +++ b/browser/base/content/baseMenuOverlay.xul @@ -68,38 +68,41 @@ label="&helpMenu.label;" accesskey="&helpMenu.accesskey;"> #endif - - + + label="&helpContentsMac.label;" + key="key_openHelpMacFrontend"/> #else - label="&helpContents.label;" - accesskey="&helpContents.accesskey;" - key="key_openHelp"/> + label="&helpContents.label;" + accesskey="&helpContents.accesskey;" + key="key_openHelp"/> #endif # Show IE Users menu item on Windows only #ifdef XP_WIN - + #endif - - + #ifndef XP_MACOSX - + #endif - + + oncommand="openAboutDialog();"/> + diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index e8a28fbb2f41..10eec80a06ef 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -8,10 +8,6 @@ toolbar[printpreview="true"] { -moz-binding: url("chrome://global/content/printPreviewBindings.xml#printpreviewtoolbar"); } -toolbarbutton[type="updates"] { - -moz-binding: url("chrome://mozapps/content/update/updates.xml#updateStatusbarNotification"); -} - #noPreviewAvailable { background-color: white !important; diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 53c59722762a..583c13e7396f 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -5785,11 +5785,3 @@ missingPluginInstaller.prototype.observe = function(aSubject, aTopic, aData){ } var gMissingPluginInstaller = new missingPluginInstaller(); -function checkForUpdates() { - var updates = Components.classes["@mozilla.org/updates/update-service;1"] - .getService(Components.interfaces.nsIUpdateService); - updates.checkForUpdates([], 0, Components.interfaces.nsIUpdateItem.TYPE_ANY, - Components.interfaces.nsIUpdateService.SOURCE_EVENT_USER, - window); -} - diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index 6b04bca97890..7ef40c613ab9 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -425,12 +425,28 @@ function openPreferences(paneID) "Preferences", features, paneID); } -function getUILink(item) +/** + * Opens the release notes page for this version of the application. + * @param event + * The DOM Event that caused this function to be called, used to + * determine where the release notes page should be displayed based + * on modifiers (e.g. Ctrl = new tab) + */ +function openReleaseNotes(event) { + var appInfo = Components.classes["@mozilla.org/xre/app-info;1"] + .getService(Components.interfaces.nsIXULAppInfo); var regionBundle = document.getElementById("bundle_browser_region"); - - if (item == "promote") - return regionBundle.getString("promoteURL"); - - return ""; + var relnotesURL = regionBundle.getFormattedString("releaseNotesURL", [appInfo.version]); + openUILink(relnotesURL, event, false, true); +} + +/** + * Opens the update manager and checks for updates to the application. + */ +function checkForUpdates() +{ + var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"] + .createInstance(Components.interfaces.nsIUpdatePrompt); + prompter.checkForUpdates(); } diff --git a/browser/locales/en-US/chrome/browser-region/region.properties b/browser/locales/en-US/chrome/browser-region/region.properties index 595ebe741dbf..efa4f663024d 100644 --- a/browser/locales/en-US/chrome/browser-region/region.properties +++ b/browser/locales/en-US/chrome/browser-region/region.properties @@ -3,7 +3,7 @@ general.useragent.contentlocale=US homePageDefault=http://start.mozilla.org/firefox fallbackDefaultSearchURL=http://www.google.com/search?&q= -promoteURL=http://www.spreadfirefox.com/promote/ +releaseNotesURL=http://www.mozilla.org/products/firefox/releases/%S.html # firefox.js browser.startup.homepage=http://start.mozilla.org/firefox diff --git a/browser/locales/en-US/chrome/browser/baseMenuOverlay.dtd b/browser/locales/en-US/chrome/browser/baseMenuOverlay.dtd index c5a1c3b31dc9..7e0a72b3116b 100644 --- a/browser/locales/en-US/chrome/browser/baseMenuOverlay.dtd +++ b/browser/locales/en-US/chrome/browser/baseMenuOverlay.dtd @@ -27,5 +27,8 @@ - - + + + + + diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd index 79f137855a02..f4f77a1f15fc 100644 --- a/browser/locales/en-US/chrome/browser/browser.dtd +++ b/browser/locales/en-US/chrome/browser/browser.dtd @@ -347,9 +347,6 @@ - - - diff --git a/browser/locales/en-US/chrome/help/menu_reference.xhtml b/browser/locales/en-US/chrome/help/menu_reference.xhtml index 13a04304d992..99fb96cac8c4 100644 --- a/browser/locales/en-US/chrome/help/menu_reference.xhtml +++ b/browser/locales/en-US/chrome/help/menu_reference.xhtml @@ -366,9 +366,10 @@ Contributors:

Opens this Help window displaying information that can help Internet Explorer users transition to &brandShortName;.

-

Promote &brandShortName;

-

Opens a web page that gives you information on how to promote - &brandShortName;.

+

Release Notes

+

Provides information about installing, uninstalling and configuring &brandShortName;, + as well as other important information and late breaking notices. Requires an + active Internet connection.

About &brandFullName;

Displays a dialog box with information about &brandShortName;, including diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd index e4deaf7a5687..f80654fbf977 100644 --- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd +++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd @@ -40,6 +40,8 @@ + + diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/update.dtd b/toolkit/locales/en-US/chrome/mozapps/extensions/update.dtd index 60983667e76a..33d1545235f5 100644 --- a/toolkit/locales/en-US/chrome/mozapps/extensions/update.dtd +++ b/toolkit/locales/en-US/chrome/mozapps/extensions/update.dtd @@ -1,5 +1,87 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/update.properties b/toolkit/locales/en-US/chrome/mozapps/extensions/update.properties new file mode 100755 index 000000000000..e656f3d733b1 --- /dev/null +++ b/toolkit/locales/en-US/chrome/mozapps/extensions/update.properties @@ -0,0 +1,52 @@ +mismatchCheckNow=Check Now +mismatchCheckNowAccesskey=C +mismatchDontCheck=Don't Check +mismatchDontCheckAccesskey=D +installButtonText=Install Now +installButtonTextAccesskey=I +nextButtonText=Next > +nextButtonTextAccesskey=N +cancelButtonText=Cancel +cancelButtonTextAccesskey=C +app.update.url=https://aus.mozilla.org/update/firefox/en-US.rdf + +updatesAvailableTitle=New Updates Available +updatesAvailableText=Click Here to View + +checkingPrefix=Checking for Updates to %S ... +downloadingPrefix=Downloading: %S +installingPrefix=Installing: %S +closeButton=Close + +installErrorDescription=The following components could not be installed due to errors (the file could not be downloaded, was corrupt, or for some other reason). +checkingErrorDescription=%S could not check for updates to the following components (either the update server(s) did not respond, or the update service(s) were not found). +installErrorItemFormat=%S (%S) + +versionUpdateComplete=Version Compatibility Update Complete + +updatesAvailableTooltip-0=Update(s) Available +updatesAvailableTooltip-1=Update(s) Available +updatesAvailableTooltip-2=Critical Update(s) Available + +updatesCheckForUpdatesTooltip=Double-click here to check for updates + +installTextNoFurtherActions=Choose the ones you want to install and click Install Now to install them. +installTextFurtherCations=Choose the ones you want to install and click Next to continue. + +appNameAndVersionFormat=%S %S +updateTypePatches=Critical Updates (%S) +updateTypeComponents=Optional Components (%S) +updateTypeExtensions=Extensions and Themes (%S) +updateTypeLangPacks=Language Packs (%S) + +foundAppLabel=%S %S is available. We strongly recommend that you install this upgrade as soon as possible. +foundAppFeatures=%S %S features: +foundAppInfoLink=More information about %S %S ... +foundInstructions=Choose the ones you want to install and click Install Now to install them. +foundInstructionsAppComps=Choose the ones you want to install and click Next to continue. + +appupdateperformedtitle=Restart Required +appupdateperformedmessage=%S has been updated this session. Please restart %S before performing any more updates. + +updatesdisabledtitle=Update Disabled +updatesdisabledmessage=Update has been disabled by your Administrator. diff --git a/toolkit/locales/en-US/chrome/mozapps/update/incompatible.dtd b/toolkit/locales/en-US/chrome/mozapps/update/incompatible.dtd new file mode 100755 index 000000000000..9d1e224523a3 --- /dev/null +++ b/toolkit/locales/en-US/chrome/mozapps/update/incompatible.dtd @@ -0,0 +1,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/toolkit/locales/en-US/chrome/mozapps/update/update.dtd b/toolkit/locales/en-US/chrome/mozapps/update/update.dtd deleted file mode 100644 index ff1c5f9c9aa6..000000000000 --- a/toolkit/locales/en-US/chrome/mozapps/update/update.dtd +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/toolkit/locales/en-US/chrome/mozapps/update/updates.dtd b/toolkit/locales/en-US/chrome/mozapps/update/updates.dtd new file mode 100755 index 000000000000..ac6e5201bc54 --- /dev/null +++ b/toolkit/locales/en-US/chrome/mozapps/update/updates.dtd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/locales/en-US/chrome/mozapps/update/updates.properties b/toolkit/locales/en-US/chrome/mozapps/update/updates.properties new file mode 100755 index 000000000000..91b818fcaf4e --- /dev/null +++ b/toolkit/locales/en-US/chrome/mozapps/update/updates.properties @@ -0,0 +1,5 @@ +updateName=%S %S +updateType_major=New Version +updateType_minor=Security Update +introType_minor=An important Security Update for %S is available: +introType_major=A new version of %S is available: diff --git a/toolkit/locales/jar.mn b/toolkit/locales/jar.mn index b14032ad41fc..3dfeda39c102 100644 --- a/toolkit/locales/jar.mn +++ b/toolkit/locales/jar.mn @@ -76,6 +76,8 @@ locale/@AB_CD@/mozapps/extensions/extensions.properties (%chrome/mozapps/extensions/extensions.properties) locale/@AB_CD@/mozapps/extensions/about.dtd (%chrome/mozapps/extensions/about.dtd) locale/@AB_CD@/mozapps/extensions/finalize.dtd (%chrome/mozapps/extensions/finalize.dtd) + locale/@AB_CD@/mozapps/extensions/update.dtd (%chrome/mozapps/extensions/update.dtd) + locale/@AB_CD@/mozapps/extensions/update.properties (%chrome/mozapps/extensions/update.properties) locale/@AB_CD@/mozapps/plugins/plugins.dtd (%chrome/mozapps/plugins/plugins.dtd) locale/@AB_CD@/mozapps/plugins/plugins.properties (%chrome/mozapps/plugins/plugins.properties) locale/@AB_CD@/mozapps/preferences/ocsp.dtd (%chrome/mozapps/preferences/ocsp.dtd) @@ -86,8 +88,9 @@ locale/@AB_CD@/mozapps/profile/createProfileWizard.dtd (%chrome/mozapps/profile/createProfileWizard.dtd) locale/@AB_CD@/mozapps/profile/profileSelection.properties (%chrome/mozapps/profile/profileSelection.properties) locale/@AB_CD@/mozapps/profile/profileSelection.dtd (%chrome/mozapps/profile/profileSelection.dtd) - locale/@AB_CD@/mozapps/update/update.dtd (%chrome/mozapps/update/update.dtd) - locale/@AB_CD@/mozapps/update/update.properties (%chrome/mozapps/update/update.properties) + locale/@AB_CD@/mozapps/update/updates.dtd (%chrome/mozapps/update/updates.dtd) + locale/@AB_CD@/mozapps/update/updates.properties (%chrome/mozapps/update/updates.properties) + locale/@AB_CD@/mozapps/update/incompatible.dtd (%chrome/mozapps/update/incompatible.dtd) locale/@AB_CD@/mozapps/update/errors.dtd (%chrome/mozapps/update/errors.dtd) locale/@AB_CD@/mozapps/xpinstall/xpinstallConfirm.dtd (%chrome/mozapps/xpinstall/xpinstallConfirm.dtd) locale/@AB_CD@/mozapps/xpinstall/xpinstallConfirm.properties (%chrome/mozapps/xpinstall/xpinstallConfirm.properties) diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 32591b920f57..02adcab81d2e 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -69,6 +69,8 @@ const OP_NEEDS_UNINSTALL = "needs-uninstall"; const OP_NEEDS_ENABLE = "needs-enable"; const OP_NEEDS_DISABLE = "needs-disable"; +const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul"; + /////////////////////////////////////////////////////////////////////////////// // Utility Functions @@ -517,10 +519,11 @@ function onThemeSelect(aEvent) var gExtensionContextMenus = ["menuitem_options", "menuitem_homepage", "menuitem_about", "menuseparator_1", "menuitem_uninstall", "menuitem_update", "menuitem_enable", "menuitem_disable", "menuseparator_2", - "menuitem_moveTop", "menuitem_moveUp", "menuitem_moveDn"]; + "menuitem_moveTop", "menuitem_moveUp", "menuitem_moveDn", + "menuseparator_3", "menuitem_showFolder"]; var gThemeContextMenus = ["menuitem_useTheme", "menuitem_homepage", "menuitem_about", "menuseparator_1", "menuitem_uninstall", "menuitem_update", - "menuitem_enable"]; + "menuitem_enable", "menuseparator_3", "menuitem_showFolder"]; function buildContextMenu(aEvent) { @@ -761,6 +764,9 @@ var gExtensionsViewController = { case "cmd_movedn": var children = gExtensionsView.children; return selectedItem && (children[children.length-1] != selectedItem); + case "cmd_showFolder": + return selectedItem && + selectedItem.getAttribute("toBeInstalled") != "true"; #ifndef MOZ_PHOENIX case "cmd_install": return true; @@ -884,11 +890,26 @@ var gExtensionsViewController = { var id = aSelectedItem ? getIDFromResourceURI(aSelectedItem.id) : null; var itemType = gWindowState == "extensions" ? nsIUpdateItem.TYPE_EXTENSION : nsIUpdateItem.TYPE_THEME; var items = id ? [gExtensionManager.getItemForID(id)] : []; - var updates = Components.classes["@mozilla.org/updates/update-service;1"] - .getService(Components.interfaces.nsIUpdateService); - updates.checkForUpdates(items, items.length, itemType, - Components.interfaces.nsIUpdateService.SOURCE_EVENT_USER, - window); + + var ary = Components.classes["@mozilla.org/supports-array;1"] + .createInstance(Components.interfaces.nsISupportsArray); + var updateTypes = Components.classes["@mozilla.org/supports-PRUint8;1"] + .createInstance(Components.interfaces.nsISupportsPRUint8); + updateTypes.data = itemType; + ary.AppendElement(updateTypes); + var sourceEvent = Components.classes["@mozilla.org/supports-PRBool;1"] + .createInstance(Components.interfaces.nsISupportsPRBool); + sourceEvent.data = false; + ary.AppendElement(sourceEvent); + for (var i = 0; i < items.length; ++i) + ary.AppendElement(items[i]); + + var features = "chrome,centerscreen,dialog,titlebar"; + // This *must* be modal so as not to break startup! This code is invoked before + // the main event loop is initiated (via checkForMismatches). + var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] + .getService(Components.interfaces.nsIWindowWatcher); + ww.openWindow(window, URI_EXTENSION_UPDATE_DIALOG, "", features, ary); }, cmd_uninstall: function (aSelectedItem) @@ -931,6 +952,15 @@ var gExtensionsViewController = { gExtensionsView.selected = document.getElementById(nextElement); }, + cmd_showFolder: function (aSelectedItem) + { + var id = getIDFromResourceURI(aSelectedItem.id); + var installLocation = gExtensionManager.getInstallLocation(id); + var location = installLocation.getItemLocation(id); + if (location instanceof Components.interfaces.nsILocalFile) + location.reveal(); + }, + cmd_disable: function (aSelectedItem) { gExtensionManager.disableItem(getIDFromResourceURI(aSelectedItem.id)); diff --git a/toolkit/mozapps/extensions/content/extensions.xul b/toolkit/mozapps/extensions/content/extensions.xul index 6f4ec4c6416b..781a23acec3f 100644 --- a/toolkit/mozapps/extensions/content/extensions.xul +++ b/toolkit/mozapps/extensions/content/extensions.xul @@ -100,6 +100,7 @@ + diff --git a/toolkit/mozapps/extensions/content/update.css b/toolkit/mozapps/extensions/content/update.css new file mode 100755 index 000000000000..39dceda6d74e --- /dev/null +++ b/toolkit/mozapps/extensions/content/update.css @@ -0,0 +1,41 @@ +radiogroup[type="update-types"] { + overflow: auto; + -moz-binding: url("chrome://mozapps/content/extensions/update.xml#updateCategorySet"); +} + +radio[type="update-type"] { + -moz-binding: url("chrome://mozapps/content/extensions/update.xml#updateCategory"); + -moz-box-orient: vertical; + -moz-box-align: stretch; +} + +radio[type="update-type"] .updateCategoryContent { + visibility: collapse; +} + +radiogroup[_uninitialized] radio[type="update-type"] .updateCategoryContent { + visibility: visible !important; +} + +.updateCategoryContent { + overflow: hidden; +} + +radio[type="update-type"][selected="true"] .updateCategoryContent { + visibility: visible; +} + +.wizard-header-description { + display: none; +} + +checkbox[type="update"] { + -moz-binding: url("chrome://mozapps/content/extensions/update.xml#updateItem"); +} + +link { + -moz-binding: url("chrome://mozapps/content/extensions/update.xml#link"); + -moz-user-focus: normal; +} + + diff --git a/toolkit/mozapps/extensions/content/update.js b/toolkit/mozapps/extensions/content/update.js index ab537f239d05..3da52424928d 100644 --- a/toolkit/mozapps/extensions/content/update.js +++ b/toolkit/mozapps/extensions/content/update.js @@ -12,7 +12,7 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is The Extension Manager. +# The Original Code is The Update Service. # # The Initial Developer of the Original Code is Ben Goodger. # Portions created by the Initial Developer are Copyright (C) 2004 @@ -35,111 +35,558 @@ # # ***** END LICENSE BLOCK ***** -var gUpdateDialog = { - _updateType: "", - _extensionManager: "", - _extensionID: "", - _openTime: null, - _brandShortName: "", - _updateStrings: null, - _extensionsToUpdate: [], +// +// window.arguments[1...] is an array of nsIUpdateItem implementing objects +// that are to be updated. +// * if the array is empty, all items are updated (like a background update +// check) +// * if the array contains one or two UpdateItems, with null id fields, +// all items of that /type/ are updated. +// +// This UI can be opened from the following places, and in the following modes: +// +// - from the Version Compatibility Checker at startup +// as the application starts a check is done to see if the application being +// started is the same version that was started last time. If it isn't, a +// list of UpdateItems that are incompatible with the verison being +// started is generated and this UI opened with that list. This UI then +// offers to check for updates to those UpdateItems that are compatible +// with the version of the application being started. +// +// In this mode, the wizard is opened to panel 'mismatch'. +// +// - from the Extension Manager or Options Dialog or any UI where the user +// directly requests to check for updates. +// in this case the user selects UpdateItem(s) to update and this list +// is passed to this UI. If a single item is sent with the id field set to +// null but the type set correctly, this UI will check for updates to all +// items of that type. +// +// In this mode, the wizard is opened to panel 'checking'. +// + +const nsIUpdateItem = Components.interfaces.nsIUpdateItem; +const nsIUpdateService = Components.interfaces.nsIUpdateService; + +const PREF_UPDATE_EXTENSIONS_AUTOUPDATEENABLED = "extensions.update.autoUpdateEnabled"; +const PREF_UPDATE_EXTENSIONS_COUNT = "extensions.update.count"; +const PREF_UPDATE_EXTENSIONS_SEVERITY_THRESHOLD = "extensions.update.severity.threshold"; + +const PREF_UPDATE_SEVERITY = "update.severity"; + +var gShowMismatch = null; +var gUpdateTypes = null; + +var gUpdateWizard = { + // The items to check for updates for (e.g. an extension, some subset of extensions, + // all extensions, a list of compatible extensions, etc...) + items: [], + // The items that we found updates available for + itemsToUpdate: [], + // The items that we successfully installed updates for + updatedCount: 0, + shouldSuggestAutoChecking: false, + shouldAutoCheck: false, - _messages: ["update-started", - "update-ended", - "update-item-started", - "update-item-ended", - "update-item-error"], + remainingExtensionUpdateCount: 0, + + succeeded: true, init: function () { - this._updateType = window.arguments[0]; - this._extensionManager = window.arguments[1]; - this._extensionID = window.arguments[2]; + gUpdateTypes = window.arguments[0]; + gShowMismatch = window.arguments[1]; + + var items = window.arguments; + if (window.arguments.length == 2) { + var em = Components.classes["@mozilla.org/extensions/manager;1"] + .getService(Components.interfaces.nsIExtensionManager); + items = [0,0].concat(em.getItemList(nsIUpdateItem.TYPE_ADDON, { })); + } + + for (var i = 2; i < items.length; ++i) + this.items.push(items[i].QueryInterface(nsIUpdateItem)); + + var pref = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + this.shouldSuggestAutoChecking = gShowMismatch && + !pref.getBoolPref(PREF_UPDATE_EXTENSIONS_AUTOUPDATEENABLED); + + if (gShowMismatch) + gMismatchPage.init(); + else + document.documentElement.advance(); + }, + + uninit: function () + { + // Ensure all observers are unhooked, just in case something goes wrong or the + // user aborts. + gUpdatePage.uninit(); + }, + + onWizardFinish: function () + { + var pref = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + if (this.shouldSuggestAutoChecking) + pref.setBoolPref("update.extensions.enabled", this.shouldAutoCheck); + + if (this.succeeded) { + // Downloading and Installed Extension + this.clearExtensionUpdatePrefs(); + } + + // Send an event to refresh any FE notification components. + var os = Components.classes["@mozilla.org/observer-service;1"] + .getService(Components.interfaces.nsIObserverService); + os.notifyObservers(null, "Update:Ended", "1"); + }, + + clearExtensionUpdatePrefs: function () + { + var pref = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + if (pref.prefHasUserValue(PREF_UPDATE_EXTENSIONS_COUNT)) + pref.clearUserPref(PREF_UPDATE_EXTENSIONS_COUNT); + }, + + _setUpButton: function (aButtonID, aButtonKey, aDisabled) + { + var strings = document.getElementById("updateStrings"); + var button = document.documentElement.getButton(aButtonID); + if (aButtonKey) { + button.label = strings.getString(aButtonKey); + try { + button.accesskey = strings.getString(aButtonKey + "Accesskey"); + } + catch (e) { + } + } + button.disabled = aDisabled; + }, + + setButtonLabels: function (aBackButton, aBackButtonIsDisabled, + aNextButton, aNextButtonIsDisabled, + aCancelButton, aCancelButtonIsDisabled) + { + this._setUpButton("back", aBackButton, aBackButtonIsDisabled); + this._setUpButton("next", aNextButton, aNextButtonIsDisabled); + this._setUpButton("cancel", aCancelButton, aCancelButtonIsDisabled); + }, + + ///////////////////////////////////////////////////////////////////////////// + // Update Errors + errorItems: [], + showErrors: function (aState, aErrors) + { + openDialog("chrome://mozapps/content/update/errors.xul", "", + "modal", { state: aState, errors: aErrors }); + }, + + showUpdateCheckErrors: function () + { + var errors = []; + for (var i = 0; i < this.errorItems.length; ++i) + errors.push({ name: this.errorItems[i].name, error: true, + item: this.errorItems[i] }); + this.showErrors("checking", errors); + }, + + checkForErrors: function (aElementIDToShow) + { + if (this.errorOnGeneric || this.errorItems.length > 0) + document.getElementById(aElementIDToShow).hidden = false; + }, + + onWizardClose: function (aEvent) + { + if (gInstallingPage._installing) { + var os = Components.classes["@mozilla.org/observer-service;1"] + .getService(Components.interfaces.nsIObserverService); + os.notifyObservers(null, "xpinstall-progress", "cancel"); + return false; + } + return true; + } +}; + +var gMismatchPage = { + init: function () + { + var incompatible = document.getElementById("mismatch.incompatible"); + for (var i = 0; i < gUpdateWizard.items.length; ++i) { + var item = gUpdateWizard.items[i]; + var listitem = document.createElement("listitem"); + listitem.setAttribute("label", item.name + " " + item.version); + incompatible.appendChild(listitem); + } + }, + + onPageShow: function () + { + gUpdateWizard.setButtonLabels(null, true, + "mismatchCheckNow", false, + "mismatchDontCheck", false); + document.documentElement.getButton("next").focus(); + } +}; + +var gUpdatePage = { + _completeCount: 0, + _messages: ["Update:Extension:Started", + "Update:Extension:Ended", + "Update:Extension:Item-Started", + "Update:Extension:Item-Ended", + "Update:Extension:Item-Error", + "Update:Ended"], + + onPageShow: function () + { + gUpdateWizard.setButtonLabels(null, true, + "nextButtonText", true, + "cancelButtonText", false); + document.documentElement.getButton("next").focus(); var os = Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService); for (var i = 0; i < this._messages.length; ++i) os.addObserver(this, this._messages[i], false); - - this._openTime = Math.abs(Date.UTC()); - - this._brandShortName = document.getElementById("brandStrings").getString("brandShortName"); - this._updateStrings = document.getElementById("extensionsStrings"); - if (this._updateType == "extensions") - this._extensionManager.updateExtension(this._extensionID, window); - else if (gUpdateType == "themes") - this._extensionManager.updateTheme(this._extensionID); + gUpdateWizard.errorItems = []; + + var em = Components.classes["@mozilla.org/extensions/manager;1"] + .getService(Components.interfaces.nsIExtensionManager); + em.update(gUpdateWizard.items, gUpdateWizard.items.length, false); }, - + + _destroyed: false, uninit: function () { + if (this._destroyed) + return; + var os = Components.classes["@mozilla.org/observer-service;1"] .getService(Components.interfaces.nsIObserverService); for (var i = 0; i < this._messages.length; ++i) os.removeObserver(this, this._messages[i]); + + this._destroyed = true; }, - - cancel: function () + + _totalCount: 0, + get totalCount() { - // This will cause uninit to be called, removing our listener, so the extension manager's - // notifications will go nowhere. - window.close(); - }, + if (!this._totalCount) { + this._totalCount = gUpdateWizard.items.length; + if (this._totalCount == 0) { + var em = Components.classes["@mozilla.org/extensions/manager;1"] + .getService(Components.interfaces.nsIExtensionManager); + var extensionCount = em.getItemList(nsIUpdateItem.TYPE_EXTENSION, {}).length; + var themeCount = em.getItemList(nsIUpdateItem.TYPE_THEME, {}).length; + + this._totalCount = extensionCount + themeCount + 1; + } + } + return this._totalCount; + }, observe: function (aSubject, aTopic, aData) { + var canFinish = false; + dump("*** items = " + gUpdateWizard.items + "\n"); switch (aTopic) { - case "update-started": + case "Update:Extension:Started": break; - case "update-item-started": + case "Update:Extension:Item-Started": break; - case "update-item-ended": - this._extensionsToUpdate.push(aSubject); - break; - case "update-ended": - var installObj = { }; - for (var i = 0; i < this._extensionsToUpdate.length; ++i) { - var e = this._extensionsToUpdate[i]; - installObj[e.name + " " + e.version] = e.xpiURL; + case "Update:Extension:Item-Ended": + if (aSubject) { + var item = aSubject.QueryInterface(Components.interfaces.nsIUpdateItem); + gUpdateWizard.itemsToUpdate.push(item); + + var updateStrings = document.getElementById("updateStrings"); + var status = document.getElementById("checking.status"); + var statusString = updateStrings.getFormattedString("checkingPrefix", [item.name]); + status.setAttribute("value", statusString); } - if (InstallTrigger.updateEnabled()) - InstallTrigger.install(installObj); + ++this._completeCount; - document.documentElement.acceptDialog(); - break; -/* - case "update-start": - dump("*** update-start: " + aSubject + ", " + aData + "\n"); - break; - case "update-item-network-start": - dump("*** update-item-network-start: " + aSubject + ", " + aData + "\n"); - break; - case "update-item-network-end": - dump("*** update-item-network-end: " + aSubject + ", " + aData + "\n"); - break; - case "update-item-processing-start": - dump("*** update-item-processing-start: " + aSubject + ", " + aData + "\n"); - break; - case "update-item-processing-end": - dump("*** update-item-processing-end: " + aSubject + ", " + aData + "\n"); - break; - case "update-item-error": - dump("*** update-item-error: " + aSubject + ", " + aData + "\n"); - break; - case "update-end": - dump("*** update-end: " + aSubject + ", " + aData + "\n"); + // Update the Progress Bar + var progress = document.getElementById("checking.progress"); + progress.value = Math.ceil((this._completeCount / this.totalCount) * 100); - // Report Status - - // Unhook observers - var os = Components.classes["@mozilla.org/observer-service;1"] - .getService(Components.interfaces.nsIObserverService); - for (var i = 0; i < this._messages.length; ++i) - os.removeObserver(this, this._messages[i]); - break; -*/ + case "Update:Extension:Item-Error": + if (aSubject) { + var item = aSubject.QueryInterface(Components.interfaces.nsIUpdateItem); + gUpdateWizard.errorItems.push(item); + } + else { + for (var i = 0; i < gUpdateWizard.items.length; ++i) { + if (!gUpdateWizard.items[i].updateRDF) + gUpdateWizard.errorItems.push(gUpdateWizard.items[i]); + } + } + ++this._completeCount; + var progress = document.getElementById("checking.progress"); + progress.value = Math.ceil((this._completeCount / this.totalCount) * 100); + + break; + case "Update:Extension:Ended": + canFinish = gUpdateWizard.items.length > 0; + dump("*** " + aTopic + "... canFinish = " + canFinish + "\n"); + break; + case "Update:Ended": + // If we're doing a general update check, (that is, no specific extensions/themes + // were passed in for us to check for updates to), this notification means both + // extension and app updates have completed. + canFinish = true; + break; + } + + if (canFinish) { + gUpdatePage.uninit(); + if ((gUpdateTypes & nsIUpdateItem.TYPE_ADDON && gUpdateWizard.itemsToUpdate.length > 0)) + document.getElementById("checking").setAttribute("next", "found"); + document.documentElement.advance(); } } }; + +var gFoundPage = { + _nonAppItems: [], + + _newestInfo: null, + + buildAddons: function () + { + var hasExtensions = false; + var foundAddonsList = document.getElementById("found.addons.list"); + var uri = Components.classes["@mozilla.org/network/standard-url;1"] + .createInstance(Components.interfaces.nsIURI); + var itemCount = gUpdateWizard.itemsToUpdate.length; + for (var i = 0; i < itemCount; ++i) { + var item = gUpdateWizard.itemsToUpdate[i]; + var checkbox = document.createElement("checkbox"); + foundAddonsList.appendChild(checkbox); + checkbox.setAttribute("type", "update"); + checkbox.label = item.name + " " + item.version; + checkbox.URL = item.xpiURL; + checkbox.infoURL = ""; + checkbox.internalName = ""; + uri.spec = item.xpiURL; + checkbox.source = uri.host; + checkbox.checked = true; + hasExtensions = true; + } + + if (hasExtensions) { + var addonsHeader = document.getElementById("addons"); + var strings = document.getElementById("updateStrings"); + addonsHeader.label = strings.getFormattedString("updateTypeExtensions", [itemCount]); + addonsHeader.collapsed = false; + } + }, + + _initialized: false, + onPageShow: function () + { + gUpdateWizard.setButtonLabels(null, true, + "installButtonText", false, + null, false); + document.documentElement.getButton("next").focus(); + + var updates = document.getElementById("found.updates"); + if (!this._initialized) { + this._initialized = true; + + updates.computeSizes(); + + if (gUpdateTypes & nsIUpdateItem.TYPE_ADDON) + this.buildAddons(); + } + + var kids = updates._getRadioChildren(); + for (var i = 0; i < kids.length; ++i) { + if (kids[i].collapsed == false) { + updates.selectedIndex = i; + break; + } + } + }, + + onSelect: function (aEvent) + { + var updates = document.getElementById("found.updates"); + var oneChecked = false; + var items = updates.selectedItem.getElementsByTagName("checkbox"); + for (var i = 0; i < items.length; ++i) { + if (items[i].checked) { + oneChecked = true; + break; + } + } + + var strings = document.getElementById("updateStrings"); + gUpdateWizard.setButtonLabels(null, true, + "installButtonText", true, + null, false); + var text = strings.getString("foundInstructions"); + document.getElementById("found").setAttribute("next", "installing"); + document.documentElement.getButton("next").disabled = !oneChecked; + + var foundInstructions = document.getElementById("foundInstructions"); + while (foundInstructions.hasChildNodes()) + foundInstructions.removeChild(foundInstructions.firstChild); + foundInstructions.appendChild(document.createTextNode(text)); + } +}; + +var gInstallingPage = { + _installing : false, + _restartRequired : false, + _objs : [], + + onPageShow: function () + { + gUpdateWizard.setButtonLabels(null, true, + "nextButtonText", true, + null, true); + + // Get XPInstallManager and kick off download/install + // process, registering us as an observer. + var items = []; + this._objs = []; + + this._restartRequired = false; + + gUpdateWizard.remainingExtensionUpdateCount = gUpdateWizard.itemsToUpdate.length; + + var updates = document.getElementById("found.updates"); + var checkboxes = updates.selectedItem.getElementsByTagName("checkbox"); + for (var i = 0; i < checkboxes.length; ++i) { + if (checkboxes[i].type == "update" && checkboxes[i].checked) { + items.push(checkboxes[i].URL); + this._objs.push({ name: checkboxes[i].label }); + } + } + + var xpimgr = Components.classes["@mozilla.org/xpinstall/install-manager;1"] + .createInstance(Components.interfaces.nsIXPInstallManager); + xpimgr.initManagerFromChrome(items, items.length, this); + }, + + ///////////////////////////////////////////////////////////////////////////// + // nsIXPIProgressDialog + onStateChange: function (aIndex, aState, aValue) + { + var strings = document.getElementById("updateStrings"); + + const nsIXPIProgressDialog = Components.interfaces.nsIXPIProgressDialog; + switch (aState) { + case nsIXPIProgressDialog.DOWNLOAD_START: + var label = strings.getFormattedString("downloadingPrefix", [this._objs[aIndex].name]); + var actionItem = document.getElementById("actionItem"); + actionItem.value = label; + break; + case nsIXPIProgressDialog.DOWNLOAD_DONE: + case nsIXPIProgressDialog.INSTALL_START: + var label = strings.getFormattedString("installingPrefix", [this._objs[aIndex].name]); + var actionItem = document.getElementById("actionItem"); + actionItem.value = label; + this._installing = true; + break; + case nsIXPIProgressDialog.INSTALL_DONE: + switch (aValue) { + case 999: + this._restartRequired = true; + break; + case 0: + --gUpdateWizard.remainingExtensionUpdateCount; + break; + } + break; + case nsIXPIProgressDialog.DIALOG_CLOSE: + this._installing = false; + var nextPage = this._errors ? "errors" : (this._restartRequired ? "restart" : "finished"); + document.getElementById("installing").setAttribute("next", nextPage); + document.documentElement.advance(); + break; + } + }, + + _objs: [], + _errors: false, + + onProgress: function (aIndex, aValue, aMaxValue) + { + var downloadProgress = document.getElementById("downloadProgress"); + downloadProgress.value = Math.ceil((aValue/aMaxValue) * 100); + } +}; + +var gErrorsPage = { + onPageShow: function () + { + document.documentElement.getButton("finish").focus(); + gUpdateWizard.succeeded = false; + }, + + onShowErrors: function () + { + gUpdateWizard.showErrors("install", gInstallingPage._objs); + } +}; + +var gFinishedPage = { + onPageShow: function () + { + gUpdateWizard.setButtonLabels(null, true, null, true, null, true); + document.documentElement.getButton("finish").focus(); + + var iR = document.getElementById("incompatibleRemaining"); + var iR2 = document.getElementById("incompatibleRemaining2"); + var fEC = document.getElementById("finishedEnableChecking"); + + if (gUpdateWizard.shouldSuggestAutoChecking) { + iR.hidden = true; + iR2.hidden = false; + fEC.hidden = false; + fEC.click(); + } + else { + iR.hidden = false; + iR2.hidden = true; + fEC.hidden = true; + } + + if (gShowMismatch) { + document.getElementById("finishedMismatch").hidden = false; + document.getElementById("incompatibleAlert").hidden = false; + } + } +}; + +var gNoUpdatesPage = { + onPageShow: function (aEvent) + { + gUpdateWizard.setButtonLabels(null, true, null, true, null, true); + document.documentElement.getButton("finish").focus(); + if (gShowMismatch) { + document.getElementById("introUser").hidden = true; + document.getElementById("introMismatch").hidden = false; + document.getElementById("mismatchNoUpdates").hidden = false; + + if (gUpdateWizard.shouldSuggestAutoChecking) { + document.getElementById("mismatchIncompatibleRemaining").hidden = true; + document.getElementById("mismatchIncompatibleRemaining2").hidden = false; + document.getElementById("mismatchFinishedEnableChecking").hidden = false; + } + } + + gUpdateWizard.succeeded = false; + gUpdateWizard.checkForErrors("updateCheckErrorNotFound"); + } +}; + diff --git a/toolkit/mozapps/extensions/content/update.xml b/toolkit/mozapps/extensions/content/update.xml new file mode 100755 index 000000000000..2610436c7335 --- /dev/null +++ b/toolkit/mozapps/extensions/content/update.xml @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + null + + + + + + + + + + +#ifdef MOZ_WIDGET_GTK2 + +#endif + + + + + +#ifdef MOZ_WIDGET_GTK2 + +#endif + + + + + + + + + + + + + + 0) { + newHeight = this._content.boxObject.height - this._animateIncrement; + newHeight = newHeight < 0 ? 0 : newHeight; + this._content.style.height = newHeight + "px"; + this._timer.initWithCallback(this, this._animateDelay, + Components.interfaces.nsITimer.TYPE_ONE_SHOT); + } + else { + this._timer.cancel(); + this._content.style.visibility = "collapse"; + } + } + else { + if (this._content.boxObject.height <= this._destinationSize) { + newHeight = this._content.boxObject.height + this._animateIncrement; + newHeight = newHeight > this.expandedHeight ? this.expandedHeight : newHeight; + this._content.style.height = newHeight + "px"; + this._timer.initWithCallback(this, this._animateDelay, + Components.interfaces.nsITimer.TYPE_ONE_SHOT); + } + else + this._timer.cancel(); + } + ]]> + + + + + + + + + + + + document.getAnonymousElementByAttribute(this, "class", "updateCategoryContent"); + + null + 50 + 25 + 0 + + + + + + + + + + +#ifdef MOZ_WIDGET_GTK2 + +#endif + +#ifdef MOZ_WIDGET_GTK2 + + +#endif + + + + + +#ifdef MOZ_WIDGET_GTK2 + +#endif + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/mozapps/extensions/content/update.xul b/toolkit/mozapps/extensions/content/update.xul index 4d5da53e6a99..5241b6774473 100644 --- a/toolkit/mozapps/extensions/content/update.xul +++ b/toolkit/mozapps/extensions/content/update.xul @@ -14,15 +14,14 @@ # for the specific language governing rights and limitations under the # License. # -# The Original Code is The Extension Manager. +# The Original Code is The Extension Update Service. # -# The Initial Developer of the Original Code is -# Ben Goodger. +# The Initial Developer of the Original Code is Ben Goodger. # Portions created by the Initial Developer are Copyright (C) 2004 # the Initial Developer. All Rights Reserved. # # Contributor(s): -# Ben Goodger +# Ben Goodger # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or @@ -39,36 +38,161 @@ # ***** END LICENSE BLOCK ***** + + - %updateDTD; %brandDTD; ]> -

- + title="&updateWizard.title;" + windowtype="Update:Wizard" + onload="gUpdateWizard.init();" + onunload="gUpdateWizard.uninit();" + onwizardfinish="gUpdateWizard.onWizardFinish();" + onclose="return gUpdateWizard.onWizardClose(event);" + style="width: 47em; min-height: 35em;" + buttons="accept,cancel"> +