mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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.
This commit is contained in:
parent
52d0cb06a8
commit
c1869c479f
@ -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);
|
||||
},
|
||||
|
||||
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -203,7 +203,7 @@ InstallTrigger.prototype = {
|
||||
return this.startSoftwareUpdate(url);
|
||||
},
|
||||
|
||||
_resolveURL: function (url) {
|
||||
_resolveURL: function(url) {
|
||||
return Services.io.newURI(url, null, this._url);
|
||||
},
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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 " +
|
||||
|
@ -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, "<");
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)).
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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<Map> 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",
|
||||
|
@ -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 = {
|
||||
# </blocklist>
|
||||
*/
|
||||
|
||||
_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)
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user