diff options
Diffstat (limited to 'toolkit/mozapps/extensions/content')
18 files changed, 2163 insertions, 1636 deletions
diff --git a/toolkit/mozapps/extensions/content/about.js b/toolkit/mozapps/extensions/content/about.js index 4f8fb353e..49ca4acc1 100644 --- a/toolkit/mozapps/extensions/content/about.js +++ b/toolkit/mozapps/extensions/content/about.js @@ -6,21 +6,15 @@ "use strict"; -/* import-globals-from ../../../content/contentAreaUtils.js */ - -var Cu = Components.utils; -Cu.import("resource://gre/modules/AddonManager.jsm"); - function init() { var addon = window.arguments[0]; var extensionsStrings = document.getElementById("extensionsStrings"); document.documentElement.setAttribute("addontype", addon.type); - var iconURL = AddonManager.getPreferredIconURL(addon, 48, window); - if (iconURL) { + if (addon.iconURL) { var extensionIcon = document.getElementById("extensionIcon"); - extensionIcon.src = iconURL; + extensionIcon.src = addon.iconURL; } document.title = extensionsStrings.getFormattedString("aboutWindowTitle", [addon.name]); @@ -74,7 +68,7 @@ function init() { var acceptButton = document.documentElement.getButton("accept"); acceptButton.label = extensionsStrings.getString("aboutWindowCloseButton"); - + setTimeout(sizeToContent, 0); } diff --git a/toolkit/mozapps/extensions/content/blocklist.js b/toolkit/mozapps/extensions/content/blocklist.js index 6d524e6ee..6b47fd652 100644 --- a/toolkit/mozapps/extensions/content/blocklist.js +++ b/toolkit/mozapps/extensions/content/blocklist.js @@ -26,7 +26,7 @@ function init() { var richlist = document.getElementById("addonList"); var list = gArgs.list; - list.sort(function(a, b) { return String.localeCompare(a.name, b.name); }); + list.sort(function listSort(a, b) { return String.localeCompare(a.name, b.name); }); for (let listItem of list) { let item = document.createElement("richlistitem"); item.setAttribute("name", listItem.name); diff --git a/toolkit/mozapps/extensions/content/eula.js b/toolkit/mozapps/extensions/content/eula.js index 537ee7284..a05f7fe1c 100644 --- a/toolkit/mozapps/extensions/content/eula.js +++ b/toolkit/mozapps/extensions/content/eula.js @@ -6,18 +6,14 @@ "use strict"; -var Cu = Components.utils; -Cu.import("resource://gre/modules/AddonManager.jsm"); - function Startup() { var bundle = document.getElementById("extensionsStrings"); var addon = window.arguments[0].addon; document.documentElement.setAttribute("addontype", addon.type); - var iconURL = AddonManager.getPreferredIconURL(addon, 48, window); - if (iconURL) - document.getElementById("icon").src = iconURL; + if (addon.iconURL) + document.getElementById("icon").src = addon.iconURL; var label = document.createTextNode(bundle.getFormattedString("eulaHeader", [addon.name])); document.getElementById("heading").appendChild(label); diff --git a/toolkit/mozapps/extensions/content/extensions.css b/toolkit/mozapps/extensions/content/extensions.css index cb5313365..41c140565 100644 --- a/toolkit/mozapps/extensions/content/extensions.css +++ b/toolkit/mozapps/extensions/content/extensions.css @@ -39,6 +39,10 @@ xhtml|link { -moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#creator-link"); } +.translators { + -moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#translators-list"); +} + .meta-rating { -moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#rating"); } @@ -74,8 +78,7 @@ setting[type="bool"][localized="true"] { -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-localized-bool"); } -setting[type="bool"]:not([learnmore]) .preferences-learnmore, -setting[type="boolint"]:not([learnmore]) .preferences-learnmore { +setting[type="bool"]:not([learnmore]) .preferences-learnmore { visibility: collapse; } @@ -131,11 +134,6 @@ setting[type="menulist"] { display: none; } -#show-disabled-unsigned-extensions .button-text { - margin-inline-start: 3px !important; - margin-inline-end: 2px !important; -} - #header-searching:not([active]) { visibility: hidden; } @@ -154,6 +152,8 @@ setting[type="menulist"] { .addon:not([notification="info"]) .info, .addon:not([pending]) .pending, .addon:not([upgrade="true"]) .update-postfix, +.addon:not([native="true"]) .nativeAddon, +.addon:not([native="false"]) .compatAddon, .addon[active="true"] .disabled-postfix, .addon[pending="install"] .update-postfix, .addon[pending="install"] .disabled-postfix, @@ -198,7 +198,7 @@ setting[type="menulist"] { display: none; } -#addons-page .view-pane:not([type="plugin"]) #plugindeprecation-notice { +#addons-page .view-pane:not([type="plugin"]) .plugin-info-container { display: none; } @@ -249,13 +249,10 @@ richlistitem:not([selected]) * { .view-pane[type="experiment"] .addon:not([pending="uninstall"]) .pending, .view-pane[type="experiment"] .disabled-postfix, .view-pane[type="experiment"] .update-postfix, -.view-pane[type="experiment"] .addon-control.enable, -.view-pane[type="experiment"] .addon-control.disable, +.view-pane[type="experiment"] .version, #detail-view[type="experiment"] .alert-container, #detail-view[type="experiment"] #detail-version, -#detail-view[type="experiment"] #detail-creator, -#detail-view[type="experiment"] #detail-enable-btn, -#detail-view[type="experiment"] #detail-disable-btn { +#detail-view[type="experiment"] #detail-creator { display: none; } @@ -268,3 +265,24 @@ richlistitem:not([selected]) * { .addon[type="experiment"][status="installing"] .experiment-state { display: none; } + +/* Indicator style for extension target application */ +.addon[native] .nativeIndicator { + margin-left: 5pt; + padding-bottom: 1pt; +} +.addon[native][active="false"] .nativeIndicator { + opacity: 0.4; +} +.addon[native] .nativeAddon { + color: #3366FF; +} +.addon[native] .compatAddon { + color: #FF6600; +} + +/* Translators for Language Pack details */ +.translators > label { + -moz-margin-start: 0px; + -moz-margin-end: 0px; +} diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 56158d9c6..8d9c132e6 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -4,13 +4,10 @@ "use strict"; -/* import-globals-from ../../../content/contentAreaUtils.js */ -/* globals XMLStylesheetProcessingInstruction*/ - -var Cc = Components.classes; -var Ci = Components.interfaces; -var Cu = Components.utils; -var Cr = Components.results; +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; +const Cr = Components.results; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); @@ -18,19 +15,13 @@ Cu.import("resource://gre/modules/DownloadUtils.jsm"); Cu.import("resource://gre/modules/AddonManager.jsm"); Cu.import("resource://gre/modules/addons/AddonRepository.jsm"); -const CONSTANTS = {}; -Cu.import("resource://gre/modules/addons/AddonConstants.jsm", CONSTANTS); -const SIGNING_REQUIRED = CONSTANTS.REQUIRE_SIGNING ? - true : - Services.prefs.getBoolPref("xpinstall.signatures.required"); - XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", "resource://gre/modules/PluralForm.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Preferences", - "resource://gre/modules/Preferences.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Experiments", - "resource:///modules/experiments/Experiments.jsm"); +XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () { + return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}). + BrowserToolboxProcess; +}); const PREF_DISCOVERURL = "extensions.webservice.discoverURL"; const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane"; @@ -40,6 +31,8 @@ const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled"; const PREF_GETADDONS_CACHE_ID_ENABLED = "extensions.%ID%.getAddons.cache.enabled"; const PREF_UI_TYPE_HIDDEN = "extensions.ui.%TYPE%.hidden"; const PREF_UI_LASTCATEGORY = "extensions.ui.lastCategory"; +const PREF_ADDON_DEBUGGING_ENABLED = "devtools.chrome.enabled"; +const PREF_REMOTE_DEBUGGING_ENABLED = "devtools.debugger.remote-enabled"; const LOADING_MSG_DELAY = 100; @@ -63,103 +56,28 @@ XPCOMUtils.defineLazyServiceGetter(gStrings, "bundleSvc", "@mozilla.org/intl/stringbundle;1", "nsIStringBundleService"); -XPCOMUtils.defineLazyGetter(gStrings, "brand", function() { +XPCOMUtils.defineLazyGetter(gStrings, "brand", function brandLazyGetter() { return this.bundleSvc.createBundle("chrome://branding/locale/brand.properties"); }); -XPCOMUtils.defineLazyGetter(gStrings, "ext", function() { +XPCOMUtils.defineLazyGetter(gStrings, "ext", function extLazyGetter() { return this.bundleSvc.createBundle("chrome://mozapps/locale/extensions/extensions.properties"); }); -XPCOMUtils.defineLazyGetter(gStrings, "dl", function() { +XPCOMUtils.defineLazyGetter(gStrings, "dl", function dlLazyGetter() { return this.bundleSvc.createBundle("chrome://mozapps/locale/downloads/downloads.properties"); }); -XPCOMUtils.defineLazyGetter(gStrings, "brandShortName", function() { +XPCOMUtils.defineLazyGetter(gStrings, "brandShortName", function brandShortNameLazyGetter() { return this.brand.GetStringFromName("brandShortName"); }); -XPCOMUtils.defineLazyGetter(gStrings, "appVersion", function() { +XPCOMUtils.defineLazyGetter(gStrings, "appVersion", function appVersionLazyGetter() { return Services.appinfo.version; }); document.addEventListener("load", initialize, true); window.addEventListener("unload", shutdown, false); -class MessageDispatcher { - constructor(target) { - this.listeners = new Map(); - this.target = target; - } - - addMessageListener(name, handler) { - if (!this.listeners.has(name)) { - this.listeners.set(name, new Set()); - } - - this.listeners.get(name).add(handler); - } - - removeMessageListener(name, handler) { - if (this.listeners.has(name)) { - this.listeners.get(name).delete(handler); - } - } - - sendAsyncMessage(name, data) { - for (let handler of this.listeners.get(name) || new Set()) { - Promise.resolve().then(() => { - handler.receiveMessage({ - name, - data, - target: this.target, - }); - }); - } - } -} - -/** - * A mock FrameMessageManager global to allow frame scripts to run in - * non-top-level, non-remote <browser>s as if they were top-level or - * remote. - * - * @param {Element} browser - * A XUL <browser> element. - */ -class FakeFrameMessageManager { - constructor(browser) { - let dispatcher = new MessageDispatcher(browser); - let frameDispatcher = new MessageDispatcher(null); - - this.sendAsyncMessage = frameDispatcher.sendAsyncMessage.bind(frameDispatcher); - this.addMessageListener = dispatcher.addMessageListener.bind(dispatcher); - this.removeMessageListener = dispatcher.removeMessageListener.bind(dispatcher); - - this.frame = { - get content() { - return browser.contentWindow; - }, - - get docShell() { - return browser.docShell; - }, - - addEventListener: browser.addEventListener.bind(browser), - removeEventListener: browser.removeEventListener.bind(browser), - - sendAsyncMessage: dispatcher.sendAsyncMessage.bind(dispatcher), - addMessageListener: frameDispatcher.addMessageListener.bind(frameDispatcher), - removeMessageListener: frameDispatcher.removeMessageListener.bind(frameDispatcher), - } - } - - loadFrameScript(url) { - Services.scriptloader.loadSubScript(url, Object.create(this.frame)); - } -} - var gPendingInitializations = 1; -Object.defineProperty(this, "gIsInitializing", { - get: () => gPendingInitializations > 0 -}); +this.__defineGetter__("gIsInitializing", function gIsInitializingGetter() gPendingInitializations > 0); function initialize(event) { // XXXbz this listener gets _all_ load events for all nodes in the @@ -236,6 +154,9 @@ function initialize(event) { } gViewController.loadInitialView(view); + + Services.prefs.addObserver(PREF_ADDON_DEBUGGING_ENABLED, debuggingPrefChanged, false); + Services.prefs.addObserver(PREF_REMOTE_DEBUGGING_ENABLED, debuggingPrefChanged, false); } function notifyInitialized() { @@ -256,6 +177,8 @@ function shutdown() { gEventManager.shutdown(); gViewController.shutdown(); Services.obs.removeObserver(sendEMPong, "EM-ping"); + Services.prefs.removeObserver(PREF_ADDON_DEBUGGING_ENABLED, debuggingPrefChanged); + Services.prefs.removeObserver(PREF_REMOTE_DEBUGGING_ENABLED, debuggingPrefChanged); } function sendEMPong(aSubject, aTopic, aData) { @@ -274,12 +197,6 @@ function loadView(aViewId) { } } -function isCorrectlySigned(aAddon) { - // Add-ons without an "isCorrectlySigned" property are correctly signed as - // they aren't the correct type for signing. - return aAddon.isCorrectlySigned !== false; -} - function isDiscoverEnabled() { if (Services.prefs.getPrefType(PREF_DISCOVERURL) == Services.prefs.PREF_INVALID) return false; @@ -297,23 +214,6 @@ function isDiscoverEnabled() { return true; } -function getExperimentEndDate(aAddon) { - if (!("@mozilla.org/browser/experiments-service;1" in Cc)) { - return 0; - } - - if (!aAddon.isActive) { - return aAddon.endDate; - } - - let experiment = Experiments.instance().getActiveExperiment(); - if (!experiment) { - return 0; - } - - return experiment.endDate; -} - /** * Obtain the main DOMWindow for the current context. */ @@ -345,8 +245,9 @@ function getMainWindowWithPreferencesPane() { let mainWindow = getMainWindow(); if (mainWindow && "openAdvancedPreferences" in mainWindow) { return mainWindow; + } else { + return null; } - return null; } /** @@ -372,27 +273,27 @@ var HTML5History = { .canGoForward; }, - back: function() { + back: function HTML5History_back() { window.history.back(); gViewController.updateCommand("cmd_back"); gViewController.updateCommand("cmd_forward"); }, - forward: function() { + forward: function HTML5History_forward() { window.history.forward(); gViewController.updateCommand("cmd_back"); gViewController.updateCommand("cmd_forward"); }, - pushState: function(aState) { + pushState: function HTML5History_pushState(aState) { window.history.pushState(aState, document.title); }, - replaceState: function(aState) { + replaceState: function HTML5History_replaceState(aState) { window.history.replaceState(aState, document.title); }, - popState: function() { + popState: function HTML5History_popState() { function onStatePopped(aEvent) { window.removeEventListener("popstate", onStatePopped, true); // TODO To ensure we can't go forward again we put an additional entry @@ -426,7 +327,7 @@ var FakeHistory = { return (this.pos + 1) < this.states.length; }, - back: function() { + back: function FakeHistory_back() { if (this.pos == 0) throw Components.Exception("Cannot go back from this point"); @@ -436,7 +337,7 @@ var FakeHistory = { gViewController.updateCommand("cmd_forward"); }, - forward: function() { + forward: function FakeHistory_forward() { if ((this.pos + 1) >= this.states.length) throw Components.Exception("Cannot go forward from this point"); @@ -446,17 +347,17 @@ var FakeHistory = { gViewController.updateCommand("cmd_forward"); }, - pushState: function(aState) { + pushState: function FakeHistory_pushState(aState) { this.pos++; this.states.splice(this.pos, this.states.length); this.states.push(aState); }, - replaceState: function(aState) { + replaceState: function FakeHistory_replaceState(aState) { this.states[this.pos] = aState; }, - popState: function() { + popState: function FakeHistory_popState() { if (this.pos == 0) throw Components.Exception("Cannot popState from this view"); @@ -484,7 +385,8 @@ var gEventManager = { _listeners: {}, _installListeners: [], - initialize: function() { + initialize: function gEM_initialize() { + var self = this; const ADDON_EVENTS = ["onEnabling", "onEnabled", "onDisabling", "onDisabled", "onUninstalling", "onUninstalled", "onInstalled", "onOperationCancelled", @@ -493,7 +395,9 @@ var gEventManager = { "onPropertyChanged"]; for (let evt of ADDON_EVENTS) { let event = evt; - this[event] = (...aArgs) => this.delegateAddonEvent(event, aArgs); + self[event] = function initialize_delegateAddonEvent(...aArgs) { + self.delegateAddonEvent(event, aArgs); + }; } const INSTALL_EVENTS = ["onNewInstall", "onDownloadStarted", @@ -504,7 +408,9 @@ var gEventManager = { "onExternalInstall"]; for (let evt of INSTALL_EVENTS) { let event = evt; - this[event] = (...aArgs) => this.delegateInstallEvent(event, aArgs); + self[event] = function initialize_delegateInstallEvent(...aArgs) { + self.delegateInstallEvent(event, aArgs); + }; } AddonManager.addManagerListener(this); @@ -515,7 +421,7 @@ var gEventManager = { this.refreshAutoUpdateDefault(); var contextMenu = document.getElementById("addonitem-popup"); - contextMenu.addEventListener("popupshowing", function() { + contextMenu.addEventListener("popupshowing", function contextMenu_onPopupshowing() { var addon = gViewController.currentViewObj.getSelectedAddon(); contextMenu.setAttribute("addontype", addon.type); @@ -535,39 +441,15 @@ var gEventManager = { menuSep.hidden = (countMenuItemsBeforeSep == 0); }, false); - - let addonTooltip = document.getElementById("addonitem-tooltip"); - addonTooltip.addEventListener("popupshowing", function() { - let addonItem = addonTooltip.triggerNode; - // The way the test triggers the tooltip the richlistitem is the - // tooltipNode but in normal use it is the anonymous node. This allows - // any case - if (addonItem.localName != "richlistitem") - addonItem = document.getBindingParent(addonItem); - - let tiptext = addonItem.getAttribute("name"); - - if (addonItem.mAddon) { - if (shouldShowVersionNumber(addonItem.mAddon)) { - tiptext += " " + (addonItem.hasAttribute("upgrade") ? addonItem.mManualUpdate.version - : addonItem.mAddon.version); - } - } - else if (shouldShowVersionNumber(addonItem.mInstall)) { - tiptext += " " + addonItem.mInstall.version; - } - - addonTooltip.label = tiptext; - }, false); }, - shutdown: function() { + shutdown: function gEM_shutdown() { AddonManager.removeManagerListener(this); AddonManager.removeInstallListener(this); AddonManager.removeAddonListener(this); }, - registerAddonListener: function(aListener, aAddonId) { + registerAddonListener: function gEM_registerAddonListener(aListener, aAddonId) { if (!(aAddonId in this._listeners)) this._listeners[aAddonId] = []; else if (this._listeners[aAddonId].indexOf(aListener) != -1) @@ -575,7 +457,7 @@ var gEventManager = { this._listeners[aAddonId].push(aListener); }, - unregisterAddonListener: function(aListener, aAddonId) { + unregisterAddonListener: function gEM_unregisterAddonListener(aListener, aAddonId) { if (!(aAddonId in this._listeners)) return; var index = this._listeners[aAddonId].indexOf(aListener); @@ -584,20 +466,20 @@ var gEventManager = { this._listeners[aAddonId].splice(index, 1); }, - registerInstallListener: function(aListener) { + registerInstallListener: function gEM_registerInstallListener(aListener) { if (this._installListeners.indexOf(aListener) != -1) return; this._installListeners.push(aListener); }, - unregisterInstallListener: function(aListener) { + unregisterInstallListener: function gEM_unregisterInstallListener(aListener) { var i = this._installListeners.indexOf(aListener); if (i == -1) return; this._installListeners.splice(i, 1); }, - delegateAddonEvent: function(aEvent, aParams) { + delegateAddonEvent: function gEM_delegateAddonEvent(aEvent, aParams) { var addon = aParams.shift(); if (!(addon.id in this._listeners)) return; @@ -608,14 +490,14 @@ var gEventManager = { continue; try { listener[aEvent].apply(listener, aParams); - } catch (e) { + } catch(e) { // this shouldn't be fatal Cu.reportError(e); } } }, - delegateInstallEvent: function(aEvent, aParams) { + delegateInstallEvent: function gEM_delegateInstallEvent(aEvent, aParams) { var existingAddon = aEvent == "onExternalInstall" ? aParams[1] : aParams[0].existingAddon; // If the install is an update then send the event to all listeners // registered for the existing add-on @@ -627,14 +509,14 @@ var gEventManager = { continue; try { listener[aEvent].apply(listener, aParams); - } catch (e) { + } catch(e) { // this shouldn't be fatal Cu.reportError(e); } } }, - refreshGlobalWarning: function() { + refreshGlobalWarning: function gEM_refreshGlobalWarning() { var page = document.getElementById("addons-page"); if (Services.appinfo.inSafeMode) { @@ -656,7 +538,7 @@ var gEventManager = { page.removeAttribute("warning"); }, - refreshAutoUpdateDefault: function() { + refreshAutoUpdateDefault: function gEM_refreshAutoUpdateDefault() { var updateEnabled = AddonManager.updateEnabled; var autoUpdateDefault = AddonManager.autoUpdateDefault; @@ -669,15 +551,15 @@ var gEventManager = { document.getElementById("utils-resetAddonUpdatesToManual").hidden = autoUpdateDefault; }, - onCompatibilityModeChanged: function() { + onCompatibilityModeChanged: function gEM_onCompatibilityModeChanged() { this.refreshGlobalWarning(); }, - onCheckUpdateSecurityChanged: function() { + onCheckUpdateSecurityChanged: function gEM_onCheckUpdateSecurityChanged() { this.refreshGlobalWarning(); }, - onUpdateModeChanged: function() { + onUpdateModeChanged: function gEM_onUpdateModeChanged() { this.refreshAutoUpdateDefault(); } }; @@ -693,10 +575,8 @@ var gViewController = { initialViewSelected: false, lastHistoryIndex: -1, - initialize: function() { + initialize: function gVC_initialize() { this.viewPort = document.getElementById("view-port"); - this.headeredViews = document.getElementById("headered-views"); - this.headeredViewsDeck = document.getElementById("headered-views-content"); this.viewObjects["search"] = gSearchView; this.viewObjects["discover"] = gDiscoverView; @@ -704,30 +584,28 @@ var gViewController = { this.viewObjects["detail"] = gDetailView; this.viewObjects["updates"] = gUpdatesView; - for (let type in this.viewObjects) { - let view = this.viewObjects[type]; + for each (let view in this.viewObjects) view.initialize(); - } window.controllers.appendController(this); - window.addEventListener("popstate", function(e) { + window.addEventListener("popstate", + function window_onStatePopped(e) { gViewController.updateState(e.state); }, false); }, - shutdown: function() { + shutdown: function gVC_shutdown() { if (this.currentViewObj) this.currentViewObj.hide(); this.currentViewRequest = 0; - for (let type in this.viewObjects) { - let view = this.viewObjects[type]; + for each(let view in this.viewObjects) { if ("shutdown" in view) { try { view.shutdown(); - } catch (e) { + } catch(e) { // this shouldn't be fatal Cu.reportError(e); } @@ -737,7 +615,7 @@ var gViewController = { window.controllers.removeController(this); }, - updateState: function(state) { + updateState: function gVC_updateState(state) { try { this.loadViewInternal(state.view, state.previousView, state); this.lastHistoryIndex = gHistory.index; @@ -749,17 +627,18 @@ var gViewController = { gHistory.back(); else gViewController.replaceView(gViewDefault); - } else if (gHistory.canGoForward) { - gHistory.forward(); } else { - gViewController.replaceView(gViewDefault); + if (gHistory.canGoForward) + gHistory.forward(); + else + gViewController.replaceView(gViewDefault); } } }, - parseViewId: function(aViewId) { + parseViewId: function gVC_parseViewId(aViewId) { var matchRegex = /^addons:\/\/([^\/]+)\/(.*)$/; - var [, viewType, viewParam] = aViewId.match(matchRegex) || []; + var [,viewType, viewParam] = aViewId.match(matchRegex) || []; return {type: viewType, param: decodeURIComponent(viewParam)}; }, @@ -767,7 +646,7 @@ var gViewController = { return !this.currentViewObj || this.currentViewObj.node.hasAttribute("loading"); }, - loadView: function(aViewId) { + loadView: function gVC_loadView(aViewId) { var isRefresh = false; if (aViewId == this.currentViewId) { if (this.isLoading) @@ -792,7 +671,7 @@ var gViewController = { // Replaces the existing view with a new one, rewriting the current history // entry to match. - replaceView: function(aViewId) { + replaceView: function gVC_replaceView(aViewId) { if (aViewId == this.currentViewId) return; @@ -804,7 +683,7 @@ var gViewController = { this.loadViewInternal(aViewId, null, state); }, - loadInitialView: function(aViewId) { + loadInitialView: function gVC_loadInitialView(aViewId) { var state = { view: aViewId, previousView: null @@ -816,24 +695,7 @@ var gViewController = { notifyInitialized(); }, - get displayedView() { - if (this.viewPort.selectedPanel == this.headeredViews) { - return this.headeredViewsDeck.selectedPanel; - } - return this.viewPort.selectedPanel; - }, - - set displayedView(view) { - let node = view.node; - if (node.parentNode == this.headeredViewsDeck) { - this.headeredViewsDeck.selectedPanel = node; - this.viewPort.selectedPanel = this.headeredViews; - } else { - this.viewPort.selectedPanel = node; - } - }, - - loadViewInternal: function(aViewId, aPreviousView, aState) { + loadViewInternal: function gVC_loadViewInternal(aViewId, aPreviousView, aState) { var view = this.parseViewId(aViewId); if (!view.type || !(view.type in this.viewObjects)) @@ -848,7 +710,7 @@ var gViewController = { let canHide = this.currentViewObj.hide(); if (canHide === false) return; - this.displayedView.removeAttribute("loading"); + this.viewPort.selectedPanel.removeAttribute("loading"); } catch (e) { // this shouldn't be fatal Cu.reportError(e); @@ -860,8 +722,8 @@ var gViewController = { this.currentViewId = aViewId; this.currentViewObj = viewObj; - this.displayedView = this.currentViewObj; - this.currentViewObj.node.setAttribute("loading", "true"); + this.viewPort.selectedPanel = this.currentViewObj.node; + this.viewPort.selectedPanel.setAttribute("loading", "true"); this.currentViewObj.node.focus(); if (aViewId == aPreviousView) @@ -871,13 +733,13 @@ var gViewController = { }, // Moves back in the document history and removes the current history entry - popState: function(aCallback) { + popState: function gVC_popState(aCallback) { this.viewChangeCallback = aCallback; gHistory.popState(); }, - notifyViewChanged: function() { - this.displayedView.removeAttribute("loading"); + notifyViewChanged: function gVC_notifyViewChanged() { + this.viewPort.selectedPanel.removeAttribute("loading"); if (this.viewChangeCallback) { this.viewChangeCallback(); @@ -891,35 +753,33 @@ var gViewController = { commands: { cmd_back: { - isEnabled: function() { + isEnabled: function cmd_back_isEnabled() { return gHistory.canGoBack; }, - doCommand: function() { + doCommand: function cmd_back_doCommand() { gHistory.back(); } }, cmd_forward: { - isEnabled: function() { + isEnabled: function cmd_forward_isEnabled() { return gHistory.canGoForward; }, - doCommand: function() { + doCommand: function cmd_forward_doCommand() { gHistory.forward(); } }, cmd_focusSearch: { isEnabled: () => true, - doCommand: function() { + doCommand: function cmd_focusSearch_doCommand() { gHeader.focusSearchBox(); } }, cmd_restartApp: { - isEnabled: function() { - return true; - }, - doCommand: function() { + isEnabled: function cmd_restartApp_isEnabled() true, + doCommand: function cmd_restartApp_doCommand() { let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]. createInstance(Ci.nsISupportsPRBool); Services.obs.notifyObservers(cancelQuit, "quit-application-requested", @@ -934,28 +794,31 @@ var gViewController = { }, cmd_enableCheckCompatibility: { - isEnabled: function() { - return true; - }, - doCommand: function() { + isEnabled: function cmd_enableCheckCompatibility_isEnabled() true, + doCommand: function cmd_enableCheckCompatibility_doCommand() { AddonManager.checkCompatibility = true; } }, cmd_enableUpdateSecurity: { - isEnabled: function() { - return true; - }, - doCommand: function() { + isEnabled: function cmd_enableUpdateSecurity_isEnabled() true, + doCommand: function cmd_enableUpdateSecurity_doCommand() { AddonManager.checkUpdateSecurity = true; } }, +/* Plugincheck service is currently N/A for Pale Moon + cmd_pluginCheck: { + isEnabled: function cmd_pluginCheck_isEnabled() true, + doCommand: function cmd_pluginCheck_doCommand() { + openURL(Services.urlFormatter.formatURLPref("plugins.update.url")); + } + }, +*/ + cmd_toggleAutoUpdateDefault: { - isEnabled: function() { - return true; - }, - doCommand: function() { + isEnabled: function cmd_toggleAutoUpdateDefault_isEnabled() true, + doCommand: function cmd_toggleAutoUpdateDefault_doCommand() { if (!AddonManager.updateEnabled || !AddonManager.autoUpdateDefault) { // One or both of the prefs is false, i.e. the checkbox is not checked. // Now toggle both to true. If the user wants us to auto-update @@ -971,11 +834,9 @@ var gViewController = { }, cmd_resetAddonAutoUpdate: { - isEnabled: function() { - return true; - }, - doCommand: function() { - AddonManager.getAllAddons(function(aAddonList) { + isEnabled: function cmd_resetAddonAutoUpdate_isEnabled() true, + doCommand: function cmd_resetAddonAutoUpdate_doCommand() { + AddonManager.getAllAddons(function cmd_resetAddonAutoUpdate_getAllAddons(aAddonList) { for (let addon of aAddonList) { if ("applyBackgroundUpdates" in addon) addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT; @@ -985,37 +846,33 @@ var gViewController = { }, cmd_goToDiscoverPane: { - isEnabled: function() { + isEnabled: function cmd_goToDiscoverPane_isEnabled() { return gDiscoverView.enabled; }, - doCommand: function() { + doCommand: function cmd_goToDiscoverPane_doCommand() { gViewController.loadView("addons://discover/"); } }, cmd_goToRecentUpdates: { - isEnabled: function() { - return true; - }, - doCommand: function() { + isEnabled: function cmd_goToRecentUpdates_isEnabled() true, + doCommand: function cmd_goToRecentUpdates_doCommand() { gViewController.loadView("addons://updates/recent"); } }, cmd_goToAvailableUpdates: { - isEnabled: function() { - return true; - }, - doCommand: function() { + isEnabled: function cmd_goToAvailableUpdates_isEnabled() true, + doCommand: function cmd_goToAvailableUpdates_doCommand() { gViewController.loadView("addons://updates/available"); } }, cmd_showItemDetails: { - isEnabled: function(aAddon) { + isEnabled: function cmd_showItemDetails_isEnabled(aAddon) { return !!aAddon && (gViewController.currentViewObj != gDetailView); }, - doCommand: function(aAddon, aScrollToPreferences) { + doCommand: function cmd_showItemDetails_doCommand(aAddon, aScrollToPreferences) { gViewController.loadView("addons://detail/" + encodeURIComponent(aAddon.id) + (aScrollToPreferences ? "/preferences" : "")); @@ -1024,10 +881,8 @@ var gViewController = { cmd_findAllUpdates: { inProgress: false, - isEnabled: function() { - return !this.inProgress; - }, - doCommand: function() { + isEnabled: function cmd_findAllUpdates_isEnabled() !this.inProgress, + doCommand: function cmd_findAllUpdates_doCommand() { this.inProgress = true; gViewController.updateCommand("cmd_findAllUpdates"); document.getElementById("updates-noneFound").hidden = true; @@ -1038,12 +893,13 @@ var gViewController = { var numUpdated = 0; var numManualUpdates = 0; var restartNeeded = false; + var self = this; - let updateStatus = () => { + function updateStatus() { if (pendingChecks > 0) return; - this.inProgress = false; + self.inProgress = false; gViewController.updateCommand("cmd_findAllUpdates"); document.getElementById("updates-progress").hidden = true; gUpdatesView.maybeRefresh(); @@ -1067,15 +923,15 @@ var gViewController = { } var updateInstallListener = { - onDownloadFailed: function() { + onDownloadFailed: function cmd_findAllUpdates_downloadFailed() { pendingChecks--; updateStatus(); }, - onInstallFailed: function() { + onInstallFailed: function cmd_findAllUpdates_installFailed() { pendingChecks--; updateStatus(); }, - onInstallEnded: function(aInstall, aAddon) { + onInstallEnded: function cmd_findAllUpdates_installEnded(aInstall, aAddon) { pendingChecks--; numUpdated++; if (isPending(aInstall.existingAddon, "upgrade")) @@ -1085,7 +941,7 @@ var gViewController = { }; var updateCheckListener = { - onUpdateAvailable: function(aAddon, aInstall) { + onUpdateAvailable: function cmd_findAllUpdates_updateAvailable(aAddon, aInstall) { gEventManager.delegateAddonEvent("onUpdateAvailable", [aAddon, aInstall]); if (AddonManager.shouldAutoUpdate(aAddon)) { @@ -1097,17 +953,17 @@ var gViewController = { updateStatus(); } }, - onNoUpdateAvailable: function(aAddon) { + onNoUpdateAvailable: function cmd_findAllUpdates_noUpdateAvailable(aAddon) { pendingChecks--; updateStatus(); }, - onUpdateFinished: function(aAddon, aError) { + onUpdateFinished: function cmd_findAllUpdates_updateFinished(aAddon, aError) { gEventManager.delegateAddonEvent("onUpdateFinished", [aAddon, aError]); } }; - AddonManager.getAddonsByTypes(null, function(aAddonList) { + AddonManager.getAddonsByTypes(null, function cmd_findAllUpdates_getAddonsByTypes(aAddonList) { for (let addon of aAddonList) { if (addon.permissions & AddonManager.PERM_CAN_UPGRADE) { pendingChecks++; @@ -1123,20 +979,20 @@ var gViewController = { }, cmd_findItemUpdates: { - isEnabled: function(aAddon) { + isEnabled: function cmd_findItemUpdates_isEnabled(aAddon) { if (!aAddon) return false; return hasPermission(aAddon, "upgrade"); }, - doCommand: function(aAddon) { + doCommand: function cmd_findItemUpdates_doCommand(aAddon) { var listener = { - onUpdateAvailable: function(aAddon, aInstall) { + onUpdateAvailable: function cmd_findItemUpdates_updateAvailable(aAddon, aInstall) { gEventManager.delegateAddonEvent("onUpdateAvailable", [aAddon, aInstall]); if (AddonManager.shouldAutoUpdate(aAddon)) aInstall.install(); }, - onNoUpdateAvailable: function(aAddon) { + onNoUpdateAvailable: function cmd_findItemUpdates_noUpdateAvailable(aAddon) { gEventManager.delegateAddonEvent("onNoUpdateAvailable", [aAddon]); } @@ -1146,24 +1002,37 @@ var gViewController = { } }, + cmd_debugItem: { + doCommand: function cmd_debugItem_doCommand(aAddon) { + BrowserToolboxProcess.init({ addonID: aAddon.id }); + }, + + isEnabled: function cmd_debugItem_isEnabled(aAddon) { + let debuggerEnabled = Services.prefs. + getBoolPref(PREF_ADDON_DEBUGGING_ENABLED); + let remoteEnabled = Services.prefs. + getBoolPref(PREF_REMOTE_DEBUGGING_ENABLED); + return aAddon && aAddon.isDebuggable && debuggerEnabled && remoteEnabled; + } + }, + cmd_showItemPreferences: { - isEnabled: function(aAddon) { + isEnabled: function cmd_showItemPreferences_isEnabled(aAddon) { if (!aAddon || (!aAddon.isActive && !aAddon.isGMPlugin) || !aAddon.optionsURL) { return false; } if (gViewController.currentViewObj == gDetailView && - (aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE || - aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER)) { + aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE) { return false; } if (aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_INFO) return false; return true; }, - doCommand: function(aAddon) { - if (hasInlineOptions(aAddon)) { + doCommand: function cmd_showItemPreferences_doCommand(aAddon) { + if (aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE) { gViewController.commands.cmd_showItemDetails.doCommand(aAddon, true); return; } @@ -1195,11 +1064,11 @@ var gViewController = { }, cmd_showItemAbout: { - isEnabled: function(aAddon) { + isEnabled: function cmd_showItemAbout_isEnabled(aAddon) { // XXXunf This may be applicable to install items too. See bug 561260 return !!aAddon; }, - doCommand: function(aAddon) { + doCommand: function cmd_showItemAbout_doCommand(aAddon) { var aboutURL = aAddon.aboutURL; if (aboutURL) openDialog(aboutURL, "", "chrome,centerscreen,modal", aAddon); @@ -1210,17 +1079,17 @@ var gViewController = { }, cmd_enableItem: { - isEnabled: function(aAddon) { + isEnabled: function cmd_enableItem_isEnabled(aAddon) { if (!aAddon) return false; let addonType = AddonManager.addonTypes[aAddon.type]; return (!(addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) && hasPermission(aAddon, "enable")); }, - doCommand: function(aAddon) { + doCommand: function cmd_enableItem_doCommand(aAddon) { aAddon.userDisabled = false; }, - getTooltip: function(aAddon) { + getTooltip: function cmd_enableItem_getTooltip(aAddon) { if (!aAddon) return ""; if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_ENABLE) @@ -1230,17 +1099,17 @@ var gViewController = { }, cmd_disableItem: { - isEnabled: function(aAddon) { + isEnabled: function cmd_disableItem_isEnabled(aAddon) { if (!aAddon) return false; let addonType = AddonManager.addonTypes[aAddon.type]; return (!(addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) && hasPermission(aAddon, "disable")); }, - doCommand: function(aAddon) { + doCommand: function cmd_disableItem_doCommand(aAddon) { aAddon.userDisabled = true; }, - getTooltip: function(aAddon) { + getTooltip: function cmd_disableItem_getTooltip(aAddon) { if (!aAddon) return ""; if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_DISABLE) @@ -1250,12 +1119,12 @@ var gViewController = { }, cmd_installItem: { - isEnabled: function(aAddon) { + isEnabled: function cmd_installItem_isEnabled(aAddon) { if (!aAddon) return false; return aAddon.install && aAddon.install.state == AddonManager.STATE_AVAILABLE; }, - doCommand: function(aAddon) { + doCommand: function cmd_installItem_doCommand(aAddon) { function doInstall() { gViewController.currentViewObj.getListItemForID(aAddon.id)._installStatus.installRemote(); } @@ -1268,33 +1137,33 @@ var gViewController = { }, cmd_purchaseItem: { - isEnabled: function(aAddon) { + isEnabled: function cmd_purchaseItem_isEnabled(aAddon) { if (!aAddon) return false; return !!aAddon.purchaseURL; }, - doCommand: function(aAddon) { + doCommand: function cmd_purchaseItem_doCommand(aAddon) { openURL(aAddon.purchaseURL); } }, cmd_uninstallItem: { - isEnabled: function(aAddon) { + isEnabled: function cmd_uninstallItem_isEnabled(aAddon) { if (!aAddon) return false; return hasPermission(aAddon, "uninstall"); }, - doCommand: function(aAddon) { + doCommand: function cmd_uninstallItem_doCommand(aAddon) { if (gViewController.currentViewObj != gDetailView) { aAddon.uninstall(); return; } - gViewController.popState(function() { + gViewController.popState(function cmd_uninstallItem_popState() { gViewController.currentViewObj.getListItemForID(aAddon.id).uninstall(); }); }, - getTooltip: function(aAddon) { + getTooltip: function cmd_uninstallItem_getTooltip(aAddon) { if (!aAddon) return ""; if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL) @@ -1304,21 +1173,19 @@ var gViewController = { }, cmd_cancelUninstallItem: { - isEnabled: function(aAddon) { + isEnabled: function cmd_cancelUninstallItem_isEnabled(aAddon) { if (!aAddon) return false; return isPending(aAddon, "uninstall"); }, - doCommand: function(aAddon) { + doCommand: function cmd_cancelUninstallItem_doCommand(aAddon) { aAddon.cancelUninstall(); } }, cmd_installFromFile: { - isEnabled: function() { - return true; - }, - doCommand: function() { + isEnabled: function cmd_installFromFile_isEnabled() true, + doCommand: function cmd_installFromFile_doCommand() { const nsIFilePicker = Ci.nsIFilePicker; var fp = Cc["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); @@ -1345,13 +1212,13 @@ var gViewController = { getService(Ci.amIWebInstallListener); webInstaller.onWebInstallRequested(getBrowserElement(), document.documentURIObject, - installs); + installs, installs.length); } return; } var file = files.getNext(); - AddonManager.getInstallForFile(file, function(aInstall) { + AddonManager.getInstallForFile(file, function cmd_installFromFile_getInstallForFile(aInstall) { installs.push(aInstall); buildNextInstall(); }); @@ -1361,25 +1228,13 @@ var gViewController = { } }, - cmd_debugAddons: { - isEnabled: function() { - return true; - }, - doCommand: function() { - let mainWindow = getMainWindow(); - if ("switchToTabHavingURI" in mainWindow) { - mainWindow.switchToTabHavingURI("about:debugging#addons", true); - } - }, - }, - cmd_cancelOperation: { - isEnabled: function(aAddon) { + isEnabled: function cmd_cancelOperation_isEnabled(aAddon) { if (!aAddon) return false; return aAddon.pendingOperations != AddonManager.PENDING_NONE; }, - doCommand: function(aAddon) { + doCommand: function cmd_cancelOperation_doCommand(aAddon) { if (isPending(aAddon, "install")) { aAddon.install.cancel(); } else if (isPending(aAddon, "upgrade")) { @@ -1395,107 +1250,68 @@ var gViewController = { }, cmd_contribute: { - isEnabled: function(aAddon) { + isEnabled: function cmd_contribute_isEnabled(aAddon) { if (!aAddon) return false; return ("contributionURL" in aAddon && aAddon.contributionURL); }, - doCommand: function(aAddon) { + doCommand: function cmd_contribute_doCommand(aAddon) { openURL(aAddon.contributionURL); } }, cmd_askToActivateItem: { - isEnabled: function(aAddon) { + isEnabled: function cmd_askToActivateItem_isEnabled(aAddon) { if (!aAddon) return false; let addonType = AddonManager.addonTypes[aAddon.type]; return ((addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) && hasPermission(aAddon, "ask_to_activate")); }, - doCommand: function(aAddon) { + doCommand: function cmd_askToActivateItem_doCommand(aAddon) { aAddon.userDisabled = AddonManager.STATE_ASK_TO_ACTIVATE; } }, cmd_alwaysActivateItem: { - isEnabled: function(aAddon) { + isEnabled: function cmd_alwaysActivateItem_isEnabled(aAddon) { if (!aAddon) return false; let addonType = AddonManager.addonTypes[aAddon.type]; return ((addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) && hasPermission(aAddon, "enable")); }, - doCommand: function(aAddon) { + doCommand: function cmd_alwaysActivateItem_doCommand(aAddon) { aAddon.userDisabled = false; } }, cmd_neverActivateItem: { - isEnabled: function(aAddon) { + isEnabled: function cmd_neverActivateItem_isEnabled(aAddon) { if (!aAddon) return false; let addonType = AddonManager.addonTypes[aAddon.type]; return ((addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) && hasPermission(aAddon, "disable")); }, - doCommand: function(aAddon) { + doCommand: function cmd_neverActivateItem_doCommand(aAddon) { aAddon.userDisabled = true; } - }, - - cmd_experimentsLearnMore: { - isEnabled: function() { - let mainWindow = getMainWindow(); - return mainWindow && "switchToTabHavingURI" in mainWindow; - }, - doCommand: function() { - let url = Services.prefs.getCharPref("toolkit.telemetry.infoURL"); - openOptionsInTab(url); - }, - }, - - cmd_experimentsOpenTelemetryPreferences: { - isEnabled: function() { - return !!getMainWindowWithPreferencesPane(); - }, - doCommand: function() { - let mainWindow = getMainWindowWithPreferencesPane(); - mainWindow.openAdvancedPreferences("dataChoicesTab"); - }, - }, - - cmd_showUnsignedExtensions: { - isEnabled: function() { - return true; - }, - doCommand: function() { - gViewController.loadView("addons://list/extension?unsigned=true"); - }, - }, - - cmd_showAllExtensions: { - isEnabled: function() { - return true; - }, - doCommand: function() { - gViewController.loadView("addons://list/extension"); - }, - }, + } }, - supportsCommand: function(aCommand) { + supportsCommand: function gVC_supportsCommand(aCommand) { return (aCommand in this.commands); }, - isCommandEnabled: function(aCommand) { + isCommandEnabled: function gVC_isCommandEnabled(aCommand) { if (!this.supportsCommand(aCommand)) return false; var addon = this.currentViewObj.getSelectedAddon(); return this.commands[aCommand].isEnabled(addon); }, - updateCommands: function() { + updateCommands: function gVC_updateCommands() { // wait until the view is initialized if (!this.currentViewObj) return; @@ -1504,7 +1320,7 @@ var gViewController = { this.updateCommand(commandId, addon); }, - updateCommand: function(aCommandId, aAddon) { + updateCommand: function gVC_updateCommand(aCommandId, aAddon) { if (typeof aAddon == "undefined") aAddon = this.currentViewObj.getSelectedAddon(); var cmd = this.commands[aCommandId]; @@ -1519,7 +1335,7 @@ var gViewController = { } }, - doCommand: function(aCommand, aAddon) { + doCommand: function gVC_doCommand(aCommand, aAddon) { if (!this.supportsCommand(aCommand)) return; var cmd = this.commands[aCommand]; @@ -1530,12 +1346,11 @@ var gViewController = { cmd.doCommand(aAddon); }, - onEvent: function() {} + onEvent: function gVC_onEvent() {} }; function hasInlineOptions(aAddon) { return (aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE || - aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER || aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_INFO); } @@ -1549,11 +1364,14 @@ function openOptionsInTab(optionsURL) { } function formatDate(aDate) { - const locale = Cc["@mozilla.org/chrome/chrome-registry;1"] - .getService(Ci.nsIXULChromeRegistry) - .getSelectedLocale("global", true); - const dtOptions = { year: 'numeric', month: 'long', day: 'numeric' }; - return aDate.toLocaleDateString(locale, dtOptions); + return Cc["@mozilla.org/intl/scriptabledateformat;1"] + .getService(Ci.nsIScriptableDateFormat) + .FormatDate("", + Ci.nsIScriptableDateFormat.dateFormatLong, + aDate.getFullYear(), + aDate.getMonth() + 1, + aDate.getDate() + ); } @@ -1577,10 +1395,6 @@ function shouldShowVersionNumber(aAddon) { if (!aAddon.version) return false; - // The version number is hidden for experiments. - if (aAddon.type == "experiment") - return false; - // The version number is hidden for lightweight themes. if (aAddon.type == "theme") return !/@personas\.mozilla\.org$/.test(aAddon.id); @@ -1614,10 +1428,6 @@ function createItem(aObj, aIsInstall, aIsRemote) { // the binding handles the rest item.setAttribute("value", aObj.id); - if (aObj.type == "experiment") { - item.endDate = getExperimentEndDate(aObj); - } - return item; } @@ -1702,7 +1512,8 @@ function sortElements(aElements, aSortBy, aAscending) { if (addonType && (addonType.flags & AddonManager.TYPE_SUPPORTS_ASK_TO_ACTIVATE) && addon.userDisabled == AddonManager.STATE_ASK_TO_ACTIVATE) return "askToActivate"; - return "enabled"; + else + return "enabled"; } return addon[aKey]; @@ -1726,7 +1537,7 @@ function sortElements(aElements, aSortBy, aAscending) { } - aElements.sort(function(a, b) { + aElements.sort(function elementsSort(a, b) { if (!aAscending) [a, b] = [b, a]; @@ -1771,15 +1582,15 @@ function getAddonsAndInstalls(aType, aCallback) { let addons = null, installs = null; let types = (aType != null) ? [aType] : null; - AddonManager.getAddonsByTypes(types, function(aAddonsList) { - addons = aAddonsList.filter(a => !a.hidden); + AddonManager.getAddonsByTypes(types, function getAddonsAndInstalls_getAddonsByTypes(aAddonsList) { + addons = aAddonsList; if (installs != null) aCallback(addons, installs); }); - AddonManager.getInstallsByTypes(types, function(aInstallsList) { + AddonManager.getInstallsByTypes(types, function getAddonsAndInstalls_getInstallsByTypes(aInstallsList) { // skip over upgrade installs and non-active installs - installs = aInstallsList.filter(function(aInstall) { + installs = aInstallsList.filter(function installsFilter(aInstall) { return !(aInstall.existingAddon || aInstall.state == AddonManager.STATE_AVAILABLE); }); @@ -1796,7 +1607,7 @@ function doPendingUninstalls(aListBox) { var listitem = aListBox.firstChild; while (listitem) { if (listitem.getAttribute("pending") == "uninstall" && - !(listitem.opRequiresRestart("UNINSTALL"))) + !(listitem.opRequiresRestart("uninstall"))) items.push(listitem.mAddon); listitem = listitem.nextSibling; } @@ -1809,7 +1620,7 @@ var gCategories = { node: null, _search: null, - initialize: function() { + initialize: function gCategories_initialize() { this.node = document.getElementById("categories"); this._search = this.get("addons://search/"); @@ -1829,13 +1640,14 @@ var gCategories = { if (!this.node.selectedItem || this.node.selectedItem == this._search) this.node.value = gViewDefault; - this.node.addEventListener("select", () => { - this.maybeHideSearch(); - gViewController.loadView(this.node.selectedItem.value); + var self = this; + this.node.addEventListener("select", function node_onSelected() { + self.maybeHideSearch(); + gViewController.loadView(self.node.selectedItem.value); }, false); - this.node.addEventListener("click", (aEvent) => { - var selectedItem = this.node.selectedItem; + this.node.addEventListener("click", function node_onClicked(aEvent) { + var selectedItem = self.node.selectedItem; if (aEvent.target.localName == "richlistitem" && aEvent.target == selectedItem) { var viewId = selectedItem.value; @@ -1849,11 +1661,11 @@ var gCategories = { }, false); }, - shutdown: function() { + shutdown: function gCategories_shutdown() { AddonManager.removeTypeListener(this); }, - _insertCategory: function(aId, aName, aView, aPriority, aStartHidden) { + _insertCategory: function gCategories_insertCategory(aId, aName, aView, aPriority, aStartHidden) { // If this category already exists then don't re-add it if (document.getElementById("category-" + aId)) return; @@ -1887,7 +1699,7 @@ var gCategories = { this.node.insertBefore(category, node); }, - _removeCategory: function(aId) { + _removeCategory: function gCategories_removeCategory(aId) { var category = document.getElementById("category-" + aId); if (!category) return; @@ -1899,7 +1711,7 @@ var gCategories = { this.node.removeChild(category); }, - onTypeAdded: function(aType) { + onTypeAdded: function gCategories_onTypeAdded(aType) { // Ignore types that we don't have a view object for if (!(aType.viewType in gViewController.viewObjects)) return; @@ -1917,10 +1729,11 @@ var gCategories = { startHidden = true; } + var self = this; gPendingInitializations++; - getAddonsAndInstalls(aType.id, (aAddonsList, aInstallsList) => { + getAddonsAndInstalls(aType.id, function onTypeAdded_getAddonsAndInstalls(aAddonsList, aInstallsList) { var hidden = (aAddonsList.length == 0 && aInstallsList.length == 0); - var item = this.get(aViewId); + var item = self.get(aViewId); // Don't load view that is becoming hidden if (hidden && aViewId == gViewController.currentViewId) @@ -1935,25 +1748,25 @@ var gCategories = { } gEventManager.registerInstallListener({ - onDownloadStarted: function(aInstall) { + onDownloadStarted: function gCategories_onDownloadStarted(aInstall) { this._maybeShowCategory(aInstall); }, - onInstallStarted: function(aInstall) { + onInstallStarted: function gCategories_onInstallStarted(aInstall) { this._maybeShowCategory(aInstall); }, - onInstallEnded: function(aInstall, aAddon) { + onInstallEnded: function gCategories_onInstallEnded(aInstall, aAddon) { this._maybeShowCategory(aAddon); }, - onExternalInstall: function(aAddon, aExistingAddon, aRequiresRestart) { + onExternalInstall: function gCategories_onExternalInstall(aAddon, aExistingAddon, aRequiresRestart) { this._maybeShowCategory(aAddon); }, - _maybeShowCategory: aAddon => { + _maybeShowCategory: function gCategories_maybeShowCategory(aAddon) { if (aType.id == aAddon.type) { - this.get(aViewId).hidden = false; + self.get(aViewId).hidden = false; Services.prefs.setBoolPref(prefName, false); gEventManager.unregisterInstallListener(this); } @@ -1968,7 +1781,7 @@ var gCategories = { startHidden); }, - onTypeRemoved: function(aType) { + onTypeRemoved: function gCategories_onTypeRemoved(aType) { this._removeCategory(aType.id); }, @@ -1976,13 +1789,12 @@ var gCategories = { return this.node.selectedItem ? this.node.selectedItem.value : null; }, - select: function(aId, aPreviousView) { + select: function gCategories_select(aId, aPreviousView) { var view = gViewController.parseViewId(aId); if (view.type == "detail" && aPreviousView) { aId = aPreviousView; view = gViewController.parseViewId(aPreviousView); } - aId = aId.replace(/\?.*/, ""); Services.prefs.setCharPref(PREF_UI_LASTCATEGORY, aId); @@ -1993,11 +1805,10 @@ var gCategories = { return; } - var item; if (view.type == "search") - item = this._search; + var item = this._search; else - item = this.get(aId); + var item = this.get(aId); if (item) { item.hidden = false; @@ -2011,20 +1822,20 @@ var gCategories = { } }, - get: function(aId) { + get: function gCategories_get(aId) { var items = document.getElementsByAttribute("value", aId); if (items.length) return items[0]; return null; }, - setBadge: function(aId, aCount) { + setBadge: function gCategories_setBadge(aId, aCount) { let item = this.get(aId); if (item) item.badgeCount = aCount; }, - maybeHideSearch: function() { + maybeHideSearch: function gCategories_maybeHideSearch() { var view = gViewController.parseViewId(this.node.selectedItem.value); this._search.disabled = view.type != "search"; } @@ -2035,10 +1846,10 @@ var gHeader = { _search: null, _dest: "", - initialize: function() { + initialize: function gHeader_initialize() { this._search = document.getElementById("header-search"); - this._search.addEventListener("command", function(aEvent) { + this._search.addEventListener("command", function search_onCommand(aEvent) { var query = aEvent.target.value; if (query.length == 0) return; @@ -2052,7 +1863,7 @@ var gHeader = { document.getElementById("forward-btn").hidden = !shouldShow; } - window.addEventListener("focus", function(aEvent) { + window.addEventListener("focus", function window_onFocus(aEvent) { if (aEvent.target == window) updateNavButtonVisibility(); }, false); @@ -2060,15 +1871,27 @@ var gHeader = { updateNavButtonVisibility(); }, - focusSearchBox: function() { + focusSearchBox: function gHeader_focusSearchBox() { this._search.focus(); }, - onKeyPress: function(aEvent) { + onKeyPress: function gHeader_onKeyPress(aEvent) { if (String.fromCharCode(aEvent.charCode) == "/") { this.focusSearchBox(); return; } + + // XXXunf Temporary until bug 371900 is fixed. + let key = document.getElementById("focusSearch").getAttribute("key"); +#ifdef XP_MACOSX + let keyModifier = aEvent.metaKey; +#else + let keyModifier = aEvent.ctrlKey; +#endif + if (String.fromCharCode(aEvent.charCode) == key && keyModifier) { + this.focusSearchBox(); + return; + } }, get shouldShowNavButtons() { @@ -2123,9 +1946,8 @@ var gDiscoverView = { _error: null, homepageURL: null, _loadListeners: [], - hideHeader: true, - initialize: function() { + initialize: function gDiscoverView_initialize() { this.enabled = isDiscoverEnabled(); if (!this.enabled) { gCategories.get("addons://discover/").hidden = true; @@ -2147,20 +1969,22 @@ var gDiscoverView = { url = url.replace("%COMPATIBILITY_MODE%", compatMode); url = Services.urlFormatter.formatURL(url); - let setURL = (aURL) => { + var self = this; + + function setURL(aURL) { try { - this.homepageURL = Services.io.newURI(aURL, null, null); + self.homepageURL = Services.io.newURI(aURL, null, null); } catch (e) { - this.showError(); + self.showError(); notifyInitialized(); return; } - this._browser.homePage = this.homepageURL.spec; - this._browser.addProgressListener(this); + self._browser.homePage = self.homepageURL.spec; + self._browser.addProgressListener(self); - if (this.loaded) - this._loadURL(this.homepageURL.spec, false, notifyInitialized); + if (self.loaded) + self._loadURL(self.homepageURL.spec, false, notifyInitialized); else notifyInitialized(); } @@ -2171,7 +1995,7 @@ var gDiscoverView = { } gPendingInitializations++; - AddonManager.getAllAddons(function(aAddons) { + AddonManager.getAllAddons(function initialize_getAllAddons(aAddons) { var list = {}; for (let addon of aAddons) { var prefName = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%", @@ -2194,7 +2018,7 @@ var gDiscoverView = { }); }, - destroy: function() { + destroy: function gDiscoverView_destroy() { try { this._browser.removeProgressListener(this); } @@ -2203,7 +2027,7 @@ var gDiscoverView = { } }, - show: function(aParam, aRequest, aState, aIsRefresh) { + show: function gDiscoverView_show(aParam, aRequest, aState, aIsRefresh) { gViewController.updateCommands(); // If we're being told to load a specific URL then just do that @@ -2234,24 +2058,24 @@ var gDiscoverView = { gViewController.notifyViewChanged.bind(gViewController)); }, - canRefresh: function() { + canRefresh: function gDiscoverView_canRefresh() { if (this._browser.currentURI && this._browser.currentURI.spec == this._browser.homePage) return false; return true; }, - refresh: function(aParam, aRequest, aState) { + refresh: function gDiscoverView_refresh(aParam, aRequest, aState) { this.show(aParam, aRequest, aState, true); }, - hide: function() { }, + hide: function gDiscoverView_hide() { }, - showError: function() { + showError: function gDiscoverView_showError() { this.node.selectedPanel = this._error; }, - _loadURL: function(aURL, aKeepHistory, aCallback) { + _loadURL: function gDiscoverView_loadURL(aURL, aKeepHistory, aCallback) { if (this._browser.currentURI.spec == aURL) { if (aCallback) aCallback(); @@ -2268,7 +2092,7 @@ var gDiscoverView = { this._browser.loadURIWithFlags(aURL, flags); }, - onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) { + onLocationChange: function gDiscoverView_onLocationChange(aWebProgress, aRequest, aLocation, aFlags) { // Ignore the about:blank load if (aLocation.spec == "about:blank") return; @@ -2306,7 +2130,7 @@ var gDiscoverView = { aRequest.cancel(Components.results.NS_BINDING_ABORTED); }, - onSecurityChange: function(aWebProgress, aRequest, aState) { + onSecurityChange: function gDiscoverView_onSecurityChange(aWebProgress, aRequest, aState) { // Don't care about security if the page is not https if (!this.homepageURL.schemeIs("https")) return; @@ -2320,12 +2144,12 @@ var gDiscoverView = { aRequest.cancel(Components.results.NS_BINDING_ABORTED); }, - onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange: function gDiscoverView_onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) { let transferStart = Ci.nsIWebProgressListener.STATE_IS_DOCUMENT | Ci.nsIWebProgressListener.STATE_IS_REQUEST | Ci.nsIWebProgressListener.STATE_TRANSFERRING; // Once transferring begins show the content - if ((aStateFlags & transferStart) === transferStart) + if (aStateFlags & transferStart) this.node.selectedPanel = this._browser; // Only care about the network events @@ -2364,15 +2188,13 @@ var gDiscoverView = { listener(); }, - onProgressChange: function() { }, - onStatusChange: function() { }, + onProgressChange: function gDiscoverView_onProgressChange() { }, + onStatusChange: function gDiscoverView_onStatusChange() { }, QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference]), - getSelectedAddon: function() { - return null; - } + getSelectedAddon: function gDiscoverView_getSelectedAddon() null }; @@ -2390,7 +2212,7 @@ var gSearchView = { _lastRemoteTotal: 0, _pendingSearches: 0, - initialize: function() { + initialize: function gSearchView_initialize() { this.node = document.getElementById("search-view"); this._filter = document.getElementById("search-filter-radiogroup"); this._sorters = document.getElementById("search-sorters"); @@ -2403,18 +2225,19 @@ var gSearchView = { if (!AddonManager.isInstallEnabled("application/x-xpinstall")) this._filter.hidden = true; - this._listBox.addEventListener("keydown", aEvent => { + var self = this; + this._listBox.addEventListener("keydown", function listbox_onKeydown(aEvent) { if (aEvent.keyCode == aEvent.DOM_VK_RETURN) { - var item = this._listBox.selectedItem; + var item = self._listBox.selectedItem; if (item) item.showInDetailView(); } }, false); - this._filter.addEventListener("command", () => this.updateView(), false); + this._filter.addEventListener("command", function filter_onCommand() self.updateView(), false); }, - shutdown: function() { + shutdown: function gSearchView_shutdown() { if (AddonRepository.isSearching) AddonRepository.cancelSearch(); }, @@ -2423,7 +2246,7 @@ var gSearchView = { return this._pendingSearches > 0; }, - show: function(aQuery, aRequest) { + show: function gSearchView_show(aQuery, aRequest) { gEventManager.registerInstallListener(this); this.showEmptyNotice(false); @@ -2446,18 +2269,19 @@ var gSearchView = { while (this._listBox.firstChild.localName == "richlistitem") this._listBox.removeChild(this._listBox.firstChild); + var self = this; gCachedAddons = {}; this._pendingSearches = 2; this._sorters.setSort("relevancescore", false); var elements = []; - let createSearchResults = (aObjsList, aIsInstall, aIsRemote) => { + function createSearchResults(aObjsList, aIsInstall, aIsRemote) { for (let index in aObjsList) { let obj = aObjsList[index]; let score = aObjsList.length - index; if (!aIsRemote && aQuery.length > 0) { - score = this.getMatchScore(obj, aQuery); + score = self.getMatchScore(obj, aQuery); if (score == 0) continue; } @@ -2467,29 +2291,29 @@ var gSearchView = { if (aIsRemote) { gCachedAddons[obj.id] = obj; if (obj.purchaseURL) - this._sorters.showprice = true; + self._sorters.showprice = true; } elements.push(item); } } - let finishSearch = (createdCount) => { + function finishSearch(createdCount) { if (elements.length > 0) { - sortElements(elements, [this._sorters.sortBy], this._sorters.ascending); + sortElements(elements, [self._sorters.sortBy], self._sorters.ascending); for (let element of elements) - this._listBox.insertBefore(element, this._listBox.lastChild); - this.updateListAttributes(); + self._listBox.insertBefore(element, self._listBox.lastChild); + self.updateListAttributes(); } - this._pendingSearches--; - this.updateView(); + self._pendingSearches--; + self.updateView(); - if (!this.isSearching) + if (!self.isSearching) gViewController.notifyViewChanged(); } - getAddonsAndInstalls(null, function(aAddons, aInstalls) { + getAddonsAndInstalls(null, function show_getAddonsAndInstalls(aAddons, aInstalls) { if (gViewController && aRequest != gViewController.currentViewRequest) return; @@ -2501,7 +2325,7 @@ var gSearchView = { var maxRemoteResults = 0; try { maxRemoteResults = Services.prefs.getIntPref(PREF_MAXRESULTS); - } catch (e) {} + } catch(e) {} if (maxRemoteResults <= 0) { finishSearch(0); @@ -2509,24 +2333,24 @@ var gSearchView = { } AddonRepository.searchAddons(aQuery, maxRemoteResults, { - searchFailed: () => { + searchFailed: function show_SearchFailed() { if (gViewController && aRequest != gViewController.currentViewRequest) return; - this._lastRemoteTotal = 0; + self._lastRemoteTotal = 0; // XXXunf Better handling of AMO search failure. See bug 579502 finishSearch(0); // Silently fail }, - searchSucceeded: (aAddonsList, aAddonCount, aTotalResults) => { + searchSucceeded: function show_SearchSucceeded(aAddonsList, aAddonCount, aTotalResults) { if (gViewController && aRequest != gViewController.currentViewRequest) return; if (aTotalResults > maxRemoteResults) - this._lastRemoteTotal = aTotalResults; + self._lastRemoteTotal = aTotalResults; else - this._lastRemoteTotal = 0; + self._lastRemoteTotal = 0; var createdCount = createSearchResults(aAddonsList, false, true); finishSearch(createdCount); @@ -2534,12 +2358,12 @@ var gSearchView = { }); }, - showLoading: function(aLoading) { + showLoading: function gSearchView_showLoading(aLoading) { this._loading.hidden = !aLoading; this._listBox.hidden = aLoading; }, - updateView: function() { + updateView: function gSearchView_updateView() { var showLocal = this._filter.value == "local"; if (!showLocal && !AddonManager.isInstallEnabled("application/x-xpinstall")) @@ -2567,12 +2391,12 @@ var gSearchView = { gViewController.updateCommands(); }, - hide: function() { + hide: function gSearchView_hide() { gEventManager.unregisterInstallListener(this); doPendingUninstalls(this._listBox); }, - getMatchScore: function(aObj, aQuery) { + getMatchScore: function gSearchView_getMatchScore(aObj, aQuery) { var score = 0; score += this.calculateMatchScore(aObj.name, aQuery, SEARCH_SCORE_MULTIPLIER_NAME); @@ -2581,7 +2405,7 @@ var gSearchView = { return score; }, - calculateMatchScore: function(aStr, aQuery, aMultiplier) { + calculateMatchScore: function gSearchView_calculateMatchScore(aStr, aQuery, aMultiplier) { var score = 0; if (!aStr || aQuery.length == 0) return score; @@ -2613,12 +2437,12 @@ var gSearchView = { return score * aMultiplier; }, - showEmptyNotice: function(aShow) { + showEmptyNotice: function gSearchView_showEmptyNotice(aShow) { this._emptyNotice.hidden = !aShow; this._listBox.hidden = aShow; }, - showAllResultsLink: function(aTotalResults) { + showAllResultsLink: function gSearchView_showAllResultsLink(aTotalResults) { if (aTotalResults == 0) { this._allResultsLink.hidden = true; return; @@ -2632,9 +2456,9 @@ var gSearchView = { this._allResultsLink.setAttribute("href", AddonRepository.getSearchURL(this._lastQuery)); this._allResultsLink.hidden = false; - }, + }, - updateListAttributes: function() { + updateListAttributes: function gSearchView_updateListAttributes() { var item = this._listBox.querySelector("richlistitem[remote='true'][first]"); if (item) item.removeAttribute("first"); @@ -2661,7 +2485,7 @@ var gSearchView = { }, - onSortChanged: function(aSortBy, aAscending) { + onSortChanged: function gSearchView_onSortChanged(aSortBy, aAscending) { var footer = this._listBox.lastChild; this._listBox.removeChild(footer); @@ -2671,15 +2495,15 @@ var gSearchView = { this._listBox.appendChild(footer); }, - onDownloadCancelled: function(aInstall) { + onDownloadCancelled: function gSearchView_onDownloadCancelled(aInstall) { this.removeInstall(aInstall); }, - onInstallCancelled: function(aInstall) { + onInstallCancelled: function gSearchView_onInstallCancelled(aInstall) { this.removeInstall(aInstall); }, - removeInstall: function(aInstall) { + removeInstall: function gSearchView_removeInstall(aInstall) { for (let item of this._listBox.childNodes) { if (item.mInstall == aInstall) { this._listBox.removeChild(item); @@ -2688,14 +2512,14 @@ var gSearchView = { } }, - getSelectedAddon: function() { + getSelectedAddon: function gSearchView_getSelectedAddon() { var item = this._listBox.selectedItem; if (item) return item.mAddon; return null; }, - getListItemForID: function(aId) { + getListItemForID: function gSearchView_getListItemForID(aId) { var listitem = this._listBox.firstChild; while (listitem) { if (listitem.getAttribute("status") == "installed" && listitem.mAddon.id == aId) @@ -2713,52 +2537,22 @@ var gListView = { _emptyNotice: null, _type: null, - initialize: function() { + initialize: function gListView_initialize() { this.node = document.getElementById("list-view"); this._listBox = document.getElementById("addon-list"); this._emptyNotice = document.getElementById("addon-list-empty"); - this._listBox.addEventListener("keydown", (aEvent) => { + var self = this; + this._listBox.addEventListener("keydown", function listbox_onKeydown(aEvent) { if (aEvent.keyCode == aEvent.DOM_VK_RETURN) { - var item = this._listBox.selectedItem; + var item = self._listBox.selectedItem; if (item) item.showInDetailView(); } }, false); - - document.getElementById("signing-learn-more").setAttribute("href", - Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons"); - - let findSignedAddonsLink = document.getElementById("find-alternative-addons"); - try { - findSignedAddonsLink.setAttribute("href", - Services.urlFormatter.formatURLPref("extensions.getAddons.link.url")); - } catch (e) { - findSignedAddonsLink.classList.remove("text-link"); - } - - try { - document.getElementById("signing-dev-manual-link").setAttribute("href", - Services.prefs.getCharPref("xpinstall.signatures.devInfoURL")); - } catch (e) { - document.getElementById("signing-dev-info").hidden = true; - } - - if (Preferences.get("plugin.load_flash_only", true)) { - document.getElementById("plugindeprecation-learnmore-link") - .setAttribute("href", Services.urlFormatter.formatURLPref("app.support.baseURL") + "npapi"); - } else { - document.getElementById("plugindeprecation-notice").hidden = true; - } }, - show: function(aType, aRequest) { - let showOnlyDisabledUnsigned = false; - if (aType.endsWith("?unsigned=true")) { - aType = aType.replace(/\?.*/, ""); - showOnlyDisabledUnsigned = true; - } - + show: function gListView_show(aType, aRequest) { if (!(aType in AddonManager.addonTypes)) throw Components.Exception("Attempting to show unknown type " + aType, Cr.NS_ERROR_INVALID_ARG); @@ -2773,7 +2567,8 @@ var gListView = { navigator.plugins.refresh(false); } - getAddonsAndInstalls(aType, (aAddonsList, aInstallsList) => { + var self = this; + getAddonsAndInstalls(aType, function show_getAddonsAndInstalls(aAddonsList, aInstallsList) { if (gViewController && aRequest != gViewController.currentViewRequest) return; @@ -2785,96 +2580,64 @@ var gListView = { for (let installItem of aInstallsList) elements.push(createItem(installItem, true)); - this.showEmptyNotice(elements.length == 0); + self.showEmptyNotice(elements.length == 0); if (elements.length > 0) { sortElements(elements, ["uiState", "name"], true); for (let element of elements) - this._listBox.appendChild(element); + self._listBox.appendChild(element); } - this.filterDisabledUnsigned(showOnlyDisabledUnsigned); - - gEventManager.registerInstallListener(this); + gEventManager.registerInstallListener(self); gViewController.updateCommands(); gViewController.notifyViewChanged(); }); }, - hide: function() { + hide: function gListView_hide() { gEventManager.unregisterInstallListener(this); doPendingUninstalls(this._listBox); }, - filterDisabledUnsigned: function(aFilter = true) { - let foundDisabledUnsigned = false; - - if (SIGNING_REQUIRED) { - for (let item of this._listBox.childNodes) { - if (!isCorrectlySigned(item.mAddon)) - foundDisabledUnsigned = true; - else - item.hidden = aFilter; - } - } - - document.getElementById("show-disabled-unsigned-extensions").hidden = - aFilter || !foundDisabledUnsigned; - - document.getElementById("show-all-extensions").hidden = !aFilter; - document.getElementById("disabled-unsigned-addons-info").hidden = !aFilter; - }, - - showEmptyNotice: function(aShow) { + showEmptyNotice: function gListView_showEmptyNotice(aShow) { this._emptyNotice.hidden = !aShow; - this._listBox.hidden = aShow; }, - onSortChanged: function(aSortBy, aAscending) { + onSortChanged: function gListView_onSortChanged(aSortBy, aAscending) { sortList(this._listBox, aSortBy, aAscending); }, - onExternalInstall: function(aAddon, aExistingAddon, aRequiresRestart) { + onExternalInstall: function gListView_onExternalInstall(aAddon, aExistingAddon, aRequiresRestart) { // The existing list item will take care of upgrade installs if (aExistingAddon) return; - if (aAddon.hidden) - return; - this.addItem(aAddon); }, - onDownloadStarted: function(aInstall) { + onDownloadStarted: function gListView_onDownloadStarted(aInstall) { this.addItem(aInstall, true); }, - onInstallStarted: function(aInstall) { + onInstallStarted: function gListView_onInstallStarted(aInstall) { this.addItem(aInstall, true); }, - onDownloadCancelled: function(aInstall) { + onDownloadCancelled: function gListView_onDownloadCancelled(aInstall) { this.removeItem(aInstall, true); }, - onInstallCancelled: function(aInstall) { + onInstallCancelled: function gListView_onInstallCancelled(aInstall) { this.removeItem(aInstall, true); }, - onInstallEnded: function(aInstall) { + onInstallEnded: function gListView_onInstallEnded(aInstall) { // Remove any install entries for upgrades, their status will appear against // the existing item if (aInstall.existingAddon) this.removeItem(aInstall, true); - - if (aInstall.addon.type == "experiment") { - let item = this.getListItemForID(aInstall.addon.id); - if (item) { - item.endDate = getExperimentEndDate(aInstall.addon); - } - } }, - addItem: function(aObj, aIsInstall) { + addItem: function gListView_addItem(aObj, aIsInstall) { if (aObj.type != this._type) return; @@ -2892,7 +2655,7 @@ var gListView = { this.showEmptyNotice(false); }, - removeItem: function(aObj, aIsInstall) { + removeItem: function gListView_removeItem(aObj, aIsInstall) { let prop = aIsInstall ? "mInstall" : "mAddon"; for (let item of this._listBox.childNodes) { @@ -2904,14 +2667,14 @@ var gListView = { } }, - getSelectedAddon: function() { + getSelectedAddon: function gListView_getSelectedAddon() { var item = this._listBox.selectedItem; if (item) return item.mAddon; return null; }, - getListItemForID: function(aId) { + getListItemForID: function gListView_getListItemForID(aId) { var listitem = this._listBox.firstChild; while (listitem) { if (listitem.getAttribute("status") == "installed" && listitem.mAddon.id == aId) @@ -2929,25 +2692,26 @@ var gDetailView = { _loadingTimer: null, _autoUpdate: null, - initialize: function() { + initialize: function gDetailView_initialize() { this.node = document.getElementById("detail-view"); this._autoUpdate = document.getElementById("detail-autoUpdate"); - this._autoUpdate.addEventListener("command", () => { - this._addon.applyBackgroundUpdates = this._autoUpdate.value; + var self = this; + this._autoUpdate.addEventListener("command", function autoUpdate_onCommand() { + self._addon.applyBackgroundUpdates = self._autoUpdate.value; }, true); }, - shutdown: function() { + shutdown: function gDetailView_shutdown() { AddonManager.removeManagerListener(this); }, - onUpdateModeChanged: function() { + onUpdateModeChanged: function gDetailView_onUpdateModeChanged() { this.onPropertyChanged(["applyBackgroundUpdates"]); }, - _updateView: function(aAddon, aIsRemote, aScrollToPreferences) { + _updateView: function gDetailView_updateView(aAddon, aIsRemote, aScrollToPreferences) { AddonManager.addManagerListener(this); this.clearLoading(); @@ -2963,9 +2727,10 @@ var gDetailView = { gCategories.select("addons://list/" + aAddon.type); document.getElementById("detail-name").textContent = aAddon.name; - var icon = AddonManager.getPreferredIconURL(aAddon, 64, window); + var icon = aAddon.icon64URL ? aAddon.icon64URL : aAddon.iconURL; document.getElementById("detail-icon").src = icon ? icon : ""; document.getElementById("detail-creator").setCreator(aAddon.creator, aAddon.homepageURL); + document.getElementById("detail-translators").setTranslators(aAddon.translators, aAddon.type); var version = document.getElementById("detail-version"); if (shouldShowVersionNumber(aAddon)) { @@ -2975,7 +2740,6 @@ var gDetailView = { version.hidden = true; } - var screenshotbox = document.getElementById("detail-screenshot-box"); var screenshot = document.getElementById("detail-screenshot"); if (aAddon.screenshots && aAddon.screenshots.length > 0) { if (aAddon.screenshots[0].thumbnailURL) { @@ -2988,9 +2752,9 @@ var gDetailView = { screenshot.height = aAddon.screenshots[0].height; } screenshot.setAttribute("loading", "true"); - screenshotbox.hidden = false; + screenshot.hidden = false; } else { - screenshotbox.hidden = true; + screenshot.hidden = true; } var desc = document.getElementById("detail-desc"); @@ -3103,7 +2867,7 @@ var gDetailView = { downloadsRow.value = null; } - var canUpdate = !aIsRemote && hasPermission(aAddon, "upgrade") && aAddon.id != AddonManager.hotfixID; + var canUpdate = !aIsRemote && hasPermission(aAddon, "upgrade"); document.getElementById("detail-updates-row").hidden = !canUpdate; if ("applyBackgroundUpdates" in aAddon) { @@ -3130,41 +2894,13 @@ var gDetailView = { } } - if (this._addon.type == "experiment") { - let prefix = "details.experiment."; - let active = this._addon.isActive; - - let stateKey = prefix + "state." + (active ? "active" : "complete"); - let node = document.getElementById("detail-experiment-state"); - node.value = gStrings.ext.GetStringFromName(stateKey); - - let now = Date.now(); - let end = getExperimentEndDate(this._addon); - let days = Math.abs(end - now) / (24 * 60 * 60 * 1000); - - let timeKey = prefix + "time."; - let timeMessage; - if (days < 1) { - timeKey += (active ? "endsToday" : "endedToday"); - timeMessage = gStrings.ext.GetStringFromName(timeKey); - } else { - timeKey += (active ? "daysRemaining" : "daysPassed"); - days = Math.round(days); - let timeString = gStrings.ext.GetStringFromName(timeKey); - timeMessage = PluralForm.get(days, timeString) - .replace("#1", days); - } - - document.getElementById("detail-experiment-time").value = timeMessage; - } - - this.fillSettingsRows(aScrollToPreferences, (function() { + this.fillSettingsRows(aScrollToPreferences, (function updateView_fillSettingsRows() { this.updateState(); gViewController.notifyViewChanged(); }).bind(this)); }, - show: function(aAddonId, aRequest) { + show: function gDetailView_show(aAddonId, aRequest) { let index = aAddonId.indexOf("/preferences"); let scrollToPreferences = false; if (index >= 0) { @@ -3172,33 +2908,34 @@ var gDetailView = { scrollToPreferences = true; } - this._loadingTimer = setTimeout(() => { - this.node.setAttribute("loading-extended", true); + var self = this; + this._loadingTimer = setTimeout(function loadTimeOutTimer() { + self.node.setAttribute("loading-extended", true); }, LOADING_MSG_DELAY); var view = gViewController.currentViewId; - AddonManager.getAddonByID(aAddonId, (aAddon) => { + AddonManager.getAddonByID(aAddonId, function show_getAddonByID(aAddon) { if (gViewController && aRequest != gViewController.currentViewRequest) return; if (aAddon) { - this._updateView(aAddon, false, scrollToPreferences); + self._updateView(aAddon, false, scrollToPreferences); return; } // Look for an add-on pending install - AddonManager.getAllInstalls(aInstalls => { + AddonManager.getAllInstalls(function show_getAllInstalls(aInstalls) { for (let install of aInstalls) { if (install.state == AddonManager.STATE_INSTALLED && install.addon.id == aAddonId) { - this._updateView(install.addon, false); + self._updateView(install.addon, false); return; } } if (aAddonId in gCachedAddons) { - this._updateView(gCachedAddons[aAddonId], true); + self._updateView(gCachedAddons[aAddonId], true); return; } @@ -3210,7 +2947,7 @@ var gDetailView = { }); }, - hide: function() { + hide: function gDetailView_hide() { AddonManager.removeManagerListener(this); this.clearLoading(); if (this._addon) { @@ -3230,14 +2967,14 @@ var gDetailView = { } }, - updateState: function() { + updateState: function gDetailView_updateState() { gViewController.updateCommands(); var pending = this._addon.pendingOperations; if (pending != AddonManager.PENDING_NONE) { this.node.removeAttribute("notification"); - pending = null; + var pending = null; const PENDING_OPERATIONS = ["enable", "disable", "install", "uninstall", "upgrade"]; for (let op of PENDING_OPERATIONS) { @@ -3263,15 +3000,6 @@ var gDetailView = { errorLink.value = gStrings.ext.GetStringFromName("details.notification.blocked.link"); errorLink.href = this._addon.blocklistURL; errorLink.hidden = false; - } else if (!isCorrectlySigned(this._addon) && SIGNING_REQUIRED) { - this.node.setAttribute("notification", "error"); - document.getElementById("detail-error").textContent = gStrings.ext.formatStringFromName( - "details.notification.unsignedAndDisabled", [this._addon.name, gStrings.brandShortName], 2 - ); - let errorLink = document.getElementById("detail-error-link"); - errorLink.value = gStrings.ext.GetStringFromName("details.notification.unsigned.link"); - errorLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons"; - errorLink.hidden = false; } else if (!this._addon.isCompatible && (AddonManager.checkCompatibility || (this._addon.blocklistState != Ci.nsIBlocklistService.STATE_SOFTBLOCKED))) { this.node.setAttribute("notification", "warning"); @@ -3280,22 +3008,13 @@ var gDetailView = { [this._addon.name, gStrings.brandShortName, gStrings.appVersion], 3 ); document.getElementById("detail-warning-link").hidden = true; - } else if (!isCorrectlySigned(this._addon)) { - this.node.setAttribute("notification", "warning"); - document.getElementById("detail-warning").textContent = gStrings.ext.formatStringFromName( - "details.notification.unsigned", [this._addon.name, gStrings.brandShortName], 2 - ); - var warningLink = document.getElementById("detail-warning-link"); - warningLink.value = gStrings.ext.GetStringFromName("details.notification.unsigned.link"); - warningLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons"; - warningLink.hidden = false; } else if (this._addon.blocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED) { this.node.setAttribute("notification", "warning"); document.getElementById("detail-warning").textContent = gStrings.ext.formatStringFromName( "details.notification.softblocked", [this._addon.name], 1 ); - let warningLink = document.getElementById("detail-warning-link"); + var warningLink = document.getElementById("detail-warning-link"); warningLink.value = gStrings.ext.GetStringFromName("details.notification.softblocked.link"); warningLink.href = this._addon.blocklistURL; warningLink.hidden = false; @@ -3305,9 +3024,9 @@ var gDetailView = { "details.notification.outdated", [this._addon.name], 1 ); - let warningLink = document.getElementById("detail-warning-link"); + var warningLink = document.getElementById("detail-warning-link"); warningLink.value = gStrings.ext.GetStringFromName("details.notification.outdated.link"); - warningLink.href = this._addon.blocklistURL; + warningLink.href = Services.urlFormatter.formatURLPref("plugins.update.url"); warningLink.hidden = false; } else if (this._addon.blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE) { this.node.setAttribute("notification", "error"); @@ -3315,7 +3034,7 @@ var gDetailView = { "details.notification.vulnerableUpdatable", [this._addon.name], 1 ); - let errorLink = document.getElementById("detail-error-link"); + var errorLink = document.getElementById("detail-error-link"); errorLink.value = gStrings.ext.GetStringFromName("details.notification.vulnerableUpdatable.link"); errorLink.href = this._addon.blocklistURL; errorLink.hidden = false; @@ -3325,7 +3044,7 @@ var gDetailView = { "details.notification.vulnerableNoUpdate", [this._addon.name], 1 ); - let errorLink = document.getElementById("detail-error-link"); + var errorLink = document.getElementById("detail-error-link"); errorLink.value = gStrings.ext.GetStringFromName("details.notification.vulnerableNoUpdate.link"); errorLink.href = this._addon.blocklistURL; errorLink.hidden = false; @@ -3368,7 +3087,7 @@ var gDetailView = { this.node.setAttribute("active", this._addon.isActive); }, - clearLoading: function() { + clearLoading: function gDetailView_clearLoading() { if (this._loadingTimer) { clearTimeout(this._loadingTimer); this._loadingTimer = null; @@ -3377,14 +3096,14 @@ var gDetailView = { this.node.removeAttribute("loading-extended"); }, - emptySettingsRows: function() { + emptySettingsRows: function gDetailView_emptySettingsRows() { var lastRow = document.getElementById("detail-downloads"); var rows = lastRow.parentNode; while (lastRow.nextSibling) rows.removeChild(rows.lastChild); }, - fillSettingsRows: function(aScrollToPreferences, aCallback) { + fillSettingsRows: function gDetailView_fillSettingsRows(aScrollToPreferences, aCallback) { this.emptySettingsRows(); if (!hasInlineOptions(this._addon)) { if (aCallback) @@ -3392,34 +3111,6 @@ var gDetailView = { return; } - // We can't use a promise for this, since some code (especially in tests) - // relies on us finishing before the ViewChanged event bubbles up to its - // listeners, and promises resolve asynchronously. - let whenViewLoaded = callback => { - if (gViewController.displayedView.hasAttribute("loading")) { - gDetailView.node.addEventListener("ViewChanged", function viewChangedEventListener() { - gDetailView.node.removeEventListener("ViewChanged", viewChangedEventListener); - callback(); - }); - } else { - callback(); - } - }; - - let finish = (firstSetting) => { - // Ensure the page has loaded and force the XBL bindings to be synchronously applied, - // then notify observers. - whenViewLoaded(() => { - if (firstSetting) - firstSetting.clientTop; - Services.obs.notifyObservers(document, - AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, - this._addon.id); - if (aScrollToPreferences) - gDetailView.scrollToPreferencesRows(); - }); - } - // This function removes and returns the text content of aNode without // removing any child elements. Removing the text nodes ensures any XBL // bindings apply properly. @@ -3439,77 +3130,79 @@ var gDetailView = { var rows = document.getElementById("detail-downloads").parentNode; try { - if (this._addon.optionsType == AddonManager.OPTIONS_TYPE_INLINE_BROWSER) { - whenViewLoaded(() => { - this.createOptionsBrowser(rows).then(browser => { - // Make sure the browser is unloaded as soon as we change views, - // rather than waiting for the next detail view to load. - document.addEventListener("ViewChanged", function viewChangedEventListener() { - document.removeEventListener("ViewChanged", viewChangedEventListener); - browser.remove(); - }); - - finish(browser); - }); - }); - - if (aCallback) - aCallback(); - } else { - var xhr = new XMLHttpRequest(); - xhr.open("GET", this._addon.optionsURL, true); - xhr.responseType = "xml"; - xhr.onload = (function() { - var xml = xhr.responseXML; - var settings = xml.querySelectorAll(":root > setting"); - - var firstSetting = null; - for (var setting of settings) { - - var desc = stripTextNodes(setting).trim(); - if (!setting.hasAttribute("desc")) - setting.setAttribute("desc", desc); - - var type = setting.getAttribute("type"); - if (type == "file" || type == "directory") - setting.setAttribute("fullpath", "true"); - - setting = document.importNode(setting, true); - var style = setting.getAttribute("style"); - if (style) { - setting.removeAttribute("style"); - setting.setAttribute("style", style); - } - - rows.appendChild(setting); - var visible = window.getComputedStyle(setting, null).getPropertyValue("display") != "none"; - if (!firstSetting && visible) { - setting.setAttribute("first-row", true); - firstSetting = setting; - } + var xhr = new XMLHttpRequest(); + xhr.open("GET", this._addon.optionsURL, true); + xhr.responseType = "xml"; + xhr.onload = (function fillSettingsRows_onload() { + var xml = xhr.responseXML; + var settings = xml.querySelectorAll(":root > setting"); + + var firstSetting = null; + for (var setting of settings) { + + var desc = stripTextNodes(setting).trim(); + if (!setting.hasAttribute("desc")) + setting.setAttribute("desc", desc); + + var type = setting.getAttribute("type"); + if (type == "file" || type == "directory") + setting.setAttribute("fullpath", "true"); + + setting = document.importNode(setting, true); + var style = setting.getAttribute("style"); + if (style) { + setting.removeAttribute("style"); + setting.setAttribute("style", style); } - finish(firstSetting); + rows.appendChild(setting); + var visible = window.getComputedStyle(setting, null).getPropertyValue("display") != "none"; + if (!firstSetting && visible) { + setting.setAttribute("first-row", true); + firstSetting = setting; + } + } - if (aCallback) - aCallback(); - }).bind(this); - xhr.onerror = function(aEvent) { - Cu.reportError("Error " + aEvent.target.status + - " occurred while receiving " + this._addon.optionsURL); - if (aCallback) - aCallback(); - }; - xhr.send(); - } - } catch (e) { + // Ensure the page has loaded and force the XBL bindings to be synchronously applied, + // then notify observers. + if (gViewController.viewPort.selectedPanel.hasAttribute("loading")) { + gDetailView.node.addEventListener("ViewChanged", function viewChangedEventListener() { + gDetailView.node.removeEventListener("ViewChanged", viewChangedEventListener, false); + if (firstSetting) + firstSetting.clientTop; + Services.obs.notifyObservers(document, + AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, + gDetailView._addon.id); + if (aScrollToPreferences) + gDetailView.scrollToPreferencesRows(); + }, false); + } else { + if (firstSetting) + firstSetting.clientTop; + Services.obs.notifyObservers(document, + AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, + this._addon.id); + if (aScrollToPreferences) + gDetailView.scrollToPreferencesRows(); + } + if (aCallback) + aCallback(); + }).bind(this); + xhr.onerror = function fillSettingsRows_onerror(aEvent) { + Cu.reportError("Error " + aEvent.target.status + + " occurred while receiving " + this._addon.optionsURL); + if (aCallback) + aCallback(); + }; + xhr.send(); + } catch(e) { Cu.reportError(e); if (aCallback) aCallback(); } }, - scrollToPreferencesRows: function() { + scrollToPreferencesRows: function gDetailView_scrollToPreferencesRows() { // We find this row, rather than remembering it from above, // in case it has been changed by the observers. let firstRow = gDetailView.node.querySelector('setting[first-row="true"]'); @@ -3524,55 +3217,20 @@ var gDetailView = { } }, - createOptionsBrowser: function(parentNode) { - let browser = document.createElement("browser"); - browser.setAttribute("type", "content"); - browser.setAttribute("disableglobalhistory", "true"); - browser.setAttribute("class", "inline-options-browser"); - - return new Promise((resolve, reject) => { - let messageListener = { - receiveMessage({name, data}) { - if (name === "Extension:BrowserResized") - browser.style.height = `${data.height}px`; - else if (name === "Extension:BrowserContentLoaded") - resolve(browser); - }, - }; - - let onload = () => { - browser.removeEventListener("load", onload, true); - - let mm = new FakeFrameMessageManager(browser); - mm.loadFrameScript("chrome://extensions/content/ext-browser-content.js", - false); - mm.addMessageListener("Extension:BrowserContentLoaded", messageListener); - mm.addMessageListener("Extension:BrowserResized", messageListener); - mm.sendAsyncMessage("Extension:InitBrowser", {fixedWidth: true}); - - browser.setAttribute("src", this._addon.optionsURL); - }; - browser.addEventListener("load", onload, true); - browser.addEventListener("error", reject); - - parentNode.appendChild(browser); - }); - }, - - getSelectedAddon: function() { + getSelectedAddon: function gDetailView_getSelectedAddon() { return this._addon; }, - onEnabling: function() { + onEnabling: function gDetailView_onEnabling() { this.updateState(); }, - onEnabled: function() { + onEnabled: function gDetailView_onEnabled() { this.updateState(); this.fillSettingsRows(); }, - onDisabling: function(aNeedsRestart) { + onDisabling: function gDetailView_onDisabling(aNeedsRestart) { this.updateState(); if (!aNeedsRestart && hasInlineOptions(this._addon)) { Services.obs.notifyObservers(document, @@ -3581,24 +3239,24 @@ var gDetailView = { } }, - onDisabled: function() { + onDisabled: function gDetailView_onDisabled() { this.updateState(); this.emptySettingsRows(); }, - onUninstalling: function() { + onUninstalling: function gDetailView_onUninstalling() { this.updateState(); }, - onUninstalled: function() { + onUninstalled: function gDetailView_onUninstalled() { gViewController.popState(); }, - onOperationCancelled: function() { + onOperationCancelled: function gDetailView_onOperationCancelled() { this.updateState(); }, - onPropertyChanged: function(aProperties) { + onPropertyChanged: function gDetailView_onPropertyChanged(aProperties) { if (aProperties.indexOf("applyBackgroundUpdates") != -1) { this._autoUpdate.value = this._addon.applyBackgroundUpdates; let hideFindUpdates = AddonManager.shouldAutoUpdate(this._addon); @@ -3606,12 +3264,11 @@ var gDetailView = { } if (aProperties.indexOf("appDisabled") != -1 || - aProperties.indexOf("signedState") != -1 || aProperties.indexOf("userDisabled") != -1) this.updateState(); }, - onExternalInstall: function(aAddon, aExistingAddon, aNeedsRestart) { + onExternalInstall: function gDetailView_onExternalInstall(aAddon, aExistingAddon, aNeedsRestart) { // Only care about upgrades for the currently displayed add-on if (!aExistingAddon || aExistingAddon.id != this._addon.id) return; @@ -3622,7 +3279,7 @@ var gDetailView = { this.updateState(); }, - onInstallCancelled: function(aInstall) { + onInstallCancelled: function gDetailView_onInstallCancelled(aInstall) { if (aInstall.addon.id == this._addon.id) gViewController.popState(); } @@ -3637,7 +3294,7 @@ var gUpdatesView = { _updateSelected: null, _categoryItem: null, - initialize: function() { + initialize: function gUpdatesView_initialize() { this.node = document.getElementById("updates-view"); this._listBox = document.getElementById("updates-list"); this._emptyNotice = document.getElementById("updates-list-empty"); @@ -3647,7 +3304,7 @@ var gUpdatesView = { this._categoryItem = gCategories.get("addons://updates/available"); this._updateSelected = document.getElementById("update-selected-btn"); - this._updateSelected.addEventListener("command", function() { + this._updateSelected.addEventListener("command", function updateSelected_onCommand() { gUpdatesView.installSelected(); }, false); @@ -3657,12 +3314,12 @@ var gUpdatesView = { AddonManager.addInstallListener(this); }, - shutdown: function() { + shutdown: function gUpdatesView_shutdown() { AddonManager.removeAddonListener(this); AddonManager.removeInstallListener(this); }, - show: function(aType, aRequest) { + show: function gUpdatesView_show(aType, aRequest) { document.getElementById("empty-availableUpdates-msg").hidden = aType != "available"; document.getElementById("empty-recentUpdates-msg").hidden = aType != "recent"; this.showEmptyNotice(false); @@ -3677,91 +3334,92 @@ var gUpdatesView = { this._showAvailableUpdates(false, aRequest); }, - hide: function() { + hide: function gUpdatesView_hide() { this._updateSelected.hidden = true; this._categoryItem.disabled = this._categoryItem.badgeCount == 0; doPendingUninstalls(this._listBox); }, - _showRecentUpdates: function(aRequest) { - AddonManager.getAllAddons((aAddonsList) => { + _showRecentUpdates: function gUpdatesView_showRecentUpdates(aRequest) { + var self = this; + AddonManager.getAllAddons(function showRecentUpdates_getAllAddons(aAddonsList) { if (gViewController && aRequest != gViewController.currentViewRequest) return; var elements = []; let threshold = Date.now() - UPDATES_RECENT_TIMESPAN; for (let addon of aAddonsList) { - if (addon.hidden || !addon.updateDate || addon.updateDate.getTime() < threshold) + if (!addon.updateDate || addon.updateDate.getTime() < threshold) continue; elements.push(createItem(addon)); } - this.showEmptyNotice(elements.length == 0); + self.showEmptyNotice(elements.length == 0); if (elements.length > 0) { - sortElements(elements, [this._sorters.sortBy], this._sorters.ascending); + sortElements(elements, [self._sorters.sortBy], self._sorters.ascending); for (let element of elements) - this._listBox.appendChild(element); + self._listBox.appendChild(element); } gViewController.notifyViewChanged(); }); }, - _showAvailableUpdates: function(aIsRefresh, aRequest) { + _showAvailableUpdates: function gUpdatesView_showAvailableUpdates(aIsRefresh, aRequest) { /* Disable the Update Selected button so it can't get clicked before everything is initialized asynchronously. It will get re-enabled by maybeDisableUpdateSelected(). */ this._updateSelected.disabled = true; - AddonManager.getAllInstalls((aInstallsList) => { + var self = this; + AddonManager.getAllInstalls(function showAvailableUpdates_getAllInstalls(aInstallsList) { if (!aIsRefresh && gViewController && aRequest && aRequest != gViewController.currentViewRequest) return; if (aIsRefresh) { - this.showEmptyNotice(false); - this._updateSelected.hidden = true; + self.showEmptyNotice(false); + self._updateSelected.hidden = true; - while (this._listBox.childNodes.length > 0) - this._listBox.removeChild(this._listBox.firstChild); + while (self._listBox.itemCount > 0) + self._listBox.removeItemAt(0); } var elements = []; for (let install of aInstallsList) { - if (!this.isManualUpdate(install)) + if (!self.isManualUpdate(install)) continue; let item = createItem(install.existingAddon); item.setAttribute("upgrade", true); - item.addEventListener("IncludeUpdateChanged", () => { - this.maybeDisableUpdateSelected(); + item.addEventListener("IncludeUpdateChanged", function item_onIncludeUpdateChanged() { + self.maybeDisableUpdateSelected(); }, false); elements.push(item); } - this.showEmptyNotice(elements.length == 0); + self.showEmptyNotice(elements.length == 0); if (elements.length > 0) { - this._updateSelected.hidden = false; - sortElements(elements, [this._sorters.sortBy], this._sorters.ascending); + self._updateSelected.hidden = false; + sortElements(elements, [self._sorters.sortBy], self._sorters.ascending); for (let element of elements) - this._listBox.appendChild(element); + self._listBox.appendChild(element); } // ensure badge count is in sync - this._categoryItem.badgeCount = this._listBox.itemCount; + self._categoryItem.badgeCount = self._listBox.itemCount; gViewController.notifyViewChanged(); }); }, - showEmptyNotice: function(aShow) { + showEmptyNotice: function gUpdatesView_showEmptyNotice(aShow) { this._emptyNotice.hidden = !aShow; - this._listBox.hidden = aShow; }, - isManualUpdate: function(aInstall, aOnlyAvailable) { + isManualUpdate: function gUpdatesView_isManualUpdate(aInstall, aOnlyAvailable) { var isManual = aInstall.existingAddon && !AddonManager.shouldAutoUpdate(aInstall.existingAddon); if (isManual && aOnlyAvailable) @@ -3769,28 +3427,29 @@ var gUpdatesView = { return isManual; }, - maybeRefresh: function() { + maybeRefresh: function gUpdatesView_maybeRefresh() { if (gViewController.currentViewId == "addons://updates/available") this._showAvailableUpdates(true); this.updateAvailableCount(); }, - updateAvailableCount: function(aInitializing) { + updateAvailableCount: function gUpdatesView_updateAvailableCount(aInitializing) { if (aInitializing) gPendingInitializations++; - AddonManager.getAllInstalls((aInstallsList) => { - var count = aInstallsList.filter(aInstall => { - return this.isManualUpdate(aInstall, true); + var self = this; + AddonManager.getAllInstalls(function updateAvailableCount_getAllInstalls(aInstallsList) { + var count = aInstallsList.filter(function installListFilter(aInstall) { + return self.isManualUpdate(aInstall, true); }).length; - this._categoryItem.disabled = gViewController.currentViewId != "addons://updates/available" && + self._categoryItem.disabled = gViewController.currentViewId != "addons://updates/available" && count == 0; - this._categoryItem.badgeCount = count; + self._categoryItem.badgeCount = count; if (aInitializing) notifyInitialized(); }); }, - maybeDisableUpdateSelected: function() { + maybeDisableUpdateSelected: function gUpdatesView_maybeDisableUpdateSelected() { for (let item of this._listBox.childNodes) { if (item.includeUpdate) { this._updateSelected.disabled = false; @@ -3800,7 +3459,7 @@ var gUpdatesView = { this._updateSelected.disabled = true; }, - installSelected: function() { + installSelected: function gUpdatesView_installSelected() { for (let item of this._listBox.childNodes) { if (item.includeUpdate) item.upgrade(); @@ -3809,14 +3468,14 @@ var gUpdatesView = { this._updateSelected.disabled = true; }, - getSelectedAddon: function() { + getSelectedAddon: function gUpdatesView_getSelectedAddon() { var item = this._listBox.selectedItem; if (item) return item.mAddon; return null; }, - getListItemForID: function(aId) { + getListItemForID: function gUpdatesView_getListItemForID(aId) { var listitem = this._listBox.firstChild; while (listitem) { if (listitem.mAddon.id == aId) @@ -3826,42 +3485,48 @@ var gUpdatesView = { return null; }, - onSortChanged: function(aSortBy, aAscending) { + onSortChanged: function gUpdatesView_onSortChanged(aSortBy, aAscending) { sortList(this._listBox, aSortBy, aAscending); }, - onNewInstall: function(aInstall) { + onNewInstall: function gUpdatesView_onNewInstall(aInstall) { if (!this.isManualUpdate(aInstall)) return; this.maybeRefresh(); }, - onInstallStarted: function(aInstall) { + onInstallStarted: function gUpdatesView_onInstallStarted(aInstall) { this.updateAvailableCount(); }, - onInstallCancelled: function(aInstall) { + onInstallCancelled: function gUpdatesView_onInstallCancelled(aInstall) { if (!this.isManualUpdate(aInstall)) return; this.maybeRefresh(); }, - onPropertyChanged: function(aAddon, aProperties) { + onPropertyChanged: function gUpdatesView_onPropertyChanged(aAddon, aProperties) { if (aProperties.indexOf("applyBackgroundUpdates") != -1) this.updateAvailableCount(); } }; +function debuggingPrefChanged() { + gViewController.updateState(); + gViewController.updateCommands(); + gViewController.notifyViewChanged(); +} + var gDragDrop = { - onDragOver: function(aEvent) { + onDragOver: function gDragDrop_onDragOver(aEvent) { var types = aEvent.dataTransfer.types; - if (types.includes("text/uri-list") || - types.includes("text/x-moz-url") || - types.includes("application/x-moz-file")) + if (types.contains("text/uri-list") || + types.contains("text/x-moz-url") || + types.contains("application/x-moz-file")) aEvent.preventDefault(); }, - onDrop: function(aEvent) { + onDrop: function gDragDrop_onDrop(aEvent) { var dataTransfer = aEvent.dataTransfer; var urls = []; @@ -3897,12 +3562,12 @@ var gDragDrop = { getService(Ci.amIWebInstallListener); webInstaller.onWebInstallRequested(getBrowserElement(), document.documentURIObject, - installs); + installs, installs.length); } return; } - AddonManager.getInstallForURL(urls[pos++], function(aInstall) { + AddonManager.getInstallForURL(urls[pos++], function onDrop_getInstallForURL(aInstall) { installs.push(aInstall); buildNextInstall(); }, "application/x-xpinstall"); diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml index b49645cf0..fab340540 100644 --- a/toolkit/mozapps/extensions/content/extensions.xml +++ b/toolkit/mozapps/extensions/content/extensions.xml @@ -7,10 +7,10 @@ <!DOCTYPE page [ <!ENTITY % extensionsDTD SYSTEM "chrome://mozapps/locale/extensions/extensions.dtd"> %extensionsDTD; +<!ENTITY % aboutDTD SYSTEM "chrome://mozapps/locale/extensions/about.dtd"> +%aboutDTD; ]> -<!-- import-globals-from extensions.js --> - <bindings id="addonBindings" xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" @@ -489,6 +489,52 @@ </binding> + <!-- Translators list - Names of a translators of Language Pack. --> + <binding id="translators-list"> + <content> + <xul:label anonid="label" value="&translators.label;" class="sectionTitle"/> + <xul:vbox flex="1" anonid="translatorsBox" class="boxIndent"/> + </content> + + <implementation> + <constructor><![CDATA[ + if (this.hasAttribute("nameonly") && + this.getAttribute("nameonly") == "true") { + this._label.hidden = true; + } + ]]></constructor> + + <field name="_label"> + document.getAnonymousElementByAttribute(this, "anonid", "label"); + </field> + <field name="_translatorsBox"> + document.getAnonymousElementByAttribute(this, "anonid", "translatorsBox"); + </field> + + <method name="setTranslators"> + <parameter name="aTranslators"/> + <parameter name="aType"/> + <body><![CDATA[ + if (aType != "locale" || !aTranslators || aTranslators.length == 0) { + this.collapsed = true; + return; + } + this.collapsed = false; + while (this._translatorsBox.firstChild) { + this._translatorsBox.removeChild(this._translatorsBox.firstChild); + } + for (let currentItem of aTranslators) { + var label = document.createElement("label"); + label.textContent = currentItem; + label.setAttribute("class", "contributor"); + this._translatorsBox.appendChild(label); + } + ]]></body> + </method> + </implementation> + </binding> + + <!-- Install status - Displays the status of an install/upgrade. --> <binding id="install-status"> <content> @@ -739,14 +785,6 @@ ]]></body> </method> - <method name="isPending"> - <parameter name="aAction"/> - <body><![CDATA[ - var action = AddonManager["PENDING_" + aAction.toUpperCase()]; - return !!(this.mAddon.pendingOperations & action); - ]]></body> - </method> - <method name="typeHasFlag"> <parameter name="aFlag"/> <body><![CDATA[ @@ -757,6 +795,14 @@ ]]></body> </method> + <method name="isPending"> + <parameter name="aAction"/> + <body><![CDATA[ + var action = AddonManager["PENDING_" + aAction.toUpperCase()]; + return !!(this.mAddon.pendingOperations & action); + ]]></body> + </method> + <method name="onUninstalled"> <body><![CDATA[ this.parentNode.removeChild(this); @@ -775,14 +821,14 @@ <xul:image class="warning-icon"/> <xul:label anonid="warning" flex="1"/> <xul:label anonid="warning-link" class="text-link"/> - <xul:button anonid="warning-btn" class="button-link" hidden="true"/> + <xul:button anonid="warning-btn" class="button-link"/> <xul:spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> </xul:hbox> <xul:hbox anonid="error-container" class="error"> <xul:image class="error-icon"/> <xul:label anonid="error" flex="1"/> - <xul:label anonid="error-link" class="text-link" hidden="true"/> + <xul:label anonid="error-link" class="text-link"/> <xul:spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> </xul:hbox> <xul:hbox anonid="pending-container" @@ -799,7 +845,7 @@ <xul:spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> </xul:hbox> - <xul:hbox class="content-container" align="center"> + <xul:hbox class="content-container"> <xul:vbox class="icon-container"> <xul:image anonid="icon" class="icon"/> </xul:vbox> @@ -807,7 +853,10 @@ <xul:hbox class="basicinfo-container"> <xul:hbox class="name-container"> <xul:label anonid="name" class="name" crop="end" flex="1" - tooltip="addonitem-tooltip" xbl:inherits="value=name"/> + xbl:inherits="value=name,tooltiptext=name"/> + <xul:label anonid="version" class="version"/> + <xul:label class="nativeIndicator nativeAddon" value="●" tooltiptext="&addon.nativeAddon;"/> + <xul:label class="nativeIndicator compatAddon" value="●" tooltiptext="&addon.compatAddon;"/> <xul:label class="disabled-postfix" value="&addon.disabled.postfix;"/> <xul:label class="update-postfix" value="&addon.update.postfix;"/> <xul:spacer flex="5000"/> <!-- Necessary to make the name crop --> @@ -853,72 +902,77 @@ oncommand="document.getBindingParent(this).toggleReleaseNotes();"/> </xul:hbox> </xul:vbox> - </xul:hbox> - </xul:vbox> - <xul:vbox class="status-control-wrapper"> - <xul:hbox class="status-container"> - <xul:hbox anonid="checking-update" hidden="true"> - <xul:image class="spinner"/> - <xul:label value="&addon.checkingForUpdates.label;"/> - </xul:hbox> - <xul:vbox anonid="update-available" class="update-available" - hidden="true"> - <xul:checkbox anonid="include-update" class="include-update" - label="&addon.includeUpdate.label;" checked="true" - oncommand="document.getBindingParent(this).onIncludeUpdateChanged();"/> - <xul:hbox class="update-info-container"> - <xul:label class="update-available-notice" - value="&addon.updateAvailable.label;"/> - <xul:button anonid="update-btn" class="addon-control update" - label="&addon.updateNow.label;" - tooltiptext="&addon.updateNow.tooltip;" - oncommand="document.getBindingParent(this).upgrade();"/> + <xul:vbox class="status-control-wrapper"> + <xul:hbox class="status-container"> + <xul:hbox anonid="checking-update" hidden="true"> + <xul:image class="spinner"/> + <xul:label value="&addon.checkingForUpdates.label;"/> + </xul:hbox> + <xul:vbox anonid="update-available" class="update-available" + hidden="true"> + <xul:checkbox anonid="include-update" class="include-update" + label="&addon.includeUpdate.label;" checked="true" + oncommand="document.getBindingParent(this).onIncludeUpdateChanged();"/> + <xul:hbox class="update-info-container"> + <xul:label class="update-available-notice" + value="&addon.updateAvailable.label;"/> + <xul:button anonid="update-btn" class="addon-control update" + label="&addon.updateNow.label;" + tooltiptext="&addon.updateNow.tooltip;" + oncommand="document.getBindingParent(this).upgrade();"/> + </xul:hbox> + </xul:vbox> + <xul:hbox anonid="install-status" class="install-status" + hidden="true"/> </xul:hbox> - </xul:vbox> - <xul:hbox anonid="install-status" class="install-status" - hidden="true"/> - </xul:hbox> - <xul:hbox anonid="control-container" class="control-container"> - <xul:button anonid="preferences-btn" - class="addon-control preferences" + <xul:hbox anonid="control-container" class="control-container"> + <xul:button anonid="preferences-btn" + class="addon-control preferences" #ifdef XP_WIN - label="&cmd.showPreferencesWin.label;" - tooltiptext="&cmd.showPreferencesWin.tooltip;" + label="&cmd.showPreferencesWin.label;" + tooltiptext="&cmd.showPreferencesWin.tooltip;" #else - label="&cmd.showPreferencesUnix.label;" - tooltiptext="&cmd.showPreferencesUnix.tooltip;" + label="&cmd.showPreferencesUnix.label;" + tooltiptext="&cmd.showPreferencesUnix.tooltip;" #endif - oncommand="document.getBindingParent(this).showPreferences();"/> - <xul:button anonid="enable-btn" class="addon-control enable" - label="&cmd.enableAddon.label;" - oncommand="document.getBindingParent(this).userDisabled = false;"/> - <xul:button anonid="disable-btn" class="addon-control disable" - label="&cmd.disableAddon.label;" - oncommand="document.getBindingParent(this).userDisabled = true;"/> - <xul:button anonid="remove-btn" class="addon-control remove" - label="&cmd.uninstallAddon.label;" - oncommand="document.getBindingParent(this).uninstall();"/> - <xul:menulist anonid="state-menulist" - class="addon-control state" - tooltiptext="&cmd.stateMenu.tooltip;"> - <xul:menupopup> - <xul:menuitem anonid="ask-to-activate-menuitem" - class="addon-control" - label="&cmd.askToActivate.label;" - tooltiptext="&cmd.askToActivate.tooltip;" - oncommand="document.getBindingParent(this).userDisabled = AddonManager.STATE_ASK_TO_ACTIVATE;"/> - <xul:menuitem anonid="always-activate-menuitem" - class="addon-control" - label="&cmd.alwaysActivate.label;" - tooltiptext="&cmd.alwaysActivate.tooltip;" - oncommand="document.getBindingParent(this).userDisabled = false;"/> - <xul:menuitem anonid="never-activate-menuitem" - class="addon-control" - label="&cmd.neverActivate.label;" - tooltiptext="&cmd.neverActivate.tooltip;" - oncommand="document.getBindingParent(this).userDisabled = true;"/> - </xul:menupopup> - </xul:menulist> + oncommand="document.getBindingParent(this).showPreferences();"/> + <!-- label="&cmd.debugAddon.label;" --> + <xul:button anonid="debug-btn" class="addon-control debug" + label="&cmd.debugAddon.label;" + oncommand="document.getBindingParent(this).debug();"/> + + <xul:button anonid="enable-btn" class="addon-control enable" + label="&cmd.enableAddon.label;" + oncommand="document.getBindingParent(this).userDisabled = false;"/> + <xul:button anonid="disable-btn" class="addon-control disable" + label="&cmd.disableAddon.label;" + oncommand="document.getBindingParent(this).userDisabled = true;"/> + <xul:button anonid="remove-btn" class="addon-control remove" + label="&cmd.uninstallAddon.label;" + oncommand="document.getBindingParent(this).uninstall();"/> + <xul:menulist anonid="state-menulist" + class="addon-control state" + tooltiptext="&cmd.stateMenu.tooltip;"> + <xul:menupopup> + <xul:menuitem anonid="ask-to-activate-menuitem" + class="addon-control" + label="&cmd.askToActivate.label;" + tooltiptext="&cmd.askToActivate.tooltip;" + oncommand="document.getBindingParent(this).userDisabled = AddonManager.STATE_ASK_TO_ACTIVATE;"/> + <xul:menuitem anonid="always-activate-menuitem" + class="addon-control" + label="&cmd.alwaysActivate.label;" + tooltiptext="&cmd.alwaysActivate.tooltip;" + oncommand="document.getBindingParent(this).userDisabled = false;"/> + <xul:menuitem anonid="never-activate-menuitem" + class="addon-control" + label="&cmd.neverActivate.label;" + tooltiptext="&cmd.neverActivate.tooltip;" + oncommand="document.getBindingParent(this).userDisabled = true;"/> + </xul:menupopup> + </xul:menulist> + </xul:hbox> + </xul:vbox> </xul:hbox> </xul:vbox> </xul:hbox> @@ -926,7 +980,6 @@ <implementation> <constructor><![CDATA[ - this._installStatus = document.getAnonymousElementByAttribute(this, "anonid", "install-status"); this._installStatus.mControl = this; this.setAttribute("contextmenu", "addonitem-popup"); @@ -986,6 +1039,9 @@ document.getAnonymousElementByAttribute(this, "anonid", "info"); </field> + <field name="_version"> + document.getAnonymousElementByAttribute(this, "anonid", "version"); + </field> <field name="_experimentState"> document.getAnonymousElementByAttribute(this, "anonid", "experiment-state"); </field> @@ -1027,6 +1083,10 @@ document.getAnonymousElementByAttribute(this, "anonid", "enable-btn"); </field> + <field name="_debugBtn"> + document.getAnonymousElementByAttribute(this, "anonid", + "debug-btn"); + </field> <field name="_disableBtn"> document.getAnonymousElementByAttribute(this, "anonid", "disable-btn"); @@ -1095,8 +1155,8 @@ return this._includeUpdate.checked && !!this.mManualUpdate; ]]></getter> <setter><![CDATA[ - // XXXunf Eventually, we'll want to persist this for individual - // updates - see bug 594619. + //XXXunf Eventually, we'll want to persist this for individual + // updates - see bug 594619. this._includeUpdate.checked = !!val; ]]></setter> </property> @@ -1112,12 +1172,17 @@ this.setAttribute("name", aAddon.name); - var iconURL = AddonManager.getPreferredIconURL(aAddon, 48, window); + var iconURL = this.mAddon.iconURL; if (iconURL) this._icon.src = iconURL; else this._icon.src = ""; + if (shouldShowVersionNumber(this.mAddon)) + this._version.value = this.mAddon.version; + else + this._version.hidden = true; + if (this.mAddon.description) this._description.value = this.mAddon.description; else @@ -1127,17 +1192,18 @@ (this.mAddon.applyBackgroundUpdates == AddonManager.AUTOUPDATE_DISABLE || (this.mAddon.applyBackgroundUpdates == AddonManager.AUTOUPDATE_DEFAULT && !AddonManager.autoUpdateDefault))) { - AddonManager.getAllInstalls(aInstallsList => { + var self = this; + AddonManager.getAllInstalls(function(aInstallsList) { // This can return after the binding has been destroyed, // so try to detect that and return early - if (!("onNewInstall" in this)) + if (!("onNewInstall" in self)) return; for (let install of aInstallsList) { if (install.existingAddon && - install.existingAddon.id == this.mAddon.id && + install.existingAddon.id == self.mAddon.id && install.state == AddonManager.STATE_AVAILABLE) { - this.onNewInstall(install); - this.onIncludeUpdateChanged(); + self.onNewInstall(install); + self.onIncludeUpdateChanged(); } } }); @@ -1165,11 +1231,14 @@ <method name="_updateDates"> <body><![CDATA[ function formatDate(aDate) { - const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"] - .getService(Components.interfaces.nsIXULChromeRegistry) - .getSelectedLocale("global", true); - const dtOptions = { year: 'numeric', month: 'long', day: 'numeric' }; - return aDate.toLocaleDateString(locale, dtOptions); + return Cc["@mozilla.org/intl/scriptabledateformat;1"] + .getService(Ci.nsIScriptableDateFormat) + .FormatDate("", + Ci.nsIScriptableDateFormat.dateFormatLong, + aDate.getFullYear(), + aDate.getMonth() + 1, + aDate.getDate() + ); } if (this.mAddon.updateDate) @@ -1188,7 +1257,7 @@ if (pending != AddonManager.PENDING_NONE) { this.removeAttribute("notification"); - pending = null; + var pending = null; const PENDING_OPERATIONS = ["enable", "disable", "install", "uninstall", "upgrade"]; for (let op of PENDING_OPERATIONS) { @@ -1238,14 +1307,6 @@ this._errorLink.value = gStrings.ext.GetStringFromName("notification.blocked.link"); this._errorLink.href = this.mAddon.blocklistURL; this._errorLink.hidden = false; - } else if (!isUpgrade && !isCorrectlySigned(this.mAddon) && SIGNING_REQUIRED) { - this.setAttribute("notification", "error"); - this._error.textContent = gStrings.ext.formatStringFromName( - "notification.unsignedAndDisabled", [this.mAddon.name, gStrings.brandShortName], 2 - ); - this._errorLink.value = gStrings.ext.GetStringFromName("notification.unsigned.link"); - this._errorLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons"; - this._errorLink.hidden = false; } else if ((!isUpgrade && !this.mAddon.isCompatible) && (AddonManager.checkCompatibility || (this.mAddon.blocklistState != Ci.nsIBlocklistService.STATE_SOFTBLOCKED))) { this.setAttribute("notification", "warning"); @@ -1255,14 +1316,6 @@ ); this._warningLink.hidden = true; this._warningBtn.hidden = true; - } else if (!isUpgrade && !isCorrectlySigned(this.mAddon)) { - this.setAttribute("notification", "warning"); - this._warning.textContent = gStrings.ext.formatStringFromName( - "notification.unsigned", [this.mAddon.name, gStrings.brandShortName], 2 - ); - this._warningLink.value = gStrings.ext.GetStringFromName("notification.unsigned.link"); - this._warningLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons"; - this._warningLink.hidden = false; } else if (!isUpgrade && this.mAddon.blocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED) { this.setAttribute("notification", "warning"); this._warning.textContent = gStrings.ext.formatStringFromName( @@ -1280,7 +1333,7 @@ [this.mAddon.name], 1 ); this._warningLink.value = gStrings.ext.GetStringFromName("notification.outdated.link"); - this._warningLink.href = this.mAddon.blocklistURL; + this._warningLink.href = Services.urlFormatter.formatURLPref("plugins.update.url"); this._warningLink.hidden = false; this._warningBtn.hidden = true; } else if (!isUpgrade && this.mAddon.blocklistState == Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE) { @@ -1309,6 +1362,8 @@ [this.mAddon.name], 1); } else { this.removeAttribute("notification"); + if (this.mAddon.type == "extension") + this.setAttribute("native", this.mAddon.native); } } @@ -1335,31 +1390,30 @@ this._stateMenulist.classList.add('no-auto-hide'); } else { this._stateMenulist.hidden = true; - - let enableTooltip = gViewController.commands["cmd_enableItem"] - .getTooltip(this.mAddon); - this._enableBtn.setAttribute("tooltiptext", enableTooltip); if (this.hasPermission("enable")) { this._enableBtn.hidden = false; + let tooltip = gViewController.commands["cmd_enableItem"] + .getTooltip(this.mAddon); + this._enableBtn.setAttribute("tooltiptext", tooltip); } else { this._enableBtn.hidden = true; } - let disableTooltip = gViewController.commands["cmd_disableItem"] - .getTooltip(this.mAddon); - this._disableBtn.setAttribute("tooltiptext", disableTooltip); if (this.hasPermission("disable")) { this._disableBtn.hidden = false; + let tooltip = gViewController.commands["cmd_disableItem"] + .getTooltip(this.mAddon); + this._disableBtn.setAttribute("tooltiptext", tooltip); } else { this._disableBtn.hidden = true; } } - let uninstallTooltip = gViewController.commands["cmd_uninstallItem"] - .getTooltip(this.mAddon); - this._removeBtn.setAttribute("tooltiptext", uninstallTooltip); if (this.hasPermission("uninstall")) { this._removeBtn.hidden = false; + let tooltip = gViewController.commands["cmd_uninstallItem"] + .getTooltip(this.mAddon); + this._removeBtn.setAttribute("tooltiptext", tooltip); } else { this._removeBtn.hidden = true; } @@ -1370,6 +1424,12 @@ this.mAddon.install.state != AddonManager.STATE_INSTALLED); this._showStatus(showProgress ? "progress" : "none"); + let debuggable = this.mAddon.isDebuggable && + Services.prefs.getBoolPref('devtools.chrome.enabled') && + Services.prefs.getBoolPref('devtools.debugger.remote-enabled'); + + this._debugBtn.disabled = this._debugBtn.hidden = !debuggable + if (this.mAddon.type == "experiment") { this.removeAttribute("notification"); let prefix = "experiment."; @@ -1403,9 +1463,18 @@ ]]></body> </method> + <method name="_updateUpgradeInfo"> + <body><![CDATA[ + // Only update the version string if we're displaying the upgrade info + if (this.hasAttribute("upgrade") && shouldShowVersionNumber(this.mAddon)) + this._version.value = this.mManualUpdate.version; + ]]></body> + </method> + <method name="_fetchReleaseNotes"> <parameter name="aURI"/> <body><![CDATA[ + var self = this; if (!aURI || this._relNotesLoaded) { sendToggleEvent(); return; @@ -1417,17 +1486,17 @@ this._relNotesLoading.hidden = false; this._relNotesError.hidden = true; - let sendToggleEvent = () => { + function sendToggleEvent() { var event = document.createEvent("Events"); event.initEvent("RelNotesToggle", true, true); - this.dispatchEvent(event); + self.dispatchEvent(event); } - let showRelNotes = () => { + function showRelNotes() { if (!relNotesData || !transformData) return; - this._relNotesLoading.hidden = true; + self._relNotesLoading.hidden = true; var processor = Components.classes["@mozilla.org/document-transformer;1?type=xslt"] .createInstance(Components.interfaces.nsIXSLTProcessor); @@ -1435,20 +1504,20 @@ processor.importStylesheet(transformData); var fragment = processor.transformToFragment(relNotesData, document); - this._relNotes.appendChild(fragment); - if (this.hasAttribute("show-relnotes")) { - var container = this._relNotesContainer; + self._relNotes.appendChild(fragment); + if (self.hasAttribute("show-relnotes")) { + var container = self._relNotesContainer; container.style.height = container.scrollHeight + "px"; } sendToggleEvent(); } - let handleError = () => { + function handleError() { dataReq.abort(); styleReq.abort(); - this._relNotesLoading.hidden = true; - this._relNotesError.hidden = false; - this._relNotesLoaded = false; // allow loading to be re-tried + self._relNotesLoading.hidden = true; + self._relNotesError.hidden = false; + self._relNotesLoaded = false; // allow loading to be re-tried sendToggleEvent(); } @@ -1471,7 +1540,6 @@ var dataReq = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"] .createInstance(Components.interfaces.nsIXMLHttpRequest); dataReq.open("GET", aURI.spec, true); - dataReq.responseType = "document"; dataReq.addEventListener("load", handleResponse, false); dataReq.addEventListener("error", handleError, false); dataReq.send(null); @@ -1479,7 +1547,6 @@ var styleReq = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"] .createInstance(Components.interfaces.nsIXMLHttpRequest); styleReq.open("GET", UPDATES_RELEASENOTES_TRANSFORMFILE, true); - styleReq.responseType = "document"; styleReq.addEventListener("load", handleResponse, false); styleReq.addEventListener("error", handleError, false); styleReq.send(null); @@ -1555,6 +1622,12 @@ ]]></body> </method> + <method name="debug"> + <body><![CDATA[ + gViewController.doCommand("cmd_debugItem", this.mAddon); + ]]></body> + </method> + <method name="showPreferences"> <body><![CDATA[ gViewController.doCommand("cmd_showItemPreferences", this.mAddon); @@ -1637,7 +1710,6 @@ <parameter name="aProperties"/> <body><![CDATA[ if (aProperties.indexOf("appDisabled") != -1 || - aProperties.indexOf("signedState") != -1 || aProperties.indexOf("userDisabled") != -1) this._updateState(); ]]></body> @@ -1689,6 +1761,7 @@ this.mManualUpdate = aInstall; this._showStatus("update-available"); + this._updateUpgradeInfo(); ]]></body> </method> @@ -1890,7 +1963,8 @@ </xul:vbox> <xul:vbox class="fade name-outer-container" flex="1"> <xul:hbox class="name-container"> - <xul:label anonid="name" class="name" crop="end" tooltip="addonitem-tooltip"/> + <xul:label anonid="name" class="name" crop="end"/> + <xul:label anonid="version" class="version" hidden="true"/> </xul:hbox> </xul:vbox> <xul:vbox class="install-status-container"> @@ -1912,6 +1986,9 @@ <field name="_name"> document.getAnonymousElementByAttribute(this, "anonid", "name"); </field> + <field name="_version"> + document.getAnonymousElementByAttribute(this, "anonid", "version"); + </field> <field name="_warning"> document.getAnonymousElementByAttribute(this, "anonid", "warning"); </field> @@ -1939,6 +2016,14 @@ this._icon.src = this.mAddon.iconURL || (this.mInstall ? this.mInstall.iconURL : ""); this._name.value = this.mAddon.name; + + if (this.mAddon.version) { + this._version.value = this.mAddon.version; + this._version.hidden = false; + } else { + this._version.hidden = true; + } + } else { this._icon.src = this.mInstall.iconURL; // AddonInstall.name isn't always available - fallback to filename @@ -1952,6 +2037,13 @@ url.QueryInterface(Components.interfaces.nsIURL); this._name.value = url.fileName; } + + if (this.mInstall.version) { + this._version.value = this.mInstall.version; + this._version.hidden = false; + } else { + this._version.hidden = true; + } } if (this.mInstall.state == AddonManager.STATE_DOWNLOAD_FAILED) { diff --git a/toolkit/mozapps/extensions/content/extensions.xul b/toolkit/mozapps/extensions/content/extensions.xul index 70939d024..c1a8edc86 100644 --- a/toolkit/mozapps/extensions/content/extensions.xul +++ b/toolkit/mozapps/extensions/content/extensions.xul @@ -6,6 +6,7 @@ <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://mozapps/content/extensions/extensions.css"?> <?xml-stylesheet href="chrome://mozapps/skin/extensions/extensions.css"?> +<?xml-stylesheet href="chrome://mozapps/skin/extensions/about.css"?> <!DOCTYPE page [ <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" > @@ -52,6 +53,8 @@ <menuitem id="menuitem_uninstallItem" command="cmd_uninstallItem" label="&cmd.uninstallAddon.label;" accesskey="&cmd.uninstallAddon.accesskey;"/> + <menuitem id="menuitem_debugItem" command="cmd_debugItem" + label="&cmd.debugAddon.label;"/> <menuseparator id="addonitem-menuseparator" /> <menuitem id="menuitem_preferences" command="cmd_showItemPreferences" #ifdef XP_WIN @@ -68,32 +71,27 @@ label="&cmd.about.label;" accesskey="&cmd.about.accesskey;"/> </menupopup> - - <tooltip id="addonitem-tooltip"/> </popupset> <!-- global commands - these act on all addons, or affect the addons manager in some other way --> <commandset id="globalCommandSet"> - <!-- XXXsw remove useless oncommand attribute once bug 371900 is fixed --> - <command id="cmd_focusSearch" oncommand=";"/> + <command id="cmd_focusSearch"/> <command id="cmd_findAllUpdates"/> <command id="cmd_restartApp"/> <command id="cmd_goToDiscoverPane"/> <command id="cmd_goToRecentUpdates"/> <command id="cmd_goToAvailableUpdates"/> <command id="cmd_installFromFile"/> - <command id="cmd_debugAddons"/> <command id="cmd_back"/> <command id="cmd_forward"/> <command id="cmd_enableCheckCompatibility"/> +<!-- <command id="cmd_pluginCheck"/> --> <command id="cmd_enableUpdateSecurity"/> <command id="cmd_toggleAutoUpdateDefault"/> <command id="cmd_resetAddonAutoUpdate"/> <command id="cmd_experimentsLearnMore"/> <command id="cmd_experimentsOpenTelemetryPreferences"/> - <command id="cmd_showUnsignedExtensions"/> - <command id="cmd_showAllExtensions"/> </commandset> <!-- view commands - these act on the selected addon --> @@ -103,6 +101,7 @@ <command id="cmd_findItemUpdates"/> <command id="cmd_showItemPreferences"/> <command id="cmd_showItemAbout"/> + <command id="cmd_debugItem"/> <command id="cmd_enableItem"/> <command id="cmd_disableItem"/> <command id="cmd_installItem"/> @@ -117,51 +116,100 @@ </commandset> <keyset> + <!-- XXXunf Disabled until bug 371900 is fixed. --> <key id="focusSearch" key="&search.commandkey;" modifiers="accel" - command="cmd_focusSearch"/> + disabled="true"/> </keyset> + + <!-- main header --> + <hbox id="header" align="center"> + <toolbarbutton id="back-btn" class="nav-button header-button" command="cmd_back" + tooltiptext="&cmd.back.tooltip;" hidden="true" disabled="true"/> + <toolbarbutton id="forward-btn" class="nav-button header-button" command="cmd_forward" + tooltiptext="&cmd.forward.tooltip;" hidden="true" disabled="true"/> + <spacer flex="1"/> + <hbox id="updates-container" align="center"> + <image class="spinner"/> + <label id="updates-noneFound" hidden="true" + value="&updates.noneFound.label;"/> + <button id="updates-manualUpdatesFound-btn" class="button-link" + hidden="true" label="&updates.manualUpdatesFound.label;" + command="cmd_goToAvailableUpdates"/> + <label id="updates-progress" hidden="true" + value="&updates.updating.label;"/> + <label id="updates-installed" hidden="true" + value="&updates.installed.label;"/> + <label id="updates-downloaded" hidden="true" + value="&updates.downloaded.label;"/> + <button id="updates-restart-btn" class="button-link" hidden="true" + label="&updates.restart.label;" + command="cmd_restartApp"/> + </hbox> + <toolbarbutton id="header-utils-btn" class="header-button" type="menu" + tooltiptext="&toolsMenu.tooltip;"> + <menupopup id="utils-menu"> + <menuitem id="utils-updateNow" + label="&updates.checkForUpdates.label;" + accesskey="&updates.checkForUpdates.accesskey;" + command="cmd_findAllUpdates"/> + <menuitem id="utils-viewUpdates" + label="&updates.viewUpdates.label;" + accesskey="&updates.viewUpdates.accesskey;" + command="cmd_goToRecentUpdates"/> + <menuseparator id="utils-installFromFile-separator"/> + <menuitem id="utils-installFromFile" + label="&installAddonFromFile.label;" + accesskey="&installAddonFromFile.accesskey;" + command="cmd_installFromFile"/> + <menuseparator/> + <menuitem id="utils-autoUpdateDefault" + label="&updates.updateAddonsAutomatically.label;" + accesskey="&updates.updateAddonsAutomatically.accesskey;" + type="checkbox" autocheck="false" + command="cmd_toggleAutoUpdateDefault"/> + <menuitem id="utils-resetAddonUpdatesToAutomatic" + label="&updates.resetUpdatesToAutomatic.label;" + accesskey="&updates.resetUpdatesToAutomatic.accesskey;" + command="cmd_resetAddonAutoUpdate"/> + <menuitem id="utils-resetAddonUpdatesToManual" + label="&updates.resetUpdatesToManual.label;" + accesskey="&updates.resetUpdatesToManual.accesskey;" + command="cmd_resetAddonAutoUpdate"/> + </menupopup> + </toolbarbutton> + <textbox id="header-search" type="search" searchbutton="true" + searchbuttonlabel="&search.buttonlabel;" + placeholder="&search.placeholder;"/> + </hbox> + <hbox flex="1"> - <vbox> - <hbox id="nav-header" - align="center" - pack="center"> - <toolbarbutton id="back-btn" - class="nav-button header-button" - command="cmd_back" - tooltiptext="&cmd.back.tooltip;" - hidden="true" - disabled="true"/> - <toolbarbutton id="forward-btn" - class="nav-button header-button" - command="cmd_forward" - tooltiptext="&cmd.forward.tooltip;" - hidden="true" - disabled="true"/> - </hbox> - <!-- category list --> - <richlistbox id="categories" flex="1"> - <richlistitem id="category-search" value="addons://search/" - class="category" - name="&view.search.label;" priority="0" - tooltiptext="&view.search.label;" disabled="true"/> - <richlistitem id="category-discover" value="addons://discover/" - class="category" - name="&view.discover.label;" priority="1000" - tooltiptext="&view.discover.label;"/> - <richlistitem id="category-availableUpdates" value="addons://updates/available" - class="category" - name="&view.availableUpdates.label;" priority="100000" - tooltiptext="&view.availableUpdates.label;" - disabled="true"/> - <richlistitem id="category-recentUpdates" value="addons://updates/recent" - class="category" - name="&view.recentUpdates.label;" priority="101000" - tooltiptext="&view.recentUpdates.label;" disabled="true"/> - </richlistbox> - </vbox> - <vbox class="main-content" flex="1"> + + <!-- category list --> + <richlistbox id="categories"> + <richlistitem id="category-search" value="addons://search/" + class="category" + name="&view.search.label;" priority="0" + tooltiptext="&view.search.label;" disabled="true"/> + <richlistitem id="category-discover" value="addons://discover/" + class="category" + name="&view.discover.label;" priority="1000" + tooltiptext="&view.discover.label;"/> + <richlistitem id="category-availableUpdates" value="addons://updates/available" + class="category" + name="&view.availableUpdates.label;" priority="100000" + tooltiptext="&view.availableUpdates.label;" + disabled="true"/> + <richlistitem id="category-recentUpdates" value="addons://updates/recent" + class="category" + name="&view.recentUpdates.label;" priority="101000" + tooltiptext="&view.recentUpdates.label;" disabled="true"/> + </richlistbox> + + <box id="view-port-container" class="main-content" flex="1"> + <!-- view port --> <deck id="view-port" flex="1" selectedIndex="0"> + <!-- discover view --> <deck id="discover-view" flex="1" class="view-pane" selectedIndex="0" tabindex="0"> <vbox id="discover-loading" align="center" pack="stretch" flex="1" class="alert-container"> @@ -189,527 +237,453 @@ <spacer class="alert-spacer-after"/> </vbox> <browser id="discover-browser" type="content" flex="1" - disablehistory="true" homepage="about:blank"/> + disablehistory="true" homepage="about:blank"/> </deck> - <!-- container for views with the search/tools header --> - <vbox id="headered-views" flex="1"> - <!-- main header --> - <hbox id="header" align="center"> - <button id="show-all-extensions" hidden="true" - label="&showAllExtensions.button.label;" - command="cmd_showAllExtensions"/> - <spacer flex="1"/> - <hbox id="updates-container" align="center"> - <image class="spinner"/> - <label id="updates-noneFound" hidden="true" - value="&updates.noneFound.label;"/> - <button id="updates-manualUpdatesFound-btn" class="button-link" - hidden="true" label="&updates.manualUpdatesFound.label;" - command="cmd_goToAvailableUpdates"/> - <label id="updates-progress" hidden="true" - value="&updates.updating.label;"/> - <label id="updates-installed" hidden="true" - value="&updates.installed.label;"/> - <label id="updates-downloaded" hidden="true" - value="&updates.downloaded.label;"/> - <button id="updates-restart-btn" class="button-link" hidden="true" - label="&updates.restart.label;" - command="cmd_restartApp"/> + <!-- search view --> + <vbox id="search-view" flex="1" class="view-pane" tabindex="0"> + <hbox class="view-header global-warning-container" align="center"> + <!-- global warnings --> + <hbox class="global-warning" flex="1"> + <hbox class="global-warning-safemode" flex="1" align="center" + tooltiptext="&warning.safemode.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.safemode.label;"/> + </hbox> + <hbox class="global-warning-checkcompatibility" flex="1" align="center" + tooltiptext="&warning.checkcompatibility.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.checkcompatibility.label;"/> + </hbox> + <button class="button-link global-warning-checkcompatibility" + label="&warning.checkcompatibility.enable.label;" + tooltiptext="&warning.checkcompatibility.enable.tooltip;" + command="cmd_enableCheckCompatibility"/> + <hbox class="global-warning-updatesecurity" flex="1" align="center" + tooltiptext="&warning.updatesecurity.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.updatesecurity.label;"/> + </hbox> + <button class="button-link global-warning-updatesecurity" + label="&warning.updatesecurity.enable.label;" + tooltiptext="&warning.updatesecurity.enable.tooltip;" + command="cmd_enableUpdateSecurity"/> + <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> </hbox> - <button id="show-disabled-unsigned-extensions" hidden="true" - class="warning" - label="&showUnsignedExtensions.button.label;" - command="cmd_showUnsignedExtensions"/> - <toolbarbutton id="header-utils-btn" class="header-button" type="menu" - tooltiptext="&toolsMenu.tooltip;"> - <menupopup id="utils-menu"> - <menuitem id="utils-updateNow" - label="&updates.checkForUpdates.label;" - accesskey="&updates.checkForUpdates.accesskey;" - command="cmd_findAllUpdates"/> - <menuitem id="utils-viewUpdates" - label="&updates.viewUpdates.label;" - accesskey="&updates.viewUpdates.accesskey;" - command="cmd_goToRecentUpdates"/> - <menuseparator id="utils-installFromFile-separator"/> - <menuitem id="utils-installFromFile" - label="&installAddonFromFile.label;" - accesskey="&installAddonFromFile.accesskey;" - command="cmd_installFromFile"/> - <menuitem id="utils-debugAddons" - label="&debugAddons.label;" - accesskey="&debugAddons.accesskey;" - command="cmd_debugAddons"/> - <menuseparator/> - <menuitem id="utils-autoUpdateDefault" - label="&updates.updateAddonsAutomatically.label;" - accesskey="&updates.updateAddonsAutomatically.accesskey;" - type="checkbox" autocheck="false" - command="cmd_toggleAutoUpdateDefault"/> - <menuitem id="utils-resetAddonUpdatesToAutomatic" - label="&updates.resetUpdatesToAutomatic.label;" - accesskey="&updates.resetUpdatesToAutomatic.accesskey;" - command="cmd_resetAddonAutoUpdate"/> - <menuitem id="utils-resetAddonUpdatesToManual" - label="&updates.resetUpdatesToManual.label;" - accesskey="&updates.resetUpdatesToManual.accesskey;" - command="cmd_resetAddonAutoUpdate"/> - </menupopup> - </toolbarbutton> - <textbox id="header-search" type="search" searchbutton="true" - searchbuttonlabel="&search.buttonlabel;" - placeholder="&search.placeholder;"/> + <spacer flex="1"/> + <hbox id="search-sorters" class="sort-controls" + showrelevance="true" sortby="relevancescore" ascending="false"/> + </hbox> + <hbox id="search-filter" align="center"> + <label id="search-filter-label" value="&search.filter2.label;"/> + <radiogroup id="search-filter-radiogroup" orient="horizontal" + align="center" persist="value" value="remote"> + <radio id="search-filter-local" class="search-filter-radio" + label="&search.filter2.installed.label;" value="local" + tooltiptext="&search.filter2.installed.tooltip;"/> + <radio id="search-filter-remote" class="search-filter-radio" + label="&search.filter2.available.label;" value="remote" + tooltiptext="&search.filter2.available.tooltip;"/> + </radiogroup> </hbox> + <vbox id="search-loading" class="alert-container" + flex="1" hidden="true"> + <spacer class="alert-spacer-before"/> + <hbox class="alert loading" align="center"> + <image/> + <label value="&loading.label;"/> + </hbox> + <spacer class="alert-spacer-after"/> + </vbox> + <vbox id="search-list-empty" class="alert-container" + flex="1" hidden="true"> + <spacer class="alert-spacer-before"/> + <vbox class="alert"> + <label value="&listEmpty.search.label;"/> + <button class="discover-button" + id="discover-button-search" + label="&listEmpty.button.label;" + command="cmd_goToDiscoverPane"/> + </vbox> + <spacer class="alert-spacer-after"/> + </vbox> + <richlistbox id="search-list" class="list" flex="1"> + <hbox pack="center"> + <label id="search-allresults-link" class="text-link"/> + </hbox> + </richlistbox> + </vbox> - <deck id="headered-views-content" flex="1" selectedIndex="0"> - <!-- search view --> - <vbox id="search-view" flex="1" class="view-pane" tabindex="0"> - <hbox class="view-header global-warning-container" align="center"> - <!-- global warnings --> - <hbox class="global-warning" flex="1"> - <hbox class="global-warning-safemode" flex="1" align="center" - tooltiptext="&warning.safemode.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.safemode.label;"/> - </hbox> - <hbox class="global-warning-checkcompatibility" flex="1" align="center" - tooltiptext="&warning.checkcompatibility.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.checkcompatibility.label;"/> - </hbox> - <button class="button-link global-warning-checkcompatibility" - label="&warning.checkcompatibility.enable.label;" - tooltiptext="&warning.checkcompatibility.enable.tooltip;" - command="cmd_enableCheckCompatibility"/> - <hbox class="global-warning-updatesecurity" flex="1" align="center" - tooltiptext="&warning.updatesecurity.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.updatesecurity.label;"/> - </hbox> - <button class="button-link global-warning-updatesecurity" - label="&warning.updatesecurity.enable.label;" - tooltiptext="&warning.updatesecurity.enable.tooltip;" - command="cmd_enableUpdateSecurity"/> - <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> - </hbox> - <spacer flex="1"/> - <hbox id="search-sorters" class="sort-controls" - showrelevance="true" sortby="relevancescore" ascending="false"/> + <!-- list view --> + <vbox id="list-view" flex="1" class="view-pane" align="stretch" tabindex="0"> + <hbox class="view-header global-warning-container"> + <!-- global warnings --> + <hbox class="global-warning" flex="1"> + <hbox class="global-warning-safemode" flex="1" align="center" + tooltiptext="&warning.safemode.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.safemode.label;"/> </hbox> - <hbox id="search-filter" align="center"> - <label id="search-filter-label" value="&search.filter2.label;"/> - <radiogroup id="search-filter-radiogroup" orient="horizontal" - align="center" persist="value" value="remote"> - <radio id="search-filter-local" class="search-filter-radio" - label="&search.filter2.installed.label;" value="local" - tooltiptext="&search.filter2.installed.tooltip;"/> - <radio id="search-filter-remote" class="search-filter-radio" - label="&search.filter2.available.label;" value="remote" - tooltiptext="&search.filter2.available.tooltip;"/> - </radiogroup> + <hbox class="global-warning-checkcompatibility" flex="1" align="center" + tooltiptext="&warning.checkcompatibility.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.checkcompatibility.label;"/> </hbox> - <vbox id="search-loading" class="alert-container" - flex="1" hidden="true"> - <spacer class="alert-spacer-before"/> - <hbox class="alert loading" align="center"> - <image/> - <label value="&loading.label;"/> - </hbox> - <spacer class="alert-spacer-after"/> - </vbox> - <vbox id="search-list-empty" class="alert-container" - flex="1" hidden="true"> - <spacer class="alert-spacer-before"/> - <vbox class="alert"> - <label value="&listEmpty.search.label;"/> - <button class="discover-button" - id="discover-button-search" - label="&listEmpty.button.label;" - command="cmd_goToDiscoverPane"/> - </vbox> - <spacer class="alert-spacer-after"/> - </vbox> - <richlistbox id="search-list" class="list" flex="1"> - <hbox pack="center"> - <label id="search-allresults-link" class="text-link"/> - </hbox> - </richlistbox> + <button class="button-link global-warning-checkcompatibility" + label="&warning.checkcompatibility.enable.label;" + tooltiptext="&warning.checkcompatibility.enable.tooltip;" + command="cmd_enableCheckCompatibility"/> + <hbox class="global-warning-updatesecurity" flex="1" align="center" + tooltiptext="&warning.updatesecurity.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.updatesecurity.label;"/> + </hbox> + <button class="button-link global-warning-updatesecurity" + label="&warning.updatesecurity.enable.label;" + tooltiptext="&warning.updatesecurity.enable.tooltip;" + command="cmd_enableUpdateSecurity"/> + <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> + </hbox> + </hbox> +<!-- <hbox class="view-header global-info-container plugin-info-container"> + <hbox class="global-info" flex="1" align="center"> + <button class="button-link global-info-plugincheck" + label="&info.plugincheck.label;" + tooltiptext="&info.plugincheck.tooltip;" + command="cmd_pluginCheck"/> + <spacer flex="5000"/> + </hbox> + </hbox> --> + <hbox class="view-header global-info-container experiment-info-container"> + <hbox class="global-info" flex="1" align="center"> + <label value="&experiment.info.label;"/> + <button id="experiments-learn-more" + label="&experiment.info.learnmore;" + tooltiptext="&experiment.info.learnmore;" + accesskey="&experiment.info.learnmore.accesskey;" + command="cmd_experimentsLearnMore"/> + <button id="experiments-change-telemetry" + label="&experiment.info.changetelemetry;" + tooltiptext="&experiment.info.changetelemetry;" + accesskey="&experiment.info.changetelemetry.accesskey;" + command="cmd_experimentsOpenTelemetryPreferences"/> + <spacer flex="5000"/> <!-- Necessary to allow the message to wrap. --> + </hbox> + </hbox> + <vbox id="addon-list-empty" class="alert-container" + flex="1" hidden="true"> + <spacer class="alert-spacer-before"/> + <vbox class="alert"> + <label value="&listEmpty.installed.label;"/> + <button class="discover-button" + id="discover-button-install" + label="&listEmpty.button.label;" + command="cmd_goToDiscoverPane"/> </vbox> + <spacer class="alert-spacer-after"/> + </vbox> + <richlistbox id="addon-list" class="list" flex="1"/> + </vbox> - <!-- list view --> - <vbox id="list-view" flex="1" class="view-pane" align="stretch" tabindex="0"> - <!-- info UI for add-ons that have been disabled for being unsigned --> - <vbox id="disabled-unsigned-addons-info" hidden="true"> - <label id="disabled-unsigned-addons-heading" value="&disabledUnsigned.heading;"/> - <description> - &disabledUnsigned.description.start;<label class="text-link plain" id="find-alternative-addons">&disabledUnsigned.description.findAddonsLink;</label>&disabledUnsigned.description.end; - </description> - <hbox pack="start"><label class="text-link" id="signing-learn-more">&disabledUnsigned.learnMore;</label></hbox> - <description id="signing-dev-info"> - &disabledUnsigned.devInfo.start;<label class="text-link plain" id="signing-dev-manual-link">&disabledUnsigned.devInfo.linkToManual;</label>&disabledUnsigned.devInfo.end; - </description> - </vbox> - <vbox id="plugindeprecation-notice" class="alert-container"> - <hbox class="alert"> - <description>&pluginDeprecation.description;   - <label class="text-link plain" id="plugindeprecation-learnmore-link">&pluginDeprecation.learnMore;</label> - </description> - </hbox> - </vbox> - <hbox class="view-header global-warning-container"> - <!-- global warnings --> - <hbox class="global-warning" flex="1"> - <hbox class="global-warning-safemode" flex="1" align="center" - tooltiptext="&warning.safemode.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.safemode.label;"/> - </hbox> - <hbox class="global-warning-checkcompatibility" flex="1" align="center" - tooltiptext="&warning.checkcompatibility.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.checkcompatibility.label;"/> - </hbox> - <button class="button-link global-warning-checkcompatibility" - label="&warning.checkcompatibility.enable.label;" - tooltiptext="&warning.checkcompatibility.enable.tooltip;" - command="cmd_enableCheckCompatibility"/> - <hbox class="global-warning-updatesecurity" flex="1" align="center" - tooltiptext="&warning.updatesecurity.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.updatesecurity.label;"/> - </hbox> - <button class="button-link global-warning-updatesecurity" - label="&warning.updatesecurity.enable.label;" - tooltiptext="&warning.updatesecurity.enable.tooltip;" - command="cmd_enableUpdateSecurity"/> - <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> - </hbox> - </hbox> - <hbox class="view-header global-info-container experiment-info-container"> - <hbox class="global-info" flex="1" align="center"> - <label value="&experiment.info.label;"/> - <button id="experiments-learn-more" - label="&experiment.info.learnmore;" - tooltiptext="&experiment.info.learnmore;" - accesskey="&experiment.info.learnmore.accesskey;" - command="cmd_experimentsLearnMore"/> - <button id="experiments-change-telemetry" - label="&experiment.info.changetelemetry;" - tooltiptext="&experiment.info.changetelemetry;" - accesskey="&experiment.info.changetelemetry.accesskey;" - command="cmd_experimentsOpenTelemetryPreferences"/> - <spacer flex="5000"/> <!-- Necessary to allow the message to wrap. --> - </hbox> + <!-- updates view --> + <vbox id="updates-view" flex="1" class="view-pane" tabindex="0"> + <hbox class="view-header global-warning-container" align="center"> + <!-- global warnings --> + <hbox class="global-warning" flex="1"> + <hbox class="global-warning-safemode" flex="1" align="center" + tooltiptext="&warning.safemode.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.safemode.label;"/> </hbox> - <vbox id="addon-list-empty" class="alert-container" - flex="1" hidden="true"> - <spacer class="alert-spacer-before"/> - <vbox class="alert"> - <label value="&listEmpty.installed.label;"/> - <button class="discover-button" - id="discover-button-install" - label="&listEmpty.button.label;" - command="cmd_goToDiscoverPane"/> - </vbox> - <spacer class="alert-spacer-after"/> - </vbox> - <richlistbox id="addon-list" class="list" flex="1"/> - </vbox> - <!-- updates view --> - <vbox id="updates-view" flex="1" class="view-pane" tabindex="0"> - <hbox class="view-header global-warning-container" align="center"> - <!-- global warnings --> - <hbox class="global-warning" flex="1"> - <hbox class="global-warning-safemode" flex="1" align="center" - tooltiptext="&warning.safemode.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.safemode.label;"/> - </hbox> - <hbox class="global-warning-checkcompatibility" flex="1" align="center" - tooltiptext="&warning.checkcompatibility.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.checkcompatibility.label;"/> - </hbox> - <button class="button-link global-warning-checkcompatibility" - label="&warning.checkcompatibility.enable.label;" - tooltiptext="&warning.checkcompatibility.enable.tooltip;" - command="cmd_enableCheckCompatibility"/> - <hbox class="global-warning-updatesecurity" flex="1" align="center" - tooltiptext="&warning.updatesecurity.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.updatesecurity.label;"/> - </hbox> - <button class="button-link global-warning-updatesecurity" - label="&warning.updatesecurity.enable.label;" - tooltiptext="&warning.updatesecurity.enable.tooltip;" - command="cmd_enableUpdateSecurity"/> - <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> - </hbox> - <spacer flex="1"/> - <hbox id="updates-sorters" class="sort-controls" sortby="updateDate" - ascending="false"/> + <hbox class="global-warning-checkcompatibility" flex="1" align="center" + tooltiptext="&warning.checkcompatibility.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.checkcompatibility.label;"/> </hbox> - <vbox id="updates-list-empty" class="alert-container" - flex="1" hidden="true"> - <spacer class="alert-spacer-before"/> - <vbox class="alert"> - <label id="empty-availableUpdates-msg" value="&listEmpty.availableUpdates.label;"/> - <label id="empty-recentUpdates-msg" value="&listEmpty.recentUpdates.label;"/> - <button label="&listEmpty.findUpdates.label;" - command="cmd_findAllUpdates"/> - </vbox> - <spacer class="alert-spacer-after"/> - </vbox> - <hbox id="update-actions" pack="center"> - <button id="update-selected-btn" hidden="true" - label="&updates.updateSelected.label;" - tooltiptext="&updates.updateSelected.tooltip;"/> + <button class="button-link global-warning-checkcompatibility" + label="&warning.checkcompatibility.enable.label;" + tooltiptext="&warning.checkcompatibility.enable.tooltip;" + command="cmd_enableCheckCompatibility"/> + <hbox class="global-warning-updatesecurity" flex="1" align="center" + tooltiptext="&warning.updatesecurity.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.updatesecurity.label;"/> </hbox> - <richlistbox id="updates-list" class="list" flex="1"/> + <button class="button-link global-warning-updatesecurity" + label="&warning.updatesecurity.enable.label;" + tooltiptext="&warning.updatesecurity.enable.tooltip;" + command="cmd_enableUpdateSecurity"/> + <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> + </hbox> + <spacer flex="1"/> + <hbox id="updates-sorters" class="sort-controls" sortby="updateDate" + ascending="false"/> + </hbox> + <vbox id="updates-list-empty" class="alert-container" + flex="1" hidden="true"> + <spacer class="alert-spacer-before"/> + <vbox class="alert"> + <label id="empty-availableUpdates-msg" value="&listEmpty.availableUpdates.label;"/> + <label id="empty-recentUpdates-msg" value="&listEmpty.recentUpdates.label;"/> + <button label="&listEmpty.findUpdates.label;" + command="cmd_findAllUpdates"/> </vbox> + <spacer class="alert-spacer-after"/> + </vbox> + <hbox id="update-actions" pack="center"> + <button id="update-selected-btn" hidden="true" + label="&updates.updateSelected.label;" + tooltiptext="&updates.updateSelected.tooltip;"/> + </hbox> + <richlistbox id="updates-list" class="list" flex="1"/> + </vbox> - <!-- detail view --> - <scrollbox id="detail-view" flex="1" class="view-pane addon-view" orient="vertical" tabindex="0" - role="document"> - <!-- global warnings --> - <hbox class="global-warning-container global-warning"> - <hbox class="global-warning-safemode" flex="1" align="center" - tooltiptext="&warning.safemode.label;"> + <!-- detail view --> + <scrollbox id="detail-view" flex="1" class="view-pane addon-view" orient="vertical" tabindex="0" + role="document"> + <!-- global warnings --> + <hbox class="global-warning-container global-warning"> + <hbox class="global-warning-safemode" flex="1" align="center" + tooltiptext="&warning.safemode.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.safemode.label;"/> + </hbox> + <hbox class="global-warning-checkcompatibility" flex="1" align="center" + tooltiptext="&warning.checkcompatibility.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.checkcompatibility.label;"/> + </hbox> + <button class="button-link global-warning-checkcompatibility" + label="&warning.checkcompatibility.enable.label;" + tooltiptext="&warning.checkcompatibility.enable.tooltip;" + command="cmd_enableCheckCompatibility"/> + <hbox class="global-warning-updatesecurity" flex="1" align="center" + tooltiptext="&warning.updatesecurity.label;"> + <image class="warning-icon"/> + <label class="global-warning-text" flex="1" crop="end" + value="&warning.updatesecurity.label;"/> + </hbox> + <button class="button-link global-warning-updatesecurity" + label="&warning.updatesecurity.enable.label;" + tooltiptext="&warning.updatesecurity.enable.tooltip;" + command="cmd_enableUpdateSecurity"/> + <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> + </hbox> + <hbox flex="1"> + <spacer flex="1"/> + <!-- "loading" splash screen --> + <vbox class="alert-container"> + <spacer class="alert-spacer-before"/> + <hbox class="alert loading"> + <image/> + <label value="&loading.label;"/> + </hbox> + <spacer class="alert-spacer-after"/> + </vbox> + <!-- actual detail view --> + <vbox class="detail-view-container" flex="3" contextmenu="addonitem-popup"> + <vbox id="detail-notifications"> + <hbox id="warning-container" align="center" class="warning"> <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.safemode.label;"/> + <label id="detail-warning" flex="1"/> + <label id="detail-warning-link" class="text-link"/> + <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> </hbox> - <hbox class="global-warning-checkcompatibility" flex="1" align="center" - tooltiptext="&warning.checkcompatibility.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.checkcompatibility.label;"/> + <hbox id="error-container" align="center" class="error"> + <image class="error-icon"/> + <label id="detail-error" flex="1"/> + <label id="detail-error-link" class="text-link"/> + <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> </hbox> - <button class="button-link global-warning-checkcompatibility" - label="&warning.checkcompatibility.enable.label;" - tooltiptext="&warning.checkcompatibility.enable.tooltip;" - command="cmd_enableCheckCompatibility"/> - <hbox class="global-warning-updatesecurity" flex="1" align="center" - tooltiptext="&warning.updatesecurity.label;"> - <image class="warning-icon"/> - <label class="global-warning-text" flex="1" crop="end" - value="&warning.updatesecurity.label;"/> + <hbox id="pending-container" align="center" class="pending"> + <image class="pending-icon"/> + <label id="detail-pending" flex="1"/> + <button id="detail-restart-btn" class="button-link" + label="&addon.restartNow.label;" + command="cmd_restartApp"/> + <button id="detail-undo-btn" class="button-link" + label="&addon.undoAction.label;" + tooltipText="&addon.undoAction.tooltip;" + command="cmd_cancelOperation"/> + <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> </hbox> - <button class="button-link global-warning-updatesecurity" - label="&warning.updatesecurity.enable.label;" - tooltiptext="&warning.updatesecurity.enable.tooltip;" - command="cmd_enableUpdateSecurity"/> - <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> - </hbox> - <hbox flex="1"> - <spacer flex="1"/> - <!-- "loading" splash screen --> - <vbox class="alert-container"> - <spacer class="alert-spacer-before"/> - <hbox class="alert loading"> - <image/> - <label value="&loading.label;"/> - </hbox> - <spacer class="alert-spacer-after"/> + </vbox> + <hbox align="start"> + <vbox id="detail-icon-container" align="end"> + <image id="detail-icon" class="icon"/> </vbox> - <!-- actual detail view --> - <vbox class="detail-view-container" flex="3" contextmenu="addonitem-popup"> - <vbox id="detail-notifications"> - <hbox id="warning-container" align="center" class="warning"> - <image class="warning-icon"/> - <label id="detail-warning" flex="1"/> - <label id="detail-warning-link" class="text-link"/> - <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> - </hbox> - <hbox id="error-container" align="center" class="error"> - <image class="error-icon"/> - <label id="detail-error" flex="1"/> - <label id="detail-error-link" class="text-link"/> - <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> - </hbox> - <hbox id="pending-container" align="center" class="pending"> - <image class="pending-icon"/> - <label id="detail-pending" flex="1"/> - <button id="detail-restart-btn" class="button-link" - label="&addon.restartNow.label;" - command="cmd_restartApp"/> - <button id="detail-undo-btn" class="button-link" - label="&addon.undoAction.label;" - tooltipText="&addon.undoAction.tooltip;" - command="cmd_cancelOperation"/> - <spacer flex="5000"/> <!-- Necessary to allow the message to wrap --> + <vbox flex="1"> + <vbox id="detail-summary"> + <hbox id="detail-name-container" class="name-container" + align="start"> + <label id="detail-name" flex="1"/> + <label id="detail-version"/> + <label class="disabled-postfix" value="&addon.disabled.postfix;"/> + <label class="update-postfix" value="&addon.update.postfix;"/> + <spacer flex="5000"/> <!-- Necessary to allow the name to wrap --> </hbox> + <label id="detail-creator" class="creator"/> + <label id="detail-translators" class="translators"/> </vbox> - <hbox align="start"> - <vbox id="detail-icon-container" align="end"> - <image id="detail-icon" class="icon"/> + <hbox id="detail-experiment-container"> + <svg width="8" height="8" viewBox="0 0 8 8" version="1.1" + xmlns="http://www.w3.org/2000/svg" + id="detail-experiment-bullet-container"> + <circle cx="4" cy="4" r="4" id="detail-experiment-bullet"/> + </svg> + <label id="detail-experiment-state"/> + <label id="detail-experiment-time"/> + </hbox> + <hbox id="detail-desc-container" align="start"> + <vbox pack="center"> <!-- Necessary to work around bug 394738 --> + <image id="detail-screenshot" hidden="true"/> </vbox> <vbox flex="1"> - <vbox id="detail-summary"> - <hbox id="detail-name-container" class="name-container" - align="start"> - <label id="detail-name" flex="1"/> - <label id="detail-version"/> - <label class="disabled-postfix" value="&addon.disabled.postfix;"/> - <label class="update-postfix" value="&addon.update.postfix;"/> - <spacer flex="5000"/> <!-- Necessary to allow the name to wrap --> - </hbox> - <label id="detail-creator" class="creator"/> - </vbox> - <hbox id="detail-experiment-container"> - <svg width="8" height="8" viewBox="0 0 8 8" version="1.1" - xmlns="http://www.w3.org/2000/svg" - id="detail-experiment-bullet-container"> - <circle cx="4" cy="4" r="4" id="detail-experiment-bullet"/> - </svg> - <label id="detail-experiment-state"/> - <label id="detail-experiment-time"/> - </hbox> - <hbox id="detail-desc-container" align="start"> - <vbox id="detail-screenshot-box" pack="center" hidden="true"> <!-- Necessary to work around bug 394738 --> - <image id="detail-screenshot"/> - </vbox> - <vbox flex="1"> - <description id="detail-desc"/> - <description id="detail-fulldesc"/> - </vbox> - </hbox> - <vbox id="detail-contributions"> - <description id="detail-contrib-description"> - &detail.contributions.description; - </description> + <description id="detail-desc"/> + <description id="detail-fulldesc"/> + </vbox> + </hbox> + <vbox id="detail-contributions"> + <description id="detail-contrib-description"> + &detail.contributions.description; + </description> + <hbox align="center"> + <label id="detail-contrib-suggested"/> + <spacer flex="1"/> + <button id="detail-contrib-btn" + label="&cmd.contribute.label;" + accesskey="&cmd.contribute.accesskey;" + tooltiptext="&cmd.contribute.tooltip;" + command="cmd_contribute"/> + </hbox> + </vbox> + <grid id="detail-grid"> + <columns> + <column flex="1"/> + <column flex="2"/> + </columns> + <rows id="detail-rows"> + <row class="detail-row-complex" id="detail-updates-row"> + <label class="detail-row-label" value="&detail.updateType;"/> <hbox align="center"> - <label id="detail-contrib-suggested"/> - <spacer flex="1"/> - <button id="detail-contrib-btn" - label="&cmd.contribute.label;" - accesskey="&cmd.contribute.accesskey;" - tooltiptext="&cmd.contribute.tooltip;" - command="cmd_contribute"/> + <radiogroup id="detail-autoUpdate" orient="horizontal"> + <!-- The values here need to match the values of + AddonManager.AUTOUPDATE_* --> + <radio label="&detail.updateDefault.label;" + tooltiptext="&detail.updateDefault.tooltip;" + value="1"/> + <radio label="&detail.updateAutomatic.label;" + tooltiptext="&detail.updateAutomatic.tooltip;" + value="2"/> + <radio label="&detail.updateManual.label;" + tooltiptext="&detail.updateManual.tooltip;" + value="0"/> + </radiogroup> + <button id="detail-findUpdates-btn" class="button-link" + label="&detail.checkForUpdates.label;" + accesskey="&detail.checkForUpdates.accesskey;" + tooltiptext="&detail.checkForUpdates.tooltip;" + command="cmd_findItemUpdates"/> </hbox> - </vbox> - <grid id="detail-grid"> - <columns> - <column flex="1"/> - <column flex="2"/> - </columns> - <rows id="detail-rows"> - <row class="detail-row-complex" id="detail-updates-row"> - <label class="detail-row-label" value="&detail.updateType;"/> - <hbox align="center"> - <radiogroup id="detail-autoUpdate" orient="horizontal"> - <!-- The values here need to match the values of - AddonManager.AUTOUPDATE_* --> - <radio label="&detail.updateDefault.label;" - tooltiptext="&detail.updateDefault.tooltip;" - value="1"/> - <radio label="&detail.updateAutomatic.label;" - tooltiptext="&detail.updateAutomatic.tooltip;" - value="2"/> - <radio label="&detail.updateManual.label;" - tooltiptext="&detail.updateManual.tooltip;" - value="0"/> - </radiogroup> - <button id="detail-findUpdates-btn" class="button-link" - label="&detail.checkForUpdates.label;" - accesskey="&detail.checkForUpdates.accesskey;" - tooltiptext="&detail.checkForUpdates.tooltip;" - command="cmd_findItemUpdates"/> - </hbox> - </row> - <row class="detail-row" id="detail-dateUpdated" label="&detail.lastupdated.label;"/> - <row class="detail-row-complex" id="detail-homepage-row" label="&detail.home;"> - <label class="detail-row-label" value="&detail.home;"/> - <label id="detail-homepage" class="detail-row-value text-link" crop="end"/> - </row> - <row class="detail-row-complex" id="detail-repository-row" label="&detail.repository;"> - <label class="detail-row-label" value="&detail.repository;"/> - <label id="detail-repository" class="detail-row-value text-link"/> - </row> - <row class="detail-row" id="detail-size" label="&detail.size;"/> - <row class="detail-row-complex" id="detail-rating-row"> - <label class="detail-row-label" value="&rating2.label;"/> - <hbox> - <label id="detail-rating" class="meta-value meta-rating" - showrating="average"/> - <label id="detail-reviews" class="text-link"/> - </hbox> - </row> - <row class="detail-row" id="detail-downloads" label="&detail.numberOfDownloads.label;"/> - </rows> - </grid> - <hbox id="detail-controls"> - <button id="detail-prefs-btn" class="addon-control preferences" + </row> + <row class="detail-row" id="detail-dateUpdated" label="&detail.lastupdated.label;"/> + <row class="detail-row-complex" id="detail-homepage-row" label="&detail.home;"> + <label class="detail-row-label" value="&detail.home;"/> + <label id="detail-homepage" class="detail-row-value text-link" crop="end"/> + </row> + <row class="detail-row-complex" id="detail-repository-row" label="&detail.repository;"> + <label class="detail-row-label" value="&detail.repository;"/> + <label id="detail-repository" class="detail-row-value text-link"/> + </row> + <row class="detail-row" id="detail-size" label="&detail.size;"/> + <row class="detail-row-complex" id="detail-rating-row"> + <label class="detail-row-label" value="&rating2.label;"/> + <hbox> + <label id="detail-rating" class="meta-value meta-rating" + showrating="average"/> + <label id="detail-reviews" class="text-link"/> + </hbox> + </row> + <row class="detail-row" id="detail-downloads" label="&detail.numberOfDownloads.label;"/> + </rows> + </grid> + <hbox id="detail-controls"> + <button id="detail-prefs-btn" class="addon-control preferences" #ifdef XP_WIN - label="&detail.showPreferencesWin.label;" - accesskey="&detail.showPreferencesWin.accesskey;" - tooltiptext="&detail.showPreferencesWin.tooltip;" + label="&detail.showPreferencesWin.label;" + accesskey="&detail.showPreferencesWin.accesskey;" + tooltiptext="&detail.showPreferencesWin.tooltip;" #else - label="&detail.showPreferencesUnix.label;" - accesskey="&detail.showPreferencesUnix.accesskey;" - tooltiptext="&detail.showPreferencesUnix.tooltip;" + label="&detail.showPreferencesUnix.label;" + accesskey="&detail.showPreferencesUnix.accesskey;" + tooltiptext="&detail.showPreferencesUnix.tooltip;" #endif - command="cmd_showItemPreferences"/> - <spacer flex="1"/> - <button id="detail-enable-btn" class="addon-control enable" - label="&cmd.enableAddon.label;" - accesskey="&cmd.enableAddon.accesskey;" - command="cmd_enableItem"/> - <button id="detail-disable-btn" class="addon-control disable" - label="&cmd.disableAddon.label;" - accesskey="&cmd.disableAddon.accesskey;" - command="cmd_disableItem"/> - <button id="detail-uninstall-btn" class="addon-control remove" - label="&cmd.uninstallAddon.label;" - accesskey="&cmd.uninstallAddon.accesskey;" - command="cmd_uninstallItem"/> - <button id="detail-purchase-btn" class="addon-control purchase" - command="cmd_purchaseItem"/> - <button id="detail-install-btn" class="addon-control install" - label="&cmd.installAddon.label;" - accesskey="&cmd.installAddon.accesskey;" - command="cmd_installItem"/> - <menulist id="detail-state-menulist" - crop="none" sizetopopup="always" - tooltiptext="&cmd.stateMenu.tooltip;"> - <menupopup> - <menuitem id="detail-ask-to-activate-menuitem" - class="addon-control" - label="&cmd.askToActivate.label;" - tooltiptext="&cmd.askToActivate.tooltip;" - command="cmd_askToActivateItem"/> - <menuitem id="detail-always-activate-menuitem" - class="addon-control" - label="&cmd.alwaysActivate.label;" - tooltiptext="&cmd.alwaysActivate.tooltip;" - command="cmd_alwaysActivateItem"/> - <menuitem id="detail-never-activate-menuitem" - class="addon-control" - label="&cmd.neverActivate.label;" - tooltiptext="&cmd.neverActivate.tooltip;" - command="cmd_neverActivateItem"/> - </menupopup> - </menulist> - </hbox> - </vbox> + command="cmd_showItemPreferences"/> + <spacer flex="1"/> + <button id="detail-debug-btn" class="addon-control debug" + label="Debug" + command="cmd_debugItem" /> + <button id="detail-enable-btn" class="addon-control enable" + label="&cmd.enableAddon.label;" + accesskey="&cmd.enableAddon.accesskey;" + command="cmd_enableItem"/> + <button id="detail-disable-btn" class="addon-control disable" + label="&cmd.disableAddon.label;" + accesskey="&cmd.disableAddon.accesskey;" + command="cmd_disableItem"/> + <button id="detail-uninstall-btn" class="addon-control remove" + label="&cmd.uninstallAddon.label;" + accesskey="&cmd.uninstallAddon.accesskey;" + command="cmd_uninstallItem"/> + <button id="detail-purchase-btn" class="addon-control purchase" + command="cmd_purchaseItem"/> + <button id="detail-install-btn" class="addon-control install" + label="&cmd.installAddon.label;" + accesskey="&cmd.installAddon.accesskey;" + command="cmd_installItem"/> + <menulist id="detail-state-menulist" + crop="none" sizetopopup="always" + tooltiptext="&cmd.stateMenu.tooltip;"> + <menupopup> + <menuitem id="detail-ask-to-activate-menuitem" + class="addon-control" + label="&cmd.askToActivate.label;" + tooltiptext="&cmd.askToActivate.tooltip;" + command="cmd_askToActivateItem"/> + <menuitem id="detail-always-activate-menuitem" + class="addon-control" + label="&cmd.alwaysActivate.label;" + tooltiptext="&cmd.alwaysActivate.tooltip;" + command="cmd_alwaysActivateItem"/> + <menuitem id="detail-never-activate-menuitem" + class="addon-control" + label="&cmd.neverActivate.label;" + tooltiptext="&cmd.neverActivate.tooltip;" + command="cmd_neverActivateItem"/> + </menupopup> + </menulist> </hbox> </vbox> - <spacer flex="1"/> </hbox> - </scrollbox> - </deck> - </vbox> + </vbox> + <spacer flex="1"/> + </hbox> + </scrollbox> + </deck> - </vbox> + + </box> </hbox> + </page> diff --git a/toolkit/mozapps/extensions/content/list.js b/toolkit/mozapps/extensions/content/list.js index a31922703..aac87911e 100644 --- a/toolkit/mozapps/extensions/content/list.js +++ b/toolkit/mozapps/extensions/content/list.js @@ -16,11 +16,11 @@ const kDialog = "dialog"; * caller can inspect the user action after the dialog closes by inspecting the * value of the |result| parameter on this object which is set to the dlgtype * of the button used to close the dialog. - * + * * window.arguments[0] is an array of strings to display in the tree. If the * array is empty the tree will not be displayed. * window.arguments[1] a JS Object with the following properties: - * + * * title: A title string, to be displayed in the title bar of the dialog. * message1: A message string, displayed above the addon list * message2: A message string, displayed below the addon list @@ -39,7 +39,7 @@ const kDialog = "dialog"; * ... * }, * - * result: The dlgtype of button that was used to dismiss the dialog. + * result: The dlgtype of button that was used to dismiss the dialog. */ "use strict"; @@ -113,7 +113,7 @@ function init() { message.appendChild(document.createTextNode(params[messageEntry])); } } - + document.getElementById("infoIcon").className = params["iconClass"] ? "spaced " + params["iconClass"] : "spaced alert-icon"; diff --git a/toolkit/mozapps/extensions/content/newaddon.js b/toolkit/mozapps/extensions/content/newaddon.js index b1ad5631b..2b2a54af5 100644 --- a/toolkit/mozapps/extensions/content/newaddon.js +++ b/toolkit/mozapps/extensions/content/newaddon.js @@ -2,9 +2,9 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -var Cc = Components.classes; -var Ci = Components.interfaces; -var Cu = Components.utils; +const Cc = Components.classes; +const Ci = Components.interfaces; +const Cu = Components.utils; Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/AddonManager.jsm"); @@ -13,7 +13,7 @@ var gAddon = null; // If the user enables the add-on through some other UI close this window var EnableListener = { - onEnabling: function(aAddon) { + onEnabling: function EnableListener_onEnabling(aAddon) { if (aAddon.id == gAddon.id) window.close(); } @@ -38,11 +38,11 @@ function initialize() { let bundle = Services.strings.createBundle("chrome://mozapps/locale/extensions/newaddon.properties"); - AddonManager.getAddonByID(id, function(aAddon) { - // If the add-on doesn't exist or it is already enabled or it has already - // been seen or it cannot be enabled then this UI is useless, just close it. - // This shouldn't normally happen unless session restore restores the tab. - if (!aAddon || !aAddon.userDisabled || aAddon.seen || + AddonManager.getAddonByID(id, function initialize_getAddonByID(aAddon) { + // If the add-on doesn't exist or it is already enabled or it cannot be + // enabled then this UI is useless, just close it. This shouldn't normally + // happen unless session restore restores the tab + if (!aAddon || !aAddon.userDisabled || !(aAddon.permissions & AddonManager.PERM_CAN_ENABLE)) { window.close(); return; @@ -79,14 +79,6 @@ function initialize() { document.getElementById("location").hidden = true; } - // Only mark the add-on as seen if the page actually gets focus - if (document.hasFocus()) { - aAddon.markAsSeen(); - } - else { - document.addEventListener("focus", () => aAddon.markAsSeen(), false); - } - var event = document.createEvent("Events"); event.initEvent("AddonDisplayed", true, true); document.dispatchEvent(event); diff --git a/toolkit/mozapps/extensions/content/newaddon.xul b/toolkit/mozapps/extensions/content/newaddon.xul index 1d8545249..0806f2799 100644 --- a/toolkit/mozapps/extensions/content/newaddon.xul +++ b/toolkit/mozapps/extensions/content/newaddon.xul @@ -52,13 +52,12 @@ <button id="continue-button" label="&continue;" oncommand="continueClicked()"/> </hbox> - <vbox id="restartPanel"> - <description id="restartMessage">&restartMessage;</description> - <hbox id="restartPanelButtons"> - <button id="restart-button" label="&restartButton;" oncommand="restartClicked()"/> - <button id="cancel-button" label="&cancelButton;" oncommand="cancelClicked()"/> - </hbox> - </vbox> + <hbox id="restartPanel"> + <spacer id="restartSpacer"/> + <description id="restartMessage" flex="1">&restartMessage;</description> + <button id="restart-button" label="&restartButton;" oncommand="restartClicked()"/> + <button id="cancel-button" label="&cancelButton;" oncommand="cancelClicked()"/> + </hbox> </deck> </vbox> diff --git a/toolkit/mozapps/extensions/content/selectAddons.css b/toolkit/mozapps/extensions/content/selectAddons.css new file mode 100644 index 000000000..636757721 --- /dev/null +++ b/toolkit/mozapps/extensions/content/selectAddons.css @@ -0,0 +1,22 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#select .addon { + -moz-binding: url("chrome://mozapps/content/extensions/selectAddons.xml#addon-select"); +} + +#confirm .addon { + -moz-binding: url("chrome://mozapps/content/extensions/selectAddons.xml#addon-confirm"); +} + +#select-scrollbox, +#confirm-scrollbox { + overflow-y: auto; + -moz-box-orient: vertical; +} + +.addon:not([optionalupdate]) .addon-action-update, +.addon[optionalupdate] .addon-action-message { + display: none; +} diff --git a/toolkit/mozapps/extensions/content/selectAddons.js b/toolkit/mozapps/extensions/content/selectAddons.js new file mode 100644 index 000000000..f80932b3f --- /dev/null +++ b/toolkit/mozapps/extensions/content/selectAddons.js @@ -0,0 +1,347 @@ +// -*- indent-tabs-mode: nil; js-indent-level: 2 -*- + +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +Components.utils.import("resource://gre/modules/AddonManager.jsm"); +Components.utils.import("resource://gre/modules/addons/AddonRepository.jsm"); +Components.utils.import("resource://gre/modules/Services.jsm"); + +const Cc = Components.classes; +const Ci = Components.interfaces; + +var gView = null; + +function showView(aView) { + gView = aView; + + gView.show(); + + // If the view's show method immediately showed a different view then don't + // do anything else + if (gView != aView) + return; + + let viewNode = document.getElementById(gView.nodeID); + viewNode.parentNode.selectedPanel = viewNode; + + // For testing dispatch an event when the view changes + var event = document.createEvent("Events"); + event.initEvent("ViewChanged", true, true); + viewNode.dispatchEvent(event); +} + +function showButtons(aCancel, aBack, aNext, aDone) { + document.getElementById("cancel").hidden = !aCancel; + document.getElementById("back").hidden = !aBack; + document.getElementById("next").hidden = !aNext; + document.getElementById("done").hidden = !aDone; +} + +function isAddonDistroInstalled(aID) { + let branch = Services.prefs.getBranch("extensions.installedDistroAddon."); + if (!branch.prefHasUserValue(aID)) + return false; + + return branch.getBoolPref(aID); +} + +function orderForScope(aScope) { + return aScope == AddonManager.SCOPE_PROFILE ? 1 : 0; +} + +var gAddons = {}; + +var gChecking = { + nodeID: "checking", + + _progress: null, + _addonCount: 0, + _completeCount: 0, + + show: function gChecking_show() { + showButtons(true, false, false, false); + this._progress = document.getElementById("checking-progress"); + + AddonManager.getAllAddons(aAddons => { + if (aAddons.length == 0) { + window.close(); + return; + } + + aAddons = aAddons.filter(function gChecking_filterAddons(aAddon) { + if (aAddon.type == "plugin" || aAddon.type == "service") + return false; + + if (aAddon.type == "theme") { + // Don't show application shipped themes + if (aAddon.scope == AddonManager.SCOPE_APPLICATION) + return false; + // Don't show already disabled themes + if (aAddon.userDisabled) + return false; + } + + return true; + }); + + this._addonCount = aAddons.length; + this._progress.value = 0; + this._progress.max = aAddons.length; + this._progress.mode = "determined"; + + AddonRepository.repopulateCache().then(() => { + for (let addonItem of aAddons) { + // Ignore disabled themes + if (addonItem.type != "theme" || !addonItem.userDisabled) { + gAddons[addonItem.id] = { + addon: addonItem, + install: null, + wasActive: addonItem.isActive + } + } + + addonItem.findUpdates(this, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED); + } + }); + }); + }, + + onUpdateAvailable: function gChecking_onUpdateAvailable(aAddon, aInstall) { + // If the add-on can be upgraded then remember the new version + if (aAddon.permissions & AddonManager.PERM_CAN_UPGRADE) + gAddons[aAddon.id].install = aInstall; + }, + + onUpdateFinished: function gChecking_onUpdateFinished(aAddon, aError) { + this._completeCount++; + this._progress.value = this._completeCount; + + if (this._completeCount < this._addonCount) + return; + + // Tycho: var addons = [gAddons[id] for (id in gAddons)]; + var addons = []; + for (let id in gAddons) { + addons.push(gAddons[id]) + } + + addons.sort(function sortAddons(a, b) { + let orderA = orderForScope(a.addon.scope); + let orderB = orderForScope(b.addon.scope); + + if (orderA != orderB) + return orderA - orderB; + + return String.localeCompare(a.addon.name, b.addon.name); + }); + + let rows = document.getElementById("select-rows"); + let lastAddon = null; + for (let entry of addons) { + if (lastAddon && + orderForScope(entry.addon.scope) != orderForScope(lastAddon.scope)) { + let separator = document.createElement("separator"); + rows.appendChild(separator); + } + + let row = document.createElement("row"); + row.setAttribute("id", entry.addon.id); + row.setAttribute("class", "addon"); + rows.appendChild(row); + row.setAddon(entry.addon, entry.install, entry.wasActive, + isAddonDistroInstalled(entry.addon.id)); + + if (entry.install) + entry.install.addListener(gUpdate); + + lastAddon = entry.addon; + } + + showView(gSelect); + } +}; + +var gSelect = { + nodeID: "select", + + show: function gSelect_show() { + this.updateButtons(); + }, + + updateButtons: function gSelect_updateButtons() { + for (let row = document.getElementById("select-rows").firstChild; + row; row = row.nextSibling) { + if (row.localName == "separator") + continue; + + if (row.action) { + showButtons(false, false, true, false); + return; + } + } + + showButtons(false, false, false, true); + }, + + next: function gSelect_next() { + showView(gConfirm); + }, + + done: function gSelect_done() { + window.close(); + } +}; + +var gConfirm = { + nodeID: "confirm", + + show: function gConfirm_show() { + showButtons(false, true, false, true); + + let box = document.getElementById("confirm-scrollbox").firstChild; + while (box) { + box.hidden = true; + while (box.lastChild != box.firstChild) + box.removeChild(box.lastChild); + box = box.nextSibling; + } + + for (let row = document.getElementById("select-rows").firstChild; + row; row = row.nextSibling) { + if (row.localName == "separator") + continue; + + let action = row.action; + if (!action) + continue; + + let list = document.getElementById(action + "-list"); + + list.hidden = false; + let item = document.createElement("hbox"); + item.setAttribute("id", row._addon.id); + item.setAttribute("class", "addon"); + item.setAttribute("type", row._addon.type); + item.setAttribute("name", row._addon.name); + if (action == "update" || action == "enable") + item.setAttribute("active", "true"); + list.appendChild(item); + + if (action == "update") + showButtons(false, true, true, false); + } + }, + + back: function gConfirm_back() { + showView(gSelect); + }, + + next: function gConfirm_next() { + showView(gUpdate); + }, + + done: function gConfirm_done() { + for (let row = document.getElementById("select-rows").firstChild; + row; row = row.nextSibling) { + if (row.localName != "separator") + row.apply(); + } + + window.close(); + } +} + +var gUpdate = { + nodeID: "update", + + _progress: null, + _waitingCount: 0, + _completeCount: 0, + _errorCount: 0, + + show: function gUpdate_show() { + showButtons(true, false, false, false); + + this._progress = document.getElementById("update-progress"); + + for (let row = document.getElementById("select-rows").firstChild; + row; row = row.nextSibling) { + if (row.localName != "separator") + row.apply(); + } + + this._progress.mode = "determined"; + this._progress.max = this._waitingCount; + this._progress.value = this._completeCount; + }, + + checkComplete: function gUpdate_checkComplete() { + this._progress.value = this._completeCount; + if (this._completeCount < this._waitingCount) + return; + + if (this._errorCount > 0) { + showView(gErrors); + return; + } + + window.close(); + }, + + onDownloadStarted: function gUpdate_onDownloadStarted(aInstall) { + this._waitingCount++; + }, + + onDownloadFailed: function gUpdate_onDownloadFailed(aInstall) { + this._errorCount++; + this._completeCount++; + this.checkComplete(); + }, + + onInstallFailed: function gUpdate_onInstallFailed(aInstall) { + this._errorCount++; + this._completeCount++; + this.checkComplete(); + }, + + onInstallEnded: function gUpdate_onInstallEnded(aInstall) { + this._completeCount++; + this.checkComplete(); + } +}; + +var gErrors = { + nodeID: "errors", + + show: function gErrors_show() { + showButtons(false, false, false, true); + }, + + done: function gErrors_done() { + window.close(); + } +}; + +window.addEventListener("load", function loadEventListener() { + showView(gChecking); }, false); + +// When closing the window cancel any pending or in-progress installs +window.addEventListener("unload", function unloadEventListener() { + for (let id in gAddons) { + let entry = gAddons[id]; + if (!entry.install) + return; + + aEntry.install.removeListener(gUpdate); + + if (entry.install.state != AddonManager.STATE_INSTALLED && + entry.install.state != AddonManager.STATE_DOWNLOAD_FAILED && + entry.install.state != AddonManager.STATE_INSTALL_FAILED) { + entry.install.cancel(); + } + } +}, false); diff --git a/toolkit/mozapps/extensions/content/selectAddons.xml b/toolkit/mozapps/extensions/content/selectAddons.xml new file mode 100644 index 000000000..dbfc0d400 --- /dev/null +++ b/toolkit/mozapps/extensions/content/selectAddons.xml @@ -0,0 +1,235 @@ +<?xml version="1.0"?> + +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + +<!DOCTYPE window [ +<!ENTITY % updateDTD SYSTEM "chrome://mozapps/locale/extensions/selectAddons.dtd"> +<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd"> +%updateDTD; +%brandDTD; +]> + +<bindings xmlns="http://www.mozilla.org/xbl" + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + xmlns:xbl="http://www.mozilla.org/xbl"> + + <binding id="addon-select"> + <content> + <xul:hbox class="select-keep select-cell"> + <xul:checkbox class="addon-keep-checkbox" anonid="keep" + xbl:inherits="tooltiptext=name" + oncommand="document.getBindingParent(this).keepChanged();"/> + </xul:hbox> + <xul:hbox class="select-icon select-cell"> + <xul:image class="addon-icon" xbl:inherits="type"/> + </xul:hbox> + <xul:hbox class="select-name select-cell"> + <xul:label class="addon-name" crop="end" style="&select.name.style;" + xbl:inherits="xbl:text=name"/> + </xul:hbox> + <xul:hbox class="select-action select-cell"> + <xul:label class="addon-action-message" style="&select.action.style;" + xbl:inherits="xbl:text=action"/> + <xul:checkbox anonid="update" checked="true" class="addon-action-update" + oncommand="document.getBindingParent(this).updateChanged();" + style="&select.action.style;" xbl:inherits="label=action"/> + </xul:hbox> + <xul:hbox class="select-source select-cell"> + <xul:label class="addon-source" xbl:inherits="xbl:text=source"/> + </xul:hbox> + </content> + + <implementation> + <field name="_addon"/> + <field name="_disabled"/> + <field name="_install"/> + <field name="_wasActive"/> + <field name="_keep">document.getAnonymousElementByAttribute(this, "anonid", "keep");</field> + <field name="_update">document.getAnonymousElementByAttribute(this, "anonid", "update");</field> + <field name="_strings">document.getElementById("strings");</field> + + <property name="action" readonly="true"> + <getter><![CDATA[ + if (!this._keep.checked) { + if (this._wasActive) + return "disable"; + else + return null; + } + + if (this._addon.appDisabled && !this._install) + return "incompatible"; + + if (this._install && (AddonManager.shouldAutoUpdate(this._addon) || this._update.checked)) + return "update"; + + if (this._addon.permissions & AddonManager.PERM_CAN_ENABLE) + return "enable"; + + return null; + ]]></getter> + </property> + + <method name="setAddon"> + <parameter name="aAddon"/> + <parameter name="aInstall"/> + <parameter name="aWasActive"/> + <parameter name="aDistroInstalled"/> + <body><![CDATA[ + this._addon = aAddon; + this._install = aInstall; + this._wasActive = aWasActive; + + this.setAttribute("name", aAddon.name); + this.setAttribute("type", aAddon.type); + + // User and bundled add-ons default to staying enabled, + // others default to disabled. + switch (aAddon.scope) { + case AddonManager.SCOPE_PROFILE: + this._keep.checked = !aAddon.userDisabled; + if (aDistroInstalled) + this.setAttribute("source", this._strings.getString("source.bundled")); + else + this.setAttribute("source", this._strings.getString("source.profile")); + break; + default: + this._keep.checked = false; + this.setAttribute("source", this._strings.getString("source.other")); + } + + this.updateAction(); + ]]></body> + </method> + + <method name="setActionMessage"> + <body><![CDATA[ + if (!this._keep.checked) { + // If the user no longer wants this add-on then it is either being + // disabled or nothing is changing. Don't complicate matters by + // talking about updates for this case + + if (this._wasActive) + this.setAttribute("action", this._strings.getString("action.disabled")); + else + this.setAttribute("action", ""); + + this.removeAttribute("optionalupdate"); + return; + } + + if (this._addon.appDisabled && !this._install) { + // If the add-on is incompatible and there is no update available + // then it will remain disabled + + this.setAttribute("action", this._strings.getString("action.incompatible")); + + this.removeAttribute("optionalupdate"); + return; + } + + if (this._install) { + if (!AddonManager.shouldAutoUpdate(this._addon)) { + this.setAttribute("optionalupdate", "true"); + + // If manual updating for the add-on then display the right + // text depending on whether the update is required to make + // the add-on work or not + if (this._addon.appDisabled) + this.setAttribute("action", this._strings.getString("action.neededupdate")); + else + this.setAttribute("action", this._strings.getString("action.unneededupdate")); + return; + } + + this.removeAttribute("optionalupdate"); + + // If the update is needed to make the add-on compatible then + // say so otherwise just say nothing about it + if (this._addon.appDisabled) { + this.setAttribute("action", this._strings.getString("action.autoupdate")); + return; + } + } + else { + this.removeAttribute("optionalupdate"); + } + + // If the add-on didn't used to be active and it now is (via a + // compatibility update) or it can be enabled then the action is to + // enable the add-on + if (!this._wasActive && (this._addon.isActive || this._addon.permissions & AddonManager.PERM_CAN_ENABLE)) { + this.setAttribute("action", this._strings.getString("action.enabled")); + return; + } + + // In all other cases the add-on is simply remaining enabled + this.setAttribute("action", ""); + ]]></body> + </method> + + <method name="updateAction"> + <body><![CDATA[ + this.setActionMessage(); + let installingUpdate = this._install && + (AddonManager.shouldAutoUpdate(this._addon) || + this._update.checked); + + if (this._keep.checked && (!this._addon.appDisabled || installingUpdate)) + this.setAttribute("active", "true"); + else + this.removeAttribute("active"); + + gSelect.updateButtons(); + ]]></body> + </method> + + <method name="updateChanged"> + <body><![CDATA[ + this.updateAction(); + ]]></body> + </method> + + <method name="keepChanged"> + <body><![CDATA[ + this.updateAction(); + ]]></body> + </method> + + <method name="keep"> + <body><![CDATA[ + this._keep.checked = true; + this.keepChanged(); + ]]></body> + </method> + + <method name="disable"> + <body><![CDATA[ + this._keep.checked = false; + this.keepChanged(); + ]]></body> + </method> + + <method name="apply"> + <body><![CDATA[ + this._addon.userDisabled = !this._keep.checked; + + if (!this._install || !this._keep.checked) + return; + + if (AddonManager.shouldAutoUpdate(this._addon) || this._update.checked) + this._install.install(); + ]]></body> + </method> + </implementation> + </binding> + + <binding id="addon-confirm"> + <content> + <xul:image class="addon-icon" xbl:inherits="type"/> + <xul:label class="addon-name" xbl:inherits="xbl:text=name"/> + </content> + </binding> +</bindings> diff --git a/toolkit/mozapps/extensions/content/selectAddons.xul b/toolkit/mozapps/extensions/content/selectAddons.xul new file mode 100644 index 000000000..0fa292ecf --- /dev/null +++ b/toolkit/mozapps/extensions/content/selectAddons.xul @@ -0,0 +1,124 @@ +<?xml version="1.0"?> + +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> +<?xml-stylesheet href="chrome://mozapps/content/extensions/selectAddons.css" type="text/css"?> +<?xml-stylesheet href="chrome://mozapps/skin/extensions/selectAddons.css" type="text/css"?> + +<!DOCTYPE window [ +<!ENTITY % updateDTD SYSTEM "chrome://mozapps/locale/extensions/selectAddons.dtd"> +<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd"> +%updateDTD; +%brandDTD; +]> + +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + style="&upgrade.style;" id="select-window"> + + <script type="application/javascript" src="chrome://mozapps/content/extensions/selectAddons.js"/> + <stringbundle id="strings" src="chrome://mozapps/locale/extensions/selectAddons.properties"/> + + <deck id="view-deck" flex="1" align="stretch" pack="stretch"> + <vbox id="checking" align="stretch"> + <vbox flex="1"> + <label id="checking-heading" class="heading">&checking.heading;</label> + </vbox> + <progressmeter id="checking-progress" class="progress" mode="undetermined"/> + <vbox flex="1"> + <label id="checking-progress-label" class="progress-label">&checking.progress.label;</label> + </vbox> + </vbox> + + <vbox id="select" align="stretch"> + <label id="select-heading" class="heading">&select.heading;</label> + + <description id="select-description">&select.description;</description> + + <vbox id="select-list" align="stretch" flex="1"> + <hbox id="select-header"> + <hbox class="select-keep select-cell" style="&select.keep.style;"> + <label value="&select.keep;"/> + </hbox> + <hbox class="select-icon select-cell"/> + <hbox id="heading-name" class="select-name select-cell" style="&select.name.style;"> + <label value="&select.name;"/> + </hbox> + <hbox id="heading-action" class="select-action select-cell" style="&select.action.style;"> + <label value="&select.action;"/> + </hbox> + <hbox class="select-source select-cell" flex="1"> + <label value="&select.source;"/> + </hbox> + </hbox> + + <scrollbox id="select-scrollbox" flex="1"> + <grid id="select-grid" flex="1"> + <columns> + <column style="&select.keep.style;"/> + <column/> + <column id="column-name"/> + <column id="column-action" class="select-action"/> + <column class="select-source" flex="1"/> + </columns> + + <rows id="select-rows"/> + </grid> + </scrollbox> + </vbox> + </vbox> + + <vbox id="confirm" align="stretch"> + <label id="confirm-heading" class="heading">&confirm.heading;</label> + + <description id="confirm-description">&confirm.description;</description> + + <scrollbox id="confirm-scrollbox" flex="1"> + <vbox id="disable-list" class="action-list" hidden="true"> + <label class="action-header">&action.disable.heading;</label> + </vbox> + + <vbox id="incompatible-list" class="action-list" hidden="true"> + <label class="action-header">&action.incompatible.heading;</label> + </vbox> + + <vbox id="update-list" class="action-list" hidden="true"> + <label class="action-header">&action.update.heading;</label> + </vbox> + + <vbox id="enable-list" class="action-list" hidden="true"> + <label class="action-header">&action.enable.heading;</label> + </vbox> + </scrollbox> + </vbox> + + <vbox id="update" align="stretch"> + <vbox flex="1"> + <label id="update-heading" class="heading">&update.heading;</label> + </vbox> + <progressmeter id="update-progress" class="progress" mode="undetermined"/> + <vbox flex="1"> + <label id="update-progress-label" class="progress-label">&update.progress.label;</label> + </vbox> + </vbox> + + <vbox id="errors"> + <vbox flex="1"> + <label id="errors-heading" class="heading">&errors.heading;</label> + </vbox> + <description id="errors-description" value="&errors.description;"/> + <spacer flex="1"/> + </vbox> + </deck> + + <hbox id="footer" align="center"> + <label id="footer-label" flex="1">&footer.label;</label> + <button id="cancel" label="&cancel.label;" oncommand="window.close()"/> + <button id="back" label="&back.label;" oncommand="gView.back()" hidden="true"/> + <button id="next" label="&next.label;" oncommand="gView.next()" hidden="true"/> + <button id="done" label="&done.label;" oncommand="gView.done()" hidden="true"/> + </hbox> + +</window> diff --git a/toolkit/mozapps/extensions/content/setting.xml b/toolkit/mozapps/extensions/content/setting.xml index 2b70eb0d0..c4eae1fd3 100644 --- a/toolkit/mozapps/extensions/content/setting.xml +++ b/toolkit/mozapps/extensions/content/setting.xml @@ -8,13 +8,18 @@ %extensionsDTD; ]> -<!-- import-globals-from extensions.js --> - <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + <binding id="settings"> + <content orient="vertical"> + <xul:label class="settings-title" xbl:inherits="xbl:text=label" flex="1"/> + <children/> + </content> + </binding> + <binding id="setting-base"> <implementation> <constructor><![CDATA[ @@ -23,7 +28,7 @@ this.addEventListener("keypress", function(event) { event.stopPropagation(); }, false); - + if (this.usePref) Services.prefs.addObserver(this.pref, this._observer, true); ]]></constructor> @@ -206,7 +211,7 @@ <body> <![CDATA[ let val = Services.prefs.getComplexValue(this.pref, Components.interfaces.nsIPrefLocalizedString).data; - if (this.inverted) val = !val; + if(this.inverted) val = !val; this.value = (val == "true"); ]]> </body> @@ -216,7 +221,7 @@ <body> <![CDATA[ let val = this.value; - if (this.inverted) val = !val; + if(this.inverted) val = !val; let pref = Components.classes["@mozilla.org/pref-localizedstring;1"].createInstance(Components.interfaces.nsIPrefLocalizedString); pref.data = this.inverted ? (!val).toString() : val.toString(); Services.prefs.setComplexValue(this.pref, Components.interfaces.nsIPrefLocalizedString, pref); @@ -292,7 +297,8 @@ <method name="valueFromPreference"> <body> <![CDATA[ - this.value = Preferences.get(this.pref, ""); + const nsISupportsString = Components.interfaces.nsISupportsString; + this.value = Services.prefs.getComplexValue(this.pref, nsISupportsString).data; ]]> </body> </method> @@ -300,7 +306,10 @@ <method name="valueToPreference"> <body> <![CDATA[ - Preferences.set(this.pref, this.value); + const nsISupportsString = Components.interfaces.nsISupportsString; + let iss = Components.classes["@mozilla.org/supports-string;1"].createInstance(nsISupportsString); + iss.data = this.value; + Services.prefs.setComplexValue(this.pref, nsISupportsString, iss); ]]> </body> </method> @@ -386,7 +395,7 @@ <method name="valueFromPreference"> <body> <![CDATA[ - this.value = Preferences.get(this.pref, ""); + this.value = Services.prefs.getCharPref(this.pref); ]]> </body> </method> @@ -394,7 +403,7 @@ <method name="valueToPreference"> <body> <![CDATA[ - Preferences.set(this.pref, this.value); + Services.prefs.setCharPref(this.pref, this.value); ]]> </body> </method> @@ -449,7 +458,20 @@ <method name="valueFromPreference"> <body> <![CDATA[ - let val = Preferences.get(this.pref, "").toString(); + let val; + switch (Services.prefs.getPrefType(this.pref)) { + case Ci.nsIPrefBranch.PREF_STRING: + val = Services.prefs.getCharPref(this.pref); + break; + case Ci.nsIPrefBranch.PREF_INT: + val = Services.prefs.getIntPref(this.pref); + break; + case Ci.nsIPrefBranch.PREF_BOOL: + val = Services.prefs.getBoolPref(this.pref).toString(); + break; + default: + return; + } if ("itemCount" in this.control) { for (let i = 0; i < this.control.itemCount; i++) { @@ -470,12 +492,12 @@ <![CDATA[ // We might not have a pref already set, so we guess the type from the value attribute let val = this.control.selectedItem.value; - if (val == "true" || val == "false") { - val = val == "true"; - } else if (/^-?\d+$/.test(val)) { - val = parseInt(val, 10); - } - Preferences.set(this.pref, val); + if (val == "true" || val == "false") + Services.prefs.setBoolPref(this.pref, val == "true"); + else if (/^-?\d+$/.test(val)) + Services.prefs.setIntPref(this.pref, val); + else + Services.prefs.setCharPref(this.pref, val); ]]> </body> </method> diff --git a/toolkit/mozapps/extensions/content/update.js b/toolkit/mozapps/extensions/content/update.js index 80d0fa688..afc74dca8 100644 --- a/toolkit/mozapps/extensions/content/update.js +++ b/toolkit/mozapps/extensions/content/update.js @@ -50,7 +50,7 @@ var gUpdateWizard = { upgradeFailed: 0, upgradeDeclined: 0, - init: function() + init: function gUpdateWizard_init() { logger = Log.repository.getLogger("addons.update-dialog"); // XXX could we pass the addons themselves rather than the IDs? @@ -82,7 +82,7 @@ var gUpdateWizard = { Services.prefs.setBoolPref(PREF_UPDATE_EXTENSIONS_ENABLED, this.shouldAutoCheck); }, - _setUpButton: function(aButtonID, aButtonKey, aDisabled) + _setUpButton: function gUpdateWizard_setUpButton(aButtonID, aButtonKey, aDisabled) { var strings = document.getElementById("updateStrings"); var button = document.documentElement.getButton(aButtonID); @@ -97,7 +97,7 @@ var gUpdateWizard = { button.disabled = aDisabled; }, - setButtonLabels: function(aBackButton, aBackButtonIsDisabled, + setButtonLabels: function gUpdateWizard_setButtonLabels(aBackButton, aBackButtonIsDisabled, aNextButton, aNextButtonIsDisabled, aCancelButton, aCancelButtonIsDisabled) { @@ -106,21 +106,22 @@ var gUpdateWizard = { this._setUpButton("cancel", aCancelButton, aCancelButtonIsDisabled); }, + ///////////////////////////////////////////////////////////////////////////// // Update Errors errorItems: [], - checkForErrors: function(aElementIDToShow) + checkForErrors: function gUpdateWizard_checkForErrors(aElementIDToShow) { if (this.errorItems.length > 0) document.getElementById(aElementIDToShow).hidden = false; }, - onWizardClose: function(aEvent) + onWizardClose: function gUpdateWizard_onWizardClose(aEvent) { return this.onWizardCancel(); }, - onWizardCancel: function() + onWizardCancel: function gUpdateWizard_onWizardCancel() { gUpdateWizard.shuttingDown = true; // Allow add-ons to continue downloading and installing @@ -130,8 +131,13 @@ var gUpdateWizard = { if (gMismatchPage.waiting) { logger.info("Dialog closed in mismatch page"); if (gUpdateWizard.addonInstalls.size > 0) { - gInstallingPage.startInstalls( - Array.from(gUpdateWizard.addonInstalls.values())); + // Tycho: gInstallingPage.startInstalls([i for ([, i] of gUpdateWizard.addonInstalls)]); + let results = []; + for (let [, i] of gUpdateWizard.addonInstalls) { + results.push(i); + } + + gInstallingPage.startInstalls(results); } return true; } @@ -149,13 +155,13 @@ var gUpdateWizard = { }; var gOfflinePage = { - onPageAdvanced: function() + onPageAdvanced: function gOfflinePage_onPageAdvanced() { Services.io.offline = false; return true; }, - toggleOffline: function() + toggleOffline: function gOfflinePage_toggleOffline() { var nextbtn = document.documentElement.getButton("next"); nextbtn.disabled = !nextbtn.disabled; @@ -164,11 +170,11 @@ var gOfflinePage = { // Addon listener to count addons enabled/disabled by metadata checks var listener = { - onDisabled: function(aAddon) { + onDisabled: function listener_onDisabled(aAddon) { gUpdateWizard.affectedAddonIDs.add(aAddon.id); gUpdateWizard.metadataDisabled++; }, - onEnabled: function(aAddon) { + onEnabled: function listener_onEnabled(aAddon) { gUpdateWizard.affectedAddonIDs.delete(aAddon.id); gUpdateWizard.metadataEnabled++; } @@ -178,7 +184,7 @@ var gVersionInfoPage = { _completeCount: 0, _totalCount: 0, _versionInfoDone: false, - onPageShow: Task.async(function*() { + onPageShow: Task.async(function* gVersionInfoPage_onPageShow() { gUpdateWizard.setButtonLabels(null, true, "nextButtonText", true, "cancelButtonText", false); @@ -195,10 +201,14 @@ var gVersionInfoPage = { logger.debug("repopulateCache completed after dialog closed"); } } - // Fetch the add-ons that are still affected by this update, - // excluding the hotfix add-on. - let idlist = Array.from(gUpdateWizard.affectedAddonIDs).filter( - a => a.id != AddonManager.hotfixID); + // Fetch the add-ons that are still affected by this update. + // Tycho: let idlist = [id for (id of gUpdateWizard.affectedAddonIDs)]; + + let idlist = []; + for (let id of gUpdateWizard.affectedAddonIDs) { + idlist.push(id); + } + if (idlist.length < 1) { gVersionInfoPage.onAllUpdatesFinished(); return; @@ -208,7 +218,16 @@ var gVersionInfoPage = { let fetchedAddons = yield new Promise((resolve, reject) => AddonManager.getAddonsByIDs(idlist, resolve)); // We shouldn't get nulls here, but let's be paranoid... - gUpdateWizard.addons = fetchedAddons.filter(a => a); + // Tycho: gUpdateWizard.addons = [a for (a of fetchedAddons) if (a)]; + let results = []; + for (let a of fetchedAddons) { + if (a) { + results.push(a); + } + } + + gUpdateWizard.addons = results; + if (gUpdateWizard.addons.length < 1) { gVersionInfoPage.onAllUpdatesFinished(); return; @@ -222,7 +241,7 @@ var gVersionInfoPage = { } }), - onAllUpdatesFinished: function() { + onAllUpdatesFinished: function gVersionInfoPage_onAllUpdatesFinished() { AddonManager.removeAddonListener(listener); AddonManagerPrivate.recordSimpleMeasure("appUpdate_disabled", gUpdateWizard.disabled); @@ -236,8 +255,18 @@ var gVersionInfoPage = { AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeFailed", 0); AddonManagerPrivate.recordSimpleMeasure("appUpdate_upgradeDeclined", 0); // Filter out any add-ons that are now enabled. - let addonList = gUpdateWizard.addons.map(a => a.id + ":" + a.appDisabled); - logger.debug("VersionInfo updates finished: found " + addonList.toSource()); + // Tycho: + // logger.debug("VersionInfo updates finished: found " + + // [addon.id + ":" + addon.appDisabled for (addon of gUpdateWizard.addons)].toSource()); + + let logDisabledAddons = []; + for (let addon of gUpdateWizard.addons) { + if (addon.appDisabled) { + logDisabledAddons.push(addon.id + ":" + addon.appDisabled); + } + } + logger.debug("VersionInfo updates finished: found " + logDisabledAddons.toSource()); + let filteredAddons = []; for (let a of gUpdateWizard.addons) { if (a.appDisabled) { @@ -254,8 +283,13 @@ var gVersionInfoPage = { if (gUpdateWizard.shuttingDown) { // jump directly to updating auto-update add-ons in the background if (gUpdateWizard.addonInstalls.size > 0) { - let installs = Array.from(gUpdateWizard.addonInstalls.values()); - gInstallingPage.startInstalls(installs); + // Tycho: gInstallingPage.startInstalls([i for ([, i] of gUpdateWizard.addonInstalls)]); + let results = []; + for (let [, i] of gUpdateWizard.addonInstalls) { + results.push(i); + } + + gInstallingPage.startInstalls(results); } return; } @@ -271,14 +305,15 @@ var gVersionInfoPage = { logger.info("VersionInfo: No updates require further action"); // VersionInfo compatibility updates resolved all compatibility problems, // close this window and continue starting the application... - // XXX Bug 314754 - We need to use setTimeout to close the window due to + //XXX Bug 314754 - We need to use setTimeout to close the window due to // the EM using xmlHttpRequest when checking for updates. setTimeout(close, 0); } }, + ///////////////////////////////////////////////////////////////////////////// // UpdateListener - onUpdateFinished: function(aAddon, status) { + onUpdateFinished: function gVersionInfoPage_onUpdateFinished(aAddon, status) { ++this._completeCount; if (status != AddonManager.UPDATE_STATUS_NO_ERROR) { @@ -317,7 +352,7 @@ var gVersionInfoPage = { this.onAllUpdatesFinished(); }, - onUpdateAvailable: function(aAddon, aInstall) { + onUpdateAvailable: function gVersionInfoPage_onUpdateAvailable(aAddon, aInstall) { logger.debug("VersionInfo got an install for " + aAddon.id + ": " + aAddon.version); gUpdateWizard.addonInstalls.set(aAddon.id, aInstall); }, @@ -326,7 +361,7 @@ var gVersionInfoPage = { var gMismatchPage = { waiting: false, - onPageShow: function() + onPageShow: function gMismatchPage_onPageShow() { gMismatchPage.waiting = true; gUpdateWizard.setButtonLabels(null, true, @@ -346,7 +381,7 @@ var gMismatchPage = { var gUpdatePage = { _totalCount: 0, _completeCount: 0, - onPageShow: function() + onPageShow: function gUpdatePage_onPageShow() { gMismatchPage.waiting = false; gUpdateWizard.setButtonLabels(null, true, @@ -365,7 +400,7 @@ var gUpdatePage = { } }, - onAllUpdatesFinished: function() { + onAllUpdatesFinished: function gUpdatePage_onAllUpdatesFinished() { if (gUpdateWizard.shuttingDown) return; @@ -375,13 +410,14 @@ var gUpdatePage = { document.documentElement.currentPage = nextPage; }, + ///////////////////////////////////////////////////////////////////////////// // UpdateListener - onUpdateAvailable: function(aAddon, aInstall) { + onUpdateAvailable: function gUpdatePage_onUpdateAvailable(aAddon, aInstall) { logger.debug("UpdatePage got an update for " + aAddon.id + ": " + aAddon.version); gUpdateWizard.addonsToUpdate.push(aInstall); }, - onUpdateFinished: function(aAddon, status) { + onUpdateFinished: function gUpdatePage_onUpdateFinished(aAddon, status) { if (status != AddonManager.UPDATE_STATUS_NO_ERROR) gUpdateWizard.errorItems.push(aAddon); @@ -404,7 +440,7 @@ var gUpdatePage = { }; var gFoundPage = { - onPageShow: function() + onPageShow: function gFoundPage_onPageShow() { gUpdateWizard.setButtonLabels(null, true, "installButtonText", false, @@ -430,7 +466,7 @@ var gFoundPage = { } }, - toggleXPInstallEnable: function(aEvent) + toggleXPInstallEnable: function gFoundPage_toggleXPInstallEnable(aEvent) { var enabled = aEvent.target.checked; gUpdateWizard.xpinstallEnabled = enabled; @@ -440,7 +476,7 @@ var gFoundPage = { this.updateNextButton(); }, - updateNextButton: function() + updateNextButton: function gFoundPage_updateNextButton() { if (!gUpdateWizard.xpinstallEnabled) { document.documentElement.getButton("next").disabled = true; @@ -474,20 +510,28 @@ var gInstallingPage = { // Initialize fields we need for installing and tracking progress, // and start iterating through the installations - startInstalls: function(aInstallList) { + startInstalls: function gInstallingPage_startInstalls(aInstallList) { if (!gUpdateWizard.xpinstallEnabled) { return; } - let installs = Array.from(aInstallList).map(a => a.existingAddon.id); - logger.debug("Start installs for " + installs.toSource()); + // Tycho: + // logger.debug("Start installs for " + // + [i.existingAddon.id for (i of aInstallList)].toSource()); + + let logInstallAddons = []; + for (let i of aInstallList) { + logInstallAddons.push(i.existingAddon.id); + } + logger.debug("Start installs for " + logInstallAddons.toSource()); + this._errors = []; this._installs = aInstallList; this._installing = true; this.startNextInstall(); }, - onPageShow: function() + onPageShow: function gInstallingPage_onPageShow() { gUpdateWizard.setButtonLabels(null, true, "nextButtonText", true, @@ -510,7 +554,7 @@ var gInstallingPage = { this.startInstalls(toInstall); }, - startNextInstall: function() { + startNextInstall: function gInstallingPage_startNextInstall() { if (this._currentInstall >= 0) { this._installs[this._currentInstall].removeListener(this); } @@ -548,8 +592,9 @@ var gInstallingPage = { install.install(); }, + ///////////////////////////////////////////////////////////////////////////// // InstallListener - onDownloadStarted: function(aInstall) { + onDownloadStarted: function gInstallingPage_onDownloadStarted(aInstall) { if (gUpdateWizard.shuttingDown) { return; } @@ -559,7 +604,7 @@ var gInstallingPage = { actionItem.value = label; }, - onDownloadProgress: function(aInstall) { + onDownloadProgress: function gInstallingPage_onDownloadProgress(aInstall) { if (gUpdateWizard.shuttingDown) { return; } @@ -567,17 +612,17 @@ var gInstallingPage = { downloadProgress.value = Math.ceil(100 * aInstall.progress / aInstall.maxProgress); }, - onDownloadEnded: function(aInstall) { + onDownloadEnded: function gInstallingPage_onDownloadEnded(aInstall) { }, - onDownloadFailed: function(aInstall) { + onDownloadFailed: function gInstallingPage_onDownloadFailed(aInstall) { this._errors.push(aInstall); gUpdateWizard.upgradeFailed++; this.startNextInstall(); }, - onInstallStarted: function(aInstall) { + onInstallStarted: function gInstallingPage_onInstallStarted(aInstall) { if (gUpdateWizard.shuttingDown) { return; } @@ -587,7 +632,7 @@ var gInstallingPage = { actionItem.value = label; }, - onInstallEnded: function(aInstall, aAddon) { + onInstallEnded: function gInstallingPage_onInstallEnded(aInstall, aAddon) { if (!gUpdateWizard.shuttingDown) { // Remember that this add-on was updated during startup AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_CHANGED, @@ -598,7 +643,7 @@ var gInstallingPage = { this.startNextInstall(); }, - onInstallFailed: function(aInstall) { + onInstallFailed: function gInstallingPage_onInstallFailed(aInstall) { this._errors.push(aInstall); gUpdateWizard.upgradeFailed++; @@ -607,7 +652,7 @@ var gInstallingPage = { }; var gInstallErrorsPage = { - onPageShow: function() + onPageShow: function gInstallErrorsPage_onPageShow() { gUpdateWizard.setButtonLabels(null, true, null, true, null, true); document.documentElement.getButton("finish").focus(); @@ -617,7 +662,7 @@ var gInstallErrorsPage = { // Displayed when there are incompatible add-ons and the xpinstall.enabled // pref is false and locked. var gAdminDisabledPage = { - onPageShow: function() + onPageShow: function gAdminDisabledPage_onPageShow() { gUpdateWizard.setButtonLabels(null, true, null, true, "cancelButtonText", true); @@ -628,7 +673,7 @@ var gAdminDisabledPage = { // Displayed when selected add-on updates have been installed without error. // There can still be add-ons that are not compatible and don't have an update. var gFinishedPage = { - onPageShow: function() + onPageShow: function gFinishedPage_onPageShow() { gUpdateWizard.setButtonLabels(null, true, null, true, null, true); document.documentElement.getButton("finish").focus(); @@ -647,7 +692,7 @@ var gFinishedPage = { // Displayed when there are incompatible add-ons and there are no available // updates. var gNoUpdatesPage = { - onPageShow: function(aEvent) + onPageShow: function gNoUpdatesPage_onPageLoad(aEvent) { gUpdateWizard.setButtonLabels(null, true, null, true, null, true); if (gUpdateWizard.shouldSuggestAutoChecking) { diff --git a/toolkit/mozapps/extensions/content/update.xul b/toolkit/mozapps/extensions/content/update.xul index 745983814..094651fa5 100644 --- a/toolkit/mozapps/extensions/content/update.xul +++ b/toolkit/mozapps/extensions/content/update.xul @@ -87,6 +87,7 @@ <description>&noupdates.intro.desc;</description> <separator class="thin"/> <hbox id="updateCheckErrorNotFound" class="alertBox" hidden="true" align="top"> + <image id="alert"/> <description flex="1">&noupdates.error.desc;</description> </hbox> <separator class="thin"/> @@ -156,6 +157,7 @@ onpageshow="gAdminDisabledPage.onPageShow();"> <separator/> <hbox class="alertBox" align="top"> + <image id="alert"/> <description flex="1">&adminDisabled.warning.label;</description> </hbox> <separator flex="1"/> diff --git a/toolkit/mozapps/extensions/content/xpinstallConfirm.js b/toolkit/mozapps/extensions/content/xpinstallConfirm.js index 5660cdaaf..678e37001 100644 --- a/toolkit/mozapps/extensions/content/xpinstallConfirm.js +++ b/toolkit/mozapps/extensions/content/xpinstallConfirm.js @@ -6,7 +6,7 @@ var XPInstallConfirm = {}; -XPInstallConfirm.init = function() +XPInstallConfirm.init = function XPInstallConfirm_init() { Components.utils.import("resource://gre/modules/AddonManager.jsm"); @@ -36,7 +36,7 @@ XPInstallConfirm.init = function() var delay_in_milliseconds = prefs.getIntPref("security.dialog_enable_delay"); _installCountdownLength = Math.round(delay_in_milliseconds / 500); } catch (ex) { } - + var itemList = document.getElementById("itemList"); let installMap = new WeakMap(); @@ -47,7 +47,7 @@ XPInstallConfirm.init = function() window.close(); } }; - + var numItemsToInstall = args.installs.length; for (let install of args.installs) { var installItem = document.createElement("installitem"); @@ -72,7 +72,7 @@ XPInstallConfirm.init = function() installMap.set(install, installItem); install.addListener(installListener); } - + var introString = bundle.getString("itemWarnIntroSingle"); if (numItemsToInstall > 4) introString = bundle.getFormattedString("itemWarnIntroMultiple", [numItemsToInstall]); @@ -81,7 +81,7 @@ XPInstallConfirm.init = function() while (introNode.hasChildNodes()) introNode.removeChild(introNode.firstChild); introNode.appendChild(textNode); - + var okButton = document.documentElement.getButton("accept"); okButton.focus(); @@ -177,7 +177,7 @@ XPInstallConfirm.init = function() okButton.label = bundle.getString("installButtonLabel"); } -XPInstallConfirm.onOK = function() +XPInstallConfirm.onOK = function XPInstallConfirm_onOk() { Components.classes["@mozilla.org/base/telemetry;1"]. getService(Components.interfaces.nsITelemetry). @@ -188,7 +188,7 @@ XPInstallConfirm.onOK = function() return true; } -XPInstallConfirm.onCancel = function() +XPInstallConfirm.onCancel = function XPInstallConfirm_onCancel() { // Perform the install or cancel after the window has unloaded XPInstallConfirm._installOK = false; |