From c1869c479f1d1bd38d7f58494a9b4a01b5c77981 Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Thu, 19 Nov 2015 16:35:41 -0800 Subject: [PATCH] Bug 1226386: Remove functions names where possible. r=rhelmer We used to need explicit names for functions to make stack traces display properly. The JS engine is smarter now so doesn't need them and they just make the code messy and redundant. --- toolkit/mozapps/extensions/AddonManager.jsm | 270 +++++---- .../extensions/ChromeManifestParser.jsm | 10 +- toolkit/mozapps/extensions/DeferredSave.jsm | 6 +- .../extensions/LightweightThemeManager.jsm | 99 ++-- toolkit/mozapps/extensions/addonManager.js | 32 +- .../mozapps/extensions/amContentHandler.js | 4 +- .../mozapps/extensions/amInstallTrigger.js | 2 +- .../extensions/amWebInstallListener.js | 28 +- .../mozapps/extensions/content/blocklist.js | 2 +- .../mozapps/extensions/content/extensions.js | 537 +++++++++--------- .../mozapps/extensions/content/newaddon.js | 4 +- .../extensions/content/selectAddons.js | 46 +- toolkit/mozapps/extensions/content/update.js | 72 +-- .../extensions/content/xpinstallConfirm.js | 6 +- .../extensions/internal/AddonLogging.jsm | 14 +- .../extensions/internal/AddonRepository.jsm | 112 ++-- .../AddonRepository_SQLiteMigrator.jsm | 44 +- .../internal/AddonUpdateChecker.jsm | 48 +- .../mozapps/extensions/internal/Content.js | 2 +- .../extensions/internal/GMPProvider.jsm | 6 +- .../LightweightThemeImageOptimizer.jsm | 25 +- .../extensions/internal/PluginProvider.jsm | 22 +- .../extensions/internal/XPIProvider.jsm | 361 ++++++------ .../extensions/internal/XPIProviderUtils.js | 64 +-- .../mozapps/extensions/nsBlocklistService.js | 90 ++- .../extensions/nsBlocklistServiceContent.js | 22 +- 26 files changed, 943 insertions(+), 985 deletions(-) diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm index 63949aa7f92..0d8a340b476 100644 --- a/toolkit/mozapps/extensions/AddonManager.jsm +++ b/toolkit/mozapps/extensions/AddonManager.jsm @@ -79,7 +79,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository", XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm"); -XPCOMUtils.defineLazyGetter(this, "CertUtils", function certUtilsLazyGetter() { +XPCOMUtils.defineLazyGetter(this, "CertUtils", function() { let certUtils = {}; Components.utils.import("resource://gre/modules/CertUtils.jsm", certUtils); return certUtils; @@ -137,13 +137,13 @@ function providerName(aProvider) { * parent 'addons' level logger accordingly. */ var PrefObserver = { - init: function PrefObserver_init() { + init: function() { Services.prefs.addObserver(PREF_LOGGING_ENABLED, this, false); Services.obs.addObserver(this, "xpcom-shutdown", false); this.observe(null, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, PREF_LOGGING_ENABLED); }, - observe: function PrefObserver_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { if (aTopic == "xpcom-shutdown") { Services.prefs.removeObserver(PREF_LOGGING_ENABLED, this); Services.obs.removeObserver(this, "xpcom-shutdown"); @@ -370,7 +370,7 @@ AsyncObjectCaller.prototype = { * Passes the next object to the listener or calls noMoreObjects if there * are none left. */ - callNext: function AOC_callNext() { + callNext: function() { if (this.objects.length == 0) { this.listener.noMoreObjects(this); return; @@ -496,7 +496,7 @@ AddonAuthor.prototype = { url: null, // Returns the author's name, defaulting to the empty string - toString: function AddonAuthor_toString() { + toString: function() { return this.name || ""; } } @@ -540,7 +540,7 @@ AddonScreenshot.prototype = { caption: null, // Returns the screenshot URL, defaulting to the empty string - toString: function AddonScreenshot_toString() { + toString: function() { return this.url || ""; } } @@ -646,7 +646,7 @@ function AddonType(aID, aLocaleURI, aLocaleKey, aViewType, aUIPriority, aFlags) this.flags = aFlags; if (aLocaleURI) { - this.__defineGetter__("name", function nameGetter() { + this.__defineGetter__("name", function() { delete this.name; let bundle = Services.strings.createBundle(aLocaleURI); this.name = bundle.GetStringFromName(aLocaleKey.replace("%ID%", aID)); @@ -692,7 +692,7 @@ var AddonManagerInternal = { // A read-only wrapper around the types dictionary typesProxy: Proxy.create({ - getOwnPropertyDescriptor: function typesProxy_getOwnPropertyDescriptor(aName) { + getOwnPropertyDescriptor: function(aName) { if (!(aName in AddonManagerInternal.types)) return undefined; @@ -704,44 +704,44 @@ var AddonManagerInternal = { } }, - getPropertyDescriptor: function typesProxy_getPropertyDescriptor(aName) { + getPropertyDescriptor: function(aName) { return this.getOwnPropertyDescriptor(aName); }, - getOwnPropertyNames: function typesProxy_getOwnPropertyNames() { + getOwnPropertyNames: function() { return Object.keys(AddonManagerInternal.types); }, - getPropertyNames: function typesProxy_getPropertyNames() { + getPropertyNames: function() { return this.getOwnPropertyNames(); }, - delete: function typesProxy_delete(aName) { + delete: function(aName) { // Not allowed to delete properties return false; }, - defineProperty: function typesProxy_defineProperty(aName, aProperty) { + defineProperty: function(aName, aProperty) { // Ignore attempts to define properties }, - fix: function typesProxy_fix(){ + fix: function(){ return undefined; }, // Despite MDC's claims to the contrary, it is required that this trap // be defined - enumerate: function typesProxy_enumerate() { + enumerate: function() { // All properties are enumerable return this.getPropertyNames(); } }), - recordTimestamp: function AMI_recordTimestamp(name, value) { + recordTimestamp: function(name, value) { this.TelemetryTimestamps.add(name, value); }, - validateBlocklist: function AMI_validateBlocklist() { + validateBlocklist: function() { let appBlocklist = FileUtils.getFile(KEY_APPDIR, [FILE_BLOCKLIST]); // If there is no application shipped blocklist then there is nothing to do @@ -875,7 +875,7 @@ var AddonManagerInternal = { * Initializes the AddonManager, loading any known providers and initializing * them. */ - startup: function AMI_startup() { + startup: function() { try { if (gStarted) return; @@ -1051,7 +1051,7 @@ var AddonManagerInternal = { * @param aTypes * An optional array of add-on types */ - registerProvider: function AMI_registerProvider(aProvider, aTypes) { + registerProvider: function(aProvider, aTypes) { if (!aProvider || typeof aProvider != "object") throw Components.Exception("aProvider must be specified", Cr.NS_ERROR_INVALID_ARG); @@ -1077,7 +1077,7 @@ var AddonManagerInternal = { let typeListeners = this.typeListeners.slice(0); for (let listener of typeListeners) { - safeCall(function listenerSafeCall() { + safeCall(function() { listener.onTypeAdded(aType); }); } @@ -1103,7 +1103,7 @@ var AddonManagerInternal = { * For providers that have async shutdown methods returning Promises, * the caller should wait for that Promise to resolve. */ - unregisterProvider: function AMI_unregisterProvider(aProvider) { + unregisterProvider: function(aProvider) { if (!aProvider || typeof aProvider != "object") throw Components.Exception("aProvider must be specified", Cr.NS_ERROR_INVALID_ARG); @@ -1122,7 +1122,7 @@ var AddonManagerInternal = { let typeListeners = this.typeListeners.slice(0); for (let listener of typeListeners) { - safeCall(function listenerSafeCall() { + safeCall(function() { listener.onTypeRemoved(oldType); }); } @@ -1158,7 +1158,7 @@ var AddonManagerInternal = { * * @param aProvider Provider object to mark safe */ - markProviderSafe: function AMI_markProviderSafe(aProvider) { + markProviderSafe: function(aProvider) { if (!gStarted) { throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1188,7 +1188,7 @@ var AddonManagerInternal = { * The method name to call * @see callProvider */ - callProviders: function AMI_callProviders(aMethod, ...aArgs) { + callProviders: function(aMethod, ...aArgs) { if (!aMethod || typeof aMethod != "string") throw Components.Exception("aMethod must be a non-empty string", Cr.NS_ERROR_INVALID_ARG); @@ -1229,7 +1229,7 @@ var AddonManagerInternal = { * @return Promise{null} that resolves when all providers and dependent modules * have finished shutting down */ - shutdownManager: Task.async(function* () { + shutdownManager: Task.async(function*() { logger.debug("shutdown"); this.callManagerListeners("onShutdown"); @@ -1300,7 +1300,7 @@ var AddonManagerInternal = { return filtered; } - AddonManager.getAddonsByTypes(["plugin"], function (aPlugins) { + AddonManager.getAddonsByTypes(["plugin"], function(aPlugins) { port.sendAsyncMessage("PluginList", [filterProperties(p) for (p of aPlugins)]); }); }, @@ -1310,7 +1310,7 @@ var AddonManagerInternal = { * * @see nsIObserver */ - observe: function AMI_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { switch (aData) { case PREF_EM_CHECK_COMPATIBILITY: { let oldValue = gCheckCompatibility; @@ -1406,7 +1406,7 @@ var AddonManagerInternal = { * The optional application version to use for %APP_VERSION% * @return The appropriately escaped URI. */ - escapeAddonURI: function AMI_escapeAddonURI(aAddon, aUri, aAppVersion) + escapeAddonURI: function(aAddon, aUri, aAppVersion) { if (!aAddon || typeof aAddon != "object") throw Components.Exception("aAddon must be an Addon object", @@ -1451,7 +1451,7 @@ var AddonManagerInternal = { // Replace custom parameters (names of custom parameters must have at // least 3 characters to prevent lookups for something like %D0%C8) var catMan = null; - uri = uri.replace(/%(\w{3,})%/g, function parameterReplace(aMatch, aParam) { + uri = uri.replace(/%(\w{3,})%/g, function(aMatch, aParam) { if (!catMan) { catMan = Cc["@mozilla.org/categorymanager;1"]. getService(Ci.nsICategoryManager); @@ -1477,12 +1477,12 @@ var AddonManagerInternal = { * @return Promise{null} Resolves when the background update check is complete * (the resulting addon installations may still be in progress). */ - backgroundUpdateCheck: function AMI_backgroundUpdateCheck() { + backgroundUpdateCheck: function() { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); - let buPromise = Task.spawn(function* backgroundUpdateTask() { + let buPromise = Task.spawn(function*() { let hotfixID = this.hotfixID; let appUpdateEnabled = Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED) && @@ -1516,7 +1516,7 @@ var AddonManagerInternal = { // be applied updates.push(new Promise((resolve, reject) => { addon.findUpdates({ - onUpdateAvailable: function BUC_onUpdateAvailable(aAddon, aInstall) { + onUpdateAvailable: function(aAddon, aInstall) { // Start installing updates when the add-on can be updated and // background updates should be applied. logger.debug("Found update for add-on ${id}", aAddon); @@ -1582,7 +1582,7 @@ var AddonManagerInternal = { null, update.version)); aInstall.addListener({ - onDownloadEnded: function BUC_onDownloadEnded(aInstall) { + onDownloadEnded: function(aInstall) { if (aInstall.addon.id != hotfixID) { logger.warn("The downloaded hotfix add-on did not have the " + "expected ID and so will not be installed."); @@ -1615,13 +1615,13 @@ var AddonManagerInternal = { } }, - onInstallEnded: function BUC_onInstallEnded(aInstall) { + onInstallEnded: function(aInstall) { // Remember the last successfully installed version. Services.prefs.setCharPref(PREF_EM_HOTFIX_LASTVERSION, aInstall.version); }, - onInstallCancelled: function BUC_onInstallCancelled(aInstall) { + onInstallCancelled: function(aInstall) { // Revert to the previous version if the installation was // cancelled. Services.prefs.setCharPref(PREF_EM_HOTFIX_LASTVERSION, @@ -1665,7 +1665,7 @@ var AddonManagerInternal = { * @param aID * The ID of the add-on */ - addStartupChange: function AMI_addStartupChange(aType, aID) { + addStartupChange: function(aType, aID) { if (!aType || typeof aType != "string") throw Components.Exception("aType must be a non-empty string", Cr.NS_ERROR_INVALID_ARG); @@ -1695,7 +1695,7 @@ var AddonManagerInternal = { * @param aID * The ID of the add-on */ - removeStartupChange: function AMI_removeStartupChange(aType, aID) { + removeStartupChange: function(aType, aID) { if (!aType || typeof aType != "string") throw Components.Exception("aType must be a non-empty string", Cr.NS_ERROR_INVALID_ARG); @@ -1720,7 +1720,7 @@ var AddonManagerInternal = { * @param aMethod * The method on the listeners to call */ - callManagerListeners: function AMI_callManagerListeners(aMethod, ...aArgs) { + callManagerListeners: function(aMethod, ...aArgs) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1751,7 +1751,7 @@ var AddonManagerInternal = { * An optional array of extra InstallListeners to also call * @return false if any of the listeners returned false, true otherwise */ - callInstallListeners: function AMI_callInstallListeners(aMethod, + callInstallListeners: function(aMethod, aExtraListeners, ...aArgs) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", @@ -1793,7 +1793,7 @@ var AddonManagerInternal = { * @param aMethod * The method on the listeners to call */ - callAddonListeners: function AMI_callAddonListeners(aMethod, ...aArgs) { + callAddonListeners: function(aMethod, ...aArgs) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1827,7 +1827,7 @@ var AddonManagerInternal = { * A boolean indicating if the change will only take place the next * time the application is restarted */ - notifyAddonChanged: function AMI_notifyAddonChanged(aID, aType, aPendingRestart) { + notifyAddonChanged: function(aID, aType, aPendingRestart) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1864,7 +1864,7 @@ var AddonManagerInternal = { * their add-ons in response to an application change such as a blocklist * update. */ - updateAddonAppDisabledStates: function AMI_updateAddonAppDisabledStates() { + updateAddonAppDisabledStates: function() { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1879,7 +1879,7 @@ var AddonManagerInternal = { * @param aCallback * Function to call when operation is complete. */ - updateAddonRepositoryData: function AMI_updateAddonRepositoryData(aCallback) { + updateAddonRepositoryData: function(aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1889,11 +1889,11 @@ var AddonManagerInternal = { Cr.NS_ERROR_INVALID_ARG); new AsyncObjectCaller(this.providers, "updateAddonRepositoryData", { - nextObject: function updateAddonRepositoryData_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "updateAddonRepositoryData", aCaller.callNext.bind(aCaller)); }, - noMoreObjects: function updateAddonRepositoryData_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback); // only tests should care about this Services.obs.notifyObservers(null, "TEST:addon-repository-data-updated", null); @@ -1922,7 +1922,7 @@ var AddonManagerInternal = { * An optional nsILoadGroup to associate any network requests with * @throws if the aUrl, aCallback or aMimetype arguments are not specified */ - getInstallForURL: function AMI_getInstallForURL(aUrl, aCallback, aMimetype, + getInstallForURL: function(aUrl, aCallback, aMimetype, aHash, aName, aIcons, aVersion, aBrowser) { if (!gStarted) @@ -1992,7 +1992,7 @@ var AddonManagerInternal = { * An optional mimetype hint for the add-on * @throws if the aFile or aCallback arguments are not specified */ - getInstallForFile: function AMI_getInstallForFile(aFile, aCallback, aMimetype) { + getInstallForFile: function(aFile, aCallback, aMimetype) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2010,9 +2010,9 @@ var AddonManagerInternal = { Cr.NS_ERROR_INVALID_ARG); new AsyncObjectCaller(this.providers, "getInstallForFile", { - nextObject: function getInstallForFile_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getInstallForFile", aFile, - function getInstallForFile_safeCall(aInstall) { + function(aInstall) { if (aInstall) safeCall(aCallback, aInstall); else @@ -2020,7 +2020,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getInstallForFile_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, null); } }); @@ -2036,7 +2036,7 @@ var AddonManagerInternal = { * A callback which will be passed an array of AddonInstalls * @throws If the aCallback argument is not specified */ - getInstallsByTypes: function AMI_getInstallsByTypes(aTypes, aCallback) { + getInstallsByTypes: function(aTypes, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2052,9 +2052,9 @@ var AddonManagerInternal = { let installs = []; new AsyncObjectCaller(this.providers, "getInstallsByTypes", { - nextObject: function getInstallsByTypes_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getInstallsByTypes", aTypes, - function getInstallsByTypes_safeCall(aProviderInstalls) { + function(aProviderInstalls) { if (aProviderInstalls) { installs = installs.concat(aProviderInstalls); } @@ -2062,7 +2062,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getInstallsByTypes_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, installs); } }); @@ -2074,7 +2074,7 @@ var AddonManagerInternal = { * @param aCallback * A callback which will be passed an array of AddonInstalls */ - getAllInstalls: function AMI_getAllInstalls(aCallback) { + getAllInstalls: function(aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2094,7 +2094,7 @@ var AddonManagerInternal = { * @return string containing the Addon ID or null * @see amIAddonManager.mapURIToAddonID */ - mapURIToAddonID: function AMI_mapURIToAddonID(aURI) { + mapURIToAddonID: function(aURI) { if (!(aURI instanceof Ci.nsIURI)) { throw Components.Exception("aURI is not a nsIURI", Cr.NS_ERROR_INVALID_ARG); @@ -2119,7 +2119,7 @@ var AddonManagerInternal = { * The mimetype to check * @return true if installation is enabled for the mimetype */ - isInstallEnabled: function AMI_isInstallEnabled(aMimetype) { + isInstallEnabled: function(aMimetype) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2147,7 +2147,7 @@ var AddonManagerInternal = { * The nsIPrincipal that initiated the install * @return true if the source is allowed to install this mimetype */ - isInstallAllowed: function AMI_isInstallAllowed(aMimetype, aInstallingPrincipal) { + isInstallAllowed: function(aMimetype, aInstallingPrincipal) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2182,10 +2182,8 @@ var AddonManagerInternal = { * @param aInstalls * The array of AddonInstalls to be installed */ - installAddonsFromWebpage: function AMI_installAddonsFromWebpage(aMimetype, - aBrowser, - aInstallingPrincipal, - aInstalls) { + installAddonsFromWebpage: function(aMimetype, aBrowser, + aInstallingPrincipal, aInstalls) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2287,12 +2285,12 @@ var AddonManagerInternal = { * @param aListener * The InstallListener to add */ - addInstallListener: function AMI_addInstallListener(aListener) { + addInstallListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be a InstallListener object", Cr.NS_ERROR_INVALID_ARG); - if (!this.installListeners.some(function addInstallListener_matchListener(i) { + if (!this.installListeners.some(function(i) { return i == aListener; })) this.installListeners.push(aListener); }, @@ -2303,7 +2301,7 @@ var AddonManagerInternal = { * @param aListener * The InstallListener to remove */ - removeInstallListener: function AMI_removeInstallListener(aListener) { + removeInstallListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be a InstallListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2324,7 +2322,7 @@ var AddonManagerInternal = { * @return a Promise that rejects if the add-on is not restartless * or an add-on with the same ID is already temporarily installed */ - installTemporaryAddon: function AMI_installTemporaryAddon(aFile) { + installTemporaryAddon: function(aFile) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2358,7 +2356,7 @@ var AddonManagerInternal = { * Optional window object for determining the correct scale. * @return {String} The absolute URL of the icon or null if the addon doesn't have icons */ - getPreferredIconURL: function AMI_getPreferredIconURL(aAddon, aSize, aWindow = undefined) { + getPreferredIconURL: function(aAddon, aSize, aWindow = undefined) { if (aWindow && aWindow.devicePixelRatio) { aSize *= aWindow.devicePixelRatio; } @@ -2422,7 +2420,7 @@ var AddonManagerInternal = { * @rejects Never * @throws if the aID argument is not specified */ - getAddonByID: function AMI_getAddonByID(aID) { + getAddonByID: function(aID) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2446,7 +2444,7 @@ var AddonManagerInternal = { * The callback to pass the retrieved add-on to. * @throws if the aGUID or aCallback arguments are not specified */ - getAddonBySyncGUID: function AMI_getAddonBySyncGUID(aGUID, aCallback) { + getAddonBySyncGUID: function(aGUID, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2460,9 +2458,9 @@ var AddonManagerInternal = { Cr.NS_ERROR_INVALID_ARG); new AsyncObjectCaller(this.providers, "getAddonBySyncGUID", { - nextObject: function getAddonBySyncGUID_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getAddonBySyncGUID", aGUID, - function getAddonBySyncGUID_safeCall(aAddon) { + function(aAddon) { if (aAddon) { safeCall(aCallback, aAddon); } else { @@ -2471,7 +2469,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getAddonBySyncGUID_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, null); } }); @@ -2487,7 +2485,7 @@ var AddonManagerInternal = { * @rejects Never * @throws if the aIDs argument is not specified */ - getAddonsByIDs: function AMI_getAddonsByIDs(aIDs) { + getAddonsByIDs: function(aIDs) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2509,7 +2507,7 @@ var AddonManagerInternal = { * The callback to pass an array of Addons to. * @throws if the aCallback argument is not specified */ - getAddonsByTypes: function AMI_getAddonsByTypes(aTypes, aCallback) { + getAddonsByTypes: function(aTypes, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2525,9 +2523,9 @@ var AddonManagerInternal = { let addons = []; new AsyncObjectCaller(this.providers, "getAddonsByTypes", { - nextObject: function getAddonsByTypes_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getAddonsByTypes", aTypes, - function getAddonsByTypes_concatAddons(aProviderAddons) { + function(aProviderAddons) { if (aProviderAddons) { addons = addons.concat(aProviderAddons); } @@ -2535,7 +2533,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getAddonsByTypes_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, addons); } }); @@ -2547,7 +2545,7 @@ var AddonManagerInternal = { * @param aCallback * A callback which will be passed an array of Addons */ - getAllAddons: function AMI_getAllAddons(aCallback) { + getAllAddons: function(aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2569,8 +2567,7 @@ var AddonManagerInternal = { * The callback to pass the array of Addons to * @throws if the aCallback argument is not specified */ - getAddonsWithOperationsByTypes: - function AMI_getAddonsWithOperationsByTypes(aTypes, aCallback) { + getAddonsWithOperationsByTypes: function(aTypes, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2598,7 +2595,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getAddonsWithOperationsByTypes_noMoreObjects(caller) { + noMoreObjects: function(caller) { safeCall(aCallback, addons); } }); @@ -2610,12 +2607,12 @@ var AddonManagerInternal = { * @param aListener * The listener to add */ - addManagerListener: function AMI_addManagerListener(aListener) { + addManagerListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be an AddonManagerListener object", Cr.NS_ERROR_INVALID_ARG); - if (!this.managerListeners.some(function addManagerListener_matchListener(i) { + if (!this.managerListeners.some(function(i) { return i == aListener; })) this.managerListeners.push(aListener); }, @@ -2626,7 +2623,7 @@ var AddonManagerInternal = { * @param aListener * The listener to remove */ - removeManagerListener: function AMI_removeManagerListener(aListener) { + removeManagerListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be an AddonManagerListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2646,12 +2643,12 @@ var AddonManagerInternal = { * @param aListener * The AddonListener to add */ - addAddonListener: function AMI_addAddonListener(aListener) { + addAddonListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be an AddonListener object", Cr.NS_ERROR_INVALID_ARG); - if (!this.addonListeners.some(function addAddonListener_matchListener(i) { + if (!this.addonListeners.some(function(i) { return i == aListener; })) this.addonListeners.push(aListener); }, @@ -2662,7 +2659,7 @@ var AddonManagerInternal = { * @param aListener * The AddonListener to remove */ - removeAddonListener: function AMI_removeAddonListener(aListener) { + removeAddonListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be an AddonListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2682,12 +2679,12 @@ var AddonManagerInternal = { * @param aListener * The TypeListener to add */ - addTypeListener: function AMI_addTypeListener(aListener) { + addTypeListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be a TypeListener object", Cr.NS_ERROR_INVALID_ARG); - if (!this.typeListeners.some(function addTypeListener_matchListener(i) { + if (!this.typeListeners.some(function(i) { return i == aListener; })) this.typeListeners.push(aListener); }, @@ -2698,7 +2695,7 @@ var AddonManagerInternal = { * @param aListener * The TypeListener to remove */ - removeTypeListener: function AMI_removeTypeListener(aListener) { + removeTypeListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be a TypeListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2795,23 +2792,23 @@ var AddonManagerInternal = { * subject to change at any time. */ this.AddonManagerPrivate = { - startup: function AMP_startup() { + startup: function() { AddonManagerInternal.startup(); }, - registerProvider: function AMP_registerProvider(aProvider, aTypes) { + registerProvider: function(aProvider, aTypes) { AddonManagerInternal.registerProvider(aProvider, aTypes); }, - unregisterProvider: function AMP_unregisterProvider(aProvider) { + unregisterProvider: function(aProvider) { AddonManagerInternal.unregisterProvider(aProvider); }, - markProviderSafe: function AMP_markProviderSafe(aProvider) { + markProviderSafe: function(aProvider) { AddonManagerInternal.markProviderSafe(aProvider); }, - backgroundUpdateCheck: function AMP_backgroundUpdateCheck() { + backgroundUpdateCheck: function() { return AddonManagerInternal.backgroundUpdateCheck(); }, @@ -2829,32 +2826,32 @@ this.AddonManagerPrivate = { AddonManagerInternal.backgroundUpdateCheck(); }, - addStartupChange: function AMP_addStartupChange(aType, aID) { + addStartupChange: function(aType, aID) { AddonManagerInternal.addStartupChange(aType, aID); }, - removeStartupChange: function AMP_removeStartupChange(aType, aID) { + removeStartupChange: function(aType, aID) { AddonManagerInternal.removeStartupChange(aType, aID); }, - notifyAddonChanged: function AMP_notifyAddonChanged(aID, aType, aPendingRestart) { + notifyAddonChanged: function(aID, aType, aPendingRestart) { AddonManagerInternal.notifyAddonChanged(aID, aType, aPendingRestart); }, - updateAddonAppDisabledStates: function AMP_updateAddonAppDisabledStates() { + updateAddonAppDisabledStates: function() { AddonManagerInternal.updateAddonAppDisabledStates(); }, - updateAddonRepositoryData: function AMP_updateAddonRepositoryData(aCallback) { + updateAddonRepositoryData: function(aCallback) { AddonManagerInternal.updateAddonRepositoryData(aCallback); }, - callInstallListeners: function AMP_callInstallListeners(...aArgs) { + callInstallListeners: function(...aArgs) { return AddonManagerInternal.callInstallListeners.apply(AddonManagerInternal, aArgs); }, - callAddonListeners: function AMP_callAddonListeners(...aArgs) { + callAddonListeners: function(...aArgs) { AddonManagerInternal.callAddonListeners.apply(AddonManagerInternal, aArgs); }, @@ -2866,16 +2863,16 @@ this.AddonManagerPrivate = { AddonType: AddonType, - recordTimestamp: function AMP_recordTimestamp(name, value) { + recordTimestamp: function(name, value) { AddonManagerInternal.recordTimestamp(name, value); }, _simpleMeasures: {}, - recordSimpleMeasure: function AMP_recordSimpleMeasure(name, value) { + recordSimpleMeasure: function(name, value) { this._simpleMeasures[name] = value; }, - recordException: function AMP_recordException(aModule, aContext, aException) { + recordException: function(aModule, aContext, aException) { let report = { module: aModule, context: aContext @@ -2895,15 +2892,15 @@ this.AddonManagerPrivate = { this._simpleMeasures.exception = report; }, - getSimpleMeasures: function AMP_getSimpleMeasures() { + getSimpleMeasures: function() { return this._simpleMeasures; }, - getTelemetryDetails: function AMP_getTelemetryDetails() { + getTelemetryDetails: function() { return AddonManagerInternal.telemetryDetails; }, - setTelemetryDetails: function AMP_setTelemetryDetails(aProvider, aDetails) { + setTelemetryDetails: function(aProvider, aDetails) { AddonManagerInternal.telemetryDetails[aProvider] = aDetails; }, @@ -2922,7 +2919,7 @@ this.AddonManagerPrivate = { * This can be used as an implementation for Addon.findUpdates() when * no update mechanism is available. */ - callNoUpdateListeners: function (addon, listener, reason, appVersion, platformVersion) { + callNoUpdateListeners: function(addon, listener, reason, appVersion, platformVersion) { if ("onNoCompatibilityUpdateAvailable" in listener) { safeCall(listener.onNoCompatibilityUpdateAvailable.bind(listener), addon); } @@ -3147,14 +3144,14 @@ this.AddonManager = { return gStartupComplete && !gShutdownInProgress; }, - getInstallForURL: function AM_getInstallForURL(aUrl, aCallback, aMimetype, + getInstallForURL: function(aUrl, aCallback, aMimetype, aHash, aName, aIcons, aVersion, aBrowser) { AddonManagerInternal.getInstallForURL(aUrl, aCallback, aMimetype, aHash, aName, aIcons, aVersion, aBrowser); }, - getInstallForFile: function AM_getInstallForFile(aFile, aCallback, aMimetype) { + getInstallForFile: function(aFile, aCallback, aMimetype) { AddonManagerInternal.getInstallForFile(aFile, aCallback, aMimetype); }, @@ -3165,13 +3162,13 @@ this.AddonManager = { * The type of startup change to get * @return An array of add-on IDs */ - getStartupChanges: function AM_getStartupChanges(aType) { + getStartupChanges: function(aType) { if (!(aType in AddonManagerInternal.startupChanges)) return []; return AddonManagerInternal.startupChanges[aType].slice(0); }, - getAddonByID: function AM_getAddonByID(aID, aCallback) { + getAddonByID: function(aID, aCallback) { if (typeof aCallback != "function") throw Components.Exception("aCallback must be a function", Cr.NS_ERROR_INVALID_ARG); @@ -3181,11 +3178,11 @@ this.AddonManager = { .catch(logger.error); }, - getAddonBySyncGUID: function AM_getAddonBySyncGUID(aGUID, aCallback) { + getAddonBySyncGUID: function(aGUID, aCallback) { AddonManagerInternal.getAddonBySyncGUID(aGUID, aCallback); }, - getAddonsByIDs: function AM_getAddonsByIDs(aIDs, aCallback) { + getAddonsByIDs: function(aIDs, aCallback) { if (typeof aCallback != "function") throw Components.Exception("aCallback must be a function", Cr.NS_ERROR_INVALID_ARG); @@ -3195,40 +3192,39 @@ this.AddonManager = { .catch(logger.error); }, - getAddonsWithOperationsByTypes: - function AM_getAddonsWithOperationsByTypes(aTypes, aCallback) { + getAddonsWithOperationsByTypes: function(aTypes, aCallback) { AddonManagerInternal.getAddonsWithOperationsByTypes(aTypes, aCallback); }, - getAddonsByTypes: function AM_getAddonsByTypes(aTypes, aCallback) { + getAddonsByTypes: function(aTypes, aCallback) { AddonManagerInternal.getAddonsByTypes(aTypes, aCallback); }, - getAllAddons: function AM_getAllAddons(aCallback) { + getAllAddons: function(aCallback) { AddonManagerInternal.getAllAddons(aCallback); }, - getInstallsByTypes: function AM_getInstallsByTypes(aTypes, aCallback) { + getInstallsByTypes: function(aTypes, aCallback) { AddonManagerInternal.getInstallsByTypes(aTypes, aCallback); }, - getAllInstalls: function AM_getAllInstalls(aCallback) { + getAllInstalls: function(aCallback) { AddonManagerInternal.getAllInstalls(aCallback); }, - mapURIToAddonID: function AM_mapURIToAddonID(aURI) { + mapURIToAddonID: function(aURI) { return AddonManagerInternal.mapURIToAddonID(aURI); }, - isInstallEnabled: function AM_isInstallEnabled(aType) { + isInstallEnabled: function(aType) { return AddonManagerInternal.isInstallEnabled(aType); }, - isInstallAllowed: function AM_isInstallAllowed(aType, aInstallingPrincipal) { + isInstallAllowed: function(aType, aInstallingPrincipal) { return AddonManagerInternal.isInstallAllowed(aType, ensurePrincipal(aInstallingPrincipal)); }, - installAddonsFromWebpage: function AM_installAddonsFromWebpage(aType, aBrowser, + installAddonsFromWebpage: function(aType, aBrowser, aInstallingPrincipal, aInstalls) { AddonManagerInternal.installAddonsFromWebpage(aType, aBrowser, @@ -3236,39 +3232,39 @@ this.AddonManager = { aInstalls); }, - installTemporaryAddon: function AM_installTemporaryAddon(aDirectory) { + installTemporaryAddon: function(aDirectory) { return AddonManagerInternal.installTemporaryAddon(aDirectory); }, - addManagerListener: function AM_addManagerListener(aListener) { + addManagerListener: function(aListener) { AddonManagerInternal.addManagerListener(aListener); }, - removeManagerListener: function AM_removeManagerListener(aListener) { + removeManagerListener: function(aListener) { AddonManagerInternal.removeManagerListener(aListener); }, - addInstallListener: function AM_addInstallListener(aListener) { + addInstallListener: function(aListener) { AddonManagerInternal.addInstallListener(aListener); }, - removeInstallListener: function AM_removeInstallListener(aListener) { + removeInstallListener: function(aListener) { AddonManagerInternal.removeInstallListener(aListener); }, - addAddonListener: function AM_addAddonListener(aListener) { + addAddonListener: function(aListener) { AddonManagerInternal.addAddonListener(aListener); }, - removeAddonListener: function AM_removeAddonListener(aListener) { + removeAddonListener: function(aListener) { AddonManagerInternal.removeAddonListener(aListener); }, - addTypeListener: function AM_addTypeListener(aListener) { + addTypeListener: function(aListener) { AddonManagerInternal.addTypeListener(aListener); }, - removeTypeListener: function AM_removeTypeListener(aListener) { + removeTypeListener: function(aListener) { AddonManagerInternal.removeTypeListener(aListener); }, @@ -3283,7 +3279,7 @@ this.AddonManager = { * The Addon representing the add-on * @return true if the addon should auto-update, false otherwise. */ - shouldAutoUpdate: function AM_shouldAutoUpdate(aAddon) { + shouldAutoUpdate: function(aAddon) { if (!aAddon || typeof aAddon != "object") throw Components.Exception("aAddon must be specified", Cr.NS_ERROR_INVALID_ARG); @@ -3345,11 +3341,11 @@ this.AddonManager = { return AddonManagerInternal.hotfixID; }, - escapeAddonURI: function AM_escapeAddonURI(aAddon, aUri, aAppVersion) { + escapeAddonURI: function(aAddon, aUri, aAppVersion) { return AddonManagerInternal.escapeAddonURI(aAddon, aUri, aAppVersion); }, - getPreferredIconURL: function AM_getPreferredIconURL(aAddon, aSize, aWindow = undefined) { + getPreferredIconURL: function(aAddon, aSize, aWindow = undefined) { return AddonManagerInternal.getPreferredIconURL(aAddon, aSize, aWindow); }, diff --git a/toolkit/mozapps/extensions/ChromeManifestParser.jsm b/toolkit/mozapps/extensions/ChromeManifestParser.jsm index 9a77c54295a..ebad5ad7be0 100644 --- a/toolkit/mozapps/extensions/ChromeManifestParser.jsm +++ b/toolkit/mozapps/extensions/ChromeManifestParser.jsm @@ -45,7 +45,7 @@ this.ChromeManifestParser = { * @return Array of objects describing each manifest instruction, in the form: * { type: instruction-type, baseURI: string-uri, args: [arguments] } **/ - parseSync: function CMP_parseSync(aURI) { + parseSync: function(aURI) { function parseLine(aLine) { let line = aLine.trim(); if (line.length == 0 || line.charAt(0) == '#') @@ -81,7 +81,7 @@ this.ChromeManifestParser = { return data; }, - _readFromJar: function CMP_readFromJar(aURI) { + _readFromJar: function(aURI) { let data = ""; let entries = []; let readers = []; @@ -124,7 +124,7 @@ this.ChromeManifestParser = { return data; }, - _readFromFile: function CMP_readFromFile(aURI) { + _readFromFile: function(aURI) { let file = aURI.QueryInterface(Ci.nsIFileURL).file; if (!file.exists() || !file.isFile()) return ""; @@ -151,8 +151,8 @@ this.ChromeManifestParser = { * Instruction type to filter by. * @return True if any matching instructions were found in the manifest. */ - hasType: function CMP_hasType(aManifest, aType) { - return aManifest.some(function hasType_matchEntryType(aEntry) { + hasType: function(aManifest, aType) { + return aManifest.some(function(aEntry) { return aEntry.type == aType; }); } diff --git a/toolkit/mozapps/extensions/DeferredSave.jsm b/toolkit/mozapps/extensions/DeferredSave.jsm index 7587ce83bcc..0daa0fc6c79 100644 --- a/toolkit/mozapps/extensions/DeferredSave.jsm +++ b/toolkit/mozapps/extensions/DeferredSave.jsm @@ -51,13 +51,13 @@ const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed"; * parent 'addons' level logger accordingly. */ var PrefObserver = { - init: function PrefObserver_init() { + init: function() { Services.prefs.addObserver(PREF_LOGGING_ENABLED, this, false); Services.obs.addObserver(this, "xpcom-shutdown", false); this.observe(null, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, PREF_LOGGING_ENABLED); }, - observe: function PrefObserver_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { if (aTopic == "xpcom-shutdown") { Services.prefs.removeObserver(PREF_LOGGING_ENABLED, this); Services.obs.removeObserver(this, "xpcom-shutdown"); @@ -103,7 +103,7 @@ PrefObserver.init(); * that marks the data as needing to be saved, and when the DeferredSave * begins writing the data to disk. Default 50 milliseconds. */ -this.DeferredSave = function (aPath, aDataProvider, aDelay) { +this.DeferredSave = function(aPath, aDataProvider, aDelay) { // Create a new logger (child of 'DeferredSave' logger) // for use by this particular instance of DeferredSave object let leafName = OS.Path.basename(aPath); diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm index eb739965de8..2416fa2e817 100644 --- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm +++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm @@ -42,12 +42,12 @@ const PERSIST_FILES = { XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeImageOptimizer", "resource://gre/modules/addons/LightweightThemeImageOptimizer.jsm"); -this.__defineGetter__("_prefs", function prefsGetter() { +this.__defineGetter__("_prefs", function() { delete this._prefs; return this._prefs = Services.prefs.getBranch("lightweightThemes."); }); -this.__defineGetter__("_maxUsedThemes", function maxUsedThemesGetter() { +this.__defineGetter__("_maxUsedThemes", function() { delete this._maxUsedThemes; try { this._maxUsedThemes = _prefs.getIntPref("maxUsedThemes"); @@ -58,7 +58,7 @@ this.__defineGetter__("_maxUsedThemes", function maxUsedThemesGetter() { return this._maxUsedThemes; }); -this.__defineSetter__("_maxUsedThemes", function maxUsedThemesSetter(aVal) { +this.__defineSetter__("_maxUsedThemes", function(aVal) { delete this._maxUsedThemes; return this._maxUsedThemes = aVal; }); @@ -72,7 +72,7 @@ var _themeIDBeingDisabled = null; // Convert from the old storage format (in which the order of usedThemes // was combined with isThemeSelected to determine which theme was selected) // to the new one (where a selectedThemeID determines which theme is selected). -(function migrateToNewStorageFormat() { +(function() { let wasThemeSelected = false; try { wasThemeSelected = _prefs.getBoolPref("isThemeSelected"); @@ -145,11 +145,11 @@ this.LightweightThemeManager = { return _setCurrentTheme(aData, false); }, - setLocalTheme: function LightweightThemeManager_setLocalTheme(aData) { + setLocalTheme: function(aData) { _setCurrentTheme(aData, true); }, - getUsedTheme: function LightweightThemeManager_getUsedTheme(aId) { + getUsedTheme: function(aId) { var usedThemes = this.usedThemes; for (let usedTheme of usedThemes) { if (usedTheme.id == aId) @@ -158,7 +158,7 @@ this.LightweightThemeManager = { return null; }, - forgetUsedTheme: function LightweightThemeManager_forgetUsedTheme(aId) { + forgetUsedTheme: function(aId) { let theme = this.getUsedTheme(aId); if (!theme || LightweightThemeManager._builtInThemes.has(theme.id)) return; @@ -176,7 +176,7 @@ this.LightweightThemeManager = { AddonManagerPrivate.callAddonListeners("onUninstalled", wrapper); }, - addBuiltInTheme: function LightweightThemeManager_addBuiltInTheme(theme) { + addBuiltInTheme: function(theme) { if (!theme || !theme.id || this.usedThemes.some(t => t.id == theme.id)) { throw new Error("Trying to add invalid builtIn theme"); } @@ -184,7 +184,7 @@ this.LightweightThemeManager = { this._builtInThemes.set(theme.id, theme); }, - forgetBuiltInTheme: function LightweightThemeManager_forgetBuiltInTheme(id) { + forgetBuiltInTheme: function(id) { if (!this._builtInThemes.has(id)) { let currentTheme = this.currentTheme; if (currentTheme && currentTheme.id == id) { @@ -194,13 +194,13 @@ this.LightweightThemeManager = { return this._builtInThemes.delete(id); }, - clearBuiltInThemes: function LightweightThemeManager_clearBuiltInThemes() { + clearBuiltInThemes: function() { for (let id of this._builtInThemes.keys()) { this.forgetBuiltInTheme(id); } }, - previewTheme: function LightweightThemeManager_previewTheme(aData) { + previewTheme: function(aData) { let cancel = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool); cancel.data = false; Services.obs.notifyObservers(cancel, "lightweight-theme-preview-requested", @@ -219,7 +219,7 @@ this.LightweightThemeManager = { _notifyWindows(aData); }, - resetPreview: function LightweightThemeManager_resetPreview() { + resetPreview: function() { if (_previewTimer) { _previewTimer.cancel(); _previewTimer = null; @@ -227,7 +227,7 @@ this.LightweightThemeManager = { } }, - parseTheme: function LightweightThemeManager_parseTheme(aString, aBaseURI) { + parseTheme: function(aString, aBaseURI) { try { return _sanitizeTheme(JSON.parse(aString), aBaseURI, false); } catch (e) { @@ -235,7 +235,7 @@ this.LightweightThemeManager = { } }, - updateCurrentTheme: function LightweightThemeManager_updateCurrentTheme() { + updateCurrentTheme: function() { try { if (!_prefs.getBoolPref("update.enabled")) return; @@ -259,7 +259,7 @@ this.LightweightThemeManager = { req.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING; var self = this; - req.addEventListener("load", function loadEventListener() { + req.addEventListener("load", function() { if (req.status != 200) return; @@ -283,7 +283,7 @@ this.LightweightThemeManager = { * @param aData * The lightweight theme to switch to */ - themeChanged: function LightweightThemeManager_themeChanged(aData) { + themeChanged: function(aData) { if (_previewTimer) { _previewTimer.cancel(); _previewTimer = null; @@ -295,7 +295,7 @@ this.LightweightThemeManager = { _updateUsedThemes(usedThemes); if (PERSIST_ENABLED) { LightweightThemeImageOptimizer.purge(); - _persistImages(aData, function themeChanged_persistImages() { + _persistImages(aData, function() { _notifyWindows(this.currentThemeForDisplay); }.bind(this)); } @@ -314,7 +314,7 @@ this.LightweightThemeManager = { * Starts the Addons provider and enables the new lightweight theme if * necessary. */ - startup: function LightweightThemeManager_startup() { + startup: function() { if (Services.prefs.prefHasUserValue(PREF_LWTHEME_TO_SELECT)) { let id = Services.prefs.getCharPref(PREF_LWTHEME_TO_SELECT); if (id) @@ -330,7 +330,7 @@ this.LightweightThemeManager = { /** * Shuts down the provider. */ - shutdown: function LightweightThemeManager_shutdown() { + shutdown: function() { _prefs.removeObserver("", _prefObserver); }, @@ -346,7 +346,7 @@ this.LightweightThemeManager = { * true if the newly enabled add-on will only become enabled after a * restart */ - addonChanged: function LightweightThemeManager_addonChanged(aId, aType, aPendingRestart) { + addonChanged: function(aId, aType, aPendingRestart) { if (aType != ADDON_TYPE) return; @@ -419,7 +419,7 @@ this.LightweightThemeManager = { * @param aCallback * A callback to pass the Addon to */ - getAddonByID: function LightweightThemeManager_getAddonByID(aId, aCallback) { + getAddonByID: function(aId, aCallback) { let id = _getInternalID(aId); if (!id) { aCallback(null); @@ -443,7 +443,7 @@ this.LightweightThemeManager = { * @param aCallback * A callback to pass an array of Addons to */ - getAddonsByTypes: function LightweightThemeManager_getAddonsByTypes(aTypes, aCallback) { + getAddonsByTypes: function(aTypes, aCallback) { if (aTypes && aTypes.indexOf(ADDON_TYPE) == -1) { aCallback([]); return; @@ -458,57 +458,55 @@ this.LightweightThemeManager = { * consumers of the AddonManager API. */ function AddonWrapper(aTheme) { - this.__defineGetter__("id", function AddonWrapper_idGetter() { + this.__defineGetter__("id", function() { return aTheme.id + ID_SUFFIX; }); - this.__defineGetter__("type", function AddonWrapper_typeGetter() { + this.__defineGetter__("type", function() { return ADDON_TYPE; }); - this.__defineGetter__("isActive", function AddonWrapper_isActiveGetter() { + this.__defineGetter__("isActive", function() { let current = LightweightThemeManager.currentTheme; if (current) return aTheme.id == current.id; return false; }); - this.__defineGetter__("name", function AddonWrapper_nameGetter() { + this.__defineGetter__("name", function() { return aTheme.name; }); - this.__defineGetter__("version", function AddonWrapper_versionGetter() { + this.__defineGetter__("version", function() { return "version" in aTheme ? aTheme.version : ""; }); ["description", "homepageURL", "iconURL"].forEach(function(prop) { - this.__defineGetter__(prop, function AddonWrapper_optionalPropGetter() { + this.__defineGetter__(prop, function() { return prop in aTheme ? aTheme[prop] : null; }); }, this); ["installDate", "updateDate"].forEach(function(prop) { - this.__defineGetter__(prop, function AddonWrapper_datePropGetter() { + this.__defineGetter__(prop, function() { return prop in aTheme ? new Date(aTheme[prop]) : null; }); }, this); - this.__defineGetter__("creator", function AddonWrapper_creatorGetter() { + this.__defineGetter__("creator", function() { return "author" in aTheme ? new AddonManagerPrivate.AddonAuthor(aTheme.author) : null; }); - this.__defineGetter__("screenshots", function AddonWrapper_screenshotsGetter() { + this.__defineGetter__("screenshots", function() { let url = aTheme.previewURL; return [new AddonManagerPrivate.AddonScreenshot(url)]; }); - this.__defineGetter__("pendingOperations", - function AddonWrapper_pendingOperationsGetter() { + this.__defineGetter__("pendingOperations", function() { let pending = AddonManager.PENDING_NONE; if (this.isActive == this.userDisabled) pending |= this.isActive ? AddonManager.PENDING_DISABLE : AddonManager.PENDING_ENABLE; return pending; }); - this.__defineGetter__("operationsRequiringRestart", - function AddonWrapper_operationsRequiringRestartGetter() { + this.__defineGetter__("operationsRequiringRestart", function() { // If a non-default theme is in use then a restart will be required to // enable lightweight themes unless dynamic theme switching is enabled if (Services.prefs.prefHasUserValue(PREF_GENERAL_SKINS_SELECTEDSKIN)) { @@ -524,13 +522,13 @@ function AddonWrapper(aTheme) { return AddonManager.OP_NEEDS_RESTART_NONE; }); - this.__defineGetter__("size", function AddonWrapper_sizeGetter() { + this.__defineGetter__("size", function() { // The size changes depending on whether the theme is in use or not, this is // probably not worth exposing. return null; }); - this.__defineGetter__("permissions", function AddonWrapper_permissionsGetter() { + this.__defineGetter__("permissions", function() { let permissions = 0; // Do not allow uninstall of builtIn themes. @@ -543,7 +541,7 @@ function AddonWrapper(aTheme) { return permissions; }); - this.__defineGetter__("userDisabled", function AddonWrapper_userDisabledGetter() { + this.__defineGetter__("userDisabled", function() { if (_themeIDBeingEnabled == aTheme.id) return false; if (_themeIDBeingDisabled == aTheme.id) @@ -559,7 +557,7 @@ function AddonWrapper(aTheme) { } }); - this.__defineSetter__("userDisabled", function AddonWrapper_userDisabledSetter(val) { + this.__defineSetter__("userDisabled", function(val) { if (val == this.userDisabled) return val; @@ -571,15 +569,15 @@ function AddonWrapper(aTheme) { return val; }); - this.uninstall = function AddonWrapper_uninstall() { + this.uninstall = function() { LightweightThemeManager.forgetUsedTheme(aTheme.id); }; - this.cancelUninstall = function AddonWrapper_cancelUninstall() { + this.cancelUninstall = function() { throw new Error("Theme is not marked to be uninstalled"); }; - this.findUpdates = function AddonWrapper_findUpdates(listener, reason, appVersion, platformVersion) { + this.findUpdates = function(listener, reason, appVersion, platformVersion) { AddonManagerPrivate.callNoUpdateListeners(this, listener, reason, appVersion, platformVersion); }; } @@ -608,7 +606,7 @@ AddonWrapper.prototype = { }, // Lightweight themes are always compatible - isCompatibleWith: function AddonWrapper_isCompatibleWith(appVersion, platformVersion) { + isCompatibleWith: function(appVersion, platformVersion) { return true; }, @@ -742,8 +740,7 @@ function _sanitizeTheme(aData, aBaseURI, aLocal) { } function _usedThemesExceptId(aId) { - return LightweightThemeManager.usedThemes.filter( - function usedThemesExceptId_filterID(t) { + return LightweightThemeManager.usedThemes.filter(function(t) { return "id" in t && t.id != aId; }); } @@ -783,7 +780,7 @@ function _notifyWindows(aThemeData) { var _previewTimer; var _previewTimerCallback = { - notify: function _previewTimerCallback_notify() { + notify: function() { LightweightThemeManager.resetPreview(); } }; @@ -860,11 +857,11 @@ function _persistImage(sourceURL, localFileName, successCallback) { } function _persistProgressListener(successCallback) { - this.onLocationChange = function persistProgressListener_onLocationChange() {}; - this.onProgressChange = function persistProgressListener_onProgressChange() {}; - this.onStatusChange = function persistProgressListener_onStatusChange() {}; - this.onSecurityChange = function persistProgressListener_onSecurityChange() {}; - this.onStateChange = function persistProgressListener_onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) { + this.onLocationChange = function() {}; + this.onProgressChange = function() {}; + this.onStatusChange = function() {}; + this.onSecurityChange = function() {}; + this.onStateChange = function(aWebProgress, aRequest, aStateFlags, aStatus) { if (aRequest && aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK && aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) { diff --git a/toolkit/mozapps/extensions/addonManager.js b/toolkit/mozapps/extensions/addonManager.js index 731e70c6c4b..24bca7e09bf 100644 --- a/toolkit/mozapps/extensions/addonManager.js +++ b/toolkit/mozapps/extensions/addonManager.js @@ -53,7 +53,7 @@ function amManager() { } amManager.prototype = { - observe: function AMC_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { if (aTopic == "addons-startup") AddonManagerPrivate.startup(); }, @@ -61,7 +61,7 @@ amManager.prototype = { /** * @see amIAddonManager.idl */ - mapURIToAddonID: function AMC_mapURIToAddonID(uri, id) { + mapURIToAddonID: function(uri, id) { id.value = AddonManager.mapURIToAddonID(uri); return !!id.value; }, @@ -69,19 +69,15 @@ amManager.prototype = { /** * @see amIWebInstaller.idl */ - isInstallEnabled: function AMC_isInstallEnabled(aMimetype, aReferer) { + isInstallEnabled: function(aMimetype, aReferer) { return AddonManager.isInstallEnabled(aMimetype); }, /** * @see amIWebInstaller.idl */ - installAddonsFromWebpage: function AMC_installAddonsFromWebpage(aMimetype, - aBrowser, - aInstallingPrincipal, - aUris, aHashes, - aNames, aIcons, - aCallback) { + installAddonsFromWebpage: function(aMimetype, aBrowser, aInstallingPrincipal, + aUris, aHashes, aNames, aIcons, aCallback) { if (aUris.length == 0) return false; @@ -98,7 +94,7 @@ amManager.prototype = { return; } let uri = aUris.shift(); - AddonManager.getInstallForURL(uri, function buildNextInstall_getInstallForURL(aInstall) { + AddonManager.getInstallForURL(uri, function(aInstall) { function callCallback(aUri, aStatus) { try { aCallback.onInstallEnded(aUri, aStatus); @@ -112,22 +108,22 @@ amManager.prototype = { installs.push(aInstall); if (aCallback) { aInstall.addListener({ - onDownloadCancelled: function buildNextInstall_onDownloadCancelled(aInstall) { + onDownloadCancelled: function(aInstall) { callCallback(uri, USER_CANCELLED); }, - onDownloadFailed: function buildNextInstall_onDownloadFailed(aInstall) { + onDownloadFailed: function(aInstall) { if (aInstall.error == AddonManager.ERROR_CORRUPT_FILE) callCallback(uri, CANT_READ_ARCHIVE); else callCallback(uri, DOWNLOAD_ERROR); }, - onInstallFailed: function buildNextInstall_onInstallFailed(aInstall) { + onInstallFailed: function(aInstall) { callCallback(uri, EXECUTION_ERROR); }, - onInstallEnded: function buildNextInstall_onInstallEnded(aInstall, aStatus) { + onInstallEnded: function(aInstall, aStatus) { callCallback(uri, SUCCESS); } }); @@ -144,7 +140,7 @@ amManager.prototype = { return retval; }, - notify: function AMC_notify(aTimer) { + notify: function(aTimer) { AddonManagerPrivate.backgroundUpdateTimerHandler(); }, @@ -154,7 +150,7 @@ amManager.prototype = { * Listens to requests from child processes for InstallTrigger * activity, and sends back callbacks. */ - receiveMessage: function AMC_receiveMessage(aMessage) { + receiveMessage: function(aMessage) { let payload = aMessage.data; switch (aMessage.name) { @@ -165,7 +161,7 @@ amManager.prototype = { let callback = null; if (payload.callbackID != -1) { callback = { - onInstallEnded: function ITP_callback(url, status) { + onInstallEnded: function(url, status) { gParentMM.broadcastAsyncMessage(MSG_INSTALL_CALLBACK, { callbackID: payload.callbackID, url: url, @@ -184,7 +180,7 @@ amManager.prototype = { classID: Components.ID("{4399533d-08d1-458c-a87a-235f74451cfa}"), _xpcom_factory: { - createInstance: function AMC_createInstance(aOuter, aIid) { + createInstance: function(aOuter, aIid) { if (aOuter != null) throw Components.Exception("Component does not support aggregation", Cr.NS_ERROR_NO_AGGREGATION); diff --git a/toolkit/mozapps/extensions/amContentHandler.js b/toolkit/mozapps/extensions/amContentHandler.js index 708f670b1e8..8dc4dfecdce 100644 --- a/toolkit/mozapps/extensions/amContentHandler.js +++ b/toolkit/mozapps/extensions/amContentHandler.js @@ -28,7 +28,7 @@ amContentHandler.prototype = { * @param aRequest * The nsIRequest dealing with the content */ - handleContent: function XCH_handleContent(aMimetype, aContext, aRequest) { + handleContent: function(aMimetype, aContext, aRequest) { if (aMimetype != XPI_CONTENT_TYPE) throw Cr.NS_ERROR_WONT_HANDLE_CONTENT; @@ -89,7 +89,7 @@ amContentHandler.prototype = { classID: Components.ID("{7beb3ba8-6ec3-41b4-b67c-da89b8518922}"), QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentHandler]), - log : function XCH_log(aMsg) { + log : function(aMsg) { let msg = "amContentHandler.js: " + (aMsg.join ? aMsg.join("") : aMsg); Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService). logStringMessage(msg); diff --git a/toolkit/mozapps/extensions/amInstallTrigger.js b/toolkit/mozapps/extensions/amInstallTrigger.js index ccb944984ab..c157a24b6f1 100644 --- a/toolkit/mozapps/extensions/amInstallTrigger.js +++ b/toolkit/mozapps/extensions/amInstallTrigger.js @@ -203,7 +203,7 @@ InstallTrigger.prototype = { return this.startSoftwareUpdate(url); }, - _resolveURL: function (url) { + _resolveURL: function(url) { return Services.io.newURI(url, null, this._url); }, diff --git a/toolkit/mozapps/extensions/amWebInstallListener.js b/toolkit/mozapps/extensions/amWebInstallListener.js index e9e7858f0dd..3bdf70ccbe6 100644 --- a/toolkit/mozapps/extensions/amWebInstallListener.js +++ b/toolkit/mozapps/extensions/amWebInstallListener.js @@ -90,7 +90,7 @@ Installer.prototype = { /** * Checks if all downloads are now complete and if so prompts to install. */ - checkAllDownloaded: function Installer_checkAllDownloaded() { + checkAllDownloaded: function() { // Prevent re-entrancy caused by the confirmation dialog cancelling unwanted // installs. if (!this.isDownloading) @@ -205,7 +205,7 @@ Installer.prototype = { /** * Checks if all installs are now complete and if so notifies observers. */ - checkAllInstalled: function Installer_checkAllInstalled() { + checkAllInstalled: function() { var failed = []; for (let install of this.downloads) { @@ -231,32 +231,32 @@ Installer.prototype = { this.installed = null; }, - onDownloadCancelled: function Installer_onDownloadCancelled(aInstall) { + onDownloadCancelled: function(aInstall) { aInstall.removeListener(this); this.checkAllDownloaded(); }, - onDownloadFailed: function Installer_onDownloadFailed(aInstall) { + onDownloadFailed: function(aInstall) { aInstall.removeListener(this); this.checkAllDownloaded(); }, - onDownloadEnded: function Installer_onDownloadEnded(aInstall) { + onDownloadEnded: function(aInstall) { this.checkAllDownloaded(); return false; }, - onInstallCancelled: function Installer_onInstallCancelled(aInstall) { + onInstallCancelled: function(aInstall) { aInstall.removeListener(this); this.checkAllInstalled(); }, - onInstallFailed: function Installer_onInstallFailed(aInstall) { + onInstallFailed: function(aInstall) { aInstall.removeListener(this); this.checkAllInstalled(); }, - onInstallEnded: function Installer_onInstallEnded(aInstall) { + onInstallEnded: function(aInstall) { aInstall.removeListener(this); this.installed.push(aInstall); @@ -278,7 +278,7 @@ extWebInstallListener.prototype = { /** * @see amIWebInstallListener.idl */ - onWebInstallDisabled: function extWebInstallListener_onWebInstallDisabled(aBrowser, aUri, aInstalls) { + onWebInstallDisabled: function(aBrowser, aUri, aInstalls) { let info = { browser: aBrowser, originatingURI: aUri, @@ -292,13 +292,13 @@ extWebInstallListener.prototype = { /** * @see amIWebInstallListener.idl */ - onWebInstallOriginBlocked: function extWebInstallListener_onWebInstallOriginBlocked(aBrowser, aUri, aInstalls) { + onWebInstallOriginBlocked: function(aBrowser, aUri, aInstalls) { let info = { browser: aBrowser, originatingURI: aUri, installs: aInstalls, - install: function onWebInstallBlocked_install() { + install: function() { }, QueryInterface: XPCOMUtils.generateQI([Ci.amIWebInstallInfo]) @@ -311,13 +311,13 @@ extWebInstallListener.prototype = { /** * @see amIWebInstallListener.idl */ - onWebInstallBlocked: function extWebInstallListener_onWebInstallBlocked(aBrowser, aUri, aInstalls) { + onWebInstallBlocked: function(aBrowser, aUri, aInstalls) { let info = { browser: aBrowser, originatingURI: aUri, installs: aInstalls, - install: function onWebInstallBlocked_install() { + install: function() { new Installer(this.browser, this.originatingURI, this.installs); }, @@ -331,7 +331,7 @@ extWebInstallListener.prototype = { /** * @see amIWebInstallListener.idl */ - onWebInstallRequested: function extWebInstallListener_onWebInstallRequested(aBrowser, aUri, aInstalls) { + onWebInstallRequested: function(aBrowser, aUri, aInstalls) { new Installer(aBrowser, aUri, aInstalls); // We start the installs ourself diff --git a/toolkit/mozapps/extensions/content/blocklist.js b/toolkit/mozapps/extensions/content/blocklist.js index 6b47fd65298..6d524e6eee4 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 listSort(a, b) { return String.localeCompare(a.name, b.name); }); + list.sort(function(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/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index c5ea3a7197c..c820baa59b4 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -24,7 +24,7 @@ const SIGNING_REQUIRED = CONSTANTS.REQUIRE_SIGNING ? XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", "resource://gre/modules/PluralForm.jsm"); -XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () { +XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() { return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}). BrowserToolboxProcess; }); @@ -64,20 +64,20 @@ XPCOMUtils.defineLazyServiceGetter(gStrings, "bundleSvc", "@mozilla.org/intl/stringbundle;1", "nsIStringBundleService"); -XPCOMUtils.defineLazyGetter(gStrings, "brand", function brandLazyGetter() { +XPCOMUtils.defineLazyGetter(gStrings, "brand", function() { return this.bundleSvc.createBundle("chrome://branding/locale/brand.properties"); }); -XPCOMUtils.defineLazyGetter(gStrings, "ext", function extLazyGetter() { +XPCOMUtils.defineLazyGetter(gStrings, "ext", function() { return this.bundleSvc.createBundle("chrome://mozapps/locale/extensions/extensions.properties"); }); -XPCOMUtils.defineLazyGetter(gStrings, "dl", function dlLazyGetter() { +XPCOMUtils.defineLazyGetter(gStrings, "dl", function() { return this.bundleSvc.createBundle("chrome://mozapps/locale/downloads/downloads.properties"); }); -XPCOMUtils.defineLazyGetter(gStrings, "brandShortName", function brandShortNameLazyGetter() { +XPCOMUtils.defineLazyGetter(gStrings, "brandShortName", function() { return this.brand.GetStringFromName("brandShortName"); }); -XPCOMUtils.defineLazyGetter(gStrings, "appVersion", function appVersionLazyGetter() { +XPCOMUtils.defineLazyGetter(gStrings, "appVersion", function() { return Services.appinfo.version; }); @@ -85,7 +85,7 @@ document.addEventListener("load", initialize, true); window.addEventListener("unload", shutdown, false); var gPendingInitializations = 1; -this.__defineGetter__("gIsInitializing", function gIsInitializingGetter() { +this.__defineGetter__("gIsInitializing", function() { return gPendingInitializations > 0; }); @@ -311,27 +311,27 @@ var HTML5History = { .canGoForward; }, - back: function HTML5History_back() { + back: function() { window.history.back(); gViewController.updateCommand("cmd_back"); gViewController.updateCommand("cmd_forward"); }, - forward: function HTML5History_forward() { + forward: function() { window.history.forward(); gViewController.updateCommand("cmd_back"); gViewController.updateCommand("cmd_forward"); }, - pushState: function HTML5History_pushState(aState) { + pushState: function(aState) { window.history.pushState(aState, document.title); }, - replaceState: function HTML5History_replaceState(aState) { + replaceState: function(aState) { window.history.replaceState(aState, document.title); }, - popState: function HTML5History_popState() { + popState: function() { function onStatePopped(aEvent) { window.removeEventListener("popstate", onStatePopped, true); // TODO To ensure we can't go forward again we put an additional entry @@ -365,7 +365,7 @@ var FakeHistory = { return (this.pos + 1) < this.states.length; }, - back: function FakeHistory_back() { + back: function() { if (this.pos == 0) throw Components.Exception("Cannot go back from this point"); @@ -375,7 +375,7 @@ var FakeHistory = { gViewController.updateCommand("cmd_forward"); }, - forward: function FakeHistory_forward() { + forward: function() { if ((this.pos + 1) >= this.states.length) throw Components.Exception("Cannot go forward from this point"); @@ -385,17 +385,17 @@ var FakeHistory = { gViewController.updateCommand("cmd_forward"); }, - pushState: function FakeHistory_pushState(aState) { + pushState: function(aState) { this.pos++; this.states.splice(this.pos, this.states.length); this.states.push(aState); }, - replaceState: function FakeHistory_replaceState(aState) { + replaceState: function(aState) { this.states[this.pos] = aState; }, - popState: function FakeHistory_popState() { + popState: function() { if (this.pos == 0) throw Components.Exception("Cannot popState from this view"); @@ -423,7 +423,7 @@ var gEventManager = { _listeners: {}, _installListeners: [], - initialize: function gEM_initialize() { + initialize: function() { var self = this; const ADDON_EVENTS = ["onEnabling", "onEnabled", "onDisabling", "onDisabled", "onUninstalling", "onUninstalled", @@ -433,7 +433,7 @@ var gEventManager = { "onPropertyChanged"]; for (let evt of ADDON_EVENTS) { let event = evt; - self[event] = function initialize_delegateAddonEvent(...aArgs) { + self[event] = function(...aArgs) { self.delegateAddonEvent(event, aArgs); }; } @@ -446,7 +446,7 @@ var gEventManager = { "onExternalInstall"]; for (let evt of INSTALL_EVENTS) { let event = evt; - self[event] = function initialize_delegateInstallEvent(...aArgs) { + self[event] = function(...aArgs) { self.delegateInstallEvent(event, aArgs); }; } @@ -459,7 +459,7 @@ var gEventManager = { this.refreshAutoUpdateDefault(); var contextMenu = document.getElementById("addonitem-popup"); - contextMenu.addEventListener("popupshowing", function contextMenu_onPopupshowing() { + contextMenu.addEventListener("popupshowing", function() { var addon = gViewController.currentViewObj.getSelectedAddon(); contextMenu.setAttribute("addontype", addon.type); @@ -506,13 +506,13 @@ var gEventManager = { }, false); }, - shutdown: function gEM_shutdown() { + shutdown: function() { AddonManager.removeManagerListener(this); AddonManager.removeInstallListener(this); AddonManager.removeAddonListener(this); }, - registerAddonListener: function gEM_registerAddonListener(aListener, aAddonId) { + registerAddonListener: function(aListener, aAddonId) { if (!(aAddonId in this._listeners)) this._listeners[aAddonId] = []; else if (this._listeners[aAddonId].indexOf(aListener) != -1) @@ -520,7 +520,7 @@ var gEventManager = { this._listeners[aAddonId].push(aListener); }, - unregisterAddonListener: function gEM_unregisterAddonListener(aListener, aAddonId) { + unregisterAddonListener: function(aListener, aAddonId) { if (!(aAddonId in this._listeners)) return; var index = this._listeners[aAddonId].indexOf(aListener); @@ -529,20 +529,20 @@ var gEventManager = { this._listeners[aAddonId].splice(index, 1); }, - registerInstallListener: function gEM_registerInstallListener(aListener) { + registerInstallListener: function(aListener) { if (this._installListeners.indexOf(aListener) != -1) return; this._installListeners.push(aListener); }, - unregisterInstallListener: function gEM_unregisterInstallListener(aListener) { + unregisterInstallListener: function(aListener) { var i = this._installListeners.indexOf(aListener); if (i == -1) return; this._installListeners.splice(i, 1); }, - delegateAddonEvent: function gEM_delegateAddonEvent(aEvent, aParams) { + delegateAddonEvent: function(aEvent, aParams) { var addon = aParams.shift(); if (!(addon.id in this._listeners)) return; @@ -560,7 +560,7 @@ var gEventManager = { } }, - delegateInstallEvent: function gEM_delegateInstallEvent(aEvent, aParams) { + delegateInstallEvent: function(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 @@ -579,7 +579,7 @@ var gEventManager = { } }, - refreshGlobalWarning: function gEM_refreshGlobalWarning() { + refreshGlobalWarning: function() { var page = document.getElementById("addons-page"); if (Services.appinfo.inSafeMode) { @@ -601,7 +601,7 @@ var gEventManager = { page.removeAttribute("warning"); }, - refreshAutoUpdateDefault: function gEM_refreshAutoUpdateDefault() { + refreshAutoUpdateDefault: function() { var updateEnabled = AddonManager.updateEnabled; var autoUpdateDefault = AddonManager.autoUpdateDefault; @@ -614,15 +614,15 @@ var gEventManager = { document.getElementById("utils-resetAddonUpdatesToManual").hidden = autoUpdateDefault; }, - onCompatibilityModeChanged: function gEM_onCompatibilityModeChanged() { + onCompatibilityModeChanged: function() { this.refreshGlobalWarning(); }, - onCheckUpdateSecurityChanged: function gEM_onCheckUpdateSecurityChanged() { + onCheckUpdateSecurityChanged: function() { this.refreshGlobalWarning(); }, - onUpdateModeChanged: function gEM_onUpdateModeChanged() { + onUpdateModeChanged: function() { this.refreshAutoUpdateDefault(); } }; @@ -638,7 +638,7 @@ var gViewController = { initialViewSelected: false, lastHistoryIndex: -1, - initialize: function gVC_initialize() { + initialize: function() { this.viewPort = document.getElementById("view-port"); this.viewObjects["search"] = gSearchView; @@ -654,14 +654,13 @@ var gViewController = { window.controllers.appendController(this); - window.addEventListener("popstate", - function window_onStatePopped(e) { + window.addEventListener("popstate", function(e) { gViewController.updateState(e.state); }, false); }, - shutdown: function gVC_shutdown() { + shutdown: function() { if (this.currentViewObj) this.currentViewObj.hide(); this.currentViewRequest = 0; @@ -681,7 +680,7 @@ var gViewController = { window.controllers.removeController(this); }, - updateState: function gVC_updateState(state) { + updateState: function(state) { try { this.loadViewInternal(state.view, state.previousView, state); this.lastHistoryIndex = gHistory.index; @@ -702,7 +701,7 @@ var gViewController = { } }, - parseViewId: function gVC_parseViewId(aViewId) { + parseViewId: function(aViewId) { var matchRegex = /^addons:\/\/([^\/]+)\/(.*)$/; var [,viewType, viewParam] = aViewId.match(matchRegex) || []; return {type: viewType, param: decodeURIComponent(viewParam)}; @@ -712,7 +711,7 @@ var gViewController = { return !this.currentViewObj || this.currentViewObj.node.hasAttribute("loading"); }, - loadView: function gVC_loadView(aViewId) { + loadView: function(aViewId) { var isRefresh = false; if (aViewId == this.currentViewId) { if (this.isLoading) @@ -737,7 +736,7 @@ var gViewController = { // Replaces the existing view with a new one, rewriting the current history // entry to match. - replaceView: function gVC_replaceView(aViewId) { + replaceView: function(aViewId) { if (aViewId == this.currentViewId) return; @@ -749,7 +748,7 @@ var gViewController = { this.loadViewInternal(aViewId, null, state); }, - loadInitialView: function gVC_loadInitialView(aViewId) { + loadInitialView: function(aViewId) { var state = { view: aViewId, previousView: null @@ -761,7 +760,7 @@ var gViewController = { notifyInitialized(); }, - loadViewInternal: function gVC_loadViewInternal(aViewId, aPreviousView, aState) { + loadViewInternal: function(aViewId, aPreviousView, aState) { var view = this.parseViewId(aViewId); if (!view.type || !(view.type in this.viewObjects)) @@ -799,12 +798,12 @@ var gViewController = { }, // Moves back in the document history and removes the current history entry - popState: function gVC_popState(aCallback) { + popState: function(aCallback) { this.viewChangeCallback = aCallback; gHistory.popState(); }, - notifyViewChanged: function gVC_notifyViewChanged() { + notifyViewChanged: function() { this.viewPort.selectedPanel.removeAttribute("loading"); if (this.viewChangeCallback) { @@ -819,35 +818,35 @@ var gViewController = { commands: { cmd_back: { - isEnabled: function cmd_back_isEnabled() { + isEnabled: function() { return gHistory.canGoBack; }, - doCommand: function cmd_back_doCommand() { + doCommand: function() { gHistory.back(); } }, cmd_forward: { - isEnabled: function cmd_forward_isEnabled() { + isEnabled: function() { return gHistory.canGoForward; }, - doCommand: function cmd_forward_doCommand() { + doCommand: function() { gHistory.forward(); } }, cmd_focusSearch: { isEnabled: () => true, - doCommand: function cmd_focusSearch_doCommand() { + doCommand: function() { gHeader.focusSearchBox(); } }, cmd_restartApp: { - isEnabled: function cmd_restartApp_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_restartApp_doCommand() { + doCommand: function() { let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]. createInstance(Ci.nsISupportsPRBool); Services.obs.notifyObservers(cancelQuit, "quit-application-requested", @@ -862,37 +861,37 @@ var gViewController = { }, cmd_enableCheckCompatibility: { - isEnabled: function cmd_enableCheckCompatibility_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_enableCheckCompatibility_doCommand() { + doCommand: function() { AddonManager.checkCompatibility = true; } }, cmd_enableUpdateSecurity: { - isEnabled: function cmd_enableUpdateSecurity_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_enableUpdateSecurity_doCommand() { + doCommand: function() { AddonManager.checkUpdateSecurity = true; } }, cmd_pluginCheck: { - isEnabled: function cmd_pluginCheck_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_pluginCheck_doCommand() { + doCommand: function() { openURL(Services.urlFormatter.formatURLPref("plugins.update.url")); } }, cmd_toggleAutoUpdateDefault: { - isEnabled: function cmd_toggleAutoUpdateDefault_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_toggleAutoUpdateDefault_doCommand() { + doCommand: function() { 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 @@ -908,11 +907,11 @@ var gViewController = { }, cmd_resetAddonAutoUpdate: { - isEnabled: function cmd_resetAddonAutoUpdate_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_resetAddonAutoUpdate_doCommand() { - AddonManager.getAllAddons(function cmd_resetAddonAutoUpdate_getAllAddons(aAddonList) { + doCommand: function() { + AddonManager.getAllAddons(function(aAddonList) { for (let addon of aAddonList) { if ("applyBackgroundUpdates" in addon) addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT; @@ -922,37 +921,37 @@ var gViewController = { }, cmd_goToDiscoverPane: { - isEnabled: function cmd_goToDiscoverPane_isEnabled() { + isEnabled: function() { return gDiscoverView.enabled; }, - doCommand: function cmd_goToDiscoverPane_doCommand() { + doCommand: function() { gViewController.loadView("addons://discover/"); } }, cmd_goToRecentUpdates: { - isEnabled: function cmd_goToRecentUpdates_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_goToRecentUpdates_doCommand() { + doCommand: function() { gViewController.loadView("addons://updates/recent"); } }, cmd_goToAvailableUpdates: { - isEnabled: function cmd_goToAvailableUpdates_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_goToAvailableUpdates_doCommand() { + doCommand: function() { gViewController.loadView("addons://updates/available"); } }, cmd_showItemDetails: { - isEnabled: function cmd_showItemDetails_isEnabled(aAddon) { + isEnabled: function(aAddon) { return !!aAddon && (gViewController.currentViewObj != gDetailView); }, - doCommand: function cmd_showItemDetails_doCommand(aAddon, aScrollToPreferences) { + doCommand: function(aAddon, aScrollToPreferences) { gViewController.loadView("addons://detail/" + encodeURIComponent(aAddon.id) + (aScrollToPreferences ? "/preferences" : "")); @@ -961,10 +960,10 @@ var gViewController = { cmd_findAllUpdates: { inProgress: false, - isEnabled: function cmd_findAllUpdates_isEnabled() { + isEnabled: function() { return !this.inProgress; }, - doCommand: function cmd_findAllUpdates_doCommand() { + doCommand: function() { this.inProgress = true; gViewController.updateCommand("cmd_findAllUpdates"); document.getElementById("updates-noneFound").hidden = true; @@ -1005,15 +1004,15 @@ var gViewController = { } var updateInstallListener = { - onDownloadFailed: function cmd_findAllUpdates_downloadFailed() { + onDownloadFailed: function() { pendingChecks--; updateStatus(); }, - onInstallFailed: function cmd_findAllUpdates_installFailed() { + onInstallFailed: function() { pendingChecks--; updateStatus(); }, - onInstallEnded: function cmd_findAllUpdates_installEnded(aInstall, aAddon) { + onInstallEnded: function(aInstall, aAddon) { pendingChecks--; numUpdated++; if (isPending(aInstall.existingAddon, "upgrade")) @@ -1023,7 +1022,7 @@ var gViewController = { }; var updateCheckListener = { - onUpdateAvailable: function cmd_findAllUpdates_updateAvailable(aAddon, aInstall) { + onUpdateAvailable: function(aAddon, aInstall) { gEventManager.delegateAddonEvent("onUpdateAvailable", [aAddon, aInstall]); if (AddonManager.shouldAutoUpdate(aAddon)) { @@ -1035,17 +1034,17 @@ var gViewController = { updateStatus(); } }, - onNoUpdateAvailable: function cmd_findAllUpdates_noUpdateAvailable(aAddon) { + onNoUpdateAvailable: function(aAddon) { pendingChecks--; updateStatus(); }, - onUpdateFinished: function cmd_findAllUpdates_updateFinished(aAddon, aError) { + onUpdateFinished: function(aAddon, aError) { gEventManager.delegateAddonEvent("onUpdateFinished", [aAddon, aError]); } }; - AddonManager.getAddonsByTypes(null, function cmd_findAllUpdates_getAddonsByTypes(aAddonList) { + AddonManager.getAddonsByTypes(null, function(aAddonList) { for (let addon of aAddonList) { if (addon.permissions & AddonManager.PERM_CAN_UPGRADE) { pendingChecks++; @@ -1061,20 +1060,20 @@ var gViewController = { }, cmd_findItemUpdates: { - isEnabled: function cmd_findItemUpdates_isEnabled(aAddon) { + isEnabled: function(aAddon) { if (!aAddon) return false; return hasPermission(aAddon, "upgrade"); }, - doCommand: function cmd_findItemUpdates_doCommand(aAddon) { + doCommand: function(aAddon) { var listener = { - onUpdateAvailable: function cmd_findItemUpdates_updateAvailable(aAddon, aInstall) { + onUpdateAvailable: function(aAddon, aInstall) { gEventManager.delegateAddonEvent("onUpdateAvailable", [aAddon, aInstall]); if (AddonManager.shouldAutoUpdate(aAddon)) aInstall.install(); }, - onNoUpdateAvailable: function cmd_findItemUpdates_noUpdateAvailable(aAddon) { + onNoUpdateAvailable: function(aAddon) { gEventManager.delegateAddonEvent("onNoUpdateAvailable", [aAddon]); } @@ -1085,11 +1084,11 @@ var gViewController = { }, cmd_debugItem: { - doCommand: function cmd_debugItem_doCommand(aAddon) { + doCommand: function(aAddon) { BrowserToolboxProcess.init({ addonID: aAddon.id }); }, - isEnabled: function cmd_debugItem_isEnabled(aAddon) { + isEnabled: function(aAddon) { let debuggerEnabled = Services.prefs. getBoolPref(PREF_ADDON_DEBUGGING_ENABLED); let remoteEnabled = Services.prefs. @@ -1099,7 +1098,7 @@ var gViewController = { }, cmd_showItemPreferences: { - isEnabled: function cmd_showItemPreferences_isEnabled(aAddon) { + isEnabled: function(aAddon) { if (!aAddon || (!aAddon.isActive && !aAddon.isGMPlugin) || !aAddon.optionsURL) { @@ -1113,7 +1112,7 @@ var gViewController = { return false; return true; }, - doCommand: function cmd_showItemPreferences_doCommand(aAddon) { + doCommand: function(aAddon) { if (aAddon.optionsType == AddonManager.OPTIONS_TYPE_INLINE) { gViewController.commands.cmd_showItemDetails.doCommand(aAddon, true); return; @@ -1146,11 +1145,11 @@ var gViewController = { }, cmd_showItemAbout: { - isEnabled: function cmd_showItemAbout_isEnabled(aAddon) { + isEnabled: function(aAddon) { // XXXunf This may be applicable to install items too. See bug 561260 return !!aAddon; }, - doCommand: function cmd_showItemAbout_doCommand(aAddon) { + doCommand: function(aAddon) { var aboutURL = aAddon.aboutURL; if (aboutURL) openDialog(aboutURL, "", "chrome,centerscreen,modal", aAddon); @@ -1161,17 +1160,17 @@ var gViewController = { }, cmd_enableItem: { - isEnabled: function cmd_enableItem_isEnabled(aAddon) { + isEnabled: function(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 cmd_enableItem_doCommand(aAddon) { + doCommand: function(aAddon) { aAddon.userDisabled = false; }, - getTooltip: function cmd_enableItem_getTooltip(aAddon) { + getTooltip: function(aAddon) { if (!aAddon) return ""; if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_ENABLE) @@ -1181,17 +1180,17 @@ var gViewController = { }, cmd_disableItem: { - isEnabled: function cmd_disableItem_isEnabled(aAddon) { + isEnabled: function(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 cmd_disableItem_doCommand(aAddon) { + doCommand: function(aAddon) { aAddon.userDisabled = true; }, - getTooltip: function cmd_disableItem_getTooltip(aAddon) { + getTooltip: function(aAddon) { if (!aAddon) return ""; if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_DISABLE) @@ -1201,12 +1200,12 @@ var gViewController = { }, cmd_installItem: { - isEnabled: function cmd_installItem_isEnabled(aAddon) { + isEnabled: function(aAddon) { if (!aAddon) return false; return aAddon.install && aAddon.install.state == AddonManager.STATE_AVAILABLE; }, - doCommand: function cmd_installItem_doCommand(aAddon) { + doCommand: function(aAddon) { function doInstall() { gViewController.currentViewObj.getListItemForID(aAddon.id)._installStatus.installRemote(); } @@ -1219,33 +1218,33 @@ var gViewController = { }, cmd_purchaseItem: { - isEnabled: function cmd_purchaseItem_isEnabled(aAddon) { + isEnabled: function(aAddon) { if (!aAddon) return false; return !!aAddon.purchaseURL; }, - doCommand: function cmd_purchaseItem_doCommand(aAddon) { + doCommand: function(aAddon) { openURL(aAddon.purchaseURL); } }, cmd_uninstallItem: { - isEnabled: function cmd_uninstallItem_isEnabled(aAddon) { + isEnabled: function(aAddon) { if (!aAddon) return false; return hasPermission(aAddon, "uninstall"); }, - doCommand: function cmd_uninstallItem_doCommand(aAddon) { + doCommand: function(aAddon) { if (gViewController.currentViewObj != gDetailView) { aAddon.uninstall(); return; } - gViewController.popState(function cmd_uninstallItem_popState() { + gViewController.popState(function() { gViewController.currentViewObj.getListItemForID(aAddon.id).uninstall(); }); }, - getTooltip: function cmd_uninstallItem_getTooltip(aAddon) { + getTooltip: function(aAddon) { if (!aAddon) return ""; if (aAddon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_UNINSTALL) @@ -1255,21 +1254,21 @@ var gViewController = { }, cmd_cancelUninstallItem: { - isEnabled: function cmd_cancelUninstallItem_isEnabled(aAddon) { + isEnabled: function(aAddon) { if (!aAddon) return false; return isPending(aAddon, "uninstall"); }, - doCommand: function cmd_cancelUninstallItem_doCommand(aAddon) { + doCommand: function(aAddon) { aAddon.cancelUninstall(); } }, cmd_installFromFile: { - isEnabled: function cmd_installFromFile_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_installFromFile_doCommand() { + doCommand: function() { const nsIFilePicker = Ci.nsIFilePicker; var fp = Cc["@mozilla.org/filepicker;1"] .createInstance(nsIFilePicker); @@ -1302,7 +1301,7 @@ var gViewController = { } var file = files.getNext(); - AddonManager.getInstallForFile(file, function cmd_installFromFile_getInstallForFile(aInstall) { + AddonManager.getInstallForFile(file, function(aInstall) { installs.push(aInstall); buildNextInstall(); }); @@ -1313,12 +1312,12 @@ var gViewController = { }, cmd_cancelOperation: { - isEnabled: function cmd_cancelOperation_isEnabled(aAddon) { + isEnabled: function(aAddon) { if (!aAddon) return false; return aAddon.pendingOperations != AddonManager.PENDING_NONE; }, - doCommand: function cmd_cancelOperation_doCommand(aAddon) { + doCommand: function(aAddon) { if (isPending(aAddon, "install")) { aAddon.install.cancel(); } else if (isPending(aAddon, "upgrade")) { @@ -1334,107 +1333,107 @@ var gViewController = { }, cmd_contribute: { - isEnabled: function cmd_contribute_isEnabled(aAddon) { + isEnabled: function(aAddon) { if (!aAddon) return false; return ("contributionURL" in aAddon && aAddon.contributionURL); }, - doCommand: function cmd_contribute_doCommand(aAddon) { + doCommand: function(aAddon) { openURL(aAddon.contributionURL); } }, cmd_askToActivateItem: { - isEnabled: function cmd_askToActivateItem_isEnabled(aAddon) { + isEnabled: function(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 cmd_askToActivateItem_doCommand(aAddon) { + doCommand: function(aAddon) { aAddon.userDisabled = AddonManager.STATE_ASK_TO_ACTIVATE; } }, cmd_alwaysActivateItem: { - isEnabled: function cmd_alwaysActivateItem_isEnabled(aAddon) { + isEnabled: function(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 cmd_alwaysActivateItem_doCommand(aAddon) { + doCommand: function(aAddon) { aAddon.userDisabled = false; } }, cmd_neverActivateItem: { - isEnabled: function cmd_neverActivateItem_isEnabled(aAddon) { + isEnabled: function(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 cmd_neverActivateItem_doCommand(aAddon) { + doCommand: function(aAddon) { aAddon.userDisabled = true; } }, cmd_experimentsLearnMore: { - isEnabled: function cmd_experimentsLearnMore_isEnabled() { + isEnabled: function() { let mainWindow = getMainWindow(); return mainWindow && "switchToTabHavingURI" in mainWindow; }, - doCommand: function cmd_experimentsLearnMore_doCommand() { + doCommand: function() { let url = Services.prefs.getCharPref("toolkit.telemetry.infoURL"); openOptionsInTab(url); }, }, cmd_experimentsOpenTelemetryPreferences: { - isEnabled: function cmd_experimentsOpenTelemetryPreferences_isEnabled() { + isEnabled: function() { return !!getMainWindowWithPreferencesPane(); }, - doCommand: function cmd_experimentsOpenTelemetryPreferences_doCommand() { + doCommand: function() { let mainWindow = getMainWindowWithPreferencesPane(); mainWindow.openAdvancedPreferences("dataChoicesTab"); }, }, cmd_showUnsignedExtensions: { - isEnabled: function cmd_showUnsignedExtensions_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_showUnsignedExtensions_doCommand() { + doCommand: function() { gViewController.loadView("addons://list/extension?unsigned=true"); }, }, cmd_showAllExtensions: { - isEnabled: function cmd_showUnsignedExtensions_isEnabled() { + isEnabled: function() { return true; }, - doCommand: function cmd_showUnsignedExtensions_doCommand() { + doCommand: function() { gViewController.loadView("addons://list/extension"); }, }, }, - supportsCommand: function gVC_supportsCommand(aCommand) { + supportsCommand: function(aCommand) { return (aCommand in this.commands); }, - isCommandEnabled: function gVC_isCommandEnabled(aCommand) { + isCommandEnabled: function(aCommand) { if (!this.supportsCommand(aCommand)) return false; var addon = this.currentViewObj.getSelectedAddon(); return this.commands[aCommand].isEnabled(addon); }, - updateCommands: function gVC_updateCommands() { + updateCommands: function() { // wait until the view is initialized if (!this.currentViewObj) return; @@ -1443,7 +1442,7 @@ var gViewController = { this.updateCommand(commandId, addon); }, - updateCommand: function gVC_updateCommand(aCommandId, aAddon) { + updateCommand: function(aCommandId, aAddon) { if (typeof aAddon == "undefined") aAddon = this.currentViewObj.getSelectedAddon(); var cmd = this.commands[aCommandId]; @@ -1458,7 +1457,7 @@ var gViewController = { } }, - doCommand: function gVC_doCommand(aCommand, aAddon) { + doCommand: function(aCommand, aAddon) { if (!this.supportsCommand(aCommand)) return; var cmd = this.commands[aCommand]; @@ -1469,7 +1468,7 @@ var gViewController = { cmd.doCommand(aAddon); }, - onEvent: function gVC_onEvent() {} + onEvent: function() {} }; function hasInlineOptions(aAddon) { @@ -1668,7 +1667,7 @@ function sortElements(aElements, aSortBy, aAscending) { } - aElements.sort(function elementsSort(a, b) { + aElements.sort(function(a, b) { if (!aAscending) [a, b] = [b, a]; @@ -1713,15 +1712,15 @@ function getAddonsAndInstalls(aType, aCallback) { let addons = null, installs = null; let types = (aType != null) ? [aType] : null; - AddonManager.getAddonsByTypes(types, function getAddonsAndInstalls_getAddonsByTypes(aAddonsList) { + AddonManager.getAddonsByTypes(types, function(aAddonsList) { addons = aAddonsList.filter(a => !a.hidden); if (installs != null) aCallback(addons, installs); }); - AddonManager.getInstallsByTypes(types, function getAddonsAndInstalls_getInstallsByTypes(aInstallsList) { + AddonManager.getInstallsByTypes(types, function(aInstallsList) { // skip over upgrade installs and non-active installs - installs = aInstallsList.filter(function installsFilter(aInstall) { + installs = aInstallsList.filter(function(aInstall) { return !(aInstall.existingAddon || aInstall.state == AddonManager.STATE_AVAILABLE); }); @@ -1751,7 +1750,7 @@ var gCategories = { node: null, _search: null, - initialize: function gCategories_initialize() { + initialize: function() { this.node = document.getElementById("categories"); this._search = this.get("addons://search/"); @@ -1772,12 +1771,12 @@ var gCategories = { this.node.value = gViewDefault; var self = this; - this.node.addEventListener("select", function node_onSelected() { + this.node.addEventListener("select", function() { self.maybeHideSearch(); gViewController.loadView(self.node.selectedItem.value); }, false); - this.node.addEventListener("click", function node_onClicked(aEvent) { + this.node.addEventListener("click", function(aEvent) { var selectedItem = self.node.selectedItem; if (aEvent.target.localName == "richlistitem" && aEvent.target == selectedItem) { @@ -1792,11 +1791,11 @@ var gCategories = { }, false); }, - shutdown: function gCategories_shutdown() { + shutdown: function() { AddonManager.removeTypeListener(this); }, - _insertCategory: function gCategories_insertCategory(aId, aName, aView, aPriority, aStartHidden) { + _insertCategory: function(aId, aName, aView, aPriority, aStartHidden) { // If this category already exists then don't re-add it if (document.getElementById("category-" + aId)) return; @@ -1830,7 +1829,7 @@ var gCategories = { this.node.insertBefore(category, node); }, - _removeCategory: function gCategories_removeCategory(aId) { + _removeCategory: function(aId) { var category = document.getElementById("category-" + aId); if (!category) return; @@ -1842,7 +1841,7 @@ var gCategories = { this.node.removeChild(category); }, - onTypeAdded: function gCategories_onTypeAdded(aType) { + onTypeAdded: function(aType) { // Ignore types that we don't have a view object for if (!(aType.viewType in gViewController.viewObjects)) return; @@ -1862,7 +1861,7 @@ var gCategories = { var self = this; gPendingInitializations++; - getAddonsAndInstalls(aType.id, function onTypeAdded_getAddonsAndInstalls(aAddonsList, aInstallsList) { + getAddonsAndInstalls(aType.id, function(aAddonsList, aInstallsList) { var hidden = (aAddonsList.length == 0 && aInstallsList.length == 0); var item = self.get(aViewId); @@ -1879,23 +1878,23 @@ var gCategories = { } gEventManager.registerInstallListener({ - onDownloadStarted: function gCategories_onDownloadStarted(aInstall) { + onDownloadStarted: function(aInstall) { this._maybeShowCategory(aInstall); }, - onInstallStarted: function gCategories_onInstallStarted(aInstall) { + onInstallStarted: function(aInstall) { this._maybeShowCategory(aInstall); }, - onInstallEnded: function gCategories_onInstallEnded(aInstall, aAddon) { + onInstallEnded: function(aInstall, aAddon) { this._maybeShowCategory(aAddon); }, - onExternalInstall: function gCategories_onExternalInstall(aAddon, aExistingAddon, aRequiresRestart) { + onExternalInstall: function(aAddon, aExistingAddon, aRequiresRestart) { this._maybeShowCategory(aAddon); }, - _maybeShowCategory: function gCategories_maybeShowCategory(aAddon) { + _maybeShowCategory: function(aAddon) { if (aType.id == aAddon.type) { self.get(aViewId).hidden = false; Services.prefs.setBoolPref(prefName, false); @@ -1912,7 +1911,7 @@ var gCategories = { startHidden); }, - onTypeRemoved: function gCategories_onTypeRemoved(aType) { + onTypeRemoved: function(aType) { this._removeCategory(aType.id); }, @@ -1920,7 +1919,7 @@ var gCategories = { return this.node.selectedItem ? this.node.selectedItem.value : null; }, - select: function gCategories_select(aId, aPreviousView) { + select: function(aId, aPreviousView) { var view = gViewController.parseViewId(aId); if (view.type == "detail" && aPreviousView) { aId = aPreviousView; @@ -1954,20 +1953,20 @@ var gCategories = { } }, - get: function gCategories_get(aId) { + get: function(aId) { var items = document.getElementsByAttribute("value", aId); if (items.length) return items[0]; return null; }, - setBadge: function gCategories_setBadge(aId, aCount) { + setBadge: function(aId, aCount) { let item = this.get(aId); if (item) item.badgeCount = aCount; }, - maybeHideSearch: function gCategories_maybeHideSearch() { + maybeHideSearch: function() { var view = gViewController.parseViewId(this.node.selectedItem.value); this._search.disabled = view.type != "search"; } @@ -1978,10 +1977,10 @@ var gHeader = { _search: null, _dest: "", - initialize: function gHeader_initialize() { + initialize: function() { this._search = document.getElementById("header-search"); - this._search.addEventListener("command", function search_onCommand(aEvent) { + this._search.addEventListener("command", function(aEvent) { var query = aEvent.target.value; if (query.length == 0) return; @@ -1995,7 +1994,7 @@ var gHeader = { document.getElementById("forward-btn").hidden = !shouldShow; } - window.addEventListener("focus", function window_onFocus(aEvent) { + window.addEventListener("focus", function(aEvent) { if (aEvent.target == window) updateNavButtonVisibility(); }, false); @@ -2003,11 +2002,11 @@ var gHeader = { updateNavButtonVisibility(); }, - focusSearchBox: function gHeader_focusSearchBox() { + focusSearchBox: function() { this._search.focus(); }, - onKeyPress: function gHeader_onKeyPress(aEvent) { + onKeyPress: function(aEvent) { if (String.fromCharCode(aEvent.charCode) == "/") { this.focusSearchBox(); return; @@ -2067,7 +2066,7 @@ var gDiscoverView = { homepageURL: null, _loadListeners: [], - initialize: function gDiscoverView_initialize() { + initialize: function() { this.enabled = isDiscoverEnabled(); if (!this.enabled) { gCategories.get("addons://discover/").hidden = true; @@ -2115,7 +2114,7 @@ var gDiscoverView = { } gPendingInitializations++; - AddonManager.getAllAddons(function initialize_getAllAddons(aAddons) { + AddonManager.getAllAddons(function(aAddons) { var list = {}; for (let addon of aAddons) { var prefName = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%", @@ -2138,7 +2137,7 @@ var gDiscoverView = { }); }, - destroy: function gDiscoverView_destroy() { + destroy: function() { try { this._browser.removeProgressListener(this); } @@ -2147,7 +2146,7 @@ var gDiscoverView = { } }, - show: function gDiscoverView_show(aParam, aRequest, aState, aIsRefresh) { + show: function(aParam, aRequest, aState, aIsRefresh) { gViewController.updateCommands(); // If we're being told to load a specific URL then just do that @@ -2178,24 +2177,24 @@ var gDiscoverView = { gViewController.notifyViewChanged.bind(gViewController)); }, - canRefresh: function gDiscoverView_canRefresh() { + canRefresh: function() { if (this._browser.currentURI && this._browser.currentURI.spec == this._browser.homePage) return false; return true; }, - refresh: function gDiscoverView_refresh(aParam, aRequest, aState) { + refresh: function(aParam, aRequest, aState) { this.show(aParam, aRequest, aState, true); }, - hide: function gDiscoverView_hide() { }, + hide: function() { }, - showError: function gDiscoverView_showError() { + showError: function() { this.node.selectedPanel = this._error; }, - _loadURL: function gDiscoverView_loadURL(aURL, aKeepHistory, aCallback) { + _loadURL: function(aURL, aKeepHistory, aCallback) { if (this._browser.currentURI.spec == aURL) { if (aCallback) aCallback(); @@ -2212,7 +2211,7 @@ var gDiscoverView = { this._browser.loadURIWithFlags(aURL, flags); }, - onLocationChange: function gDiscoverView_onLocationChange(aWebProgress, aRequest, aLocation, aFlags) { + onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) { // Ignore the about:blank load if (aLocation.spec == "about:blank") return; @@ -2250,7 +2249,7 @@ var gDiscoverView = { aRequest.cancel(Components.results.NS_BINDING_ABORTED); }, - onSecurityChange: function gDiscoverView_onSecurityChange(aWebProgress, aRequest, aState) { + onSecurityChange: function(aWebProgress, aRequest, aState) { // Don't care about security if the page is not https if (!this.homepageURL.schemeIs("https")) return; @@ -2264,7 +2263,7 @@ var gDiscoverView = { aRequest.cancel(Components.results.NS_BINDING_ABORTED); }, - onStateChange: function gDiscoverView_onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) { + onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) { let transferStart = Ci.nsIWebProgressListener.STATE_IS_DOCUMENT | Ci.nsIWebProgressListener.STATE_IS_REQUEST | Ci.nsIWebProgressListener.STATE_TRANSFERRING; @@ -2308,13 +2307,13 @@ var gDiscoverView = { listener(); }, - onProgressChange: function gDiscoverView_onProgressChange() { }, - onStatusChange: function gDiscoverView_onStatusChange() { }, + onProgressChange: function() { }, + onStatusChange: function() { }, QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener, Ci.nsISupportsWeakReference]), - getSelectedAddon: function gDiscoverView_getSelectedAddon() { + getSelectedAddon: function() { return null; } }; @@ -2334,7 +2333,7 @@ var gSearchView = { _lastRemoteTotal: 0, _pendingSearches: 0, - initialize: function gSearchView_initialize() { + initialize: function() { this.node = document.getElementById("search-view"); this._filter = document.getElementById("search-filter-radiogroup"); this._sorters = document.getElementById("search-sorters"); @@ -2358,7 +2357,7 @@ var gSearchView = { this._filter.addEventListener("command", () => this.updateView(), false); }, - shutdown: function gSearchView_shutdown() { + shutdown: function() { if (AddonRepository.isSearching) AddonRepository.cancelSearch(); }, @@ -2367,7 +2366,7 @@ var gSearchView = { return this._pendingSearches > 0; }, - show: function gSearchView_show(aQuery, aRequest) { + show: function(aQuery, aRequest) { gEventManager.registerInstallListener(this); this.showEmptyNotice(false); @@ -2434,7 +2433,7 @@ var gSearchView = { gViewController.notifyViewChanged(); } - getAddonsAndInstalls(null, function show_getAddonsAndInstalls(aAddons, aInstalls) { + getAddonsAndInstalls(null, function(aAddons, aInstalls) { if (gViewController && aRequest != gViewController.currentViewRequest) return; @@ -2454,7 +2453,7 @@ var gSearchView = { } AddonRepository.searchAddons(aQuery, maxRemoteResults, { - searchFailed: function show_SearchFailed() { + searchFailed: function() { if (gViewController && aRequest != gViewController.currentViewRequest) return; @@ -2464,7 +2463,7 @@ var gSearchView = { finishSearch(0); // Silently fail }, - searchSucceeded: function show_SearchSucceeded(aAddonsList, aAddonCount, aTotalResults) { + searchSucceeded: function(aAddonsList, aAddonCount, aTotalResults) { if (gViewController && aRequest != gViewController.currentViewRequest) return; @@ -2479,12 +2478,12 @@ var gSearchView = { }); }, - showLoading: function gSearchView_showLoading(aLoading) { + showLoading: function(aLoading) { this._loading.hidden = !aLoading; this._listBox.hidden = aLoading; }, - updateView: function gSearchView_updateView() { + updateView: function() { var showLocal = this._filter.value == "local"; if (!showLocal && !AddonManager.isInstallEnabled("application/x-xpinstall")) @@ -2512,12 +2511,12 @@ var gSearchView = { gViewController.updateCommands(); }, - hide: function gSearchView_hide() { + hide: function() { gEventManager.unregisterInstallListener(this); doPendingUninstalls(this._listBox); }, - getMatchScore: function gSearchView_getMatchScore(aObj, aQuery) { + getMatchScore: function(aObj, aQuery) { var score = 0; score += this.calculateMatchScore(aObj.name, aQuery, SEARCH_SCORE_MULTIPLIER_NAME); @@ -2526,7 +2525,7 @@ var gSearchView = { return score; }, - calculateMatchScore: function gSearchView_calculateMatchScore(aStr, aQuery, aMultiplier) { + calculateMatchScore: function(aStr, aQuery, aMultiplier) { var score = 0; if (!aStr || aQuery.length == 0) return score; @@ -2558,12 +2557,12 @@ var gSearchView = { return score * aMultiplier; }, - showEmptyNotice: function gSearchView_showEmptyNotice(aShow) { + showEmptyNotice: function(aShow) { this._emptyNotice.hidden = !aShow; this._listBox.hidden = aShow; }, - showAllResultsLink: function gSearchView_showAllResultsLink(aTotalResults) { + showAllResultsLink: function(aTotalResults) { if (aTotalResults == 0) { this._allResultsLink.hidden = true; return; @@ -2579,7 +2578,7 @@ var gSearchView = { this._allResultsLink.hidden = false; }, - updateListAttributes: function gSearchView_updateListAttributes() { + updateListAttributes: function() { var item = this._listBox.querySelector("richlistitem[remote='true'][first]"); if (item) item.removeAttribute("first"); @@ -2606,7 +2605,7 @@ var gSearchView = { }, - onSortChanged: function gSearchView_onSortChanged(aSortBy, aAscending) { + onSortChanged: function(aSortBy, aAscending) { var footer = this._listBox.lastChild; this._listBox.removeChild(footer); @@ -2616,15 +2615,15 @@ var gSearchView = { this._listBox.appendChild(footer); }, - onDownloadCancelled: function gSearchView_onDownloadCancelled(aInstall) { + onDownloadCancelled: function(aInstall) { this.removeInstall(aInstall); }, - onInstallCancelled: function gSearchView_onInstallCancelled(aInstall) { + onInstallCancelled: function(aInstall) { this.removeInstall(aInstall); }, - removeInstall: function gSearchView_removeInstall(aInstall) { + removeInstall: function(aInstall) { for (let item of this._listBox.childNodes) { if (item.mInstall == aInstall) { this._listBox.removeChild(item); @@ -2633,14 +2632,14 @@ var gSearchView = { } }, - getSelectedAddon: function gSearchView_getSelectedAddon() { + getSelectedAddon: function() { var item = this._listBox.selectedItem; if (item) return item.mAddon; return null; }, - getListItemForID: function gSearchView_getListItemForID(aId) { + getListItemForID: function(aId) { var listitem = this._listBox.firstChild; while (listitem) { if (listitem.getAttribute("status") == "installed" && listitem.mAddon.id == aId) @@ -2658,13 +2657,13 @@ var gListView = { _emptyNotice: null, _type: null, - initialize: function gListView_initialize() { + initialize: function() { this.node = document.getElementById("list-view"); this._listBox = document.getElementById("addon-list"); this._emptyNotice = document.getElementById("addon-list-empty"); var self = this; - this._listBox.addEventListener("keydown", function listbox_onKeydown(aEvent) { + this._listBox.addEventListener("keydown", function(aEvent) { if (aEvent.keyCode == aEvent.DOM_VK_RETURN) { var item = self._listBox.selectedItem; if (item) @@ -2691,7 +2690,7 @@ var gListView = { } }, - show: function gListView_show(aType, aRequest) { + show: function(aType, aRequest) { let showOnlyDisabledUnsigned = false; if (aType.endsWith("?unsigned=true")) { aType = aType.replace(/\?.*/, ""); @@ -2739,12 +2738,12 @@ var gListView = { }); }, - hide: function gListView_hide() { + hide: function() { gEventManager.unregisterInstallListener(this); doPendingUninstalls(this._listBox); }, - filterDisabledUnsigned: function gListView_filterDisabledUnsigned(aFilter = true) { + filterDisabledUnsigned: function(aFilter = true) { let foundDisabledUnsigned = false; if (SIGNING_REQUIRED) { @@ -2763,16 +2762,16 @@ var gListView = { document.getElementById("disabled-unsigned-addons-info").hidden = !aFilter; }, - showEmptyNotice: function gListView_showEmptyNotice(aShow) { + showEmptyNotice: function(aShow) { this._emptyNotice.hidden = !aShow; this._listBox.hidden = aShow; }, - onSortChanged: function gListView_onSortChanged(aSortBy, aAscending) { + onSortChanged: function(aSortBy, aAscending) { sortList(this._listBox, aSortBy, aAscending); }, - onExternalInstall: function gListView_onExternalInstall(aAddon, aExistingAddon, aRequiresRestart) { + onExternalInstall: function(aAddon, aExistingAddon, aRequiresRestart) { // The existing list item will take care of upgrade installs if (aExistingAddon) return; @@ -2783,23 +2782,23 @@ var gListView = { this.addItem(aAddon); }, - onDownloadStarted: function gListView_onDownloadStarted(aInstall) { + onDownloadStarted: function(aInstall) { this.addItem(aInstall, true); }, - onInstallStarted: function gListView_onInstallStarted(aInstall) { + onInstallStarted: function(aInstall) { this.addItem(aInstall, true); }, - onDownloadCancelled: function gListView_onDownloadCancelled(aInstall) { + onDownloadCancelled: function(aInstall) { this.removeItem(aInstall, true); }, - onInstallCancelled: function gListView_onInstallCancelled(aInstall) { + onInstallCancelled: function(aInstall) { this.removeItem(aInstall, true); }, - onInstallEnded: function gListView_onInstallEnded(aInstall) { + onInstallEnded: function(aInstall) { // Remove any install entries for upgrades, their status will appear against // the existing item if (aInstall.existingAddon) @@ -2813,7 +2812,7 @@ var gListView = { } }, - addItem: function gListView_addItem(aObj, aIsInstall) { + addItem: function(aObj, aIsInstall) { if (aObj.type != this._type) return; @@ -2831,7 +2830,7 @@ var gListView = { this.showEmptyNotice(false); }, - removeItem: function gListView_removeItem(aObj, aIsInstall) { + removeItem: function(aObj, aIsInstall) { let prop = aIsInstall ? "mInstall" : "mAddon"; for (let item of this._listBox.childNodes) { @@ -2843,14 +2842,14 @@ var gListView = { } }, - getSelectedAddon: function gListView_getSelectedAddon() { + getSelectedAddon: function() { var item = this._listBox.selectedItem; if (item) return item.mAddon; return null; }, - getListItemForID: function gListView_getListItemForID(aId) { + getListItemForID: function(aId) { var listitem = this._listBox.firstChild; while (listitem) { if (listitem.getAttribute("status") == "installed" && listitem.mAddon.id == aId) @@ -2868,26 +2867,26 @@ var gDetailView = { _loadingTimer: null, _autoUpdate: null, - initialize: function gDetailView_initialize() { + initialize: function() { this.node = document.getElementById("detail-view"); this._autoUpdate = document.getElementById("detail-autoUpdate"); var self = this; - this._autoUpdate.addEventListener("command", function autoUpdate_onCommand() { + this._autoUpdate.addEventListener("command", function() { self._addon.applyBackgroundUpdates = self._autoUpdate.value; }, true); }, - shutdown: function gDetailView_shutdown() { + shutdown: function() { AddonManager.removeManagerListener(this); }, - onUpdateModeChanged: function gDetailView_onUpdateModeChanged() { + onUpdateModeChanged: function() { this.onPropertyChanged(["applyBackgroundUpdates"]); }, - _updateView: function gDetailView_updateView(aAddon, aIsRemote, aScrollToPreferences) { + _updateView: function(aAddon, aIsRemote, aScrollToPreferences) { AddonManager.addManagerListener(this); this.clearLoading(); @@ -3098,13 +3097,13 @@ var gDetailView = { document.getElementById("detail-experiment-time").value = timeMessage; } - this.fillSettingsRows(aScrollToPreferences, (function updateView_fillSettingsRows() { + this.fillSettingsRows(aScrollToPreferences, (function() { this.updateState(); gViewController.notifyViewChanged(); }).bind(this)); }, - show: function gDetailView_show(aAddonId, aRequest) { + show: function(aAddonId, aRequest) { let index = aAddonId.indexOf("/preferences"); let scrollToPreferences = false; if (index >= 0) { @@ -3113,13 +3112,13 @@ var gDetailView = { } var self = this; - this._loadingTimer = setTimeout(function loadTimeOutTimer() { + this._loadingTimer = setTimeout(function() { self.node.setAttribute("loading-extended", true); }, LOADING_MSG_DELAY); var view = gViewController.currentViewId; - AddonManager.getAddonByID(aAddonId, function show_getAddonByID(aAddon) { + AddonManager.getAddonByID(aAddonId, function(aAddon) { if (gViewController && aRequest != gViewController.currentViewRequest) return; @@ -3129,7 +3128,7 @@ var gDetailView = { } // Look for an add-on pending install - AddonManager.getAllInstalls(function show_getAllInstalls(aInstalls) { + AddonManager.getAllInstalls(function(aInstalls) { for (let install of aInstalls) { if (install.state == AddonManager.STATE_INSTALLED && install.addon.id == aAddonId) { @@ -3151,7 +3150,7 @@ var gDetailView = { }); }, - hide: function gDetailView_hide() { + hide: function() { AddonManager.removeManagerListener(this); this.clearLoading(); if (this._addon) { @@ -3171,7 +3170,7 @@ var gDetailView = { } }, - updateState: function gDetailView_updateState() { + updateState: function() { gViewController.updateCommands(); var pending = this._addon.pendingOperations; @@ -3309,7 +3308,7 @@ var gDetailView = { this.node.setAttribute("active", this._addon.isActive); }, - clearLoading: function gDetailView_clearLoading() { + clearLoading: function() { if (this._loadingTimer) { clearTimeout(this._loadingTimer); this._loadingTimer = null; @@ -3318,14 +3317,14 @@ var gDetailView = { this.node.removeAttribute("loading-extended"); }, - emptySettingsRows: function gDetailView_emptySettingsRows() { + emptySettingsRows: function() { var lastRow = document.getElementById("detail-downloads"); var rows = lastRow.parentNode; while (lastRow.nextSibling) rows.removeChild(rows.lastChild); }, - fillSettingsRows: function gDetailView_fillSettingsRows(aScrollToPreferences, aCallback) { + fillSettingsRows: function(aScrollToPreferences, aCallback) { this.emptySettingsRows(); if (!hasInlineOptions(this._addon)) { if (aCallback) @@ -3355,7 +3354,7 @@ var gDetailView = { var xhr = new XMLHttpRequest(); xhr.open("GET", this._addon.optionsURL, true); xhr.responseType = "xml"; - xhr.onload = (function fillSettingsRows_onload() { + xhr.onload = (function() { var xml = xhr.responseXML; var settings = xml.querySelectorAll(":root > setting"); @@ -3410,7 +3409,7 @@ var gDetailView = { if (aCallback) aCallback(); }).bind(this); - xhr.onerror = function fillSettingsRows_onerror(aEvent) { + xhr.onerror = function(aEvent) { Cu.reportError("Error " + aEvent.target.status + " occurred while receiving " + this._addon.optionsURL); if (aCallback) @@ -3424,7 +3423,7 @@ var gDetailView = { } }, - scrollToPreferencesRows: function gDetailView_scrollToPreferencesRows() { + scrollToPreferencesRows: function() { // 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"]'); @@ -3439,20 +3438,20 @@ var gDetailView = { } }, - getSelectedAddon: function gDetailView_getSelectedAddon() { + getSelectedAddon: function() { return this._addon; }, - onEnabling: function gDetailView_onEnabling() { + onEnabling: function() { this.updateState(); }, - onEnabled: function gDetailView_onEnabled() { + onEnabled: function() { this.updateState(); this.fillSettingsRows(); }, - onDisabling: function gDetailView_onDisabling(aNeedsRestart) { + onDisabling: function(aNeedsRestart) { this.updateState(); if (!aNeedsRestart && hasInlineOptions(this._addon)) { Services.obs.notifyObservers(document, @@ -3461,24 +3460,24 @@ var gDetailView = { } }, - onDisabled: function gDetailView_onDisabled() { + onDisabled: function() { this.updateState(); this.emptySettingsRows(); }, - onUninstalling: function gDetailView_onUninstalling() { + onUninstalling: function() { this.updateState(); }, - onUninstalled: function gDetailView_onUninstalled() { + onUninstalled: function() { gViewController.popState(); }, - onOperationCancelled: function gDetailView_onOperationCancelled() { + onOperationCancelled: function() { this.updateState(); }, - onPropertyChanged: function gDetailView_onPropertyChanged(aProperties) { + onPropertyChanged: function(aProperties) { if (aProperties.indexOf("applyBackgroundUpdates") != -1) { this._autoUpdate.value = this._addon.applyBackgroundUpdates; let hideFindUpdates = AddonManager.shouldAutoUpdate(this._addon); @@ -3491,7 +3490,7 @@ var gDetailView = { this.updateState(); }, - onExternalInstall: function gDetailView_onExternalInstall(aAddon, aExistingAddon, aNeedsRestart) { + onExternalInstall: function(aAddon, aExistingAddon, aNeedsRestart) { // Only care about upgrades for the currently displayed add-on if (!aExistingAddon || aExistingAddon.id != this._addon.id) return; @@ -3502,7 +3501,7 @@ var gDetailView = { this.updateState(); }, - onInstallCancelled: function gDetailView_onInstallCancelled(aInstall) { + onInstallCancelled: function(aInstall) { if (aInstall.addon.id == this._addon.id) gViewController.popState(); } @@ -3517,7 +3516,7 @@ var gUpdatesView = { _updateSelected: null, _categoryItem: null, - initialize: function gUpdatesView_initialize() { + initialize: function() { this.node = document.getElementById("updates-view"); this._listBox = document.getElementById("updates-list"); this._emptyNotice = document.getElementById("updates-list-empty"); @@ -3527,7 +3526,7 @@ var gUpdatesView = { this._categoryItem = gCategories.get("addons://updates/available"); this._updateSelected = document.getElementById("update-selected-btn"); - this._updateSelected.addEventListener("command", function updateSelected_onCommand() { + this._updateSelected.addEventListener("command", function() { gUpdatesView.installSelected(); }, false); @@ -3537,12 +3536,12 @@ var gUpdatesView = { AddonManager.addInstallListener(this); }, - shutdown: function gUpdatesView_shutdown() { + shutdown: function() { AddonManager.removeAddonListener(this); AddonManager.removeInstallListener(this); }, - show: function gUpdatesView_show(aType, aRequest) { + show: function(aType, aRequest) { document.getElementById("empty-availableUpdates-msg").hidden = aType != "available"; document.getElementById("empty-recentUpdates-msg").hidden = aType != "recent"; this.showEmptyNotice(false); @@ -3557,15 +3556,15 @@ var gUpdatesView = { this._showAvailableUpdates(false, aRequest); }, - hide: function gUpdatesView_hide() { + hide: function() { this._updateSelected.hidden = true; this._categoryItem.disabled = this._categoryItem.badgeCount == 0; doPendingUninstalls(this._listBox); }, - _showRecentUpdates: function gUpdatesView_showRecentUpdates(aRequest) { + _showRecentUpdates: function(aRequest) { var self = this; - AddonManager.getAllAddons(function showRecentUpdates_getAllAddons(aAddonsList) { + AddonManager.getAllAddons(function(aAddonsList) { if (gViewController && aRequest != gViewController.currentViewRequest) return; @@ -3589,14 +3588,14 @@ var gUpdatesView = { }); }, - _showAvailableUpdates: function gUpdatesView_showAvailableUpdates(aIsRefresh, aRequest) { + _showAvailableUpdates: function(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; var self = this; - AddonManager.getAllInstalls(function showAvailableUpdates_getAllInstalls(aInstallsList) { + AddonManager.getAllInstalls(function(aInstallsList) { if (!aIsRefresh && gViewController && aRequest && aRequest != gViewController.currentViewRequest) return; @@ -3617,7 +3616,7 @@ var gUpdatesView = { let item = createItem(install.existingAddon); item.setAttribute("upgrade", true); - item.addEventListener("IncludeUpdateChanged", function item_onIncludeUpdateChanged() { + item.addEventListener("IncludeUpdateChanged", function() { self.maybeDisableUpdateSelected(); }, false); elements.push(item); @@ -3638,12 +3637,12 @@ var gUpdatesView = { }); }, - showEmptyNotice: function gUpdatesView_showEmptyNotice(aShow) { + showEmptyNotice: function(aShow) { this._emptyNotice.hidden = !aShow; this._listBox.hidden = aShow; }, - isManualUpdate: function gUpdatesView_isManualUpdate(aInstall, aOnlyAvailable) { + isManualUpdate: function(aInstall, aOnlyAvailable) { var isManual = aInstall.existingAddon && !AddonManager.shouldAutoUpdate(aInstall.existingAddon); if (isManual && aOnlyAvailable) @@ -3651,18 +3650,18 @@ var gUpdatesView = { return isManual; }, - maybeRefresh: function gUpdatesView_maybeRefresh() { + maybeRefresh: function() { if (gViewController.currentViewId == "addons://updates/available") this._showAvailableUpdates(true); this.updateAvailableCount(); }, - updateAvailableCount: function gUpdatesView_updateAvailableCount(aInitializing) { + updateAvailableCount: function(aInitializing) { if (aInitializing) gPendingInitializations++; var self = this; - AddonManager.getAllInstalls(function updateAvailableCount_getAllInstalls(aInstallsList) { - var count = aInstallsList.filter(function installListFilter(aInstall) { + AddonManager.getAllInstalls(function(aInstallsList) { + var count = aInstallsList.filter(function(aInstall) { return self.isManualUpdate(aInstall, true); }).length; self._categoryItem.disabled = gViewController.currentViewId != "addons://updates/available" && @@ -3673,7 +3672,7 @@ var gUpdatesView = { }); }, - maybeDisableUpdateSelected: function gUpdatesView_maybeDisableUpdateSelected() { + maybeDisableUpdateSelected: function() { for (let item of this._listBox.childNodes) { if (item.includeUpdate) { this._updateSelected.disabled = false; @@ -3683,7 +3682,7 @@ var gUpdatesView = { this._updateSelected.disabled = true; }, - installSelected: function gUpdatesView_installSelected() { + installSelected: function() { for (let item of this._listBox.childNodes) { if (item.includeUpdate) item.upgrade(); @@ -3692,14 +3691,14 @@ var gUpdatesView = { this._updateSelected.disabled = true; }, - getSelectedAddon: function gUpdatesView_getSelectedAddon() { + getSelectedAddon: function() { var item = this._listBox.selectedItem; if (item) return item.mAddon; return null; }, - getListItemForID: function gUpdatesView_getListItemForID(aId) { + getListItemForID: function(aId) { var listitem = this._listBox.firstChild; while (listitem) { if (listitem.mAddon.id == aId) @@ -3709,27 +3708,27 @@ var gUpdatesView = { return null; }, - onSortChanged: function gUpdatesView_onSortChanged(aSortBy, aAscending) { + onSortChanged: function(aSortBy, aAscending) { sortList(this._listBox, aSortBy, aAscending); }, - onNewInstall: function gUpdatesView_onNewInstall(aInstall) { + onNewInstall: function(aInstall) { if (!this.isManualUpdate(aInstall)) return; this.maybeRefresh(); }, - onInstallStarted: function gUpdatesView_onInstallStarted(aInstall) { + onInstallStarted: function(aInstall) { this.updateAvailableCount(); }, - onInstallCancelled: function gUpdatesView_onInstallCancelled(aInstall) { + onInstallCancelled: function(aInstall) { if (!this.isManualUpdate(aInstall)) return; this.maybeRefresh(); }, - onPropertyChanged: function gUpdatesView_onPropertyChanged(aAddon, aProperties) { + onPropertyChanged: function(aAddon, aProperties) { if (aProperties.indexOf("applyBackgroundUpdates") != -1) this.updateAvailableCount(); } @@ -3742,7 +3741,7 @@ function debuggingPrefChanged() { } var gDragDrop = { - onDragOver: function gDragDrop_onDragOver(aEvent) { + onDragOver: function(aEvent) { var types = aEvent.dataTransfer.types; if (types.contains("text/uri-list") || types.contains("text/x-moz-url") || @@ -3750,7 +3749,7 @@ var gDragDrop = { aEvent.preventDefault(); }, - onDrop: function gDragDrop_onDrop(aEvent) { + onDrop: function(aEvent) { var dataTransfer = aEvent.dataTransfer; var urls = []; @@ -3791,7 +3790,7 @@ var gDragDrop = { return; } - AddonManager.getInstallForURL(urls[pos++], function onDrop_getInstallForURL(aInstall) { + AddonManager.getInstallForURL(urls[pos++], function(aInstall) { installs.push(aInstall); buildNextInstall(); }, "application/x-xpinstall"); diff --git a/toolkit/mozapps/extensions/content/newaddon.js b/toolkit/mozapps/extensions/content/newaddon.js index e45b3c1ccdc..15c4f530da6 100644 --- a/toolkit/mozapps/extensions/content/newaddon.js +++ b/toolkit/mozapps/extensions/content/newaddon.js @@ -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 EnableListener_onEnabling(aAddon) { + onEnabling: function(aAddon) { if (aAddon.id == gAddon.id) window.close(); } @@ -38,7 +38,7 @@ function initialize() { let bundle = Services.strings.createBundle("chrome://mozapps/locale/extensions/newaddon.properties"); - AddonManager.getAddonByID(id, function initialize_getAddonByID(aAddon) { + AddonManager.getAddonByID(id, function(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 diff --git a/toolkit/mozapps/extensions/content/selectAddons.js b/toolkit/mozapps/extensions/content/selectAddons.js index ca5ba6d6cd7..5af815b7c70 100644 --- a/toolkit/mozapps/extensions/content/selectAddons.js +++ b/toolkit/mozapps/extensions/content/selectAddons.js @@ -62,7 +62,7 @@ var gChecking = { _addonCount: 0, _completeCount: 0, - show: function gChecking_show() { + show: function() { showButtons(true, false, false, false); this._progress = document.getElementById("checking-progress"); @@ -72,7 +72,7 @@ var gChecking = { return; } - aAddons = aAddons.filter(function gChecking_filterAddons(aAddon) { + aAddons = aAddons.filter(function(aAddon) { if (aAddon.id == AddonManager.hotfixID) { return false; } @@ -113,13 +113,13 @@ var gChecking = { }); }, - onUpdateAvailable: function gChecking_onUpdateAvailable(aAddon, aInstall) { + onUpdateAvailable: function(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) { + onUpdateFinished: function(aAddon, aError) { this._completeCount++; this._progress.value = this._completeCount; @@ -128,7 +128,7 @@ var gChecking = { var addons = [gAddons[id] for (id in gAddons)]; - addons.sort(function sortAddons(a, b) { + addons.sort(function(a, b) { let orderA = orderForScope(a.addon.scope); let orderB = orderForScope(b.addon.scope); @@ -167,11 +167,11 @@ var gChecking = { var gSelect = { nodeID: "select", - show: function gSelect_show() { + show: function() { this.updateButtons(); }, - updateButtons: function gSelect_updateButtons() { + updateButtons: function() { for (let row = document.getElementById("select-rows").firstChild; row; row = row.nextSibling) { if (row.localName == "separator") @@ -186,11 +186,11 @@ var gSelect = { showButtons(false, false, false, true); }, - next: function gSelect_next() { + next: function() { showView(gConfirm); }, - done: function gSelect_done() { + done: function() { window.close(); } }; @@ -198,7 +198,7 @@ var gSelect = { var gConfirm = { nodeID: "confirm", - show: function gConfirm_show() { + show: function() { showButtons(false, true, false, true); let box = document.getElementById("confirm-scrollbox").firstChild; @@ -235,15 +235,15 @@ var gConfirm = { } }, - back: function gConfirm_back() { + back: function() { showView(gSelect); }, - next: function gConfirm_next() { + next: function() { showView(gUpdate); }, - done: function gConfirm_done() { + done: function() { for (let row = document.getElementById("select-rows").firstChild; row; row = row.nextSibling) { if (row.localName != "separator") @@ -262,7 +262,7 @@ var gUpdate = { _completeCount: 0, _errorCount: 0, - show: function gUpdate_show() { + show: function() { showButtons(true, false, false, false); this._progress = document.getElementById("update-progress"); @@ -278,7 +278,7 @@ var gUpdate = { this._progress.value = this._completeCount; }, - checkComplete: function gUpdate_checkComplete() { + checkComplete: function() { this._progress.value = this._completeCount; if (this._completeCount < this._waitingCount) return; @@ -291,23 +291,23 @@ var gUpdate = { window.close(); }, - onDownloadStarted: function gUpdate_onDownloadStarted(aInstall) { + onDownloadStarted: function(aInstall) { this._waitingCount++; }, - onDownloadFailed: function gUpdate_onDownloadFailed(aInstall) { + onDownloadFailed: function(aInstall) { this._errorCount++; this._completeCount++; this.checkComplete(); }, - onInstallFailed: function gUpdate_onInstallFailed(aInstall) { + onInstallFailed: function(aInstall) { this._errorCount++; this._completeCount++; this.checkComplete(); }, - onInstallEnded: function gUpdate_onInstallEnded(aInstall) { + onInstallEnded: function(aInstall) { this._completeCount++; this.checkComplete(); } @@ -316,20 +316,20 @@ var gUpdate = { var gErrors = { nodeID: "errors", - show: function gErrors_show() { + show: function() { showButtons(false, false, false, true); }, - done: function gErrors_done() { + done: function() { window.close(); } }; -window.addEventListener("load", function loadEventListener() { +window.addEventListener("load", function() { showView(gChecking); }, false); // When closing the window cancel any pending or in-progress installs -window.addEventListener("unload", function unloadEventListener() { +window.addEventListener("unload", function() { for (let id in gAddons) { let entry = gAddons[id]; if (!entry.install) diff --git a/toolkit/mozapps/extensions/content/update.js b/toolkit/mozapps/extensions/content/update.js index 227f702f100..7e1214c6f69 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 gUpdateWizard_init() + init: function() { 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 gUpdateWizard_setUpButton(aButtonID, aButtonKey, aDisabled) + _setUpButton: function(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 gUpdateWizard_setButtonLabels(aBackButton, aBackButtonIsDisabled, + setButtonLabels: function(aBackButton, aBackButtonIsDisabled, aNextButton, aNextButtonIsDisabled, aCancelButton, aCancelButtonIsDisabled) { @@ -110,18 +110,18 @@ var gUpdateWizard = { // Update Errors errorItems: [], - checkForErrors: function gUpdateWizard_checkForErrors(aElementIDToShow) + checkForErrors: function(aElementIDToShow) { if (this.errorItems.length > 0) document.getElementById(aElementIDToShow).hidden = false; }, - onWizardClose: function gUpdateWizard_onWizardClose(aEvent) + onWizardClose: function(aEvent) { return this.onWizardCancel(); }, - onWizardCancel: function gUpdateWizard_onWizardCancel() + onWizardCancel: function() { gUpdateWizard.shuttingDown = true; // Allow add-ons to continue downloading and installing @@ -149,13 +149,13 @@ var gUpdateWizard = { }; var gOfflinePage = { - onPageAdvanced: function gOfflinePage_onPageAdvanced() + onPageAdvanced: function() { Services.io.offline = false; return true; }, - toggleOffline: function gOfflinePage_toggleOffline() + toggleOffline: function() { var nextbtn = document.documentElement.getButton("next"); nextbtn.disabled = !nextbtn.disabled; @@ -164,11 +164,11 @@ var gOfflinePage = { // Addon listener to count addons enabled/disabled by metadata checks var listener = { - onDisabled: function listener_onDisabled(aAddon) { + onDisabled: function(aAddon) { gUpdateWizard.affectedAddonIDs.add(aAddon.id); gUpdateWizard.metadataDisabled++; }, - onEnabled: function listener_onEnabled(aAddon) { + onEnabled: function(aAddon) { gUpdateWizard.affectedAddonIDs.delete(aAddon.id); gUpdateWizard.metadataEnabled++; } @@ -178,7 +178,7 @@ var gVersionInfoPage = { _completeCount: 0, _totalCount: 0, _versionInfoDone: false, - onPageShow: Task.async(function* gVersionInfoPage_onPageShow() { + onPageShow: Task.async(function*() { gUpdateWizard.setButtonLabels(null, true, "nextButtonText", true, "cancelButtonText", false); @@ -222,7 +222,7 @@ var gVersionInfoPage = { } }), - onAllUpdatesFinished: function gVersionInfoPage_onAllUpdatesFinished() { + onAllUpdatesFinished: function() { AddonManager.removeAddonListener(listener); AddonManagerPrivate.recordSimpleMeasure("appUpdate_disabled", gUpdateWizard.disabled); @@ -278,7 +278,7 @@ var gVersionInfoPage = { ///////////////////////////////////////////////////////////////////////////// // UpdateListener - onUpdateFinished: function gVersionInfoPage_onUpdateFinished(aAddon, status) { + onUpdateFinished: function(aAddon, status) { ++this._completeCount; if (status != AddonManager.UPDATE_STATUS_NO_ERROR) { @@ -317,7 +317,7 @@ var gVersionInfoPage = { this.onAllUpdatesFinished(); }, - onUpdateAvailable: function gVersionInfoPage_onUpdateAvailable(aAddon, aInstall) { + onUpdateAvailable: function(aAddon, aInstall) { logger.debug("VersionInfo got an install for " + aAddon.id + ": " + aAddon.version); gUpdateWizard.addonInstalls.set(aAddon.id, aInstall); }, @@ -326,7 +326,7 @@ var gVersionInfoPage = { var gMismatchPage = { waiting: false, - onPageShow: function gMismatchPage_onPageShow() + onPageShow: function() { gMismatchPage.waiting = true; gUpdateWizard.setButtonLabels(null, true, @@ -346,7 +346,7 @@ var gMismatchPage = { var gUpdatePage = { _totalCount: 0, _completeCount: 0, - onPageShow: function gUpdatePage_onPageShow() + onPageShow: function() { gMismatchPage.waiting = false; gUpdateWizard.setButtonLabels(null, true, @@ -365,7 +365,7 @@ var gUpdatePage = { } }, - onAllUpdatesFinished: function gUpdatePage_onAllUpdatesFinished() { + onAllUpdatesFinished: function() { if (gUpdateWizard.shuttingDown) return; @@ -377,12 +377,12 @@ var gUpdatePage = { ///////////////////////////////////////////////////////////////////////////// // UpdateListener - onUpdateAvailable: function gUpdatePage_onUpdateAvailable(aAddon, aInstall) { + onUpdateAvailable: function(aAddon, aInstall) { logger.debug("UpdatePage got an update for " + aAddon.id + ": " + aAddon.version); gUpdateWizard.addonsToUpdate.push(aInstall); }, - onUpdateFinished: function gUpdatePage_onUpdateFinished(aAddon, status) { + onUpdateFinished: function(aAddon, status) { if (status != AddonManager.UPDATE_STATUS_NO_ERROR) gUpdateWizard.errorItems.push(aAddon); @@ -405,7 +405,7 @@ var gUpdatePage = { }; var gFoundPage = { - onPageShow: function gFoundPage_onPageShow() + onPageShow: function() { gUpdateWizard.setButtonLabels(null, true, "installButtonText", false, @@ -431,7 +431,7 @@ var gFoundPage = { } }, - toggleXPInstallEnable: function gFoundPage_toggleXPInstallEnable(aEvent) + toggleXPInstallEnable: function(aEvent) { var enabled = aEvent.target.checked; gUpdateWizard.xpinstallEnabled = enabled; @@ -441,7 +441,7 @@ var gFoundPage = { this.updateNextButton(); }, - updateNextButton: function gFoundPage_updateNextButton() + updateNextButton: function() { if (!gUpdateWizard.xpinstallEnabled) { document.documentElement.getButton("next").disabled = true; @@ -475,7 +475,7 @@ var gInstallingPage = { // Initialize fields we need for installing and tracking progress, // and start iterating through the installations - startInstalls: function gInstallingPage_startInstalls(aInstallList) { + startInstalls: function(aInstallList) { if (!gUpdateWizard.xpinstallEnabled) { return; } @@ -488,7 +488,7 @@ var gInstallingPage = { this.startNextInstall(); }, - onPageShow: function gInstallingPage_onPageShow() + onPageShow: function() { gUpdateWizard.setButtonLabels(null, true, "nextButtonText", true, @@ -511,7 +511,7 @@ var gInstallingPage = { this.startInstalls(toInstall); }, - startNextInstall: function gInstallingPage_startNextInstall() { + startNextInstall: function() { if (this._currentInstall >= 0) { this._installs[this._currentInstall].removeListener(this); } @@ -551,7 +551,7 @@ var gInstallingPage = { ///////////////////////////////////////////////////////////////////////////// // InstallListener - onDownloadStarted: function gInstallingPage_onDownloadStarted(aInstall) { + onDownloadStarted: function(aInstall) { if (gUpdateWizard.shuttingDown) { return; } @@ -561,7 +561,7 @@ var gInstallingPage = { actionItem.value = label; }, - onDownloadProgress: function gInstallingPage_onDownloadProgress(aInstall) { + onDownloadProgress: function(aInstall) { if (gUpdateWizard.shuttingDown) { return; } @@ -569,17 +569,17 @@ var gInstallingPage = { downloadProgress.value = Math.ceil(100 * aInstall.progress / aInstall.maxProgress); }, - onDownloadEnded: function gInstallingPage_onDownloadEnded(aInstall) { + onDownloadEnded: function(aInstall) { }, - onDownloadFailed: function gInstallingPage_onDownloadFailed(aInstall) { + onDownloadFailed: function(aInstall) { this._errors.push(aInstall); gUpdateWizard.upgradeFailed++; this.startNextInstall(); }, - onInstallStarted: function gInstallingPage_onInstallStarted(aInstall) { + onInstallStarted: function(aInstall) { if (gUpdateWizard.shuttingDown) { return; } @@ -589,7 +589,7 @@ var gInstallingPage = { actionItem.value = label; }, - onInstallEnded: function gInstallingPage_onInstallEnded(aInstall, aAddon) { + onInstallEnded: function(aInstall, aAddon) { if (!gUpdateWizard.shuttingDown) { // Remember that this add-on was updated during startup AddonManagerPrivate.addStartupChange(AddonManager.STARTUP_CHANGE_CHANGED, @@ -600,7 +600,7 @@ var gInstallingPage = { this.startNextInstall(); }, - onInstallFailed: function gInstallingPage_onInstallFailed(aInstall) { + onInstallFailed: function(aInstall) { this._errors.push(aInstall); gUpdateWizard.upgradeFailed++; @@ -609,7 +609,7 @@ var gInstallingPage = { }; var gInstallErrorsPage = { - onPageShow: function gInstallErrorsPage_onPageShow() + onPageShow: function() { gUpdateWizard.setButtonLabels(null, true, null, true, null, true); document.documentElement.getButton("finish").focus(); @@ -619,7 +619,7 @@ var gInstallErrorsPage = { // Displayed when there are incompatible add-ons and the xpinstall.enabled // pref is false and locked. var gAdminDisabledPage = { - onPageShow: function gAdminDisabledPage_onPageShow() + onPageShow: function() { gUpdateWizard.setButtonLabels(null, true, null, true, "cancelButtonText", true); @@ -630,7 +630,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 gFinishedPage_onPageShow() + onPageShow: function() { gUpdateWizard.setButtonLabels(null, true, null, true, null, true); document.documentElement.getButton("finish").focus(); @@ -649,7 +649,7 @@ var gFinishedPage = { // Displayed when there are incompatible add-ons and there are no available // updates. var gNoUpdatesPage = { - onPageShow: function gNoUpdatesPage_onPageLoad(aEvent) + onPageShow: function(aEvent) { gUpdateWizard.setButtonLabels(null, true, null, true, null, true); if (gUpdateWizard.shouldSuggestAutoChecking) { diff --git a/toolkit/mozapps/extensions/content/xpinstallConfirm.js b/toolkit/mozapps/extensions/content/xpinstallConfirm.js index 678e37001e9..be3769d993e 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() +XPInstallConfirm.init = function() { Components.utils.import("resource://gre/modules/AddonManager.jsm"); @@ -177,7 +177,7 @@ XPInstallConfirm.init = function XPInstallConfirm_init() okButton.label = bundle.getString("installButtonLabel"); } -XPInstallConfirm.onOK = function XPInstallConfirm_onOk() +XPInstallConfirm.onOK = function() { Components.classes["@mozilla.org/base/telemetry;1"]. getService(Components.interfaces.nsITelemetry). @@ -188,7 +188,7 @@ XPInstallConfirm.onOK = function XPInstallConfirm_onOk() return true; } -XPInstallConfirm.onCancel = function XPInstallConfirm_onCancel() +XPInstallConfirm.onCancel = function() { // Perform the install or cancel after the window has unloaded XPInstallConfirm._installOK = false; diff --git a/toolkit/mozapps/extensions/internal/AddonLogging.jsm b/toolkit/mozapps/extensions/internal/AddonLogging.jsm index 362439bae23..88737c1bb43 100644 --- a/toolkit/mozapps/extensions/internal/AddonLogging.jsm +++ b/toolkit/mozapps/extensions/internal/AddonLogging.jsm @@ -81,7 +81,7 @@ function AddonLogger(aName) { AddonLogger.prototype = { name: null, - error: function AddonLogger_error(aStr, aException) { + error: function(aStr, aException) { let message = formatLogMessage("error", this.name, aStr, aException); let stack = getStackDetails(aException); @@ -112,7 +112,7 @@ AddonLogger.prototype = { catch (e) { } }, - warn: function AddonLogger_warn(aStr, aException) { + warn: function(aStr, aException) { let message = formatLogMessage("warn", this.name, aStr, aException); let stack = getStackDetails(aException); @@ -127,7 +127,7 @@ AddonLogger.prototype = { dump("*** " + message + "\n"); }, - log: function AddonLogger_log(aStr, aException) { + log: function(aStr, aException) { if (gDebugLogEnabled) { let message = formatLogMessage("log", this.name, aStr, aException); dump("*** " + message + "\n"); @@ -137,14 +137,14 @@ AddonLogger.prototype = { }; this.LogManager = { - getLogger: function LogManager_getLogger(aName, aTarget) { + getLogger: function(aName, aTarget) { let logger = new AddonLogger(aName); if (aTarget) { ["error", "warn", "log"].forEach(function(name) { let fname = name.toUpperCase(); delete aTarget[fname]; - aTarget[fname] = function LogManager_targetName(aStr, aException) { + aTarget[fname] = function(aStr, aException) { logger[name](aStr, aException); }; }); @@ -155,13 +155,13 @@ this.LogManager = { }; var PrefObserver = { - init: function PrefObserver_init() { + init: function() { Services.prefs.addObserver(PREF_LOGGING_ENABLED, this, false); Services.obs.addObserver(this, "xpcom-shutdown", false); this.observe(null, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, PREF_LOGGING_ENABLED); }, - observe: function PrefObserver_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { if (aTopic == "xpcom-shutdown") { Services.prefs.removeObserver(PREF_LOGGING_ENABLED, this); Services.obs.removeObserver(this, "xpcom-shutdown"); diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.jsm b/toolkit/mozapps/extensions/internal/AddonRepository.jsm index 8c090c9439c..204b226a567 100644 --- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm +++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm @@ -131,7 +131,7 @@ function getAddonsToCache(aIds, aCallback) { types = types.split(","); - AddonManager.getAddonsByIDs(aIds, function getAddonsToCache_getAddonsByIDs(aAddons) { + AddonManager.getAddonsByIDs(aIds, function(aAddons) { let enabledIds = []; for (var i = 0; i < aIds.length; i++) { var preference = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%", aIds[i]); @@ -399,7 +399,7 @@ AddonSearchResult.prototype = { * A platform version to test against * @return Boolean representing if the add-on is compatible */ - isCompatibleWith: function ASR_isCompatibleWith(aAppVerison, aPlatformVersion) { + isCompatibleWith: function(aAppVerison, aPlatformVersion) { return true; }, @@ -416,7 +416,7 @@ AddonSearchResult.prototype = { * @param aPlatformVersion * A platform version to check for updates for */ - findUpdates: function ASR_findUpdates(aListener, aReason, aAppVersion, aPlatformVersion) { + findUpdates: function(aListener, aReason, aAppVersion, aPlatformVersion) { if ("onNoCompatibilityUpdateAvailable" in aListener) aListener.onNoCompatibilityUpdateAvailable(this); if ("onNoUpdateAvailable" in aListener) @@ -530,7 +530,7 @@ this.AddonRepository = { * return: promise{integer} resolves with the result of flushing * the AddonRepository database */ - shutdown: function AddonRepo_shutdown() { + shutdown: function() { this.cancelSearch(); this._addons = null; @@ -552,7 +552,7 @@ this.AddonRepository = { return now - lastUpdate; }, - isMetadataStale: function AddonRepo_isMetadataStale() { + isMetadataStale: function() { let threshold = DEFAULT_METADATA_UPDATETHRESHOLD_SEC; try { threshold = Services.prefs.getIntPref(PREF_METADATA_UPDATETHRESHOLD_SEC); @@ -570,7 +570,7 @@ this.AddonRepository = { * @param aCallback * The callback to pass the result back to */ - getCachedAddonByID: Task.async(function* (aId, aCallback) { + getCachedAddonByID: Task.async(function*(aId, aCallback) { if (!aId || !this.cacheEnabled) { aCallback(null); return; @@ -611,7 +611,7 @@ this.AddonRepository = { * Clear and delete the AddonRepository database * @return Promise{null} resolves when the database is deleted */ - _clearCache: function () { + _clearCache: function() { this._addons = null; return AddonDatabase.delete().then(() => new Promise((resolve, reject) => @@ -619,7 +619,7 @@ this.AddonRepository = { ); }, - _repopulateCacheInternal: Task.async(function* (aSendPerformance, aTimeout) { + _repopulateCacheInternal: Task.async(function*(aSendPerformance, aTimeout) { let allAddons = yield new Promise((resolve, reject) => AddonManager.getAllAddons(resolve)); @@ -647,14 +647,14 @@ this.AddonRepository = { yield new Promise((resolve, reject) => self._beginGetAddons(addonsToCache, { - searchSucceeded: function repopulateCacheInternal_searchSucceeded(aAddons) { + searchSucceeded: function(aAddons) { self._addons = new Map(); for (let addon of aAddons) { self._addons.set(addon.id, addon); } AddonDatabase.repopulate(aAddons, resolve); }, - searchFailed: function repopulateCacheInternal_searchFailed() { + searchFailed: function() { logger.warn("Search failed when repopulating cache"); resolve(); } @@ -675,7 +675,7 @@ this.AddonRepository = { * @param aCallback * The optional callback to call once complete */ - cacheAddons: function AddonRepo_cacheAddons(aIds, aCallback) { + cacheAddons: function(aIds, aCallback) { logger.debug("cacheAddons: enabled " + this.cacheEnabled + " IDs " + aIds.toSource()); if (!this.cacheEnabled) { if (aCallback) @@ -684,7 +684,7 @@ this.AddonRepository = { } let self = this; - getAddonsToCache(aIds, function cacheAddons_getAddonsToCache(aAddons) { + getAddonsToCache(aIds, function(aAddons) { // If there are no add-ons to cache, act as if caching is disabled if (aAddons.length == 0) { if (aCallback) @@ -693,13 +693,13 @@ this.AddonRepository = { } self.getAddonsByIDs(aAddons, { - searchSucceeded: function cacheAddons_searchSucceeded(aAddons) { + searchSucceeded: function(aAddons) { for (let addon of aAddons) { self._addons.set(addon.id, addon); } AddonDatabase.insertAddons(aAddons, aCallback); }, - searchFailed: function cacheAddons_searchFailed() { + searchFailed: function() { logger.warn("Search failed when adding add-ons to cache"); if (aCallback) aCallback(); @@ -729,7 +729,7 @@ this.AddonRepository = { * The url that can be visited to see recommended add-ons in this repository. * If the corresponding preference is not defined, defaults to about:blank. */ - getRecommendedURL: function AddonRepo_getRecommendedURL() { + getRecommendedURL: function() { let url = this._formatURLPref(PREF_GETADDONS_BROWSERECOMMENDED, {}); return (url != null) ? url : "about:blank"; }, @@ -742,7 +742,7 @@ this.AddonRepository = { * @param aSearchTerms * Search terms used to search the repository */ - getSearchURL: function AddonRepo_getSearchURL(aSearchTerms) { + getSearchURL: function(aSearchTerms) { let url = this._formatURLPref(PREF_GETADDONS_BROWSESEARCHRESULTS, { TERMS : encodeURIComponent(aSearchTerms) }); @@ -753,7 +753,7 @@ this.AddonRepository = { * Cancels the search in progress. If there is no search in progress this * does nothing. */ - cancelSearch: function AddonRepo_cancelSearch() { + cancelSearch: function() { this._searching = false; if (this._request) { this._request.abort(); @@ -771,7 +771,7 @@ this.AddonRepository = { * @param aCallback * The callback to pass results to */ - getAddonsByIDs: function AddonRepo_getAddonsByIDs(aIDs, aCallback) { + getAddonsByIDs: function(aIDs, aCallback) { return this._beginGetAddons(aIDs, aCallback, false); }, @@ -889,7 +889,7 @@ this.AddonRepository = { * * @return Promise{null} Resolves when the metadata update is complete. */ - backgroundUpdateCheck: function () { + backgroundUpdateCheck: function() { return this._repopulateCacheInternal(true); }, @@ -902,7 +902,7 @@ this.AddonRepository = { * @param aCallback * The callback to pass results to */ - retrieveRecommendedAddons: function AddonRepo_retrieveRecommendedAddons(aMaxResults, aCallback) { + retrieveRecommendedAddons: function(aMaxResults, aCallback) { let url = this._formatURLPref(PREF_GETADDONS_GETRECOMMENDED, { API_VERSION : API_VERSION, @@ -912,7 +912,7 @@ this.AddonRepository = { let self = this; function handleResults(aElements, aTotalResults) { - self._getLocalAddonIds(function retrieveRecommendedAddons_getLocalAddonIds(aLocalAddonIds) { + self._getLocalAddonIds(function(aLocalAddonIds) { // aTotalResults irrelevant self._parseAddons(aElements, -1, aLocalAddonIds); }); @@ -932,7 +932,7 @@ this.AddonRepository = { * @param aCallback * The callback to pass results to */ - searchAddons: function AddonRepo_searchAddons(aSearchTerms, aMaxResults, aCallback) { + searchAddons: function(aSearchTerms, aMaxResults, aCallback) { let compatMode = "normal"; if (!AddonManager.checkCompatibility) compatMode = "ignore"; @@ -951,7 +951,7 @@ this.AddonRepository = { let self = this; function handleResults(aElements, aTotalResults) { - self._getLocalAddonIds(function searchAddons_getLocalAddonIds(aLocalAddonIds) { + self._getLocalAddonIds(function(aLocalAddonIds) { self._parseAddons(aElements, aTotalResults, aLocalAddonIds); }); } @@ -960,7 +960,7 @@ this.AddonRepository = { }, // Posts results to the callback - _reportSuccess: function AddonRepo_reportSuccess(aResults, aTotalResults) { + _reportSuccess: function(aResults, aTotalResults) { this._searching = false; this._request = null; // The callback may want to trigger a new search so clear references early @@ -971,7 +971,7 @@ this.AddonRepository = { }, // Notifies the callback of a failure - _reportFailure: function AddonRepo_reportFailure() { + _reportFailure: function() { this._searching = false; this._request = null; // The callback may want to trigger a new search so clear references early @@ -981,28 +981,28 @@ this.AddonRepository = { }, // Get descendant by unique tag name. Returns null if not unique tag name. - _getUniqueDescendant: function AddonRepo_getUniqueDescendant(aElement, aTagName) { + _getUniqueDescendant: function(aElement, aTagName) { let elementsList = aElement.getElementsByTagName(aTagName); return (elementsList.length == 1) ? elementsList[0] : null; }, // Get direct descendant by unique tag name. // Returns null if not unique tag name. - _getUniqueDirectDescendant: function AddonRepo_getUniqueDirectDescendant(aElement, aTagName) { + _getUniqueDirectDescendant: function(aElement, aTagName) { let elementsList = Array.filter(aElement.children, aChild => aChild.tagName == aTagName); return (elementsList.length == 1) ? elementsList[0] : null; }, // Parse out trimmed text content. Returns null if text content empty. - _getTextContent: function AddonRepo_getTextContent(aElement) { + _getTextContent: function(aElement) { let textContent = aElement.textContent.trim(); return (textContent.length > 0) ? textContent : null; }, // Parse out trimmed text content of a descendant with the specified tag name // Returns null if the parsing unsuccessful. - _getDescendantTextContent: function AddonRepo_getDescendantTextContent(aElement, aTagName) { + _getDescendantTextContent: function(aElement, aTagName) { let descendant = this._getUniqueDescendant(aElement, aTagName); return (descendant != null) ? this._getTextContent(descendant) : null; }, @@ -1010,7 +1010,7 @@ this.AddonRepository = { // Parse out trimmed text content of a direct descendant with the specified // tag name. // Returns null if the parsing unsuccessful. - _getDirectDescendantTextContent: function AddonRepo_getDirectDescendantTextContent(aElement, aTagName) { + _getDirectDescendantTextContent: function(aElement, aTagName) { let descendant = this._getUniqueDirectDescendant(aElement, aTagName); return (descendant != null) ? this._getTextContent(descendant) : null; }, @@ -1028,7 +1028,7 @@ this.AddonRepository = { * @return Result object containing the parsed AddonSearchResult, xpiURL and * xpiHash if the parsing was successful. Otherwise returns null. */ - _parseAddon: function AddonRepo_parseAddon(aElement, aSkip, aCompatData) { + _parseAddon: function(aElement, aSkip, aCompatData) { let skipIDs = (aSkip && aSkip.ids) ? aSkip.ids : []; let skipSourceURIs = (aSkip && aSkip.sourceURIs) ? aSkip.sourceURIs : []; @@ -1208,7 +1208,7 @@ this.AddonRepository = { break; case "all_compatible_os": let nodes = node.getElementsByTagName("os"); - addon.isPlatformCompatible = Array.some(nodes, function parseAddon_platformCompatFilter(aNode) { + addon.isPlatformCompatible = Array.some(nodes, function(aNode) { let text = aNode.textContent.toLowerCase().trim(); return text == "all" || text == Services.appinfo.OS.toLowerCase(); }); @@ -1254,7 +1254,7 @@ this.AddonRepository = { return result; }, - _parseAddons: function AddonRepo_parseAddons(aElements, aTotalResults, aSkip) { + _parseAddons: function(aElements, aTotalResults, aSkip) { let self = this; let results = []; @@ -1270,7 +1270,7 @@ this.AddonRepository = { continue; let applications = tags.getElementsByTagName("appID"); - let compatible = Array.some(applications, function parseAddons_applicationsCompatFilter(aAppNode) { + let compatible = Array.some(applications, function(aAppNode) { if (!isSameApplication(aAppNode)) return false; @@ -1337,7 +1337,7 @@ this.AddonRepository = { // Create an AddonInstall for each result results.forEach(function(aResult) { let addon = aResult.addon; - let callback = function addonInstallCallback(aInstall) { + let callback = function(aInstall) { addon.install = aInstall; pendingResults--; if (pendingResults == 0) @@ -1356,7 +1356,7 @@ this.AddonRepository = { }, // Parses addon_compatibility nodes, that describe compatibility overrides. - _parseAddonCompatElement: function AddonRepo_parseAddonCompatElement(aResultObj, aElement) { + _parseAddonCompatElement: function(aResultObj, aElement) { let guid = this._getDescendantTextContent(aElement, "guid"); if (!guid) { logger.debug("Compatibility override is missing guid."); @@ -1437,7 +1437,7 @@ this.AddonRepository = { }, // Parses addon_compatibility elements. - _parseAddonCompatData: function AddonRepo_parseAddonCompatData(aElements) { + _parseAddonCompatData: function(aElements) { let compatData = {}; Array.forEach(aElements, this._parseAddonCompatElement.bind(this, compatData)); return compatData; @@ -1497,17 +1497,17 @@ this.AddonRepository = { // Gets the id's of local add-ons, and the sourceURI's of local installs, // passing the results to aCallback - _getLocalAddonIds: function AddonRepo_getLocalAddonIds(aCallback) { + _getLocalAddonIds: function(aCallback) { let self = this; let localAddonIds = {ids: null, sourceURIs: null}; - AddonManager.getAllAddons(function getLocalAddonIds_getAllAddons(aAddons) { + AddonManager.getAllAddons(function(aAddons) { localAddonIds.ids = aAddons.map(a => a.id); if (localAddonIds.sourceURIs) aCallback(localAddonIds); }); - AddonManager.getAllInstalls(function getLocalAddonIds_getAllInstalls(aInstalls) { + AddonManager.getAllInstalls(function(aInstalls) { localAddonIds.sourceURIs = []; aInstalls.forEach(function(aInstall) { if (aInstall.state != AddonManager.STATE_AVAILABLE) @@ -1520,7 +1520,7 @@ this.AddonRepository = { }, // Create url from preference, returning null if preference does not exist - _formatURLPref: function AddonRepo_formatURLPref(aPreference, aSubstitutions) { + _formatURLPref: function(aPreference, aSubstitutions) { let url = null; try { url = Services.prefs.getCharPref(aPreference); @@ -1529,7 +1529,7 @@ this.AddonRepository = { return null; } - url = url.replace(/%([A-Z_]+)%/g, function urlSubstitution(aMatch, aKey) { + url = url.replace(/%([A-Z_]+)%/g, function(aMatch, aKey) { return (aKey in aSubstitutions) ? aSubstitutions[aKey] : aMatch; }); @@ -1538,7 +1538,7 @@ this.AddonRepository = { // Find a AddonCompatibilityOverride that matches a given aAddonVersion and // application/platform version. - findMatchingCompatOverride: function AddonRepo_findMatchingCompatOverride(aAddonVersion, + findMatchingCompatOverride: function(aAddonVersion, aCompatOverrides, aAppVersion, aPlatformVersion) { @@ -1675,7 +1675,7 @@ var AddonDatabase = { * An optional boolean to skip flushing data to disk. Useful * when the database is going to be deleted afterwards. */ - shutdown: function AD_shutdown(aSkipFlush) { + shutdown: function(aSkipFlush) { this.databaseOk = true; if (!this.connectionPromise) { @@ -1699,7 +1699,7 @@ var AddonDatabase = { * An optional callback to call once complete * @return Promise{null} resolves when the database has been deleted */ - delete: function AD_delete(aCallback) { + delete: function(aCallback) { this.DB = BLANK_DB(); this._deleting = this.Writer.flush() @@ -1714,7 +1714,7 @@ var AddonDatabase = { return this._deleting; }, - toJSON: function AD_toJSON() { + toJSON: function() { let json = { schema: this.DB.schema, addons: [] @@ -1759,7 +1759,7 @@ var AddonDatabase = { * @return: Promise{Map} * Resolves when the add-ons are retrieved from the database */ - retrieveStoredData: function (){ + retrieveStoredData: function(){ return this.openConnection().then(db => db.addons); }, @@ -1772,9 +1772,9 @@ var AddonDatabase = { * @param aCallback * An optional callback to call once complete */ - repopulate: function AD_repopulate(aAddons, aCallback) { + repopulate: function(aAddons, aCallback) { this.DB.addons.clear(); - this.insertAddons(aAddons, function repopulate_insertAddons() { + this.insertAddons(aAddons, function() { let now = Math.round(Date.now() / 1000); logger.debug("Cache repopulated, setting " + PREF_METADATA_LASTUPDATE + " to " + now); Services.prefs.setIntPref(PREF_METADATA_LASTUPDATE, now); @@ -1791,12 +1791,12 @@ var AddonDatabase = { * @param aCallback * An optional callback to call once complete */ - insertAddons: Task.async(function* (aAddons, aCallback) { + insertAddons: Task.async(function*(aAddons, aCallback) { yield this.openConnection(); yield this._insertAddons(aAddons, aCallback); }), - _insertAddons: Task.async(function* (aAddons, aCallback) { + _insertAddons: Task.async(function*(aAddons, aCallback) { for (let addon of aAddons) { this._insertAddon(addon); } @@ -1815,7 +1815,7 @@ var AddonDatabase = { * @param aCallback * The callback to call once complete */ - _insertAddon: function AD__insertAddon(aAddon) { + _insertAddon: function(aAddon) { let newAddon = this._parseAddon(aAddon); if (!newAddon || !newAddon.id || @@ -1833,7 +1833,7 @@ var AddonDatabase = { * The object to parse * @return Returns an AddonSearchResult object. */ - _parseAddon: function (aObj) { + _parseAddon: function(aObj) { if (aObj instanceof AddonSearchResult) return aObj; @@ -1958,7 +1958,7 @@ var AddonDatabase = { * The JS object to use * @return The created developer */ - _makeDeveloper: function (aObj) { + _makeDeveloper: function(aObj) { let name = aObj.name; let url = aObj.url; return new AddonManagerPrivate.AddonAuthor(name, url); @@ -1972,7 +1972,7 @@ var AddonDatabase = { * The JS object to use * @return The created screenshot */ - _makeScreenshot: function (aObj) { + _makeScreenshot: function(aObj) { let url = aObj.url; let width = aObj.width; let height = aObj.height; @@ -1992,7 +1992,7 @@ var AddonDatabase = { * The JS object to use * @return The created CompatibilityOverride */ - _makeCompatOverride: function (aObj) { + _makeCompatOverride: function(aObj) { let type = aObj.type; let minVersion = aObj.minVersion; let maxVersion = aObj.maxVersion; diff --git a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm index 43091223839..460b4da4799 100644 --- a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm +++ b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm @@ -73,7 +73,7 @@ this.AddonRepository_SQLiteMigrator = { * * @return bool Whether the DB was opened successfully. */ - _openConnection: function AD_openConnection() { + _openConnection: function() { delete this.connection; let dbfile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_DATABASE], true); @@ -160,14 +160,14 @@ this.AddonRepository_SQLiteMigrator = { * @param aCallback * The callback to pass the add-ons back to */ - _retrieveStoredData: function AD_retrieveStoredData(aCallback) { + _retrieveStoredData: function(aCallback) { let self = this; let addons = {}; // Retrieve all data from the addon table function getAllAddons() { self.getAsyncStatement("getAllAddons").executeAsync({ - handleResult: function getAllAddons_handleResult(aResults) { + handleResult: function(aResults) { let row = null; while ((row = aResults.getNextRow())) { let internal_id = row.getResultByName("internal_id"); @@ -177,7 +177,7 @@ this.AddonRepository_SQLiteMigrator = { handleError: self.asyncErrorLogger, - handleCompletion: function getAllAddons_handleCompletion(aReason) { + handleCompletion: function(aReason) { if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) { logger.error("Error retrieving add-ons from database. Returning empty results"); aCallback({}); @@ -192,7 +192,7 @@ this.AddonRepository_SQLiteMigrator = { // Retrieve all data from the developer table function getAllDevelopers() { self.getAsyncStatement("getAllDevelopers").executeAsync({ - handleResult: function getAllDevelopers_handleResult(aResults) { + handleResult: function(aResults) { let row = null; while ((row = aResults.getNextRow())) { let addon_internal_id = row.getResultByName("addon_internal_id"); @@ -211,7 +211,7 @@ this.AddonRepository_SQLiteMigrator = { handleError: self.asyncErrorLogger, - handleCompletion: function getAllDevelopers_handleCompletion(aReason) { + handleCompletion: function(aReason) { if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) { logger.error("Error retrieving developers from database. Returning empty results"); aCallback({}); @@ -226,7 +226,7 @@ this.AddonRepository_SQLiteMigrator = { // Retrieve all data from the screenshot table function getAllScreenshots() { self.getAsyncStatement("getAllScreenshots").executeAsync({ - handleResult: function getAllScreenshots_handleResult(aResults) { + handleResult: function(aResults) { let row = null; while ((row = aResults.getNextRow())) { let addon_internal_id = row.getResultByName("addon_internal_id"); @@ -244,7 +244,7 @@ this.AddonRepository_SQLiteMigrator = { handleError: self.asyncErrorLogger, - handleCompletion: function getAllScreenshots_handleCompletion(aReason) { + handleCompletion: function(aReason) { if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) { logger.error("Error retrieving screenshots from database. Returning empty results"); aCallback({}); @@ -258,7 +258,7 @@ this.AddonRepository_SQLiteMigrator = { function getAllCompatOverrides() { self.getAsyncStatement("getAllCompatOverrides").executeAsync({ - handleResult: function getAllCompatOverrides_handleResult(aResults) { + handleResult: function(aResults) { let row = null; while ((row = aResults.getNextRow())) { let addon_internal_id = row.getResultByName("addon_internal_id"); @@ -276,7 +276,7 @@ this.AddonRepository_SQLiteMigrator = { handleError: self.asyncErrorLogger, - handleCompletion: function getAllCompatOverrides_handleCompletion(aReason) { + handleCompletion: function(aReason) { if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) { logger.error("Error retrieving compatibility overrides from database. Returning empty results"); aCallback({}); @@ -290,7 +290,7 @@ this.AddonRepository_SQLiteMigrator = { function getAllIcons() { self.getAsyncStatement("getAllIcons").executeAsync({ - handleResult: function getAllIcons_handleResult(aResults) { + handleResult: function(aResults) { let row = null; while ((row = aResults.getNextRow())) { let addon_internal_id = row.getResultByName("addon_internal_id"); @@ -309,7 +309,7 @@ this.AddonRepository_SQLiteMigrator = { handleError: self.asyncErrorLogger, - handleCompletion: function getAllIcons_handleCompletion(aReason) { + handleCompletion: function(aReason) { if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) { logger.error("Error retrieving icons from database. Returning empty results"); aCallback({}); @@ -342,7 +342,7 @@ this.AddonRepository_SQLiteMigrator = { * @return a mozIStorageAsyncStatement for the SQL corresponding to the * unique key */ - getAsyncStatement: function AD_getAsyncStatement(aKey) { + getAsyncStatement: function(aKey) { if (aKey in this.asyncStatementsCache) return this.asyncStatementsCache[aKey]; @@ -389,7 +389,7 @@ this.AddonRepository_SQLiteMigrator = { * The asynchronous row to use * @return The created add-on */ - _makeAddonFromAsyncRow: function AD__makeAddonFromAsyncRow(aRow) { + _makeAddonFromAsyncRow: function(aRow) { // This is intentionally not an AddonSearchResult object in order // to allow AddonDatabase._parseAddon to parse it, same as if it // was read from the JSON database. @@ -410,7 +410,7 @@ this.AddonRepository_SQLiteMigrator = { * The asynchronous row to use * @return The created developer */ - _makeDeveloperFromAsyncRow: function AD__makeDeveloperFromAsyncRow(aRow) { + _makeDeveloperFromAsyncRow: function(aRow) { let name = aRow.getResultByName("name"); let url = aRow.getResultByName("url") return new AddonManagerPrivate.AddonAuthor(name, url); @@ -423,7 +423,7 @@ this.AddonRepository_SQLiteMigrator = { * The asynchronous row to use * @return The created screenshot */ - _makeScreenshotFromAsyncRow: function AD__makeScreenshotFromAsyncRow(aRow) { + _makeScreenshotFromAsyncRow: function(aRow) { let url = aRow.getResultByName("url"); let width = aRow.getResultByName("width"); let height = aRow.getResultByName("height"); @@ -442,7 +442,7 @@ this.AddonRepository_SQLiteMigrator = { * The asynchronous row to use * @return The created CompatibilityOverride */ - _makeCompatOverrideFromAsyncRow: function AD_makeCompatOverrideFromAsyncRow(aRow) { + _makeCompatOverrideFromAsyncRow: function(aRow) { let type = aRow.getResultByName("type"); let minVersion = aRow.getResultByName("minVersion"); let maxVersion = aRow.getResultByName("maxVersion"); @@ -464,7 +464,7 @@ this.AddonRepository_SQLiteMigrator = { * The asynchronous row to use * @return An object containing the size and URL of the icon */ - _makeIconFromAsyncRow: function AD_makeIconFromAsyncRow(aRow) { + _makeIconFromAsyncRow: function(aRow) { let size = aRow.getResultByName("size"); let url = aRow.getResultByName("url"); return { size: size, url: url }; @@ -478,7 +478,7 @@ this.AddonRepository_SQLiteMigrator = { * @param aErrorString * An error message */ - logSQLError: function AD_logSQLError(aError, aErrorString) { + logSQLError: function(aError, aErrorString) { logger.error("SQL error " + aError + ": " + aErrorString); }, @@ -488,14 +488,14 @@ this.AddonRepository_SQLiteMigrator = { * @param aError * A mozIStorageError to log */ - asyncErrorLogger: function AD_asyncErrorLogger(aError) { + asyncErrorLogger: function(aError) { logger.error("Async SQL error " + aError.result + ": " + aError.message); }, /** * Synchronously creates the triggers in the database. */ - _createTriggers: function AD__createTriggers() { + _createTriggers: function() { this.connection.executeSimpleSQL("DROP TRIGGER IF EXISTS delete_addon"); this.connection.executeSimpleSQL("CREATE TRIGGER delete_addon AFTER DELETE " + "ON addon BEGIN " + @@ -509,7 +509,7 @@ this.AddonRepository_SQLiteMigrator = { /** * Synchronously creates the indices in the database. */ - _createIndices: function AD__createIndices() { + _createIndices: function() { this.connection.executeSimpleSQL("CREATE INDEX IF NOT EXISTS developer_idx " + "ON developer (addon_internal_id)"); this.connection.executeSimpleSQL("CREATE INDEX IF NOT EXISTS screenshot_idx " + diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm index a567eb678de..aca88665b14 100644 --- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm @@ -37,7 +37,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository", "resource://gre/modules/addons/AddonRepository.jsm"); // Shared code for suppressing bad cert dialogs. -XPCOMUtils.defineLazyGetter(this, "CertUtils", function certUtilsLazyGetter() { +XPCOMUtils.defineLazyGetter(this, "CertUtils", function() { let certUtils = {}; Components.utils.import("resource://gre/modules/CertUtils.jsm", certUtils); return certUtils; @@ -79,7 +79,7 @@ RDFSerializer.prototype = { * @return a string with all characters invalid in XML character data * converted to entity references. */ - escapeEntities: function RDFS_escapeEntities(aString) { + escapeEntities: function(aString) { aString = aString.replace(/&/g, "&"); aString = aString.replace(//g, ">"); @@ -97,8 +97,7 @@ RDFSerializer.prototype = { * The current level of indent for pretty-printing * @return a string containing the serialized elements. */ - serializeContainerItems: function RDFS_serializeContainerItems(aDs, aContainer, - aIndent) { + serializeContainerItems: function(aDs, aContainer, aIndent) { var result = ""; var items = aContainer.GetElements(); while (items.hasMoreElements()) { @@ -124,9 +123,7 @@ RDFSerializer.prototype = { * @return a string containing the serialized properties. * @throws if the resource contains a property that cannot be serialized */ - serializeResourceProperties: function RDFS_serializeResourceProperties(aDs, - aResource, - aIndent) { + serializeResourceProperties: function(aDs, aResource, aIndent) { var result = ""; var items = []; var arcs = aDs.ArcLabelsOut(aResource); @@ -180,7 +177,7 @@ RDFSerializer.prototype = { * @return a string containing the serialized resource. * @throws if the RDF data contains multiple references to the same resource. */ - serializeResource: function RDFS_serializeResource(aDs, aResource, aIndent) { + serializeResource: function(aDs, aResource, aIndent) { if (this.resources.indexOf(aResource) != -1 ) { // We cannot output multiple references to the same resource. throw Components.Exception("Cannot serialize multiple references to " + aResource.Value); @@ -586,9 +583,9 @@ function UpdateParser(aId, aUpdateKey, aUrl, aObserver) { this.request.setRequestHeader("Moz-XPI-Update", "1", true); this.request.timeout = TIMEOUT; var self = this; - this.request.addEventListener("load", function loadEventListener(event) { self.onLoad() }, false); - this.request.addEventListener("error", function errorEventListener(event) { self.onError() }, false); - this.request.addEventListener("timeout", function timeoutEventListener(event) { self.onTimeout() }, false); + this.request.addEventListener("load", function(event) { self.onLoad() }, false); + this.request.addEventListener("error", function(event) { self.onError() }, false); + this.request.addEventListener("timeout", function(event) { self.onTimeout() }, false); this.request.send(null); } catch (e) { @@ -606,7 +603,7 @@ UpdateParser.prototype = { /** * Called when the manifest has been successfully loaded. */ - onLoad: function UP_onLoad() { + onLoad: function() { let request = this.request; this.request = null; this._doneAt = new Error("place holder"); @@ -700,7 +697,7 @@ UpdateParser.prototype = { /** * Called when the manifest failed to load. */ - onError: function UP_onError() { + onError: function() { if (!Components.isSuccessCode(this.request.status)) { logger.warn("Request failed: " + this.url + " - " + this.request.status); } @@ -729,7 +726,7 @@ UpdateParser.prototype = { /** * Helper method to notify the observer that an error occured. */ - notifyError: function UP_notifyError(aStatus) { + notifyError: function(aStatus) { if ("onUpdateCheckError" in this.observer) { try { this.observer.onUpdateCheckError(aStatus); @@ -743,7 +740,7 @@ UpdateParser.prototype = { /** * Called to cancel an in-progress update check. */ - cancel: function UP_cancel() { + cancel: function() { if (!this.request) { logger.error("Trying to cancel already-complete request", this._doneAt); return; @@ -837,12 +834,9 @@ this.AddonUpdateChecker = { * Ignore strictCompatibility when testing if an update matches. Optional. * @return an update object if one matches or null if not */ - getCompatibilityUpdate: function AUC_getCompatibilityUpdate(aUpdates, aVersion, - aIgnoreCompatibility, - aAppVersion, - aPlatformVersion, - aIgnoreMaxVersion, - aIgnoreStrictCompat) { + getCompatibilityUpdate: function(aUpdates, aVersion, aIgnoreCompatibility, + aAppVersion, aPlatformVersion, + aIgnoreMaxVersion, aIgnoreStrictCompat) { if (!aAppVersion) aAppVersion = Services.appinfo.version; if (!aPlatformVersion) @@ -883,12 +877,9 @@ this.AddonUpdateChecker = { * Array of AddonCompatibilityOverride to take into account. Optional. * @return an update object if one matches or null if not */ - getNewestCompatibleUpdate: function AUC_getNewestCompatibleUpdate(aUpdates, - aAppVersion, - aPlatformVersion, - aIgnoreMaxVersion, - aIgnoreStrictCompat, - aCompatOverrides) { + getNewestCompatibleUpdate: function(aUpdates, aAppVersion, aPlatformVersion, + aIgnoreMaxVersion, aIgnoreStrictCompat, + aCompatOverrides) { if (!aAppVersion) aAppVersion = Services.appinfo.version; if (!aPlatformVersion) @@ -928,8 +919,7 @@ this.AddonUpdateChecker = { * @return UpdateParser so that the caller can use UpdateParser.cancel() to shut * down in-progress update requests */ - checkForUpdates: function AUC_checkForUpdates(aId, aUpdateKey, aUrl, - aObserver) { + checkForUpdates: function(aId, aUpdateKey, aUrl, aObserver) { return new UpdateParser(aId, aUpdateKey, aUrl, aObserver); } }; diff --git a/toolkit/mozapps/extensions/internal/Content.js b/toolkit/mozapps/extensions/internal/Content.js index 9ab3b9ad6ca..e641f91c37c 100644 --- a/toolkit/mozapps/extensions/internal/Content.js +++ b/toolkit/mozapps/extensions/internal/Content.js @@ -19,7 +19,7 @@ const MSG_JAR_FLUSH = "AddonJarFlush"; try { if (Services.appinfo.processType !== Services.appinfo.PROCESS_TYPE_DEFAULT) { // Propagate JAR cache flush notifications across process boundaries. - addMessageListener(MSG_JAR_FLUSH, function jar_flushMessageListener(message) { + addMessageListener(MSG_JAR_FLUSH, function(message) { let file = new nsIFile(message.data); Services.obs.notifyObservers(file, "flush-cache-entry", null); }); diff --git a/toolkit/mozapps/extensions/internal/GMPProvider.jsm b/toolkit/mozapps/extensions/internal/GMPProvider.jsm index 56738f36e27..11179cd336d 100644 --- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm +++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm @@ -282,7 +282,7 @@ GMPWrapper.prototype = { return this._updateTask; } - this._updateTask = Task.spawn(function* GMPProvider_updateTask() { + this._updateTask = Task.spawn(function*() { this._log.trace("findUpdates() - updateTask"); try { let installManager = new GMPInstallManager(); @@ -467,7 +467,7 @@ GMPWrapper.prototype = { return this._updateTask; }, - _arePluginFilesOnDisk: function () { + _arePluginFilesOnDisk: function() { let fileExists = function(aGmpPath, aFileName) { let f = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); let path = OS.Path.join(aGmpPath, aFileName); @@ -618,7 +618,7 @@ var GMPProvider = { this._log.trace("shutdown"); Preferences.ignore(GMPPrefs.KEY_LOG_BASE, configureLogging); - let shutdownTask = Task.spawn(function* GMPProvider_shutdownTask() { + let shutdownTask = Task.spawn(function*() { this._log.trace("shutdown - shutdownTask"); let shutdownSucceeded = true; diff --git a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm index cb25c76a33e..b95737524fd 100644 --- a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm +++ b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm @@ -21,7 +21,7 @@ const ORIGIN_TOP_RIGHT = 1; const ORIGIN_BOTTOM_LEFT = 2; this.LightweightThemeImageOptimizer = { - optimize: function LWTIO_optimize(aThemeData, aScreen) { + optimize: function(aThemeData, aScreen) { let data = Utils.createCopy(aThemeData); if (!data.headerURL) { return data; @@ -38,7 +38,7 @@ this.LightweightThemeImageOptimizer = { return data; }, - purge: function LWTIO_purge() { + purge: function() { let dir = FileUtils.getDir("ProfD", ["lwtheme"]); dir.followLinks = false; try { @@ -52,8 +52,7 @@ Object.freeze(LightweightThemeImageOptimizer); var ImageCropper = { _inProgress: {}, - getCroppedImageURL: - function ImageCropper_getCroppedImageURL(aImageURL, aScreen, aOrigin) { + getCroppedImageURL: function(aImageURL, aScreen, aOrigin) { // We can crop local files, only. if (!aImageURL.startsWith("file://")) { return aImageURL; @@ -89,7 +88,7 @@ var ImageCropper = { return aImageURL; }, - _crop: function ImageCropper_crop(aURI, aTargetFile, aScreen, aOrigin) { + _crop: function(aURI, aTargetFile, aScreen, aOrigin) { let inProgress = this._inProgress; inProgress[aTargetFile.path] = true; @@ -97,7 +96,7 @@ var ImageCropper = { delete inProgress[aTargetFile.path]; } - ImageFile.read(aURI, function crop_readImageFile(aInputStream, aContentType) { + ImageFile.read(aURI, function(aInputStream, aContentType) { if (aInputStream && aContentType) { let image = ImageTools.decode(aInputStream, aContentType); if (image && image.width && image.height) { @@ -115,12 +114,12 @@ var ImageCropper = { }; var ImageFile = { - read: function ImageFile_read(aURI, aCallback) { + read: function(aURI, aCallback) { this._netUtil.asyncFetch({ uri: aURI, loadUsingSystemPrincipal: true, contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE - }, function read_asyncFetch(aInputStream, aStatus, aRequest) { + }, function(aInputStream, aStatus, aRequest) { if (Components.isSuccessCode(aStatus) && aRequest instanceof Ci.nsIChannel) { let channel = aRequest.QueryInterface(Ci.nsIChannel); aCallback(aInputStream, channel.contentType); @@ -130,9 +129,9 @@ var ImageFile = { }); }, - write: function ImageFile_write(aFile, aInputStream, aCallback) { + write: function(aFile, aInputStream, aCallback) { let fos = FileUtils.openSafeFileOutputStream(aFile); - this._netUtil.asyncCopy(aInputStream, fos, function write_asyncCopy(aResult) { + this._netUtil.asyncCopy(aInputStream, fos, function(aResult) { FileUtils.closeSafeFileOutputStream(fos); // Remove the file if writing was not successful. @@ -151,7 +150,7 @@ XPCOMUtils.defineLazyModuleGetter(ImageFile, "_netUtil", "resource://gre/modules/NetUtil.jsm", "NetUtil"); var ImageTools = { - decode: function ImageTools_decode(aInputStream, aContentType) { + decode: function(aInputStream, aContentType) { let outParam = {value: null}; try { @@ -161,7 +160,7 @@ var ImageTools = { return outParam.value; }, - encode: function ImageTools_encode(aImage, aScreen, aOrigin, aContentType) { + encode: function(aImage, aScreen, aOrigin, aContentType) { let stream; let width = Math.min(aImage.width, aScreen.width); let height = Math.min(aImage.height, aScreen.height); @@ -180,7 +179,7 @@ XPCOMUtils.defineLazyServiceGetter(ImageTools, "_imgTools", "@mozilla.org/image/tools;1", "imgITools"); var Utils = { - createCopy: function Utils_createCopy(aData) { + createCopy: function(aData) { let copy = {}; for (let [k, v] in Iterator(aData)) { copy[k] = v; diff --git a/toolkit/mozapps/extensions/internal/PluginProvider.jsm b/toolkit/mozapps/extensions/internal/PluginProvider.jsm index 3823c361cdd..13b4c6f27c2 100644 --- a/toolkit/mozapps/extensions/internal/PluginProvider.jsm +++ b/toolkit/mozapps/extensions/internal/PluginProvider.jsm @@ -55,7 +55,7 @@ var PluginProvider = { // A dictionary mapping IDs to names and descriptions plugins: null, - startup: function PL_startup() { + startup: function() { Services.obs.addObserver(this, LIST_UPDATED_TOPIC, false); Services.obs.addObserver(this, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, false); }, @@ -64,7 +64,7 @@ var PluginProvider = { * Called when the application is shutting down. Only necessary for tests * to be able to simulate a shutdown. */ - shutdown: function PL_shutdown() { + shutdown: function() { this.plugins = null; Services.obs.removeObserver(this, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED); Services.obs.removeObserver(this, LIST_UPDATED_TOPIC); @@ -73,7 +73,7 @@ var PluginProvider = { observe: function(aSubject, aTopic, aData) { switch (aTopic) { case AddonManager.OPTIONS_NOTIFICATION_DISPLAYED: - this.getAddonByID(aData, function PL_displayPluginInfo(plugin) { + this.getAddonByID(aData, function(plugin) { if (!plugin) return; @@ -102,7 +102,7 @@ var PluginProvider = { /** * Creates a PluginWrapper for a plugin object. */ - buildWrapper: function PL_buildWrapper(aPlugin) { + buildWrapper: function(aPlugin) { return new PluginWrapper(aPlugin.id, aPlugin.name, aPlugin.description, @@ -117,7 +117,7 @@ var PluginProvider = { * @param aCallback * A callback to pass the Addon to */ - getAddonByID: function PL_getAddon(aId, aCallback) { + getAddonByID: function(aId, aCallback) { if (!this.plugins) this.buildPluginList(); @@ -135,7 +135,7 @@ var PluginProvider = { * @param callback * A callback to pass an array of Addons to */ - getAddonsByTypes: function PL_getAddonsByTypes(aTypes, aCallback) { + getAddonsByTypes: function(aTypes, aCallback) { if (aTypes && aTypes.indexOf("plugin") < 0) { aCallback([]); return; @@ -163,7 +163,7 @@ var PluginProvider = { * @param aCallback * A callback to pass an array of Addons to */ - getAddonsWithOperationsByTypes: function PL_getAddonsWithOperationsByTypes(aTypes, aCallback) { + getAddonsWithOperationsByTypes: function(aTypes, aCallback) { aCallback([]); }, @@ -175,7 +175,7 @@ var PluginProvider = { * @param aCallback * A callback to pass the array of AddonInstalls to */ - getInstallsByTypes: function PL_getInstallsByTypes(aTypes, aCallback) { + getInstallsByTypes: function(aTypes, aCallback) { aCallback([]); }, @@ -184,7 +184,7 @@ var PluginProvider = { * * @return a dictionary of plugins indexed by our generated ID */ - getPluginList: function PL_getPluginList() { + getPluginList: function() { let tags = Cc["@mozilla.org/plugin/host;1"]. getService(Ci.nsIPluginHost). getPluginTags({}); @@ -216,7 +216,7 @@ var PluginProvider = { /** * Builds the list of known plugins from the plugin host */ - buildPluginList: function PL_buildPluginList() { + buildPluginList: function() { this.plugins = this.getPluginList(); }, @@ -225,7 +225,7 @@ var PluginProvider = { * to the last known list sending out any necessary API notifications for * changes. */ - updatePluginList: function PL_updatePluginList() { + updatePluginList: function() { let newList = this.getPluginList(); let lostPlugins = Object.keys(this.plugins).filter(id => !(id in newList)). diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 82d6e0bde32..bc8136219d1 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -71,7 +71,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "@mozilla.org/addons/policy-service;1", "nsIAddonPolicyService"); -XPCOMUtils.defineLazyGetter(this, "CertUtils", function certUtilsLazyGetter() { +XPCOMUtils.defineLazyGetter(this, "CertUtils", function() { let certUtils = {}; Components.utils.import("resource://gre/modules/CertUtils.jsm", certUtils); return certUtils; @@ -320,7 +320,7 @@ function loadLazyObjects() { LAZY_OBJECTS.forEach(name => { Object.defineProperty(gGlobalScope, name, { - get: function lazyObjectGetter() { + get: function() { let objs = loadLazyObjects(); return objs[name]; }, @@ -404,7 +404,7 @@ SafeInstallOperation.prototype = { _installedFiles: null, _createdDirs: null, - _installFile: function SIO_installFile(aFile, aTargetDirectory, aCopy) { + _installFile: function(aFile, aTargetDirectory, aCopy) { let oldFile = aCopy ? null : aFile.clone(); let newFile = aFile.clone(); try { @@ -421,7 +421,7 @@ SafeInstallOperation.prototype = { this._installedFiles.push({ oldFile: oldFile, newFile: newFile }); }, - _installDirectory: function SIO_installDirectory(aDirectory, aTargetDirectory, aCopy) { + _installDirectory: function(aDirectory, aTargetDirectory, aCopy) { let newDir = aTargetDirectory.clone(); newDir.append(aDirectory.leafName); try { @@ -469,7 +469,7 @@ SafeInstallOperation.prototype = { this._installedFiles.push({ oldFile: aDirectory, newFile: newDir }); }, - _installDirEntry: function SIO_installDirEntry(aDirEntry, aTargetDirectory, aCopy) { + _installDirEntry: function(aDirEntry, aTargetDirectory, aCopy) { let isDir = null; try { @@ -510,7 +510,7 @@ SafeInstallOperation.prototype = { * The directory to move into, this is expected to be an empty * directory. */ - moveUnder: function SIO_move(aFile, aTargetDirectory) { + moveUnder: function(aFile, aTargetDirectory) { try { this._installDirEntry(aFile, aTargetDirectory, false); } @@ -551,7 +551,7 @@ SafeInstallOperation.prototype = { * The directory to copy into, this is expected to be an empty * directory. */ - copy: function SIO_copy(aFile, aTargetDirectory) { + copy: function(aFile, aTargetDirectory) { try { this._installDirEntry(aFile, aTargetDirectory, true); } @@ -566,7 +566,7 @@ SafeInstallOperation.prototype = { * occurs here then both old and new directories are left in an indeterminate * state */ - rollback: function SIO_rollback() { + rollback: function() { while (this._installedFiles.length > 0) { let move = this._installedFiles.pop(); if (move.isMoveTo) { @@ -853,7 +853,7 @@ function getRDFProperty(aDs, aResource, aProperty) { * @throws if the install manifest in the stream is corrupt or could not * be read */ -var loadManifestFromWebManifest = Task.async(function* loadManifestFromWebManifest(aUri) { +var loadManifestFromWebManifest = Task.async(function*(aUri) { // We're passed the URI for the manifest file. Get the URI for its // parent directory. let uri = NetUtil.newURI("./", null, aUri); @@ -1285,7 +1285,7 @@ function defineSyncGUID(aAddon) { * @return an AddonInternal object * @throws if the directory does not contain a valid install manifest */ -var loadManifestFromDir = Task.async(function* loadManifestFromDir(aDir, aInstallLocation) { +var loadManifestFromDir = Task.async(function*(aDir, aInstallLocation) { function getFileSize(aFile) { if (aFile.isSymlink()) return 0; @@ -1370,7 +1370,7 @@ var loadManifestFromDir = Task.async(function* loadManifestFromDir(aDir, aInstal * @return an AddonInternal object * @throws if the XPI file does not contain a valid install manifest */ -var loadManifestFromZipReader = Task.async(function* loadManifestFromZipReader(aZipReader, aInstallLocation) { +var loadManifestFromZipReader = Task.async(function*(aZipReader, aInstallLocation) { function loadFromRDF(aUri) { let zis = aZipReader.getInputStream(entry); let bis = Cc["@mozilla.org/network/buffered-input-stream;1"]. @@ -1441,7 +1441,7 @@ var loadManifestFromZipReader = Task.async(function* loadManifestFromZipReader(a * @return an AddonInternal object * @throws if the XPI file does not contain a valid install manifest */ -var loadManifestFromZipFile = Task.async(function* loadManifestFromZipFile(aXPIFile, aInstallLocation) { +var loadManifestFromZipFile = Task.async(function*(aXPIFile, aInstallLocation) { let zipReader = Cc["@mozilla.org/libjar/zip-reader;1"]. createInstance(Ci.nsIZipReader); try { @@ -1798,7 +1798,7 @@ function escapeAddonURI(aAddon, aUri, aUpdateType, aAppVersion) } function removeAsync(aFile) { - return Task.spawn(function () { + return Task.spawn(function() { let info = null; try { info = yield OS.File.stat(aFile.path); @@ -1927,7 +1927,7 @@ function getDirectoryEntries(aDir, aSortEntries) { entries.push(dirEnum.nextFile); if (aSortEntries) { - entries.sort(function sortDirEntries(a, b) { + entries.sort(function(a, b) { return a.path > b.path ? -1 : 1; }); } @@ -2365,7 +2365,7 @@ this.XPIProvider = { /* * Set a value in the telemetry hash for a given ID */ - setTelemetry: function XPI_setTelemetry(aId, aName, aValue) { + setTelemetry: function(aId, aName, aValue) { if (!this._telemetryDetails[aId]) this._telemetryDetails[aId] = {}; this._telemetryDetails[aId][aName] = aValue; @@ -2374,11 +2374,11 @@ this.XPIProvider = { // Keep track of in-progress operations that support cancel() _inProgress: [], - doing: function XPI_doing(aCancellable) { + doing: function(aCancellable) { this._inProgress.push(aCancellable); }, - done: function XPI_done(aCancellable) { + done: function(aCancellable) { let i = this._inProgress.indexOf(aCancellable); if (i != -1) { this._inProgress.splice(i, 1); @@ -2387,7 +2387,7 @@ this.XPIProvider = { return false; }, - cancelAll: function XPI_cancelAll() { + cancelAll: function() { // Cancelling one may alter _inProgress, so don't use a simple iterator while (this._inProgress.length > 0) { let c = this._inProgress.shift(); @@ -2407,7 +2407,7 @@ this.XPIProvider = { * will be still valid after an add-on gets disabled or uninstalled, as * consumers may still have URIs of (leaked) resources they want to map. */ - _addURIMapping: function XPI__addURIMapping(aID, aFile) { + _addURIMapping: function(aID, aFile) { logger.info("Mapping " + aID + " to " + aFile.path); this._addonFileMap.set(aID, aFile.path); @@ -2425,7 +2425,7 @@ this.XPIProvider = { * @return * resolved nsIFileURL */ - _resolveURIToFile: function XPI__resolveURIToFile(aURI) { + _resolveURIToFile: function(aURI) { switch (aURI.scheme) { case "jar": case "file": @@ -2494,7 +2494,7 @@ this.XPIProvider = { * The version of the platform last run with this profile or null * if it is a new profile or the version is unknown */ - startup: function XPI_startup(aAppChanged, aOldAppVersion, aOldPlatformVersion) { + startup: function(aAppChanged, aOldAppVersion, aOldPlatformVersion) { function addDirectoryInstallLocation(aName, aKey, aPaths, aScope, aLocked) { try { var dir = FileUtils.getDir(aKey, aPaths); @@ -2741,7 +2741,7 @@ this.XPIProvider = { // Let these shutdown a little earlier when they still have access to most // of XPCOM Services.obs.addObserver({ - observe: function shutdownObserver(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { XPIProvider._closing = true; for (let id in XPIProvider.bootstrappedAddons) { let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); @@ -2756,7 +2756,7 @@ this.XPIProvider = { // Detect final-ui-startup for telemetry reporting Services.obs.addObserver({ - observe: function uiStartupObserver(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { AddonManagerPrivate.recordTimestamp("XPI_finalUIStartup"); XPIProvider.runPhase = XPI_AFTER_UI_STARTUP; Services.obs.removeObserver(this, "final-ui-startup"); @@ -2786,7 +2786,7 @@ this.XPIProvider = { * flushing the XPI Database if it was loaded, * 0 otherwise. */ - shutdown: function XPI_shutdown() { + shutdown: function() { logger.debug("shutdown"); // Stop anything we were doing asynchronously @@ -2838,7 +2838,7 @@ this.XPIProvider = { /** * Applies any pending theme change to the preferences. */ - applyThemeChange: function XPI_applyThemeChange() { + applyThemeChange: function() { if (!Preferences.get(PREF_DSS_SWITCHPENDING, false)) return; @@ -2866,7 +2866,7 @@ this.XPIProvider = { * IDs to check for updates. Array may be empty if no add-ons can be/need * to be updated, but the metadata check needs to be performed. */ - shouldForceUpdateCheck: function XPI_shouldForceUpdateCheck(aAppChanged) { + shouldForceUpdateCheck: function(aAppChanged) { AddonManagerPrivate.recordSimpleMeasure("XPIDB_metadata_age", AddonRepository.metadataAge()); let startupChanges = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED); @@ -2904,7 +2904,7 @@ this.XPIProvider = { * Array opf addon IDs that were disabled by the application update, and * should therefore be checked for updates. */ - showUpgradeUI: function XPI_showUpgradeUI(aAddonIDs) { + showUpgradeUI: function(aAddonIDs) { logger.debug("XPI_showUpgradeUI: " + aAddonIDs.toSource()); // Flip a flag to indicate that we interrupted startup with an interactive prompt Services.startup.interrupted = true; @@ -2924,7 +2924,7 @@ this.XPIProvider = { !XPIDatabase.writeAddonsList()); }, - updateSystemAddons: Task.async(function* XPI_updateSystemAddons() { + updateSystemAddons: Task.async(function*() { let systemAddonLocation = XPIProvider.installLocationsByName[KEY_APP_SYSTEM_ADDONS]; if (!systemAddonLocation) return; @@ -3077,7 +3077,7 @@ this.XPIProvider = { /** * Verifies that all installed add-ons are still correctly signed. */ - verifySignatures: function XPI_verifySignatures() { + verifySignatures: function() { XPIDatabase.getAddonList(a => true, (addons) => { Task.spawn(function*() { let changes = { @@ -3116,7 +3116,7 @@ this.XPIProvider = { /** * Persists changes to XPIProvider.bootstrappedAddons to its store (a pref). */ - persistBootstrappedAddons: function XPI_persistBootstrappedAddons() { + persistBootstrappedAddons: function() { // Experiments are disabled upon app load, so don't persist references. let filtered = {}; for (let id in this.bootstrappedAddons) { @@ -3135,7 +3135,7 @@ this.XPIProvider = { /** * Adds a list of currently active add-ons to the next crash report. */ - addAddonsToCrashReporter: function XPI_addAddonsToCrashReporter() { + addAddonsToCrashReporter: function() { if (!("nsICrashReporter" in Ci) || !(Services.appinfo instanceof Ci.nsICrashReporter)) return; @@ -3170,7 +3170,7 @@ this.XPIProvider = { * of passing through updated compatibility information * @return true if an add-on was installed or uninstalled */ - processPendingFileChanges: function XPI_processPendingFileChanges(aManifests) { + processPendingFileChanges: function(aManifests) { let changed = false; this.installLocations.forEach(function(aLocation) { aManifests[aLocation.name] = {}; @@ -3388,7 +3388,7 @@ this.XPIProvider = { * reload them later * @return true if any new add-ons were installed */ - installDistributionAddons: function XPI_installDistributionAddons(aManifests) { + installDistributionAddons: function(aManifests) { let distroDir; try { distroDir = FileUtils.getDir(KEY_APP_DISTRIBUTION, [DIR_EXTENSIONS]); @@ -3503,7 +3503,7 @@ this.XPIProvider = { * Imports the xpinstall permissions from preferences into the permissions * manager for the user to change later. */ - importPermissions: function XPI_importPermissions() { + importPermissions: function() { PermissionsUtils.importFromPrefs(PREF_XPI_PERMISSIONS_BRANCH, XPI_PERMISSION); }, @@ -3526,7 +3526,7 @@ this.XPIProvider = { * if it is a new profile or the version is unknown * @return true if a change requiring a restart was detected */ - checkForChanges: function XPI_checkForChanges(aAppChanged, aOldAppVersion, + checkForChanges: function(aAppChanged, aOldAppVersion, aOldPlatformVersion) { logger.debug("checkForChanges"); @@ -3702,7 +3702,7 @@ this.XPIProvider = { * The mimetype to check for * @return true if the mimetype is application/x-xpinstall */ - supportsMimetype: function XPI_supportsMimetype(aMimetype) { + supportsMimetype: function(aMimetype) { return aMimetype == "application/x-xpinstall"; }, @@ -3711,7 +3711,7 @@ this.XPIProvider = { * * @return true if installing is enabled */ - isInstallEnabled: function XPI_isInstallEnabled() { + isInstallEnabled: function() { // Default to enabled if the preference does not exist return Preferences.get(PREF_XPI_ENABLED, true); }, @@ -3722,7 +3722,7 @@ this.XPIProvider = { * * @return true if installing by direct requests is whitelisted */ - isDirectRequestWhitelisted: function XPI_isDirectRequestWhitelisted() { + isDirectRequestWhitelisted: function() { // Default to whitelisted if the preference does not exist. return Preferences.get(PREF_XPI_DIRECT_WHITELISTED, true); }, @@ -3733,7 +3733,7 @@ this.XPIProvider = { * * @return true if installing from file referrers is whitelisted */ - isFileRequestWhitelisted: function XPI_isFileRequestWhitelisted() { + isFileRequestWhitelisted: function() { // Default to whitelisted if the preference does not exist. return Preferences.get(PREF_XPI_FILE_WHITELISTED, true); }, @@ -3745,7 +3745,7 @@ this.XPIProvider = { * The nsIPrincipal that initiated the install * @return true if installing is allowed */ - isInstallAllowed: function XPI_isInstallAllowed(aInstallingPrincipal) { + isInstallAllowed: function(aInstallingPrincipal) { if (!this.isInstallEnabled()) return false; @@ -3796,9 +3796,9 @@ this.XPIProvider = { * @param aCallback * A callback to pass the AddonInstall to */ - getInstallForURL: function XPI_getInstallForURL(aUrl, aHash, aName, aIcons, - aVersion, aBrowser, aCallback) { - AddonInstall.createDownload(function getInstallForURL_createDownload(aInstall) { + getInstallForURL: function(aUrl, aHash, aName, aIcons, aVersion, aBrowser, + aCallback) { + AddonInstall.createDownload(function(aInstall) { aCallback(aInstall.wrapper); }, aUrl, aHash, aName, aIcons, aVersion, aBrowser); }, @@ -3811,8 +3811,8 @@ this.XPIProvider = { * @param aCallback * A callback to pass the AddonInstall to */ - getInstallForFile: function XPI_getInstallForFile(aFile, aCallback) { - AddonInstall.createInstall(function getInstallForFile_createInstall(aInstall) { + getInstallForFile: function(aFile, aCallback) { + AddonInstall.createInstall(function(aInstall) { if (aInstall) aCallback(aInstall.wrapper); else @@ -3831,8 +3831,7 @@ this.XPIProvider = { * @return a Promise that rejects if the add-on is not restartless * or an add-on with the same ID is already temporarily installed */ - installTemporaryAddon: Task.async(function* - XPI_installTemporaryAddon(aDirectory) { + installTemporaryAddon: Task.async(function*(aDirectory) { let addon = yield loadManifestFromFile(aDirectory, TemporaryInstallLocation); if (!addon.bootstrap) { @@ -3911,7 +3910,7 @@ this.XPIProvider = { * @param install * The AddonInstall to remove */ - removeActiveInstall: function XPI_removeActiveInstall(aInstall) { + removeActiveInstall: function(aInstall) { let where = this.installs.indexOf(aInstall); if (where == -1) { logger.warn("removeActiveInstall: could not find active install for " @@ -3929,8 +3928,8 @@ this.XPIProvider = { * @param aCallback * A callback to pass the Addon to */ - getAddonByID: function XPI_getAddonByID(aId, aCallback) { - XPIDatabase.getVisibleAddonForID (aId, function getAddonByID_getVisibleAddonForID(aAddon) { + getAddonByID: function(aId, aCallback) { + XPIDatabase.getVisibleAddonForID (aId, function(aAddon) { aCallback(aAddon ? aAddon.wrapper : null); }); }, @@ -3943,10 +3942,10 @@ this.XPIProvider = { * @param aCallback * A callback to pass an array of Addons to */ - getAddonsByTypes: function XPI_getAddonsByTypes(aTypes, aCallback) { + getAddonsByTypes: function(aTypes, aCallback) { let typesToGet = getAllAliasesForTypes(aTypes); - XPIDatabase.getVisibleAddons(typesToGet, function getAddonsByTypes_getVisibleAddons(aAddons) { + XPIDatabase.getVisibleAddons(typesToGet, function(aAddons) { aCallback(aAddons.map(a => a.wrapper)); }); }, @@ -3959,8 +3958,8 @@ this.XPIProvider = { * @param aCallback * A callback to pass the Addon to. Receives null if not found. */ - getAddonBySyncGUID: function XPI_getAddonBySyncGUID(aGUID, aCallback) { - XPIDatabase.getAddonBySyncGUID(aGUID, function getAddonBySyncGUID_getAddonBySyncGUID(aAddon) { + getAddonBySyncGUID: function(aGUID, aCallback) { + XPIDatabase.getAddonBySyncGUID(aGUID, function(aAddon) { aCallback(aAddon ? aAddon.wrapper : null); }); }, @@ -3973,12 +3972,10 @@ this.XPIProvider = { * @param aCallback * A callback to pass an array of Addons to */ - getAddonsWithOperationsByTypes: - function XPI_getAddonsWithOperationsByTypes(aTypes, aCallback) { + getAddonsWithOperationsByTypes: function(aTypes, aCallback) { let typesToGet = getAllAliasesForTypes(aTypes); - XPIDatabase.getVisibleAddonsWithPendingOperations(typesToGet, - function getAddonsWithOpsByTypes_getVisibleAddonsWithPendingOps(aAddons) { + XPIDatabase.getVisibleAddonsWithPendingOperations(typesToGet, function(aAddons) { let results = aAddons.map(a => a.wrapper); XPIProvider.installs.forEach(function(aInstall) { if (aInstall.state == AddonManager.STATE_INSTALLED && @@ -3998,7 +3995,7 @@ this.XPIProvider = { * @param aCallback * A callback to pass the array of AddonInstalls to */ - getInstallsByTypes: function XPI_getInstallsByTypes(aTypes, aCallback) { + getInstallsByTypes: function(aTypes, aCallback) { let results = []; this.installs.forEach(function(aInstall) { if (!aTypes || aTypes.indexOf(getExternalType(aInstall.type)) >= 0) @@ -4020,7 +4017,7 @@ this.XPIProvider = { * @see AddonManager.mapURIToAddonID * @see amIAddonManager.mapURIToAddonID */ - mapURIToAddonID: function XPI_mapURIToAddonID(aURI) { + mapURIToAddonID: function(aURI) { if (aURI.scheme == "moz-extension") { return AddonPolicyService.extensionURIToAddonId(aURI); } @@ -4049,7 +4046,7 @@ this.XPIProvider = { * true if the newly enabled add-on will only become enabled after a * restart */ - addonChanged: function XPI_addonChanged(aId, aType, aPendingRestart) { + addonChanged: function(aId, aType, aPendingRestart) { // We only care about themes in this provider if (aType != "theme") return; @@ -4107,7 +4104,7 @@ this.XPIProvider = { /** * Update the appDisabled property for all add-ons. */ - updateAddonAppDisabledStates: function XPI_updateAddonAppDisabledStates() { + updateAddonAppDisabledStates: function() { let addons = XPIDatabase.getAddons(); addons.forEach(function(aAddon) { this.updateAddonDisabledState(aAddon); @@ -4120,9 +4117,9 @@ this.XPIProvider = { * @param aCallback * Function to call when operation is complete. */ - updateAddonRepositoryData: function XPI_updateAddonRepositoryData(aCallback) { + updateAddonRepositoryData: function(aCallback) { let self = this; - XPIDatabase.getVisibleAddons(null, function UARD_getVisibleAddonsCallback(aAddons) { + XPIDatabase.getVisibleAddons(null, function(aAddons) { let pending = aAddons.length; logger.debug("updateAddonRepositoryData found " + pending + " visible add-ons"); if (pending == 0) { @@ -4136,8 +4133,7 @@ this.XPIProvider = { } for (let addon of aAddons) { - AddonRepository.getCachedAddonByID(addon.id, - function UARD_getCachedAddonCallback(aRepoAddon) { + AddonRepository.getCachedAddonByID(addon.id, function(aRepoAddon) { if (aRepoAddon) { logger.debug("updateAddonRepositoryData got info for " + addon.id); addon._repositoryAddon = aRepoAddon; @@ -4155,7 +4151,7 @@ this.XPIProvider = { * When the previously selected theme is removed this method will be called * to enable the default theme. */ - enableDefaultTheme: function XPI_enableDefaultTheme() { + enableDefaultTheme: function() { logger.debug("Activating default theme"); let addon = XPIDatabase.getVisibleAddonForInternalName(this.defaultSkin); if (addon) { @@ -4195,7 +4191,7 @@ this.XPIProvider = { * * @see nsIObserver */ - observe: function XPI_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { if (aTopic == NOTIFICATION_FLUSH_PERMISSIONS) { if (!aData || aData == XPI_PERMISSION) { this.importPermissions(); @@ -4235,7 +4231,7 @@ this.XPIProvider = { * The add-on to test * @return true if the operation requires a restart */ - enableRequiresRestart: function XPI_enableRequiresRestart(aAddon) { + enableRequiresRestart: function(aAddon) { // If the platform couldn't have activated extensions then we can make // changes without any restart. if (!this.extensionsActive) @@ -4272,7 +4268,7 @@ this.XPIProvider = { * The add-on to test * @return true if the operation requires a restart */ - disableRequiresRestart: function XPI_disableRequiresRestart(aAddon) { + disableRequiresRestart: function(aAddon) { // If the platform couldn't have activated up extensions then we can make // changes without any restart. if (!this.extensionsActive) @@ -4318,7 +4314,7 @@ this.XPIProvider = { * The add-on to test * @return true if the operation requires a restart */ - installRequiresRestart: function XPI_installRequiresRestart(aAddon) { + installRequiresRestart: function(aAddon) { // If the platform couldn't have activated up extensions then we can make // changes without any restart. if (!this.extensionsActive) @@ -4365,7 +4361,7 @@ this.XPIProvider = { * The add-on to test * @return true if the operation requires a restart */ - uninstallRequiresRestart: function XPI_uninstallRequiresRestart(aAddon) { + uninstallRequiresRestart: function(aAddon) { // If the platform couldn't have activated up extensions then we can make // changes without any restart. if (!this.extensionsActive) @@ -4401,9 +4397,8 @@ this.XPIProvider = { * Boolean indicating whether the add-on can run in safe mode. * @return a JavaScript scope */ - loadBootstrapScope: function XPI_loadBootstrapScope(aId, aFile, aVersion, aType, - aMultiprocessCompatible, - aRunInSafeMode) { + loadBootstrapScope: function(aId, aFile, aVersion, aType, + aMultiprocessCompatible, aRunInSafeMode) { // Mark the add-on as active for the crash reporter before loading this.bootstrappedAddons[aId] = { version: aVersion, @@ -4498,7 +4493,7 @@ this.XPIProvider = { * @param aId * The add-on's ID */ - unloadBootstrapScope: function XPI_unloadBootstrapScope(aId) { + unloadBootstrapScope: function(aId) { // In case the add-on was not multiprocess-compatible, deregister // any interpositions for it. Cu.setAddonInterposition(aId, null); @@ -4530,7 +4525,7 @@ this.XPIProvider = { * An object of additional key/value pairs to pass to the method in * the params argument */ - callBootstrapMethod: function XPI_callBootstrapMethod(aAddon, aFile, aMethod, aReason, aExtraParams) { + callBootstrapMethod: function(aAddon, aFile, aMethod, aReason, aExtraParams) { if (!aAddon.id || !aAddon.version || !aAddon.type) { logger.error(new Error("aAddon must include an id, version, and type")); return; @@ -4632,9 +4627,7 @@ this.XPIProvider = { * - false: The add-on became enabled * @throws if addon is not a DBAddonInternal */ - updateAddonDisabledState: function XPI_updateAddonDisabledState(aAddon, - aUserDisabled, - aSoftDisabled) { + updateAddonDisabledState: function(aAddon, aUserDisabled, aSoftDisabled) { if (!(aAddon.inDatabase)) throw new Error("Can only update addon states for installed addons."); if (aUserDisabled !== undefined && aSoftDisabled !== undefined) { @@ -4754,7 +4747,7 @@ this.XPIProvider = { * @throws if the addon cannot be uninstalled because it is in an install * location that does not allow it */ - uninstallAddon: function XPI_uninstallAddon(aAddon) { + uninstallAddon: function(aAddon) { if (!(aAddon.inDatabase)) throw new Error("Cannot uninstall addon " + aAddon.id + " because it is not installed"); @@ -4868,7 +4861,7 @@ this.XPIProvider = { * @param aAddon * The DBAddonInternal to cancel uninstall for */ - cancelUninstallAddon: function XPI_cancelUninstallAddon(aAddon) { + cancelUninstallAddon: function(aAddon) { if (!(aAddon.inDatabase)) throw new Error("Can only cancel uninstall for installed addons."); @@ -4984,7 +4977,7 @@ AddonInstall.prototype = { * @param aManifest * The cached manifest for the staged install */ - initStagedInstall: function AI_initStagedInstall(aManifest) { + initStagedInstall: function(aManifest) { this.name = aManifest.name; this.type = aManifest.type; this.version = aManifest.version; @@ -5009,7 +5002,7 @@ AddonInstall.prototype = { * @param aCallback * The callback to pass the initialised AddonInstall to */ - initLocalInstall: function AI_initLocalInstall(aCallback) { + initLocalInstall: function(aCallback) { aCallback = makeSafe(aCallback); this.file = this.sourceURI.QueryInterface(Ci.nsIFileURL).file; @@ -5056,7 +5049,7 @@ AddonInstall.prototype = { let self = this; this.loadManifest(this.file).then(() => { - XPIDatabase.getVisibleAddonForID(self.addon.id, function initLocalInstall_getVisibleAddon(aAddon) { + XPIDatabase.getVisibleAddonForID(self.addon.id, function(aAddon) { self.existingAddon = aAddon; if (aAddon) applyBlocklistChanges(aAddon, self.addon); @@ -5067,7 +5060,7 @@ AddonInstall.prototype = { // TODO Should we send some event here? self.state = AddonManager.STATE_CHECKING; new UpdateChecker(self.addon, { - onUpdateFinished: function updateChecker_onUpdateFinished(aAddon) { + onUpdateFinished: function(aAddon) { self.state = AddonManager.STATE_DOWNLOADED; XPIProvider.installs.push(self); AddonManagerPrivate.callInstallListeners("onNewInstall", @@ -5113,7 +5106,7 @@ AddonInstall.prototype = { * @param aVersion * An optional version for the add-on */ - initAvailableDownload: function AI_initAvailableDownload(aName, aType, aIcons, aVersion, aCallback) { + initAvailableDownload: function(aName, aType, aIcons, aVersion, aCallback) { this.state = AddonManager.STATE_AVAILABLE; this.name = aName; this.type = aType; @@ -5135,7 +5128,7 @@ AddonInstall.prototype = { * * @throws if installation cannot proceed from the current state */ - install: function AI_install() { + install: function() { switch (this.state) { case AddonManager.STATE_AVAILABLE: this.startDownload(); @@ -5170,7 +5163,7 @@ AddonInstall.prototype = { * * @throws if installation cannot be cancelled from the current state */ - cancel: function AI_cancel() { + cancel: function() { switch (this.state) { case AddonManager.STATE_DOWNLOADING: if (this.channel) { @@ -5220,8 +5213,8 @@ AddonInstall.prototype = { * @param aListener * The InstallListener to add */ - addListener: function AI_addListener(aListener) { - if (!this.listeners.some(function addListener_matchListener(i) { return i == aListener; })) + addListener: function(aListener) { + if (!this.listeners.some(function(i) { return i == aListener; })) this.listeners.push(aListener); }, @@ -5231,8 +5224,8 @@ AddonInstall.prototype = { * @param aListener * The InstallListener to remove */ - removeListener: function AI_removeListener(aListener) { - this.listeners = this.listeners.filter(function removeListener_filterListener(i) { + removeListener: function(aListener) { + this.listeners = this.listeners.filter(function(i) { return i != aListener; }); }, @@ -5240,7 +5233,7 @@ AddonInstall.prototype = { /** * Removes the temporary file owned by this AddonInstall if there is one. */ - removeTemporaryFile: function AI_removeTemporaryFile() { + removeTemporaryFile: function() { // Only proceed if this AddonInstall owns its XPI file if (!this.ownsTempFile) { this.logger.debug("removeTemporaryFile: " + this.sourceURI.spec + " does not own temp file"); @@ -5264,7 +5257,7 @@ AddonInstall.prototype = { * Updates the sourceURI and releaseNotesURI values on the Addon being * installed by this AddonInstall instance. */ - updateAddonURIs: function AI_updateAddonURIs() { + updateAddonURIs: function() { this.addon.sourceURI = this.sourceURI.spec; if (this.releaseNotesURI) this.addon.releaseNotesURI = this.releaseNotesURI.spec; @@ -5278,7 +5271,7 @@ AddonInstall.prototype = { * An array of { entryName, file } for each remaining file from the * multi-package XPI. */ - _createLinkedInstalls: Task.async(function* AI_createLinkedInstalls(aFiles) { + _createLinkedInstalls: Task.async(function*(aFiles) { if (aFiles.length == 0) return; @@ -5320,7 +5313,7 @@ AddonInstall.prototype = { * An open nsIZipReader for the multi-package XPI's files. This will * be closed before this method returns. */ - _loadMultipackageManifests: Task.async(function* AI_loadMultipackageManifests(aZipReader) { + _loadMultipackageManifests: Task.async(function*(aZipReader) { let files = []; let entries = aZipReader.findEntries("(*.[Xx][Pp][Ii]|*.[Jj][Aa][Rr])"); while (entries.hasMore()) { @@ -5382,7 +5375,7 @@ AddonInstall.prototype = { * @throws if the add-on does not contain a valid install manifest or the * XPI is incorrectly signed */ - loadManifest: Task.async(function* AI_loadManifest(file) { + loadManifest: Task.async(function*(file) { let zipreader = Cc["@mozilla.org/libjar/zip-reader;1"]. createInstance(Ci.nsIZipReader); try { @@ -5478,7 +5471,7 @@ AddonInstall.prototype = { this.addon.appDisabled = !isUsableAddon(this.addon); }), - observe: function AI_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { // Network is going offline this.cancel(); }, @@ -5486,7 +5479,7 @@ AddonInstall.prototype = { /** * Starts downloading the add-on's XPI file. */ - startDownload: function AI_startDownload() { + startDownload: function() { this.state = AddonManager.STATE_DOWNLOADING; if (!AddonManagerPrivate.callInstallListeners("onDownloadStarted", this.listeners, this.wrapper)) { @@ -5513,7 +5506,7 @@ AddonInstall.prototype = { this.openChannel(); }, - openChannel: function AI_openChannel() { + openChannel: function() { this.restartDownload = false; try { @@ -5571,7 +5564,7 @@ AddonInstall.prototype = { * * @see nsIStreamListener */ - onDataAvailable: function AI_onDataAvailable(aRequest, aContext, aInputstream, + onDataAvailable: function(aRequest, aContext, aInputstream, aOffset, aCount) { this.crypto.updateFromStream(aInputstream, aCount); this.progress += aCount; @@ -5587,7 +5580,7 @@ AddonInstall.prototype = { * * @see nsIChannelEventSink */ - asyncOnChannelRedirect: function AI_asyncOnChannelRedirect(aOldChannel, aNewChannel, aFlags, aCallback) { + asyncOnChannelRedirect: function(aOldChannel, aNewChannel, aFlags, aCallback) { if (!this.hash && aOldChannel.originalURI.schemeIs("https") && aOldChannel instanceof Ci.nsIHttpChannel) { try { @@ -5617,7 +5610,7 @@ AddonInstall.prototype = { * * @see nsIStreamListener */ - onStartRequest: function AI_onStartRequest(aRequest, aContext) { + onStartRequest: function(aRequest, aContext) { this.crypto = Cc["@mozilla.org/security/hash;1"]. createInstance(Ci.nsICryptoHash); if (this.hash) { @@ -5658,7 +5651,7 @@ AddonInstall.prototype = { * * @see nsIStreamListener */ - onStopRequest: function AI_onStopRequest(aRequest, aContext, aStatus) { + onStopRequest: function(aRequest, aContext, aStatus) { this.stream.close(); this.channel = null; this.badCerthandler = null; @@ -5718,7 +5711,7 @@ AddonInstall.prototype = { // TODO Should we send some event here (bug 557716)? self.state = AddonManager.STATE_CHECKING; new UpdateChecker(self.addon, { - onUpdateFinished: function onStopRequest_onUpdateFinished(aAddon) { + onUpdateFinished: function(aAddon) { self.downloadCompleted(); } }, AddonManager.UPDATE_WHEN_ADDON_INSTALLED); @@ -5749,7 +5742,7 @@ AddonInstall.prototype = { * @param error * The error code to pass to the listeners */ - downloadFailed: function AI_downloadFailed(aReason, aError) { + downloadFailed: function(aReason, aError) { logger.warn("Download of " + this.sourceURI.spec + " failed", aError); this.state = AddonManager.STATE_DOWNLOAD_FAILED; this.error = aReason; @@ -5771,9 +5764,9 @@ AddonInstall.prototype = { /** * Notify listeners that the download completed. */ - downloadCompleted: function AI_downloadCompleted() { + downloadCompleted: function() { let self = this; - XPIDatabase.getVisibleAddonForID(this.addon.id, function downloadCompleted_getVisibleAddonForID(aAddon) { + XPIDatabase.getVisibleAddonForID(this.addon.id, function(aAddon) { if (aAddon) self.existingAddon = aAddon; @@ -5814,7 +5807,7 @@ AddonInstall.prototype = { /** * Installs the add-on into the install location. */ - startInstall: function AI_startInstall() { + startInstall: function() { this.state = AddonManager.STATE_INSTALLING; if (!AddonManagerPrivate.callInstallListeners("onInstallStarted", this.listeners, this.wrapper)) { @@ -6021,7 +6014,7 @@ AddonInstall.prototype = { }); }, - getInterface: function AI_getInterface(iid) { + getInterface: function(iid) { if (iid.equals(Ci.nsIAuthPrompt2)) { let win = this.window; if (!win && this.browser) @@ -6053,7 +6046,7 @@ AddonInstall.prototype = { * @param aManifest * The cached manifest for the install */ -AddonInstall.createStagedInstall = function AI_createStagedInstall(aInstallLocation, aDir, aManifest) { +AddonInstall.createStagedInstall = function(aInstallLocation, aDir, aManifest) { let url = Services.io.newFileURI(aDir); let install = new AddonInstall(aInstallLocation, aDir); @@ -6069,7 +6062,7 @@ AddonInstall.createStagedInstall = function AI_createStagedInstall(aInstallLocat * @param aFile * The file to install */ -AddonInstall.createInstall = function AI_createInstall(aCallback, aFile) { +AddonInstall.createInstall = function(aCallback, aFile) { let location = XPIProvider.installLocationsByName[KEY_APP_PROFILE]; let url = Services.io.newFileURI(aFile); @@ -6101,7 +6094,7 @@ AddonInstall.createInstall = function AI_createInstall(aCallback, aFile) { * @param aBrowser * The browser performing the install */ -AddonInstall.createDownload = function AI_createDownload(aCallback, aUri, aHash, aName, aIcons, +AddonInstall.createDownload = function(aCallback, aUri, aHash, aName, aIcons, aVersion, aBrowser) { let location = XPIProvider.installLocationsByName[KEY_APP_PROFILE]; let url = NetUtil.newURI(aUri); @@ -6123,7 +6116,7 @@ AddonInstall.createDownload = function AI_createDownload(aCallback, aUri, aHash, * @param aUpdate * The metadata about the new version from the update manifest */ -AddonInstall.createUpdate = function AI_createUpdate(aCallback, aAddon, aUpdate) { +AddonInstall.createUpdate = function(aCallback, aAddon, aUpdate) { let url = NetUtil.newURI(aUpdate.updateURL); let releaseNotesURI = null; try { @@ -6152,52 +6145,52 @@ AddonInstall.createUpdate = function AI_createUpdate(aCallback, aAddon, aUpdate) * The AddonInstall to create a wrapper for */ function AddonInstallWrapper(aInstall) { - this.__defineGetter__("__AddonInstallInternal__", function AIW_debugGetter() { + this.__defineGetter__("__AddonInstallInternal__", function() { return AppConstants.DEBUG ? aInstall : undefined; }); ["name", "version", "icons", "releaseNotesURI", "file", "state", "error", "progress", "maxProgress", "certificate", "certName"].forEach(function(aProp) { - this.__defineGetter__(aProp, function AIW_propertyGetter() { + this.__defineGetter__(aProp, function() { return aInstall[aProp]; }); }, this); this.__defineGetter__("type", () => getExternalType(aInstall.type)); - this.__defineGetter__("iconURL", function AIW_iconURL() { + this.__defineGetter__("iconURL", function() { return aInstall.icons[32]; }); - this.__defineGetter__("existingAddon", function AIW_existingAddonGetter() { + this.__defineGetter__("existingAddon", function() { return aInstall.existingAddon ? aInstall.existingAddon.wrapper : null; }); - this.__defineGetter__("addon", function AIW_addonGetter() { + this.__defineGetter__("addon", function() { return aInstall.addon ? aInstall.addon.wrapper : null; }); - this.__defineGetter__("sourceURI", function AIW_sourceURIGetter() { + this.__defineGetter__("sourceURI", function() { return aInstall.sourceURI; }); - this.__defineGetter__("linkedInstalls", function AIW_linkedInstallsGetter() { + this.__defineGetter__("linkedInstalls", function() { if (!aInstall.linkedInstalls) return null; return aInstall.linkedInstalls.map(i => i.wrapper); }); - this.install = function AIW_install() { + this.install = function() { aInstall.install(); } - this.cancel = function AIW_cancel() { + this.cancel = function() { aInstall.cancel(); } - this.addListener = function AIW_addListener(listener) { + this.addListener = function(listener) { aInstall.addListener(listener); } - this.removeListener = function AIW_removeListener(listener) { + this.removeListener = function(listener) { aInstall.removeListener(listener); } } @@ -6269,7 +6262,7 @@ UpdateChecker.prototype = { * @param aMethod * The method to call on the listener */ - callListener: function UC_callListener(aMethod, ...aArgs) { + callListener: function(aMethod, ...aArgs) { if (!(aMethod in this.listener)) return; @@ -6287,7 +6280,7 @@ UpdateChecker.prototype = { * @param updates * The list of update details for the add-on */ - onUpdateCheckComplete: function UC_onUpdateCheckComplete(aUpdates) { + onUpdateCheckComplete: function(aUpdates) { XPIProvider.done(this.addon._updateCheck); this.addon._updateCheck = null; let AUC = AddonUpdateChecker; @@ -6376,7 +6369,7 @@ UpdateChecker.prototype = { } let self = this; - AddonInstall.createUpdate(function onUpdateCheckComplete_createUpdate(aInstall) { + AddonInstall.createUpdate(function(aInstall) { sendUpdateAvailableMessages(self, aInstall); }, this.addon, update); } @@ -6391,7 +6384,7 @@ UpdateChecker.prototype = { * @param aError * An error status */ - onUpdateCheckError: function UC_onUpdateCheckError(aError) { + onUpdateCheckError: function(aError) { XPIProvider.done(this.addon._updateCheck); this.addon._updateCheck = null; this.callListener("onNoCompatibilityUpdateAvailable", this.addon.wrapper); @@ -6402,7 +6395,7 @@ UpdateChecker.prototype = { /** * Called to cancel an in-progress update check */ - cancel: function UC_cancel() { + cancel: function() { let parser = this._parser; if (parser) { this._parser = null; @@ -6502,7 +6495,7 @@ AddonInternal.prototype = { return matchedOS && !needsABI; }, - isCompatibleWith: function AddonInternal_isCompatibleWith(aAppVersion, aPlatformVersion) { + isCompatibleWith: function(aAppVersion, aPlatformVersion) { let app = this.matchingTargetApplication; if (!app) return false; @@ -6582,7 +6575,7 @@ AddonInternal.prototype = { return Blocklist.getAddonBlocklistURL(this.wrapper); }, - applyCompatibilityUpdate: function AddonInternal_applyCompatibilityUpdate(aUpdate, aSyncCompatibility) { + applyCompatibilityUpdate: function(aUpdate, aSyncCompatibility) { this.targetApplications.forEach(function(aTargetApp) { aUpdate.targetApplications.forEach(function(aUpdateTarget) { if (aTargetApp.id == aUpdateTarget.id && (aSyncCompatibility || @@ -6626,7 +6619,7 @@ AddonInternal.prototype = { * @return an object containing copies of the properties of this object * ignoring private properties, functions, getters and setters */ - toJSON: function AddonInternal_toJSON(aKey) { + toJSON: function(aKey) { let obj = {}; for (let prop in this) { // Ignore the wrapper property @@ -6663,7 +6656,7 @@ AddonInternal.prototype = { * @param aObj * A JS object containing the cached metadata */ - importMetadata: function AddonInternal_importMetaData(aObj) { + importMetadata: function(aObj) { PENDING_INSTALL_METADATA.forEach(function(aProp) { if (!(aProp in aObj)) return; @@ -6675,7 +6668,7 @@ AddonInternal.prototype = { this.appDisabled = !isUsableAddon(this); }, - permissions: function AddonInternal_permissions() { + permissions: function() { let permissions = 0; // Add-ons that aren't installed cannot be modified in any way @@ -6712,7 +6705,7 @@ AddonInternal.prototype = { * the public API. */ function AddonWrapper(aAddon) { - this.__defineGetter__("__AddonInternal__", function AW_debugGetter() { + this.__defineGetter__("__AddonInternal__", function() { return AppConstants.DEBUG ? aAddon : undefined; }); @@ -6733,7 +6726,7 @@ function AddonWrapper(aAddon) { "softDisabled", "skinnable", "size", "foreignInstall", "hasBinaryComponents", "strictCompatibility", "compatibilityOverrides", "updateURL", "getDataDirectory", "multiprocessCompatible", "signedState"].forEach(function(aProp) { - this.__defineGetter__(aProp, function AddonWrapper_propertyGetter() { + this.__defineGetter__(aProp, function() { return aAddon[aProp]; }); }, this); @@ -6744,7 +6737,7 @@ function AddonWrapper(aAddon) { "contributionURL", "contributionAmount", "averageRating", "reviewCount", "reviewURL", "totalDownloads", "weeklyDownloads", "dailyUsers", "repositoryStatus"].forEach(function(aProp) { - this.__defineGetter__(aProp, function AddonWrapper_repoPropertyGetter() { + this.__defineGetter__(aProp, function() { if (aAddon._repositoryAddon) return aAddon._repositoryAddon[aProp]; @@ -6752,18 +6745,18 @@ function AddonWrapper(aAddon) { }); }, this); - this.__defineGetter__("aboutURL", function AddonWrapper_aboutURLGetter() { + this.__defineGetter__("aboutURL", function() { return this.isActive ? aAddon["aboutURL"] : null; }); ["installDate", "updateDate"].forEach(function(aProp) { - this.__defineGetter__(aProp, function AddonWrapper_datePropertyGetter() { + this.__defineGetter__(aProp, function() { return new Date(aAddon[aProp]); }); }, this); ["sourceURI", "releaseNotesURI"].forEach(function(aProp) { - this.__defineGetter__(aProp, function AddonWrapper_URIPropertyGetter() { + this.__defineGetter__(aProp, function() { let [target, fromRepo] = chooseValue(aAddon, aProp); if (!target) return null; @@ -6773,7 +6766,7 @@ function AddonWrapper(aAddon) { }); }, this); - this.__defineGetter__("optionsURL", function AddonWrapper_optionsURLGetter() { + this.__defineGetter__("optionsURL", function() { if (this.isActive && aAddon.optionsURL) return aAddon.optionsURL; @@ -6783,7 +6776,7 @@ function AddonWrapper(aAddon) { return null; }, this); - this.__defineGetter__("optionsType", function AddonWrapper_optionsTypeGetter() { + this.__defineGetter__("optionsType", function() { if (!this.isActive) return null; @@ -6811,15 +6804,15 @@ function AddonWrapper(aAddon) { return null; }, this); - this.__defineGetter__("iconURL", function AddonWrapper_iconURLGetter() { + this.__defineGetter__("iconURL", function() { return AddonManager.getPreferredIconURL(this, 48); }, this); - this.__defineGetter__("icon64URL", function AddonWrapper_icon64URLGetter() { + this.__defineGetter__("icon64URL", function() { return AddonManager.getPreferredIconURL(this, 64); }, this); - this.__defineGetter__("icons", function AddonWrapper_iconsGetter() { + this.__defineGetter__("icons", function() { let icons = {}; if (aAddon._repositoryAddon) { @@ -6856,7 +6849,7 @@ function AddonWrapper(aAddon) { }, this); PROP_LOCALE_SINGLE.forEach(function(aProp) { - this.__defineGetter__(aProp, function AddonWrapper_singleLocaleGetter() { + this.__defineGetter__(aProp, function() { // Override XPI creator if repository creator is defined if (aProp == "creator" && aAddon._repositoryAddon && aAddon._repositoryAddon.creator) { @@ -6887,7 +6880,7 @@ function AddonWrapper(aAddon) { }, this); PROP_LOCALE_MULTI.forEach(function(aProp) { - this.__defineGetter__(aProp, function AddonWrapper_multiLocaleGetter() { + this.__defineGetter__(aProp, function() { let results = null; let usedRepository = false; @@ -6910,7 +6903,7 @@ function AddonWrapper(aAddon) { [results, usedRepository] = chooseValue(aAddon.selectedLocale, aProp); if (results && !usedRepository) { - results = results.map(function mapResult(aResult) { + results = results.map(function(aResult) { return new AddonManagerPrivate.AddonAuthor(aResult); }); } @@ -6919,7 +6912,7 @@ function AddonWrapper(aAddon) { }); }, this); - this.__defineGetter__("screenshots", function AddonWrapper_screenshotsGetter() { + this.__defineGetter__("screenshots", function() { let repositoryAddon = aAddon._repositoryAddon; if (repositoryAddon && ("screenshots" in repositoryAddon)) { let repositoryScreenshots = repositoryAddon.screenshots; @@ -6935,10 +6928,10 @@ function AddonWrapper(aAddon) { return null; }); - this.__defineGetter__("applyBackgroundUpdates", function AddonWrapper_applyBackgroundUpdatesGetter() { + this.__defineGetter__("applyBackgroundUpdates", function() { return aAddon.applyBackgroundUpdates; }); - this.__defineSetter__("applyBackgroundUpdates", function AddonWrapper_applyBackgroundUpdatesSetter(val) { + this.__defineSetter__("applyBackgroundUpdates", function(val) { if (this.type == "experiment") { logger.warn("Setting applyBackgroundUpdates on an experiment is not supported."); return; @@ -6962,7 +6955,7 @@ function AddonWrapper(aAddon) { return val; }); - this.__defineSetter__("syncGUID", function AddonWrapper_syncGUIDGetter(val) { + this.__defineSetter__("syncGUID", function(val) { if (aAddon.syncGUID == val) return val; @@ -6974,24 +6967,24 @@ function AddonWrapper(aAddon) { return val; }); - this.__defineGetter__("install", function AddonWrapper_installGetter() { + this.__defineGetter__("install", function() { if (!("_install" in aAddon) || !aAddon._install) return null; return aAddon._install.wrapper; }); - this.__defineGetter__("pendingUpgrade", function AddonWrapper_pendingUpgradeGetter() { + this.__defineGetter__("pendingUpgrade", function() { return aAddon.pendingUpgrade ? aAddon.pendingUpgrade.wrapper : null; }); - this.__defineGetter__("scope", function AddonWrapper_scopeGetter() { + this.__defineGetter__("scope", function() { if (aAddon._installLocation) return aAddon._installLocation.scope; return AddonManager.SCOPE_PROFILE; }); - this.__defineGetter__("pendingOperations", function AddonWrapper_pendingOperationsGetter() { + this.__defineGetter__("pendingOperations", function() { let pending = 0; if (!(aAddon.inDatabase)) { // Add-on is pending install if there is no associated install (shouldn't @@ -7019,7 +7012,7 @@ function AddonWrapper(aAddon) { return pending; }); - this.__defineGetter__("operationsRequiringRestart", function AddonWrapper_operationsRequiringRestartGetter() { + this.__defineGetter__("operationsRequiringRestart", function() { let ops = 0; if (XPIProvider.installRequiresRestart(aAddon)) ops |= AddonManager.OP_NEEDS_RESTART_INSTALL; @@ -7033,15 +7026,15 @@ function AddonWrapper(aAddon) { return ops; }); - this.__defineGetter__("isDebuggable", function AddonWrapper_isDebuggable() { + this.__defineGetter__("isDebuggable", function() { return this.isActive && aAddon.bootstrap; }); - this.__defineGetter__("permissions", function AddonWrapper_permisionsGetter() { + this.__defineGetter__("permissions", function() { return aAddon.permissions(); }); - this.__defineGetter__("isActive", function AddonWrapper_isActiveGetter() { + this.__defineGetter__("isActive", function() { if (!aAddon.active) return false; if (!Services.appinfo.inSafeMode) @@ -7049,10 +7042,10 @@ function AddonWrapper(aAddon) { return aAddon.bootstrap && canRunInSafeMode(aAddon); }); - this.__defineGetter__("userDisabled", function AddonWrapper_userDisabledGetter() { + this.__defineGetter__("userDisabled", function() { return aAddon.softDisabled || aAddon.userDisabled; }); - this.__defineSetter__("userDisabled", function AddonWrapper_userDisabledSetter(val) { + this.__defineSetter__("userDisabled", function(val) { if (val == this.userDisabled) { return val; } @@ -7077,7 +7070,7 @@ function AddonWrapper(aAddon) { return val; }); - this.__defineSetter__("softDisabled", function AddonWrapper_softDisabledSetter(val) { + this.__defineSetter__("softDisabled", function(val) { if (val == aAddon.softDisabled) return val; @@ -7101,7 +7094,7 @@ function AddonWrapper(aAddon) { return val; }); - this.__defineGetter__("hidden", function AddonWrapper_hidden() { + this.__defineGetter__("hidden", function() { if (aAddon._installLocation.name == KEY_APP_TEMPORARY) return false; @@ -7109,11 +7102,11 @@ function AddonWrapper(aAddon) { aAddon._installLocation.name == KEY_APP_SYSTEM_ADDONS); }); - this.isCompatibleWith = function AddonWrapper_isCompatiblewith(aAppVersion, aPlatformVersion) { + this.isCompatibleWith = function(aAppVersion, aPlatformVersion) { return aAddon.isCompatibleWith(aAppVersion, aPlatformVersion); }; - this.uninstall = function AddonWrapper_uninstall() { + this.uninstall = function() { if (!(aAddon.inDatabase)) throw new Error("Cannot uninstall an add-on that isn't installed"); if (aAddon.pendingUninstall) @@ -7121,7 +7114,7 @@ function AddonWrapper(aAddon) { XPIProvider.uninstallAddon(aAddon); }; - this.cancelUninstall = function AddonWrapper_cancelUninstall() { + this.cancelUninstall = function() { if (!(aAddon.inDatabase)) throw new Error("Cannot cancel uninstall for an add-on that isn't installed"); if (!aAddon.pendingUninstall) @@ -7129,7 +7122,7 @@ function AddonWrapper(aAddon) { XPIProvider.cancelUninstallAddon(aAddon); }; - this.findUpdates = function AddonWrapper_findUpdates(aListener, aReason, aAppVersion, aPlatformVersion) { + this.findUpdates = function(aListener, aReason, aAppVersion, aPlatformVersion) { // Short-circuit updates for experiments because updates are handled // through the Experiments Manager. if (this.type == "experiment") { @@ -7142,7 +7135,7 @@ function AddonWrapper(aAddon) { }; // Returns true if there was an update in progress, false if there was no update to cancel - this.cancelUpdate = function AddonWrapper_cancelUpdate() { + this.cancelUpdate = function() { if (aAddon._updateCheck) { aAddon._updateCheck.cancel(); return true; @@ -7150,7 +7143,7 @@ function AddonWrapper(aAddon) { return false; }; - this.hasResource = function AddonWrapper_hasResource(aPath) { + this.hasResource = function(aPath) { if (aAddon._hasResourceCache.has(aPath)) return aAddon._hasResourceCache.get(aPath); @@ -7204,7 +7197,7 @@ function AddonWrapper(aAddon) { * the file or directory the add-on is installed as. * @return an nsIURI */ - this.getResourceURI = function AddonWrapper_getResourceURI(aPath) { + this.getResourceURI = function(aPath) { if (!aPath) return NetUtil.newURI(aAddon._sourceBundle); @@ -7257,7 +7250,7 @@ DirectoryInstallLocation.prototype = { * The file containing the directory path * @return An nsIFile object representing the linked directory. */ - _readDirectoryFromFile: function DirInstallLocation__readDirectoryFromFile(aFile) { + _readDirectoryFromFile: function(aFile) { let fis = Cc["@mozilla.org/network/file-input-stream;1"]. createInstance(Ci.nsIFileInputStream); fis.init(aFile, -1, -1, false); @@ -7298,7 +7291,7 @@ DirectoryInstallLocation.prototype = { /** * Finds all the add-ons installed in this location. */ - _readAddons: function DirInstallLocation__readAddons() { + _readAddons: function() { // Use a snapshot of the directory contents to avoid possible issues with // iterating over a directory while removing files from it (the YAFFS2 // embedded filesystem has this issue, see bug 772238). @@ -7378,7 +7371,7 @@ DirectoryInstallLocation.prototype = { * @return The nsIFile * @throws if the ID does not match any of the add-ons installed */ - getLocationForID: function DirInstallLocation_getLocationForID(aId) { + getLocationForID: function(aId) { if (aId in this._IDToFileMap) return this._IDToFileMap[aId].clone(); throw new Error("Unknown add-on ID " + aId); @@ -7391,7 +7384,7 @@ DirectoryInstallLocation.prototype = { * @param aId * The ID of the addon */ - isLinkedAddon: function DirInstallLocation__isLinkedAddon(aId) { + isLinkedAddon: function(aId) { return this._linkedAddons.indexOf(aId) != -1; } }; @@ -7421,7 +7414,7 @@ Object.assign(MutableDirectoryInstallLocation.prototype, { * * @return an nsIFile */ - getStagingDir: function DirInstallLocation_getStagingDir() { + getStagingDir: function() { let dir = this._directory.clone(); dir.append(DIR_STAGE); return dir; @@ -7501,7 +7494,7 @@ Object.assign(MutableDirectoryInstallLocation.prototype, { * * @return an nsIFile */ - getTrashDir: function DirInstallLocation_getTrashDir() { + getTrashDir: function() { let trashDir = this._directory.clone(); trashDir.append(DIR_TRASH); let trashDirExists = trashDir.exists(); @@ -7532,9 +7525,7 @@ Object.assign(MutableDirectoryInstallLocation.prototype, { * otherwise they will only be copied * @return an nsIFile indicating where the add-on was installed to */ - installAddon: function DirInstallLocation_installAddon(aId, aSource, - aExistingAddonID, - aCopy) { + installAddon: function(aId, aSource, aExistingAddonID, aCopy) { let trashDir = this.getTrashDir(); let transaction = new SafeInstallOperation(); @@ -7633,7 +7624,7 @@ Object.assign(MutableDirectoryInstallLocation.prototype, { * The ID of the add-on to uninstall * @throws if the ID does not match any of the add-ons installed */ - uninstallAddon: function DirInstallLocation_uninstallAddon(aId) { + uninstallAddon: function(aId) { let file = this._IDToFileMap[aId]; if (!file) { logger.warn("Attempted to remove " + aId + " from " + @@ -8017,7 +8008,7 @@ WinRegInstallLocation.prototype = { * @param key * The key that contains the ID to path mapping */ - _readAddons: function RegInstallLocation__readAddons(aKey) { + _readAddons: function(aKey) { let count = aKey.valueCount; for (let i = 0; i < count; ++i) { let id = aKey.getValueName(i); @@ -8064,7 +8055,7 @@ WinRegInstallLocation.prototype = { /** * @see DirectoryInstallLocation */ - isLinkedAddon: function RegInstallLocation_isLinkedAddon(aId) { + isLinkedAddon: function(aId) { return true; } }; diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js index e56627f3108..dcfb702d9a9 100644 --- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js +++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js @@ -175,7 +175,7 @@ function makeSafe(aCallback) { * @param aObjects * The array of objects to process asynchronously * @param aMethod - * Function with signature function(object, function aCallback(f_of_object)) + * Function with signature function(object, function(f_of_object)) * @param aCallback * Function with signature f([aMethod(object)]), called when all values * are available @@ -195,9 +195,9 @@ function asyncMap(aObjects, aMethod, aCallback) { } } - aObjects.map(function asyncMap_each(aObject, aIndex, aArray) { + aObjects.map(function(aObject, aIndex, aArray) { try { - aMethod(aObject, function asyncMap_callback(aResult) { + aMethod(aObject, function(aResult) { asyncMap_gotValue(aIndex, aResult); }); } @@ -341,8 +341,7 @@ function DBAddonInternal(aLoaded) { throw new Error("Expected passed argument to contain a descriptor"); } - XPCOMUtils.defineLazyGetter(this, "pendingUpgrade", - function DBA_pendingUpgradeGetter() { + XPCOMUtils.defineLazyGetter(this, "pendingUpgrade", function() { for (let install of XPIProvider.installs) { if (install.state == AddonManager.STATE_INSTALLED && !(install.addon.inDatabase) && @@ -525,7 +524,7 @@ this.XPIDatabase = { * {location: {id1:{addon1}, id2:{addon2}}, location2:{...}, ...} * if there is useful information */ - getMigrateDataFromSQLITE: function XPIDB_getMigrateDataFromSQLITE() { + getMigrateDataFromSQLITE: function() { let connection = null; let dbfile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_DATABASE], true); // Attempt to open the database @@ -560,7 +559,7 @@ this.XPIDatabase = { * from the install locations if the database needs to be rebuilt. * (if false, caller is XPIProvider.checkForChanges() which will rebuild) */ - syncLoadDB: function XPIDB_syncLoadDB(aRebuildOnError) { + syncLoadDB: function(aRebuildOnError) { this.migrateData = null; let fstream = null; let data = ""; @@ -734,7 +733,7 @@ this.XPIDatabase = { * @return Promise resolves to the Map of loaded JSON data stored * in this.addonDB; never rejects. */ - asyncLoadDB: function XPIDB_asyncLoadDB() { + asyncLoadDB: function() { // Already started (and possibly finished) loading if (this._dbPromise) { return this._dbPromise; @@ -788,7 +787,7 @@ this.XPIDatabase = { * from the install locations if the database needs to be rebuilt. * (if false, caller is XPIProvider.checkForChanges() which will rebuild) */ - rebuildDatabase: function XIPDB_rebuildDatabase(aRebuildOnError) { + rebuildDatabase: function(aRebuildOnError) { this.addonDB = new Map(); this.initialized = true; @@ -824,7 +823,7 @@ this.XPIDatabase = { * * @return an array of persistent descriptors for the directories */ - getActiveBundles: function XPIDB_getActiveBundles() { + getActiveBundles: function() { let bundles = []; // non-bootstrapped extensions @@ -863,7 +862,7 @@ this.XPIDatabase = { * @return an object holding information about what add-ons were previously * userDisabled and any updated compatibility information */ - getMigrateDataFromRDF: function XPIDB_getMigrateDataFromRDF(aDbWasMissing) { + getMigrateDataFromRDF: function(aDbWasMissing) { // Migrate data from extensions.rdf let rdffile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_OLD_DATABASE], true); @@ -935,7 +934,7 @@ this.XPIDatabase = { * @return an object holding information about what add-ons were previously * userDisabled and any updated compatibility information */ - getMigrateDataFromDatabase: function XPIDB_getMigrateDataFromDatabase(aConnection) { + getMigrateDataFromDatabase: function(aConnection) { let migrateData = {}; // Attempt to migrate data from a different (even future!) version of the @@ -1026,7 +1025,7 @@ this.XPIDatabase = { * flush after the database is flushed and * all cleanup is done */ - shutdown: function XPIDB_shutdown() { + shutdown: function() { logger.debug("shutdown"); if (this.initialized) { // If our last database I/O had an error, try one last time to save. @@ -1121,7 +1120,7 @@ this.XPIDatabase = { * @param aCallback * A callback to pass the DBAddonInternal to */ - getAddonInLocation: function XPIDB_getAddonInLocation(aId, aLocation, aCallback) { + getAddonInLocation: function(aId, aLocation, aCallback) { this.asyncLoadDB().then( addonDB => getRepositoryAddon(addonDB.get(aLocation + ":" + aId), makeSafe(aCallback))); @@ -1135,7 +1134,7 @@ this.XPIDatabase = { * @param aCallback * A callback to pass the array of DBAddonInternals to */ - getAddonsInLocation: function XPIDB_getAddonsInLocation(aLocation, aCallback) { + getAddonsInLocation: function(aLocation, aCallback) { this.getAddonList(aAddon => aAddon._installLocation.name == aLocation, aCallback); }, @@ -1147,7 +1146,7 @@ this.XPIDatabase = { * @param aCallback * A callback to pass the DBAddonInternal to */ - getVisibleAddonForID: function XPIDB_getVisibleAddonForID(aId, aCallback) { + getVisibleAddonForID: function(aId, aCallback) { this.getAddon(aAddon => ((aAddon.id == aId) && aAddon.visible), aCallback); }, @@ -1160,7 +1159,7 @@ this.XPIDatabase = { * @param aCallback * A callback to pass the array of DBAddonInternals to */ - getVisibleAddons: function XPIDB_getVisibleAddons(aTypes, aCallback) { + getVisibleAddons: function(aTypes, aCallback) { this.getAddonList(aAddon => (aAddon.visible && (!aTypes || (aTypes.length == 0) || (aTypes.indexOf(aAddon.type) > -1))), @@ -1174,7 +1173,7 @@ this.XPIDatabase = { * The type of add-on to retrieve * @return an array of DBAddonInternals */ - getAddonsByType: function XPIDB_getAddonsByType(aType) { + getAddonsByType: function(aType) { if (!this.addonDB) { // jank-tastic! Must synchronously load DB if the theme switches from // an XPI theme to a lightweight theme before the DB has loaded, @@ -1193,7 +1192,7 @@ this.XPIDatabase = { * The internalName of the add-on to retrieve * @return a DBAddonInternal */ - getVisibleAddonForInternalName: function XPIDB_getVisibleAddonForInternalName(aInternalName) { + getVisibleAddonForInternalName: function(aInternalName) { if (!this.addonDB) { // This may be called when the DB hasn't otherwise been loaded logger.warn("Synchronous load of XPI database due to getVisibleAddonForInternalName"); @@ -1215,9 +1214,7 @@ this.XPIDatabase = { * @param aCallback * A callback to pass the array of DBAddonInternal to */ - getVisibleAddonsWithPendingOperations: - function XPIDB_getVisibleAddonsWithPendingOperations(aTypes, aCallback) { - + getVisibleAddonsWithPendingOperations: function(aTypes, aCallback) { this.getAddonList( aAddon => (aAddon.visible && (aAddon.pendingUninstall || @@ -1238,7 +1235,7 @@ this.XPIDatabase = { * if no add-on with that GUID is found. * */ - getAddonBySyncGUID: function XPIDB_getAddonBySyncGUID(aGUID, aCallback) { + getAddonBySyncGUID: function(aGUID, aCallback) { this.getAddon(aAddon => aAddon.syncGUID == aGUID, aCallback); }, @@ -1251,7 +1248,7 @@ this.XPIDatabase = { * * @return an array of DBAddonInternals */ - getAddons: function XPIDB_getAddons() { + getAddons: function() { if (!this.addonDB) { return []; } @@ -1267,7 +1264,7 @@ this.XPIDatabase = { * The file descriptor of the add-on * @return The DBAddonInternal that was added to the database */ - addAddonMetadata: function XPIDB_addAddonMetadata(aAddon, aDescriptor) { + addAddonMetadata: function(aAddon, aDescriptor) { if (!this.addonDB) { AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_addMetadata", XPIProvider.runPhase); @@ -1297,8 +1294,7 @@ this.XPIDatabase = { * The file descriptor of the add-on * @return The DBAddonInternal that was added to the database */ - updateAddonMetadata: function XPIDB_updateAddonMetadata(aOldAddon, aNewAddon, - aDescriptor) { + updateAddonMetadata: function(aOldAddon, aNewAddon, aDescriptor) { this.removeAddonMetadata(aOldAddon); aNewAddon.syncGUID = aOldAddon.syncGUID; aNewAddon.installDate = aOldAddon.installDate; @@ -1316,7 +1312,7 @@ this.XPIDatabase = { * @param aAddon * The DBAddonInternal being removed */ - removeAddonMetadata: function XPIDB_removeAddonMetadata(aAddon) { + removeAddonMetadata: function(aAddon) { this.addonDB.delete(aAddon._key); this.saveChanges(); }, @@ -1328,7 +1324,7 @@ this.XPIDatabase = { * @param aAddon * The DBAddonInternal to make visible */ - makeAddonVisible: function XPIDB_makeAddonVisible(aAddon) { + makeAddonVisible: function(aAddon) { logger.debug("Make addon " + aAddon._key + " visible"); for (let [, otherAddon] of this.addonDB) { if ((otherAddon.id == aAddon.id) && (otherAddon._key != aAddon._key)) { @@ -1349,7 +1345,7 @@ this.XPIDatabase = { * @param aProperties * A dictionary of properties to set */ - setAddonProperties: function XPIDB_setAddonProperties(aAddon, aProperties) { + setAddonProperties: function(aAddon, aProperties) { for (let key in aProperties) { aAddon[key] = aProperties[key]; } @@ -1366,7 +1362,7 @@ this.XPIDatabase = { * GUID string to set the value to * @throws if another addon already has the specified GUID */ - setAddonSyncGUID: function XPIDB_setAddonSyncGUID(aAddon, aGUID) { + setAddonSyncGUID: function(aAddon, aGUID) { // Need to make sure no other addon has this GUID function excludeSyncGUID(otherAddon) { return (otherAddon._key != aAddon._key) && (otherAddon.syncGUID == aGUID); @@ -1386,7 +1382,7 @@ this.XPIDatabase = { * @param aAddon * The DBAddonInternal to update */ - updateAddonActive: function XPIDB_updateAddonActive(aAddon, aActive) { + updateAddonActive: function(aAddon, aActive) { logger.debug("Updating active state for add-on " + aAddon.id + " to " + aActive); aAddon.active = aActive; @@ -1396,7 +1392,7 @@ this.XPIDatabase = { /** * Synchronously calculates and updates all the active flags in the database. */ - updateActiveAddons: function XPIDB_updateActiveAddons() { + updateActiveAddons: function() { if (!this.addonDB) { logger.warn("updateActiveAddons called when DB isn't loaded"); // force the DB to load @@ -1418,7 +1414,7 @@ this.XPIDatabase = { * Writes out the XPI add-ons list for the platform to read. * @return true if the file was successfully updated, false otherwise */ - writeAddonsList: function XPIDB_writeAddonsList() { + writeAddonsList: function() { if (!this.addonDB) { // force the DB to load AddonManagerPrivate.recordSimpleMeasure("XPIDB_lateOpen_writeList", diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js index 04d225416f5..fef0c2de8fc 100644 --- a/toolkit/mozapps/extensions/nsBlocklistService.js +++ b/toolkit/mozapps/extensions/nsBlocklistService.js @@ -82,7 +82,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "gCertBlocklistService", "@mozilla.org/security/certblocklist;1", "nsICertBlocklist"); -XPCOMUtils.defineLazyGetter(this, "gPref", function bls_gPref() { +XPCOMUtils.defineLazyGetter(this, "gPref", function() { return Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService). QueryInterface(Ci.nsIPrefBranch); }); @@ -91,7 +91,7 @@ XPCOMUtils.defineLazyGetter(this, "gPref", function bls_gPref() { // Services.jsm since it will not successfully QueryInterface nsIXULAppInfo in // xpcshell tests due to other code calling Services.appinfo before the // nsIXULAppInfo is created by the tests. -XPCOMUtils.defineLazyGetter(this, "gApp", function bls_gApp() { +XPCOMUtils.defineLazyGetter(this, "gApp", function() { let appinfo = Cc["@mozilla.org/xre/app-info;1"] .getService(Ci.nsIXULRuntime); try { @@ -103,7 +103,7 @@ XPCOMUtils.defineLazyGetter(this, "gApp", function bls_gApp() { return appinfo; }); -XPCOMUtils.defineLazyGetter(this, "gABI", function bls_gABI() { +XPCOMUtils.defineLazyGetter(this, "gABI", function() { let abi = null; try { abi = gApp.XPCOMABI; @@ -124,7 +124,7 @@ XPCOMUtils.defineLazyGetter(this, "gABI", function bls_gABI() { return abi; }); -XPCOMUtils.defineLazyGetter(this, "gOSVersion", function bls_gOSVersion() { +XPCOMUtils.defineLazyGetter(this, "gOSVersion", function() { let osVersion; let sysInfo = Cc["@mozilla.org/system-info;1"]. getService(Ci.nsIPropertyBag2); @@ -148,7 +148,7 @@ XPCOMUtils.defineLazyGetter(this, "gOSVersion", function bls_gOSVersion() { }); // shared code for suppressing bad cert dialogs -XPCOMUtils.defineLazyGetter(this, "gCertUtils", function bls_gCertUtils() { +XPCOMUtils.defineLazyGetter(this, "gCertUtils", function() { let temp = { }; Components.utils.import("resource://gre/modules/CertUtils.jsm", temp); return temp; @@ -326,7 +326,7 @@ Blocklist.prototype = { _addonEntries: null, _pluginEntries: null, - shutdown: function () { + shutdown: function() { Services.obs.removeObserver(this, "xpcom-shutdown"); Services.ppmm.removeMessageListener("Blocklist:getPluginBlocklistState", this); Services.ppmm.removeMessageListener("Blocklist:content-blocklist-updated", this); @@ -334,7 +334,7 @@ Blocklist.prototype = { gPref.removeObserver(PREF_EM_LOGGING_ENABLED, this); }, - observe: function Blocklist_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { switch (aTopic) { case "xpcom-shutdown": this.shutdown(); @@ -364,7 +364,7 @@ Blocklist.prototype = { }, // Message manager message handlers - receiveMessage: function (aMsg) { + receiveMessage: function(aMsg) { switch (aMsg.name) { case "Blocklist:getPluginBlocklistState": return this.getPluginBlocklistState(aMsg.data.addonData, @@ -379,13 +379,13 @@ Blocklist.prototype = { }, /* See nsIBlocklistService */ - isAddonBlocklisted: function Blocklist_isAddonBlocklisted(addon, appVersion, toolkitVersion) { + isAddonBlocklisted: function(addon, appVersion, toolkitVersion) { return this.getAddonBlocklistState(addon, appVersion, toolkitVersion) == Ci.nsIBlocklistService.STATE_BLOCKED; }, /* See nsIBlocklistService */ - getAddonBlocklistState: function Blocklist_getAddonBlocklistState(addon, appVersion, toolkitVersion) { + getAddonBlocklistState: function(addon, appVersion, toolkitVersion) { if (!this._isBlocklistLoaded()) this._loadBlocklist(); return this._getAddonBlocklistState(addon, this._addonEntries, @@ -411,8 +411,7 @@ Blocklist.prototype = { * @returns The blocklist state for the item, one of the STATE constants as * defined in nsIBlocklistService. */ - _getAddonBlocklistState: function Blocklist_getAddonBlocklistStateCall(addon, - addonEntries, appVersion, toolkitVersion) { + _getAddonBlocklistState: function(addon, addonEntries, appVersion, toolkitVersion) { if (!gBlocklistEnabled) return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; @@ -443,13 +442,12 @@ Blocklist.prototype = { * @param addon * The add-on whose to-be-reset prefs are to be found. */ - _getAddonPrefs: function Blocklist_getAddonPrefs(addon) { + _getAddonPrefs: function(addon) { let entry = this._findMatchingAddonEntry(this._addonEntries, addon); return entry.prefs.slice(0); }, - _findMatchingAddonEntry: function Blocklist_findMatchingAddonEntry(aAddonEntries, - aAddon) { + _findMatchingAddonEntry: function(aAddonEntries, aAddon) { if (!aAddon) return null; // Returns true if the params object passes the constraints set by entry. @@ -489,7 +487,7 @@ Blocklist.prototype = { }, /* See nsIBlocklistService */ - getAddonBlocklistURL: function Blocklist_getAddonBlocklistURL(addon, appVersion, toolkitVersion) { + getAddonBlocklistURL: function(addon, appVersion, toolkitVersion) { if (!gBlocklistEnabled) return ""; @@ -503,14 +501,14 @@ Blocklist.prototype = { return this._createBlocklistURL(blItem.blockID); }, - _createBlocklistURL: function Blocklist_createBlocklistURL(id) { + _createBlocklistURL: function(id) { let url = Services.urlFormatter.formatURLPref(PREF_BLOCKLIST_ITEM_URL); url = url.replace(/%blockID%/g, id); return url; }, - notify: function Blocklist_notify(aTimer) { + notify: function(aTimer) { if (!gBlocklistEnabled) return; @@ -618,9 +616,9 @@ Blocklist.prototype = { request.QueryInterface(Components.interfaces.nsIJSXMLHttpRequest); var self = this; - request.addEventListener("error", function errorEventListener(event) { + request.addEventListener("error", function(event) { self.onXMLError(event); }, false); - request.addEventListener("load", function loadEventListener(event) { + request.addEventListener("load", function(event) { self.onXMLLoad(event); }, false); request.send(null); @@ -630,7 +628,7 @@ Blocklist.prototype = { this._loadBlocklist(); }, - onXMLLoad: Task.async(function* (aEvent) { + onXMLLoad: Task.async(function*(aEvent) { let request = aEvent.target; try { gCertUtils.checkCert(request.channel); @@ -662,7 +660,7 @@ Blocklist.prototype = { } }), - onXMLError: function Blocklist_onXMLError(aEvent) { + onXMLError: function(aEvent) { try { var request = aEvent.target; // the following may throw (e.g. a local file or timeout) @@ -688,7 +686,7 @@ Blocklist.prototype = { * Finds the newest blocklist file from the application and the profile and * load it or does nothing if neither exist. */ - _loadBlocklist: function Blocklist_loadBlocklist() { + _loadBlocklist: function() { this._addonEntries = []; this._pluginEntries = []; var profFile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_BLOCKLIST]); @@ -770,7 +768,7 @@ Blocklist.prototype = { # */ - _loadBlocklistFromFile: function Blocklist_loadBlocklistFromFile(file) { + _loadBlocklistFromFile: function(file) { if (!gBlocklistEnabled) { LOG("Blocklist::_loadBlocklistFromFile: blocklist is disabled"); return; @@ -860,7 +858,7 @@ Blocklist.prototype = { LOG("Blocklist::_preloadBlocklist: no XML File found"); }), - _preloadBlocklistFile: Task.async(function* (path){ + _preloadBlocklistFile: Task.async(function*(path){ if (this._addonEntries) { // The file has been already loaded. return; @@ -879,7 +877,7 @@ Blocklist.prototype = { } }), - _loadBlocklistFromString : function Blocklist_loadBlocklistFromString(text) { + _loadBlocklistFromString : function(text) { try { var parser = Cc["@mozilla.org/xmlextras/domparser;1"]. createInstance(Ci.nsIDOMParser); @@ -939,7 +937,7 @@ Blocklist.prototype = { } }, - _processItemNodes: function Blocklist_processItemNodes(itemNodes, prefix, handler) { + _processItemNodes: function(itemNodes, prefix, handler) { var result = []; var itemName = prefix + "Item"; for (var i = 0; i < itemNodes.length; ++i) { @@ -953,8 +951,7 @@ Blocklist.prototype = { return result; }, - _handleCertItemNode: function Blocklist_handleCertItemNode(blocklistElement, - result) { + _handleCertItemNode: function(blocklistElement, result) { let issuer = blocklistElement.getAttribute("issuerName"); if (issuer) { for (let snElement of blocklistElement.children) { @@ -981,7 +978,7 @@ Blocklist.prototype = { } }, - _handleEmItemNode: function Blocklist_handleEmItemNode(blocklistElement, result) { + _handleEmItemNode: function(blocklistElement, result) { if (!matchesOSABI(blocklistElement)) return; @@ -1034,7 +1031,7 @@ Blocklist.prototype = { result.push(blockEntry); }, - _handlePluginItemNode: function Blocklist_handlePluginItemNode(blocklistElement, result) { + _handlePluginItemNode: function(blocklistElement, result) { if (!matchesOSABI(blocklistElement)) return; @@ -1080,8 +1077,7 @@ Blocklist.prototype = { }, /* See nsIBlocklistService */ - getPluginBlocklistState: function Blocklist_getPluginBlocklistState(plugin, - appVersion, toolkitVersion) { + getPluginBlocklistState: function(plugin, appVersion, toolkitVersion) { if (AppConstants.platform == "android" || AppConstants.MOZ_B2G) { return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; @@ -1110,8 +1106,7 @@ Blocklist.prototype = { * @returns {entry: blocklistEntry, version: blocklistEntryVersion}, * or null if there is no matching entry. */ - _getPluginBlocklistEntry: function Blocklist_getPluginBlocklistEntry(plugin, - pluginEntries, appVersion, toolkitVersion) { + _getPluginBlocklistEntry: function(plugin, pluginEntries, appVersion, toolkitVersion) { if (!gBlocklistEnabled) return null; @@ -1166,8 +1161,7 @@ Blocklist.prototype = { * @returns The blocklist state for the item, one of the STATE constants as * defined in nsIBlocklistService. */ - _getPluginBlocklistState: function Blocklist_getPluginBlocklistState(plugin, - pluginEntries, appVersion, toolkitVersion) { + _getPluginBlocklistState: function(plugin, pluginEntries, appVersion, toolkitVersion) { let r = this._getPluginBlocklistEntry(plugin, pluginEntries, appVersion, toolkitVersion); @@ -1191,7 +1185,7 @@ Blocklist.prototype = { }, /* See nsIBlocklistService */ - getPluginBlocklistURL: function Blocklist_getPluginBlocklistURL(plugin) { + getPluginBlocklistURL: function(plugin) { if (!this._isBlocklistLoaded()) this._loadBlocklist(); @@ -1208,7 +1202,7 @@ Blocklist.prototype = { }, /* See nsIBlocklistService */ - getPluginInfoURL: function (plugin) { + getPluginInfoURL: function(plugin) { if (!this._isBlocklistLoaded()) this._loadBlocklist(); @@ -1224,12 +1218,12 @@ Blocklist.prototype = { return blockEntry.infoURL; }, - _notifyObserversBlocklistUpdated: function () { + _notifyObserversBlocklistUpdated: function() { Services.obs.notifyObservers(this, "blocklist-updated", ""); Services.ppmm.broadcastAsyncMessage("Blocklist:blocklistInvalidated", {}); }, - _blocklistUpdated: function Blocklist_blocklistUpdated(oldAddonEntries, oldPluginEntries) { + _blocklistUpdated: function(oldAddonEntries, oldPluginEntries) { if (AppConstants.MOZ_B2G) { return; } @@ -1243,7 +1237,7 @@ Blocklist.prototype = { } var self = this; const types = ["extension", "theme", "locale", "dictionary", "service"]; - AddonManager.getAddonsByTypes(types, function blocklistUpdated_getAddonsByTypes(addons) { + AddonManager.getAddonsByTypes(types, function(addons) { for (let addon of addons) { let oldState = Ci.nsIBlocklistService.STATE_NOTBLOCKED; @@ -1364,7 +1358,7 @@ Blocklist.prototype = { Some tests run without UI, so the async code listens to a message that can be sent programatically */ - let applyBlocklistChanges = function blocklistUpdated_applyBlocklistChanges() { + let applyBlocklistChanges = function() { for (let addon of addonList) { if (!addon.disable) continue; @@ -1465,7 +1459,7 @@ BlocklistItemData.prototype = { * @returns True if the version range covers the item version and application * or toolkit version. */ - includesItem: function BlocklistItemData_includesItem(version, appVersion, toolkitVersion) { + includesItem: function(version, appVersion, toolkitVersion) { // Some platforms have no version for plugins, these don't match if there // was a min/maxVersion provided if (!version && (this.minVersion || this.maxVersion)) @@ -1495,7 +1489,7 @@ BlocklistItemData.prototype = { * The maximum version. If null it is assumed that version is always * smaller. */ - matchesRange: function BlocklistItemData_matchesRange(version, minVersion, maxVersion) { + matchesRange: function(version, minVersion, maxVersion) { if (minVersion && gVersionChecker.compare(version, minVersion) < 0) return false; if (maxVersion && gVersionChecker.compare(version, maxVersion) > 0) @@ -1512,7 +1506,7 @@ BlocklistItemData.prototype = { * The version of the application to test for. * @returns True if this version range covers the application version given. */ - matchesTargetRange: function BlocklistItemData_matchesTargetRange(appID, appVersion) { + matchesTargetRange: function(appID, appVersion) { var blTargetApp = this.targetApps[appID]; if (!blTargetApp) return false; @@ -1534,7 +1528,7 @@ BlocklistItemData.prototype = { * "minVersion" The minimum version in a version range (default = null). * "maxVersion" The maximum version in a version range (default = null). */ - getBlocklistAppVersions: function BlocklistItemData_getBlocklistAppVersions(targetAppElement) { + getBlocklistAppVersions: function(targetAppElement) { var appVersions = [ ]; if (targetAppElement) { @@ -1562,7 +1556,7 @@ BlocklistItemData.prototype = { * "minVersion" The minimum version in a version range (default = null). * "maxVersion" The maximum version in a version range (default = null). */ - getBlocklistVersionRange: function BlocklistItemData_getBlocklistVersionRange(versionRangeElement) { + getBlocklistVersionRange: function(versionRangeElement) { var minVersion = null; var maxVersion = null; if (!versionRangeElement) diff --git a/toolkit/mozapps/extensions/nsBlocklistServiceContent.js b/toolkit/mozapps/extensions/nsBlocklistServiceContent.js index b200c382d6f..1752924b529 100644 --- a/toolkit/mozapps/extensions/nsBlocklistServiceContent.js +++ b/toolkit/mozapps/extensions/nsBlocklistServiceContent.js @@ -30,17 +30,17 @@ Blocklist.prototype = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsIBlocklistService]), - init: function () { + init: function() { Services.cpmm.addMessageListener("Blocklist:blocklistInvalidated", this); Services.obs.addObserver(this, "xpcom-shutdown", false); }, - uninit: function () { + uninit: function() { Services.cpmm.removeMessageListener("Blocklist:blocklistInvalidated", this); Services.obs.removeObserver(this, "xpcom-shutdown", false); }, - observe: function (aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { switch (aTopic) { case "xpcom-shutdown": this.uninit(); @@ -49,7 +49,7 @@ Blocklist.prototype = { }, // Message manager message handlers - receiveMessage: function (aMsg) { + receiveMessage: function(aMsg) { switch (aMsg.name) { case "Blocklist:blocklistInvalidated": Services.obs.notifyObservers(null, "blocklist-updated", null); @@ -66,7 +66,7 @@ Blocklist.prototype = { * these directly to the nsBlockListService in the parent which * doesn't query for much.. allowing us to get away with this. */ - flattenObject: function (aTag) { + flattenObject: function(aTag) { // Based on debugging the nsBlocklistService, these are the props the // parent side will check on our objects. let props = ["name", "description", "filename", "version"]; @@ -80,16 +80,16 @@ Blocklist.prototype = { // We support the addon methods here for completeness, but content currently // only calls getPluginBlocklistState. - isAddonBlocklisted: function (aAddon, aAppVersion, aToolkitVersion) { + isAddonBlocklisted: function(aAddon, aAppVersion, aToolkitVersion) { return true; }, - getAddonBlocklistState: function (aAddon, aAppVersion, aToolkitVersion) { + getAddonBlocklistState: function(aAddon, aAppVersion, aToolkitVersion) { return Components.interfaces.nsIBlocklistService.STATE_BLOCKED; }, // There are a few callers in layout that rely on this. - getPluginBlocklistState: function (aPluginTag, aAppVersion, aToolkitVersion) { + getPluginBlocklistState: function(aPluginTag, aAppVersion, aToolkitVersion) { return Services.cpmm.sendSyncMessage("Blocklist:getPluginBlocklistState", { addonData: this.flattenObject(aPluginTag), appVersion: aAppVersion, @@ -97,15 +97,15 @@ Blocklist.prototype = { })[0]; }, - getAddonBlocklistURL: function (aAddon, aAppVersion, aToolkitVersion) { + getAddonBlocklistURL: function(aAddon, aAppVersion, aToolkitVersion) { throw new Error(kMissingAPIMessage); }, - getPluginBlocklistURL: function (aPluginTag) { + getPluginBlocklistURL: function(aPluginTag) { throw new Error(kMissingAPIMessage); }, - getPluginInfoURL: function (aPluginTag) { + getPluginInfoURL: function(aPluginTag) { throw new Error(kMissingAPIMessage); } };