зеркало из https://github.com/mozilla/gecko-dev.git
Bug 767236 - Part 1: Name all anonymous functions in AddonRepository.jsm. r=Unfocused
This commit is contained in:
Родитель
2f9a2a81c5
Коммит
4ac8558a73
|
@ -42,7 +42,7 @@ const DB_SCHEMA = 4;
|
|||
const TOOLKIT_ID = "toolkit@mozilla.org";
|
||||
|
||||
["LOG", "WARN", "ERROR"].forEach(function(aName) {
|
||||
this.__defineGetter__(aName, function() {
|
||||
this.__defineGetter__(aName, function logFuncGetter() {
|
||||
Components.utils.import("resource://gre/modules/AddonLogging.jsm");
|
||||
|
||||
LogManager.getLogger("addons.repository", this);
|
||||
|
@ -118,7 +118,7 @@ function getAddonsToCache(aIds, aCallback) {
|
|||
|
||||
types = types.split(",");
|
||||
|
||||
AddonManager.getAddonsByIDs(aIds, function(aAddons) {
|
||||
AddonManager.getAddonsByIDs(aIds, function getAddonsToCache_getAddonsByIDs(aAddons) {
|
||||
let enabledIds = [];
|
||||
for (var i = 0; i < aIds.length; i++) {
|
||||
var preference = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%", aIds[i]);
|
||||
|
@ -380,7 +380,7 @@ AddonSearchResult.prototype = {
|
|||
* A platform version to test against
|
||||
* @return Boolean representing if the add-on is compatible
|
||||
*/
|
||||
isCompatibleWith: function(aAppVerison, aPlatformVersion) {
|
||||
isCompatibleWith: function ASR_isCompatibleWith(aAppVerison, aPlatformVersion) {
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -397,7 +397,7 @@ AddonSearchResult.prototype = {
|
|||
* @param aPlatformVersion
|
||||
* A platform version to check for updates for
|
||||
*/
|
||||
findUpdates: function(aListener, aReason, aAppVersion, aPlatformVersion) {
|
||||
findUpdates: function ASR_findUpdates(aListener, aReason, aAppVersion, aPlatformVersion) {
|
||||
if ("onNoCompatibilityUpdateAvailable" in aListener)
|
||||
aListener.onNoCompatibilityUpdateAvailable(this);
|
||||
if ("onNoUpdateAvailable" in aListener)
|
||||
|
@ -476,14 +476,14 @@ var AddonRepository = {
|
|||
/**
|
||||
* Initialize AddonRepository.
|
||||
*/
|
||||
initialize: function() {
|
||||
initialize: function AddonRepo_initialize() {
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Observe xpcom-shutdown notification, so we can shutdown cleanly.
|
||||
*/
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
observe: function AddonRepo_observe(aSubject, aTopic, aData) {
|
||||
if (aTopic == "xpcom-shutdown") {
|
||||
Services.obs.removeObserver(this, "xpcom-shutdown");
|
||||
this.shutdown();
|
||||
|
@ -493,12 +493,12 @@ var AddonRepository = {
|
|||
/**
|
||||
* Shut down AddonRepository
|
||||
*/
|
||||
shutdown: function() {
|
||||
shutdown: function AddonRepo_shutdown() {
|
||||
this.cancelSearch();
|
||||
|
||||
this._addons = null;
|
||||
this._pendingCallbacks = null;
|
||||
AddonDatabase.shutdown(function() {
|
||||
AddonDatabase.shutdown(function shutdown_databaseShutdown() {
|
||||
Services.obs.notifyObservers(null, "addon-repository-shutdown", null);
|
||||
});
|
||||
},
|
||||
|
@ -513,7 +513,7 @@ var AddonRepository = {
|
|||
* @param aCallback
|
||||
* The callback to pass the result back to
|
||||
*/
|
||||
getCachedAddonByID: function(aId, aCallback) {
|
||||
getCachedAddonByID: function AddonRepo_getCachedAddonByID(aId, aCallback) {
|
||||
if (!aId || !this.cacheEnabled) {
|
||||
aCallback(null);
|
||||
return;
|
||||
|
@ -529,7 +529,7 @@ var AddonRepository = {
|
|||
// Data has not been retrieved from the database, so retrieve it
|
||||
this._pendingCallbacks = [];
|
||||
this._pendingCallbacks.push(getAddon);
|
||||
AddonDatabase.retrieveStoredData(function(aAddons) {
|
||||
AddonDatabase.retrieveStoredData(function getCachedAddonByID_retrieveData(aAddons) {
|
||||
let pendingCallbacks = self._pendingCallbacks;
|
||||
|
||||
// Check if cache was shutdown or deleted before callback was called
|
||||
|
@ -566,11 +566,11 @@ var AddonRepository = {
|
|||
* @param aCallback
|
||||
* The optional callback to call once complete
|
||||
*/
|
||||
repopulateCache: function(aIds, aCallback) {
|
||||
this._repopulateCache(aIds, aCallback, false);
|
||||
repopulateCache: function AddonRepo_repopulateCache(aIds, aCallback) {
|
||||
this._repopulateCacheInternal(aIds, aCallback, false);
|
||||
},
|
||||
|
||||
_repopulateCache: function(aIds, aCallback, aSendPerformance) {
|
||||
_repopulateCacheInternal: function AddonRepo_repopulateCacheInternal(aIds, aCallback, aSendPerformance) {
|
||||
// Completely remove cache if caching is not enabled
|
||||
if (!this.cacheEnabled) {
|
||||
this._addons = null;
|
||||
|
@ -580,7 +580,7 @@ var AddonRepository = {
|
|||
}
|
||||
|
||||
let self = this;
|
||||
getAddonsToCache(aIds, function(aAddons) {
|
||||
getAddonsToCache(aIds, function repopulateCache_getAddonsToCache(aAddons) {
|
||||
// Completely remove cache if there are no add-ons to cache
|
||||
if (aAddons.length == 0) {
|
||||
self._addons = null;
|
||||
|
@ -590,12 +590,12 @@ var AddonRepository = {
|
|||
}
|
||||
|
||||
self._beginGetAddons(aAddons, {
|
||||
searchSucceeded: function(aAddons) {
|
||||
searchSucceeded: function repopulateCacheInternal_searchSucceeded(aAddons) {
|
||||
self._addons = {};
|
||||
aAddons.forEach(function(aAddon) { self._addons[aAddon.id] = aAddon; });
|
||||
AddonDatabase.repopulate(aAddons, aCallback);
|
||||
},
|
||||
searchFailed: function() {
|
||||
searchFailed: function repopulateCacheInternal_searchFailed() {
|
||||
WARN("Search failed when repopulating cache");
|
||||
if (aCallback)
|
||||
aCallback();
|
||||
|
@ -614,7 +614,7 @@ var AddonRepository = {
|
|||
* @param aCallback
|
||||
* The optional callback to call once complete
|
||||
*/
|
||||
cacheAddons: function(aIds, aCallback) {
|
||||
cacheAddons: function AddonRepo_cacheAddons(aIds, aCallback) {
|
||||
if (!this.cacheEnabled) {
|
||||
if (aCallback)
|
||||
aCallback();
|
||||
|
@ -622,7 +622,7 @@ var AddonRepository = {
|
|||
}
|
||||
|
||||
let self = this;
|
||||
getAddonsToCache(aIds, function(aAddons) {
|
||||
getAddonsToCache(aIds, function cacheAddons_getAddonsToCache(aAddons) {
|
||||
// If there are no add-ons to cache, act as if caching is disabled
|
||||
if (aAddons.length == 0) {
|
||||
if (aCallback)
|
||||
|
@ -631,11 +631,11 @@ var AddonRepository = {
|
|||
}
|
||||
|
||||
self.getAddonsByIDs(aAddons, {
|
||||
searchSucceeded: function(aAddons) {
|
||||
searchSucceeded: function cacheAddons_searchSucceeded(aAddons) {
|
||||
aAddons.forEach(function(aAddon) { self._addons[aAddon.id] = aAddon; });
|
||||
AddonDatabase.insertAddons(aAddons, aCallback);
|
||||
},
|
||||
searchFailed: function() {
|
||||
searchFailed: function cacheAddons_searchFailed() {
|
||||
WARN("Search failed when adding add-ons to cache");
|
||||
if (aCallback)
|
||||
aCallback();
|
||||
|
@ -665,7 +665,7 @@ var 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() {
|
||||
getRecommendedURL: function AddonRepo_getRecommendedURL() {
|
||||
let url = this._formatURLPref(PREF_GETADDONS_BROWSERECOMMENDED, {});
|
||||
return (url != null) ? url : "about:blank";
|
||||
},
|
||||
|
@ -678,7 +678,7 @@ var AddonRepository = {
|
|||
* @param aSearchTerms
|
||||
* Search terms used to search the repository
|
||||
*/
|
||||
getSearchURL: function(aSearchTerms) {
|
||||
getSearchURL: function AddonRepo_getSearchURL(aSearchTerms) {
|
||||
let url = this._formatURLPref(PREF_GETADDONS_BROWSESEARCHRESULTS, {
|
||||
TERMS : encodeURIComponent(aSearchTerms)
|
||||
});
|
||||
|
@ -689,7 +689,7 @@ var AddonRepository = {
|
|||
* Cancels the search in progress. If there is no search in progress this
|
||||
* does nothing.
|
||||
*/
|
||||
cancelSearch: function() {
|
||||
cancelSearch: function AddonRepo_cancelSearch() {
|
||||
this._searching = false;
|
||||
if (this._request) {
|
||||
this._request.abort();
|
||||
|
@ -707,7 +707,7 @@ var AddonRepository = {
|
|||
* @param aCallback
|
||||
* The callback to pass results to
|
||||
*/
|
||||
getAddonsByIDs: function(aIDs, aCallback) {
|
||||
getAddonsByIDs: function AddonRepo_getAddonsByIDs(aIDs, aCallback) {
|
||||
return this._beginGetAddons(aIDs, aCallback, false);
|
||||
},
|
||||
|
||||
|
@ -722,7 +722,7 @@ var AddonRepository = {
|
|||
* Boolean indicating whether to send performance data with the
|
||||
* request.
|
||||
*/
|
||||
_beginGetAddons: function(aIDs, aCallback, aSendPerformance) {
|
||||
_beginGetAddons: function AddonRepo_beginGetAddons(aIDs, aCallback, aSendPerformance) {
|
||||
let ids = aIDs.slice(0);
|
||||
|
||||
let params = {
|
||||
|
@ -817,8 +817,8 @@ var AddonRepository = {
|
|||
* Function to call when data is received. Function must be an object
|
||||
* with the keys searchSucceeded and searchFailed.
|
||||
*/
|
||||
backgroundUpdateCheck: function(aIDs, aCallback) {
|
||||
this._repopulateCache(aIDs, aCallback, true);
|
||||
backgroundUpdateCheck: function AddonRepo_backgroundUpdateCheck(aIDs, aCallback) {
|
||||
this._repopulateCacheInternal(aIDs, aCallback, true);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -830,7 +830,7 @@ var AddonRepository = {
|
|||
* @param aCallback
|
||||
* The callback to pass results to
|
||||
*/
|
||||
retrieveRecommendedAddons: function(aMaxResults, aCallback) {
|
||||
retrieveRecommendedAddons: function AddonRepo_retrieveRecommendedAddons(aMaxResults, aCallback) {
|
||||
let url = this._formatURLPref(PREF_GETADDONS_GETRECOMMENDED, {
|
||||
API_VERSION : API_VERSION,
|
||||
|
||||
|
@ -840,7 +840,7 @@ var AddonRepository = {
|
|||
|
||||
let self = this;
|
||||
function handleResults(aElements, aTotalResults) {
|
||||
self._getLocalAddonIds(function(aLocalAddonIds) {
|
||||
self._getLocalAddonIds(function retrieveRecommendedAddons_getLocalAddonIds(aLocalAddonIds) {
|
||||
// aTotalResults irrelevant
|
||||
self._parseAddons(aElements, -1, aLocalAddonIds);
|
||||
});
|
||||
|
@ -860,7 +860,7 @@ var AddonRepository = {
|
|||
* @param aCallback
|
||||
* The callback to pass results to
|
||||
*/
|
||||
searchAddons: function(aSearchTerms, aMaxResults, aCallback) {
|
||||
searchAddons: function AddonRepo_searchAddons(aSearchTerms, aMaxResults, aCallback) {
|
||||
let compatMode = "normal";
|
||||
if (!AddonManager.checkCompatibility)
|
||||
compatMode = "ignore";
|
||||
|
@ -879,7 +879,7 @@ var AddonRepository = {
|
|||
|
||||
let self = this;
|
||||
function handleResults(aElements, aTotalResults) {
|
||||
self._getLocalAddonIds(function(aLocalAddonIds) {
|
||||
self._getLocalAddonIds(function searchAddons_getLocalAddonIds(aLocalAddonIds) {
|
||||
self._parseAddons(aElements, aTotalResults, aLocalAddonIds);
|
||||
});
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ var AddonRepository = {
|
|||
},
|
||||
|
||||
// Posts results to the callback
|
||||
_reportSuccess: function(aResults, aTotalResults) {
|
||||
_reportSuccess: function AddonRepo_reportSuccess(aResults, aTotalResults) {
|
||||
this._searching = false;
|
||||
this._request = null;
|
||||
// The callback may want to trigger a new search so clear references early
|
||||
|
@ -899,7 +899,7 @@ var AddonRepository = {
|
|||
},
|
||||
|
||||
// Notifies the callback of a failure
|
||||
_reportFailure: function() {
|
||||
_reportFailure: function AddonRepo_reportFailure() {
|
||||
this._searching = false;
|
||||
this._request = null;
|
||||
// The callback may want to trigger a new search so clear references early
|
||||
|
@ -909,28 +909,28 @@ var AddonRepository = {
|
|||
},
|
||||
|
||||
// Get descendant by unique tag name. Returns null if not unique tag name.
|
||||
_getUniqueDescendant: function(aElement, aTagName) {
|
||||
_getUniqueDescendant: function AddonRepo_getUniqueDescendant(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(aElement, aTagName) {
|
||||
_getUniqueDirectDescendant: function AddonRepo_getUniqueDirectDescendant(aElement, aTagName) {
|
||||
let elementsList = Array.filter(aElement.children,
|
||||
function(aChild) aChild.tagName == aTagName);
|
||||
function arrayFiltering(aChild) aChild.tagName == aTagName);
|
||||
return (elementsList.length == 1) ? elementsList[0] : null;
|
||||
},
|
||||
|
||||
// Parse out trimmed text content. Returns null if text content empty.
|
||||
_getTextContent: function(aElement) {
|
||||
_getTextContent: function AddonRepo_getTextContent(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(aElement, aTagName) {
|
||||
_getDescendantTextContent: function AddonRepo_getDescendantTextContent(aElement, aTagName) {
|
||||
let descendant = this._getUniqueDescendant(aElement, aTagName);
|
||||
return (descendant != null) ? this._getTextContent(descendant) : null;
|
||||
},
|
||||
|
@ -938,7 +938,7 @@ var AddonRepository = {
|
|||
// Parse out trimmed text content of a direct descendant with the specified
|
||||
// tag name.
|
||||
// Returns null if the parsing unsuccessful.
|
||||
_getDirectDescendantTextContent: function(aElement, aTagName) {
|
||||
_getDirectDescendantTextContent: function AddonRepo_getDirectDescendantTextContent(aElement, aTagName) {
|
||||
let descendant = this._getUniqueDirectDescendant(aElement, aTagName);
|
||||
return (descendant != null) ? this._getTextContent(descendant) : null;
|
||||
},
|
||||
|
@ -956,7 +956,7 @@ var AddonRepository = {
|
|||
* @return Result object containing the parsed AddonSearchResult, xpiURL and
|
||||
* xpiHash if the parsing was successful. Otherwise returns null.
|
||||
*/
|
||||
_parseAddon: function(aElement, aSkip, aCompatData) {
|
||||
_parseAddon: function AddonRepo_parseAddon(aElement, aSkip, aCompatData) {
|
||||
let skipIDs = (aSkip && aSkip.ids) ? aSkip.ids : [];
|
||||
let skipSourceURIs = (aSkip && aSkip.sourceURIs) ? aSkip.sourceURIs : [];
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ var AddonRepository = {
|
|||
break;
|
||||
case "all_compatible_os":
|
||||
let nodes = node.getElementsByTagName("os");
|
||||
addon.isPlatformCompatible = Array.some(nodes, function(aNode) {
|
||||
addon.isPlatformCompatible = Array.some(nodes, function parseAddon_platformCompatFilter(aNode) {
|
||||
let text = aNode.textContent.toLowerCase().trim();
|
||||
return text == "all" || text == Services.appinfo.OS.toLowerCase();
|
||||
});
|
||||
|
@ -1160,7 +1160,7 @@ var AddonRepository = {
|
|||
return result;
|
||||
},
|
||||
|
||||
_parseAddons: function(aElements, aTotalResults, aSkip) {
|
||||
_parseAddons: function AddonRepo_parseAddons(aElements, aTotalResults, aSkip) {
|
||||
let self = this;
|
||||
let results = [];
|
||||
|
||||
|
@ -1176,7 +1176,7 @@ var AddonRepository = {
|
|||
continue;
|
||||
|
||||
let applications = tags.getElementsByTagName("appID");
|
||||
let compatible = Array.some(applications, function(aAppNode) {
|
||||
let compatible = Array.some(applications, function parseAddons_applicationsCompatFilter(aAppNode) {
|
||||
if (!isSameApplication(aAppNode))
|
||||
return false;
|
||||
|
||||
|
@ -1210,7 +1210,7 @@ var AddonRepository = {
|
|||
|
||||
// Ignore add-on missing a required attribute
|
||||
let requiredAttributes = ["id", "name", "version", "type", "creator"];
|
||||
if (requiredAttributes.some(function(aAttribute) !result.addon[aAttribute]))
|
||||
if (requiredAttributes.some(function parseAddons_attributeFilter(aAttribute) !result.addon[aAttribute]))
|
||||
continue;
|
||||
|
||||
// Add only if the add-on is compatible with the platform
|
||||
|
@ -1240,7 +1240,7 @@ var AddonRepository = {
|
|||
let self = this;
|
||||
results.forEach(function(aResult) {
|
||||
let addon = aResult.addon;
|
||||
let callback = function(aInstall) {
|
||||
let callback = function addonInstallCallback(aInstall) {
|
||||
addon.install = aInstall;
|
||||
pendingResults--;
|
||||
if (pendingResults == 0)
|
||||
|
@ -1259,7 +1259,7 @@ var AddonRepository = {
|
|||
},
|
||||
|
||||
// Parses addon_compatibility nodes, that describe compatibility overrides.
|
||||
_parseAddonCompatElement: function(aResultObj, aElement) {
|
||||
_parseAddonCompatElement: function AddonRepo_parseAddonCompatElement(aResultObj, aElement) {
|
||||
let guid = this._getDescendantTextContent(aElement, "guid");
|
||||
if (!guid) {
|
||||
LOG("Compatibility override is missing guid.");
|
||||
|
@ -1332,7 +1332,7 @@ var AddonRepository = {
|
|||
|
||||
let rangeNodes = aElement.querySelectorAll("version_ranges > version_range");
|
||||
compat.compatRanges = Array.map(rangeNodes, parseRangeNode.bind(this))
|
||||
.filter(function(aItem) !!aItem);
|
||||
.filter(function compatRangesFilter(aItem) !!aItem);
|
||||
if (compat.compatRanges.length == 0)
|
||||
return;
|
||||
|
||||
|
@ -1340,14 +1340,14 @@ var AddonRepository = {
|
|||
},
|
||||
|
||||
// Parses addon_compatibility elements.
|
||||
_parseAddonCompatData: function(aElements) {
|
||||
_parseAddonCompatData: function AddonRepo_parseAddonCompatData(aElements) {
|
||||
let compatData = {};
|
||||
Array.forEach(aElements, this._parseAddonCompatElement.bind(this, compatData));
|
||||
return compatData;
|
||||
},
|
||||
|
||||
// Begins a new search if one isn't currently executing
|
||||
_beginSearch: function(aURI, aMaxResults, aCallback, aHandleResults) {
|
||||
_beginSearch: function AddonRepo_beginSearch(aURI, aMaxResults, aCallback, aHandleResults) {
|
||||
if (this._searching || aURI == null || aMaxResults <= 0) {
|
||||
aCallback.searchFailed();
|
||||
return;
|
||||
|
@ -1366,10 +1366,10 @@ var AddonRepository = {
|
|||
this._request.overrideMimeType("text/xml");
|
||||
|
||||
let self = this;
|
||||
this._request.addEventListener("error", function(aEvent) {
|
||||
this._request.addEventListener("error", function beginSearch_errorListener(aEvent) {
|
||||
self._reportFailure();
|
||||
}, false);
|
||||
this._request.addEventListener("load", function(aEvent) {
|
||||
this._request.addEventListener("load", function beginSearch_loadListener(aEvent) {
|
||||
let request = aEvent.target;
|
||||
let responseXML = request.responseXML;
|
||||
|
||||
|
@ -1397,17 +1397,17 @@ var AddonRepository = {
|
|||
|
||||
// Gets the id's of local add-ons, and the sourceURI's of local installs,
|
||||
// passing the results to aCallback
|
||||
_getLocalAddonIds: function(aCallback) {
|
||||
_getLocalAddonIds: function AddonRepo_getLocalAddonIds(aCallback) {
|
||||
let self = this;
|
||||
let localAddonIds = {ids: null, sourceURIs: null};
|
||||
|
||||
AddonManager.getAllAddons(function(aAddons) {
|
||||
AddonManager.getAllAddons(function getLocalAddonIds_getAllAddons(aAddons) {
|
||||
localAddonIds.ids = [a.id for each (a in aAddons)];
|
||||
if (localAddonIds.sourceURIs)
|
||||
aCallback(localAddonIds);
|
||||
});
|
||||
|
||||
AddonManager.getAllInstalls(function(aInstalls) {
|
||||
AddonManager.getAllInstalls(function getLocalAddonIds_getAllInstalls(aInstalls) {
|
||||
localAddonIds.sourceURIs = [];
|
||||
aInstalls.forEach(function(aInstall) {
|
||||
if (aInstall.state != AddonManager.STATE_AVAILABLE)
|
||||
|
@ -1420,7 +1420,7 @@ var AddonRepository = {
|
|||
},
|
||||
|
||||
// Create url from preference, returning null if preference does not exist
|
||||
_formatURLPref: function(aPreference, aSubstitutions) {
|
||||
_formatURLPref: function AddonRepo_formatURLPref(aPreference, aSubstitutions) {
|
||||
let url = null;
|
||||
try {
|
||||
url = Services.prefs.getCharPref(aPreference);
|
||||
|
@ -1429,7 +1429,7 @@ var AddonRepository = {
|
|||
return null;
|
||||
}
|
||||
|
||||
url = url.replace(/%([A-Z_]+)%/g, function(aMatch, aKey) {
|
||||
url = url.replace(/%([A-Z_]+)%/g, function urlSubstitution(aMatch, aKey) {
|
||||
return (aKey in aSubstitutions) ? aSubstitutions[aKey] : aMatch;
|
||||
});
|
||||
|
||||
|
@ -1438,7 +1438,7 @@ var AddonRepository = {
|
|||
|
||||
// Find a AddonCompatibilityOverride that matches a given aAddonVersion and
|
||||
// application/platform version.
|
||||
findMatchingCompatOverride: function AR_findMatchingCompatOverride(aAddonVersion,
|
||||
findMatchingCompatOverride: function AddonRepo_findMatchingCompatOverride(aAddonVersion,
|
||||
aCompatOverrides,
|
||||
aAppVersion,
|
||||
aPlatformVersion) {
|
||||
|
@ -1561,7 +1561,7 @@ var AddonDatabase = {
|
|||
let dbfile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_DATABASE], true);
|
||||
let dbMissing = !dbfile.exists();
|
||||
|
||||
var tryAgain = (function() {
|
||||
var tryAgain = (function openConnection_tryAgain() {
|
||||
LOG("Deleting database, and attempting openConnection again");
|
||||
this.initialized = false;
|
||||
if (this.connection.connectionReady)
|
||||
|
@ -1675,7 +1675,7 @@ var AddonDatabase = {
|
|||
|
||||
// Re-create the connection smart getter to allow the database to be
|
||||
// re-loaded during testing.
|
||||
this.__defineGetter__("connection", function() {
|
||||
this.__defineGetter__("connection", function shutdown_connectionGetter() {
|
||||
return this.openConnection();
|
||||
});
|
||||
|
||||
|
@ -1690,7 +1690,7 @@ var AddonDatabase = {
|
|||
* An optional callback to call once complete
|
||||
*/
|
||||
delete: function AD_delete(aCallback) {
|
||||
this.shutdown(function() {
|
||||
this.shutdown(function delete_shutdown() {
|
||||
let dbfile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_DATABASE], true);
|
||||
if (dbfile.exists())
|
||||
dbfile.remove(false);
|
||||
|
@ -1736,7 +1736,7 @@ var AddonDatabase = {
|
|||
// Retrieve all data from the addon table
|
||||
function getAllAddons() {
|
||||
self.getAsyncStatement("getAllAddons").executeAsync({
|
||||
handleResult: function(aResults) {
|
||||
handleResult: function getAllAddons_handleResult(aResults) {
|
||||
let row = null;
|
||||
while (row = aResults.getNextRow()) {
|
||||
let internal_id = row.getResultByName("internal_id");
|
||||
|
@ -1746,7 +1746,7 @@ var AddonDatabase = {
|
|||
|
||||
handleError: self.asyncErrorLogger,
|
||||
|
||||
handleCompletion: function(aReason) {
|
||||
handleCompletion: function getAllAddons_handleCompletion(aReason) {
|
||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||
ERROR("Error retrieving add-ons from database. Returning empty results");
|
||||
aCallback({});
|
||||
|
@ -1761,7 +1761,7 @@ var AddonDatabase = {
|
|||
// Retrieve all data from the developer table
|
||||
function getAllDevelopers() {
|
||||
self.getAsyncStatement("getAllDevelopers").executeAsync({
|
||||
handleResult: function(aResults) {
|
||||
handleResult: function getAllDevelopers_handleResult(aResults) {
|
||||
let row = null;
|
||||
while (row = aResults.getNextRow()) {
|
||||
let addon_internal_id = row.getResultByName("addon_internal_id");
|
||||
|
@ -1780,7 +1780,7 @@ var AddonDatabase = {
|
|||
|
||||
handleError: self.asyncErrorLogger,
|
||||
|
||||
handleCompletion: function(aReason) {
|
||||
handleCompletion: function getAllDevelopers_handleCompletion(aReason) {
|
||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||
ERROR("Error retrieving developers from database. Returning empty results");
|
||||
aCallback({});
|
||||
|
@ -1795,7 +1795,7 @@ var AddonDatabase = {
|
|||
// Retrieve all data from the screenshot table
|
||||
function getAllScreenshots() {
|
||||
self.getAsyncStatement("getAllScreenshots").executeAsync({
|
||||
handleResult: function(aResults) {
|
||||
handleResult: function getAllScreenshots_handleResult(aResults) {
|
||||
let row = null;
|
||||
while (row = aResults.getNextRow()) {
|
||||
let addon_internal_id = row.getResultByName("addon_internal_id");
|
||||
|
@ -1813,7 +1813,7 @@ var AddonDatabase = {
|
|||
|
||||
handleError: self.asyncErrorLogger,
|
||||
|
||||
handleCompletion: function(aReason) {
|
||||
handleCompletion: function getAllScreenshots_handleCompletion(aReason) {
|
||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||
ERROR("Error retrieving screenshots from database. Returning empty results");
|
||||
aCallback({});
|
||||
|
@ -1827,7 +1827,7 @@ var AddonDatabase = {
|
|||
|
||||
function getAllCompatOverrides() {
|
||||
self.getAsyncStatement("getAllCompatOverrides").executeAsync({
|
||||
handleResult: function(aResults) {
|
||||
handleResult: function getAllCompatOverrides_handleResult(aResults) {
|
||||
let row = null;
|
||||
while (row = aResults.getNextRow()) {
|
||||
let addon_internal_id = row.getResultByName("addon_internal_id");
|
||||
|
@ -1845,7 +1845,7 @@ var AddonDatabase = {
|
|||
|
||||
handleError: self.asyncErrorLogger,
|
||||
|
||||
handleCompletion: function(aReason) {
|
||||
handleCompletion: function getAllCompatOverrides_handleCompletion(aReason) {
|
||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||
ERROR("Error retrieving compatibility overrides from database. Returning empty results");
|
||||
aCallback({});
|
||||
|
@ -1913,10 +1913,10 @@ var AddonDatabase = {
|
|||
let stmts = [this.getAsyncStatement("emptyAddon")];
|
||||
|
||||
this.connection.executeAsync(stmts, stmts.length, {
|
||||
handleResult: function() {},
|
||||
handleResult: function emptyAddon_handleResult() {},
|
||||
handleError: self.asyncErrorLogger,
|
||||
|
||||
handleCompletion: function(aReason) {
|
||||
handleCompletion: function emptyAddon_handleCompletion(aReason) {
|
||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED)
|
||||
ERROR("Error emptying database. Attempting to continue repopulating database");
|
||||
|
||||
|
@ -2019,9 +2019,9 @@ var AddonDatabase = {
|
|||
}
|
||||
|
||||
self.connection.executeAsync(stmts, stmts.length, {
|
||||
handleResult: function() {},
|
||||
handleResult: function insertAdditionalData_handleResult() {},
|
||||
handleError: self.asyncErrorLogger,
|
||||
handleCompletion: function(aReason) {
|
||||
handleCompletion: function insertAdditionalData_handleCompletion(aReason) {
|
||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||
ERROR("Error inserting additional addon metadata into database. Attempting to continue");
|
||||
self.connection.rollbackTransaction();
|
||||
|
@ -2037,10 +2037,10 @@ var AddonDatabase = {
|
|||
|
||||
// Insert add-on into database
|
||||
this._makeAddonStatement(aAddon).executeAsync({
|
||||
handleResult: function() {},
|
||||
handleResult: function makeAddonStatement_handleResult() {},
|
||||
handleError: self.asyncErrorLogger,
|
||||
|
||||
handleCompletion: function(aReason) {
|
||||
handleCompletion: function makeAddonStatement_handleCompletion(aReason) {
|
||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||
ERROR("Error inserting add-ons into database. Attempting to continue.");
|
||||
self.connection.rollbackTransaction();
|
||||
|
|
Загрузка…
Ссылка в новой задаче