mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge mozilla-central to mozilla-inbound
This commit is contained in:
commit
7c9bdda29e
@ -554,6 +554,8 @@ html[dir=rtl] .iq-resizable-se {
|
|||||||
|
|
||||||
#searchbox{
|
#searchbox{
|
||||||
width: 270px;
|
width: 270px;
|
||||||
|
max-width: -moz-available;
|
||||||
|
-moz-margin-start: 20px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,1), 0px 0px 9px rgba(0,0,0,.8);
|
box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,1), 0px 0px 9px rgba(0,0,0,.8);
|
||||||
color: white;
|
color: white;
|
||||||
|
@ -550,6 +550,8 @@ html[dir=rtl] .iq-resizable-se {
|
|||||||
|
|
||||||
#searchbox {
|
#searchbox {
|
||||||
width: 270px;
|
width: 270px;
|
||||||
|
max-width: -moz-available;
|
||||||
|
-moz-margin-start: 20px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,1), 0px 0px 13px rgba(0,0,0,.8);
|
box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,1), 0px 0px 13px rgba(0,0,0,.8);
|
||||||
color: white;
|
color: white;
|
||||||
|
@ -569,6 +569,8 @@ html[dir=rtl] .iq-resizable-se {
|
|||||||
|
|
||||||
#searchbox{
|
#searchbox{
|
||||||
width: 270px;
|
width: 270px;
|
||||||
|
max-width: -moz-available;
|
||||||
|
-moz-margin-start: 20px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,1), 0px 0px 9px rgba(0,0,0,.8);
|
box-shadow: 0px 1px 0px rgba(255,255,255,.5), 0px -1px 0px rgba(0,0,0,1), 0px 0px 9px rgba(0,0,0,.8);
|
||||||
color: white;
|
color: white;
|
||||||
|
@ -42,7 +42,7 @@ const DB_SCHEMA = 4;
|
|||||||
const TOOLKIT_ID = "toolkit@mozilla.org";
|
const TOOLKIT_ID = "toolkit@mozilla.org";
|
||||||
|
|
||||||
["LOG", "WARN", "ERROR"].forEach(function(aName) {
|
["LOG", "WARN", "ERROR"].forEach(function(aName) {
|
||||||
this.__defineGetter__(aName, function() {
|
this.__defineGetter__(aName, function logFuncGetter() {
|
||||||
Components.utils.import("resource://gre/modules/AddonLogging.jsm");
|
Components.utils.import("resource://gre/modules/AddonLogging.jsm");
|
||||||
|
|
||||||
LogManager.getLogger("addons.repository", this);
|
LogManager.getLogger("addons.repository", this);
|
||||||
@ -118,7 +118,7 @@ function getAddonsToCache(aIds, aCallback) {
|
|||||||
|
|
||||||
types = types.split(",");
|
types = types.split(",");
|
||||||
|
|
||||||
AddonManager.getAddonsByIDs(aIds, function(aAddons) {
|
AddonManager.getAddonsByIDs(aIds, function getAddonsToCache_getAddonsByIDs(aAddons) {
|
||||||
let enabledIds = [];
|
let enabledIds = [];
|
||||||
for (var i = 0; i < aIds.length; i++) {
|
for (var i = 0; i < aIds.length; i++) {
|
||||||
var preference = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%", aIds[i]);
|
var preference = PREF_GETADDONS_CACHE_ID_ENABLED.replace("%ID%", aIds[i]);
|
||||||
@ -380,7 +380,7 @@ AddonSearchResult.prototype = {
|
|||||||
* A platform version to test against
|
* A platform version to test against
|
||||||
* @return Boolean representing if the add-on is compatible
|
* @return Boolean representing if the add-on is compatible
|
||||||
*/
|
*/
|
||||||
isCompatibleWith: function(aAppVerison, aPlatformVersion) {
|
isCompatibleWith: function ASR_isCompatibleWith(aAppVerison, aPlatformVersion) {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ AddonSearchResult.prototype = {
|
|||||||
* @param aPlatformVersion
|
* @param aPlatformVersion
|
||||||
* A platform version to check for updates for
|
* 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)
|
if ("onNoCompatibilityUpdateAvailable" in aListener)
|
||||||
aListener.onNoCompatibilityUpdateAvailable(this);
|
aListener.onNoCompatibilityUpdateAvailable(this);
|
||||||
if ("onNoUpdateAvailable" in aListener)
|
if ("onNoUpdateAvailable" in aListener)
|
||||||
@ -476,14 +476,14 @@ var AddonRepository = {
|
|||||||
/**
|
/**
|
||||||
* Initialize AddonRepository.
|
* Initialize AddonRepository.
|
||||||
*/
|
*/
|
||||||
initialize: function() {
|
initialize: function AddonRepo_initialize() {
|
||||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Observe xpcom-shutdown notification, so we can shutdown cleanly.
|
* 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") {
|
if (aTopic == "xpcom-shutdown") {
|
||||||
Services.obs.removeObserver(this, "xpcom-shutdown");
|
Services.obs.removeObserver(this, "xpcom-shutdown");
|
||||||
this.shutdown();
|
this.shutdown();
|
||||||
@ -493,12 +493,12 @@ var AddonRepository = {
|
|||||||
/**
|
/**
|
||||||
* Shut down AddonRepository
|
* Shut down AddonRepository
|
||||||
*/
|
*/
|
||||||
shutdown: function() {
|
shutdown: function AddonRepo_shutdown() {
|
||||||
this.cancelSearch();
|
this.cancelSearch();
|
||||||
|
|
||||||
this._addons = null;
|
this._addons = null;
|
||||||
this._pendingCallbacks = null;
|
this._pendingCallbacks = null;
|
||||||
AddonDatabase.shutdown(function() {
|
AddonDatabase.shutdown(function shutdown_databaseShutdown() {
|
||||||
Services.obs.notifyObservers(null, "addon-repository-shutdown", null);
|
Services.obs.notifyObservers(null, "addon-repository-shutdown", null);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -513,7 +513,7 @@ var AddonRepository = {
|
|||||||
* @param aCallback
|
* @param aCallback
|
||||||
* The callback to pass the result back to
|
* The callback to pass the result back to
|
||||||
*/
|
*/
|
||||||
getCachedAddonByID: function(aId, aCallback) {
|
getCachedAddonByID: function AddonRepo_getCachedAddonByID(aId, aCallback) {
|
||||||
if (!aId || !this.cacheEnabled) {
|
if (!aId || !this.cacheEnabled) {
|
||||||
aCallback(null);
|
aCallback(null);
|
||||||
return;
|
return;
|
||||||
@ -529,7 +529,7 @@ var AddonRepository = {
|
|||||||
// Data has not been retrieved from the database, so retrieve it
|
// Data has not been retrieved from the database, so retrieve it
|
||||||
this._pendingCallbacks = [];
|
this._pendingCallbacks = [];
|
||||||
this._pendingCallbacks.push(getAddon);
|
this._pendingCallbacks.push(getAddon);
|
||||||
AddonDatabase.retrieveStoredData(function(aAddons) {
|
AddonDatabase.retrieveStoredData(function getCachedAddonByID_retrieveData(aAddons) {
|
||||||
let pendingCallbacks = self._pendingCallbacks;
|
let pendingCallbacks = self._pendingCallbacks;
|
||||||
|
|
||||||
// Check if cache was shutdown or deleted before callback was called
|
// Check if cache was shutdown or deleted before callback was called
|
||||||
@ -566,11 +566,11 @@ var AddonRepository = {
|
|||||||
* @param aCallback
|
* @param aCallback
|
||||||
* The optional callback to call once complete
|
* The optional callback to call once complete
|
||||||
*/
|
*/
|
||||||
repopulateCache: function(aIds, aCallback) {
|
repopulateCache: function AddonRepo_repopulateCache(aIds, aCallback) {
|
||||||
this._repopulateCache(aIds, aCallback, false);
|
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
|
// Completely remove cache if caching is not enabled
|
||||||
if (!this.cacheEnabled) {
|
if (!this.cacheEnabled) {
|
||||||
this._addons = null;
|
this._addons = null;
|
||||||
@ -580,7 +580,7 @@ var AddonRepository = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
getAddonsToCache(aIds, function(aAddons) {
|
getAddonsToCache(aIds, function repopulateCache_getAddonsToCache(aAddons) {
|
||||||
// Completely remove cache if there are no add-ons to cache
|
// Completely remove cache if there are no add-ons to cache
|
||||||
if (aAddons.length == 0) {
|
if (aAddons.length == 0) {
|
||||||
self._addons = null;
|
self._addons = null;
|
||||||
@ -590,12 +590,12 @@ var AddonRepository = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self._beginGetAddons(aAddons, {
|
self._beginGetAddons(aAddons, {
|
||||||
searchSucceeded: function(aAddons) {
|
searchSucceeded: function repopulateCacheInternal_searchSucceeded(aAddons) {
|
||||||
self._addons = {};
|
self._addons = {};
|
||||||
aAddons.forEach(function(aAddon) { self._addons[aAddon.id] = aAddon; });
|
aAddons.forEach(function(aAddon) { self._addons[aAddon.id] = aAddon; });
|
||||||
AddonDatabase.repopulate(aAddons, aCallback);
|
AddonDatabase.repopulate(aAddons, aCallback);
|
||||||
},
|
},
|
||||||
searchFailed: function() {
|
searchFailed: function repopulateCacheInternal_searchFailed() {
|
||||||
WARN("Search failed when repopulating cache");
|
WARN("Search failed when repopulating cache");
|
||||||
if (aCallback)
|
if (aCallback)
|
||||||
aCallback();
|
aCallback();
|
||||||
@ -614,7 +614,7 @@ var AddonRepository = {
|
|||||||
* @param aCallback
|
* @param aCallback
|
||||||
* The optional callback to call once complete
|
* The optional callback to call once complete
|
||||||
*/
|
*/
|
||||||
cacheAddons: function(aIds, aCallback) {
|
cacheAddons: function AddonRepo_cacheAddons(aIds, aCallback) {
|
||||||
if (!this.cacheEnabled) {
|
if (!this.cacheEnabled) {
|
||||||
if (aCallback)
|
if (aCallback)
|
||||||
aCallback();
|
aCallback();
|
||||||
@ -622,7 +622,7 @@ var AddonRepository = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let self = this;
|
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 there are no add-ons to cache, act as if caching is disabled
|
||||||
if (aAddons.length == 0) {
|
if (aAddons.length == 0) {
|
||||||
if (aCallback)
|
if (aCallback)
|
||||||
@ -631,11 +631,11 @@ var AddonRepository = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.getAddonsByIDs(aAddons, {
|
self.getAddonsByIDs(aAddons, {
|
||||||
searchSucceeded: function(aAddons) {
|
searchSucceeded: function cacheAddons_searchSucceeded(aAddons) {
|
||||||
aAddons.forEach(function(aAddon) { self._addons[aAddon.id] = aAddon; });
|
aAddons.forEach(function(aAddon) { self._addons[aAddon.id] = aAddon; });
|
||||||
AddonDatabase.insertAddons(aAddons, aCallback);
|
AddonDatabase.insertAddons(aAddons, aCallback);
|
||||||
},
|
},
|
||||||
searchFailed: function() {
|
searchFailed: function cacheAddons_searchFailed() {
|
||||||
WARN("Search failed when adding add-ons to cache");
|
WARN("Search failed when adding add-ons to cache");
|
||||||
if (aCallback)
|
if (aCallback)
|
||||||
aCallback();
|
aCallback();
|
||||||
@ -665,7 +665,7 @@ var AddonRepository = {
|
|||||||
* The url that can be visited to see recommended add-ons in this repository.
|
* 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.
|
* If the corresponding preference is not defined, defaults to about:blank.
|
||||||
*/
|
*/
|
||||||
getRecommendedURL: function() {
|
getRecommendedURL: function AddonRepo_getRecommendedURL() {
|
||||||
let url = this._formatURLPref(PREF_GETADDONS_BROWSERECOMMENDED, {});
|
let url = this._formatURLPref(PREF_GETADDONS_BROWSERECOMMENDED, {});
|
||||||
return (url != null) ? url : "about:blank";
|
return (url != null) ? url : "about:blank";
|
||||||
},
|
},
|
||||||
@ -678,7 +678,7 @@ var AddonRepository = {
|
|||||||
* @param aSearchTerms
|
* @param aSearchTerms
|
||||||
* Search terms used to search the repository
|
* Search terms used to search the repository
|
||||||
*/
|
*/
|
||||||
getSearchURL: function(aSearchTerms) {
|
getSearchURL: function AddonRepo_getSearchURL(aSearchTerms) {
|
||||||
let url = this._formatURLPref(PREF_GETADDONS_BROWSESEARCHRESULTS, {
|
let url = this._formatURLPref(PREF_GETADDONS_BROWSESEARCHRESULTS, {
|
||||||
TERMS : encodeURIComponent(aSearchTerms)
|
TERMS : encodeURIComponent(aSearchTerms)
|
||||||
});
|
});
|
||||||
@ -689,7 +689,7 @@ var AddonRepository = {
|
|||||||
* Cancels the search in progress. If there is no search in progress this
|
* Cancels the search in progress. If there is no search in progress this
|
||||||
* does nothing.
|
* does nothing.
|
||||||
*/
|
*/
|
||||||
cancelSearch: function() {
|
cancelSearch: function AddonRepo_cancelSearch() {
|
||||||
this._searching = false;
|
this._searching = false;
|
||||||
if (this._request) {
|
if (this._request) {
|
||||||
this._request.abort();
|
this._request.abort();
|
||||||
@ -707,7 +707,7 @@ var AddonRepository = {
|
|||||||
* @param aCallback
|
* @param aCallback
|
||||||
* The callback to pass results to
|
* The callback to pass results to
|
||||||
*/
|
*/
|
||||||
getAddonsByIDs: function(aIDs, aCallback) {
|
getAddonsByIDs: function AddonRepo_getAddonsByIDs(aIDs, aCallback) {
|
||||||
return this._beginGetAddons(aIDs, aCallback, false);
|
return this._beginGetAddons(aIDs, aCallback, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -722,7 +722,7 @@ var AddonRepository = {
|
|||||||
* Boolean indicating whether to send performance data with the
|
* Boolean indicating whether to send performance data with the
|
||||||
* request.
|
* request.
|
||||||
*/
|
*/
|
||||||
_beginGetAddons: function(aIDs, aCallback, aSendPerformance) {
|
_beginGetAddons: function AddonRepo_beginGetAddons(aIDs, aCallback, aSendPerformance) {
|
||||||
let ids = aIDs.slice(0);
|
let ids = aIDs.slice(0);
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
@ -817,8 +817,8 @@ var AddonRepository = {
|
|||||||
* Function to call when data is received. Function must be an object
|
* Function to call when data is received. Function must be an object
|
||||||
* with the keys searchSucceeded and searchFailed.
|
* with the keys searchSucceeded and searchFailed.
|
||||||
*/
|
*/
|
||||||
backgroundUpdateCheck: function(aIDs, aCallback) {
|
backgroundUpdateCheck: function AddonRepo_backgroundUpdateCheck(aIDs, aCallback) {
|
||||||
this._repopulateCache(aIDs, aCallback, true);
|
this._repopulateCacheInternal(aIDs, aCallback, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -830,7 +830,7 @@ var AddonRepository = {
|
|||||||
* @param aCallback
|
* @param aCallback
|
||||||
* The callback to pass results to
|
* The callback to pass results to
|
||||||
*/
|
*/
|
||||||
retrieveRecommendedAddons: function(aMaxResults, aCallback) {
|
retrieveRecommendedAddons: function AddonRepo_retrieveRecommendedAddons(aMaxResults, aCallback) {
|
||||||
let url = this._formatURLPref(PREF_GETADDONS_GETRECOMMENDED, {
|
let url = this._formatURLPref(PREF_GETADDONS_GETRECOMMENDED, {
|
||||||
API_VERSION : API_VERSION,
|
API_VERSION : API_VERSION,
|
||||||
|
|
||||||
@ -840,7 +840,7 @@ var AddonRepository = {
|
|||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
function handleResults(aElements, aTotalResults) {
|
function handleResults(aElements, aTotalResults) {
|
||||||
self._getLocalAddonIds(function(aLocalAddonIds) {
|
self._getLocalAddonIds(function retrieveRecommendedAddons_getLocalAddonIds(aLocalAddonIds) {
|
||||||
// aTotalResults irrelevant
|
// aTotalResults irrelevant
|
||||||
self._parseAddons(aElements, -1, aLocalAddonIds);
|
self._parseAddons(aElements, -1, aLocalAddonIds);
|
||||||
});
|
});
|
||||||
@ -860,7 +860,7 @@ var AddonRepository = {
|
|||||||
* @param aCallback
|
* @param aCallback
|
||||||
* The callback to pass results to
|
* The callback to pass results to
|
||||||
*/
|
*/
|
||||||
searchAddons: function(aSearchTerms, aMaxResults, aCallback) {
|
searchAddons: function AddonRepo_searchAddons(aSearchTerms, aMaxResults, aCallback) {
|
||||||
let compatMode = "normal";
|
let compatMode = "normal";
|
||||||
if (!AddonManager.checkCompatibility)
|
if (!AddonManager.checkCompatibility)
|
||||||
compatMode = "ignore";
|
compatMode = "ignore";
|
||||||
@ -879,7 +879,7 @@ var AddonRepository = {
|
|||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
function handleResults(aElements, aTotalResults) {
|
function handleResults(aElements, aTotalResults) {
|
||||||
self._getLocalAddonIds(function(aLocalAddonIds) {
|
self._getLocalAddonIds(function searchAddons_getLocalAddonIds(aLocalAddonIds) {
|
||||||
self._parseAddons(aElements, aTotalResults, aLocalAddonIds);
|
self._parseAddons(aElements, aTotalResults, aLocalAddonIds);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -888,7 +888,7 @@ var AddonRepository = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Posts results to the callback
|
// Posts results to the callback
|
||||||
_reportSuccess: function(aResults, aTotalResults) {
|
_reportSuccess: function AddonRepo_reportSuccess(aResults, aTotalResults) {
|
||||||
this._searching = false;
|
this._searching = false;
|
||||||
this._request = null;
|
this._request = null;
|
||||||
// The callback may want to trigger a new search so clear references early
|
// 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
|
// Notifies the callback of a failure
|
||||||
_reportFailure: function() {
|
_reportFailure: function AddonRepo_reportFailure() {
|
||||||
this._searching = false;
|
this._searching = false;
|
||||||
this._request = null;
|
this._request = null;
|
||||||
// The callback may want to trigger a new search so clear references early
|
// 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.
|
// 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);
|
let elementsList = aElement.getElementsByTagName(aTagName);
|
||||||
return (elementsList.length == 1) ? elementsList[0] : null;
|
return (elementsList.length == 1) ? elementsList[0] : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Get direct descendant by unique tag name.
|
// Get direct descendant by unique tag name.
|
||||||
// Returns null if not 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,
|
let elementsList = Array.filter(aElement.children,
|
||||||
function(aChild) aChild.tagName == aTagName);
|
function arrayFiltering(aChild) aChild.tagName == aTagName);
|
||||||
return (elementsList.length == 1) ? elementsList[0] : null;
|
return (elementsList.length == 1) ? elementsList[0] : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Parse out trimmed text content. Returns null if text content empty.
|
// Parse out trimmed text content. Returns null if text content empty.
|
||||||
_getTextContent: function(aElement) {
|
_getTextContent: function AddonRepo_getTextContent(aElement) {
|
||||||
let textContent = aElement.textContent.trim();
|
let textContent = aElement.textContent.trim();
|
||||||
return (textContent.length > 0) ? textContent : null;
|
return (textContent.length > 0) ? textContent : null;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Parse out trimmed text content of a descendant with the specified tag name
|
// Parse out trimmed text content of a descendant with the specified tag name
|
||||||
// Returns null if the parsing unsuccessful.
|
// Returns null if the parsing unsuccessful.
|
||||||
_getDescendantTextContent: function(aElement, aTagName) {
|
_getDescendantTextContent: function AddonRepo_getDescendantTextContent(aElement, aTagName) {
|
||||||
let descendant = this._getUniqueDescendant(aElement, aTagName);
|
let descendant = this._getUniqueDescendant(aElement, aTagName);
|
||||||
return (descendant != null) ? this._getTextContent(descendant) : null;
|
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
|
// Parse out trimmed text content of a direct descendant with the specified
|
||||||
// tag name.
|
// tag name.
|
||||||
// Returns null if the parsing unsuccessful.
|
// Returns null if the parsing unsuccessful.
|
||||||
_getDirectDescendantTextContent: function(aElement, aTagName) {
|
_getDirectDescendantTextContent: function AddonRepo_getDirectDescendantTextContent(aElement, aTagName) {
|
||||||
let descendant = this._getUniqueDirectDescendant(aElement, aTagName);
|
let descendant = this._getUniqueDirectDescendant(aElement, aTagName);
|
||||||
return (descendant != null) ? this._getTextContent(descendant) : null;
|
return (descendant != null) ? this._getTextContent(descendant) : null;
|
||||||
},
|
},
|
||||||
@ -956,7 +956,7 @@ var AddonRepository = {
|
|||||||
* @return Result object containing the parsed AddonSearchResult, xpiURL and
|
* @return Result object containing the parsed AddonSearchResult, xpiURL and
|
||||||
* xpiHash if the parsing was successful. Otherwise returns null.
|
* 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 skipIDs = (aSkip && aSkip.ids) ? aSkip.ids : [];
|
||||||
let skipSourceURIs = (aSkip && aSkip.sourceURIs) ? aSkip.sourceURIs : [];
|
let skipSourceURIs = (aSkip && aSkip.sourceURIs) ? aSkip.sourceURIs : [];
|
||||||
|
|
||||||
@ -1114,7 +1114,7 @@ var AddonRepository = {
|
|||||||
break;
|
break;
|
||||||
case "all_compatible_os":
|
case "all_compatible_os":
|
||||||
let nodes = node.getElementsByTagName("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();
|
let text = aNode.textContent.toLowerCase().trim();
|
||||||
return text == "all" || text == Services.appinfo.OS.toLowerCase();
|
return text == "all" || text == Services.appinfo.OS.toLowerCase();
|
||||||
});
|
});
|
||||||
@ -1160,7 +1160,7 @@ var AddonRepository = {
|
|||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
_parseAddons: function(aElements, aTotalResults, aSkip) {
|
_parseAddons: function AddonRepo_parseAddons(aElements, aTotalResults, aSkip) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let results = [];
|
let results = [];
|
||||||
|
|
||||||
@ -1176,7 +1176,7 @@ var AddonRepository = {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
let applications = tags.getElementsByTagName("appID");
|
let applications = tags.getElementsByTagName("appID");
|
||||||
let compatible = Array.some(applications, function(aAppNode) {
|
let compatible = Array.some(applications, function parseAddons_applicationsCompatFilter(aAppNode) {
|
||||||
if (!isSameApplication(aAppNode))
|
if (!isSameApplication(aAppNode))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1210,7 +1210,7 @@ var AddonRepository = {
|
|||||||
|
|
||||||
// Ignore add-on missing a required attribute
|
// Ignore add-on missing a required attribute
|
||||||
let requiredAttributes = ["id", "name", "version", "type", "creator"];
|
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;
|
continue;
|
||||||
|
|
||||||
// Add only if the add-on is compatible with the platform
|
// Add only if the add-on is compatible with the platform
|
||||||
@ -1240,7 +1240,7 @@ var AddonRepository = {
|
|||||||
let self = this;
|
let self = this;
|
||||||
results.forEach(function(aResult) {
|
results.forEach(function(aResult) {
|
||||||
let addon = aResult.addon;
|
let addon = aResult.addon;
|
||||||
let callback = function(aInstall) {
|
let callback = function addonInstallCallback(aInstall) {
|
||||||
addon.install = aInstall;
|
addon.install = aInstall;
|
||||||
pendingResults--;
|
pendingResults--;
|
||||||
if (pendingResults == 0)
|
if (pendingResults == 0)
|
||||||
@ -1259,7 +1259,7 @@ var AddonRepository = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Parses addon_compatibility nodes, that describe compatibility overrides.
|
// Parses addon_compatibility nodes, that describe compatibility overrides.
|
||||||
_parseAddonCompatElement: function(aResultObj, aElement) {
|
_parseAddonCompatElement: function AddonRepo_parseAddonCompatElement(aResultObj, aElement) {
|
||||||
let guid = this._getDescendantTextContent(aElement, "guid");
|
let guid = this._getDescendantTextContent(aElement, "guid");
|
||||||
if (!guid) {
|
if (!guid) {
|
||||||
LOG("Compatibility override is missing guid.");
|
LOG("Compatibility override is missing guid.");
|
||||||
@ -1332,7 +1332,7 @@ var AddonRepository = {
|
|||||||
|
|
||||||
let rangeNodes = aElement.querySelectorAll("version_ranges > version_range");
|
let rangeNodes = aElement.querySelectorAll("version_ranges > version_range");
|
||||||
compat.compatRanges = Array.map(rangeNodes, parseRangeNode.bind(this))
|
compat.compatRanges = Array.map(rangeNodes, parseRangeNode.bind(this))
|
||||||
.filter(function(aItem) !!aItem);
|
.filter(function compatRangesFilter(aItem) !!aItem);
|
||||||
if (compat.compatRanges.length == 0)
|
if (compat.compatRanges.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1340,14 +1340,14 @@ var AddonRepository = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Parses addon_compatibility elements.
|
// Parses addon_compatibility elements.
|
||||||
_parseAddonCompatData: function(aElements) {
|
_parseAddonCompatData: function AddonRepo_parseAddonCompatData(aElements) {
|
||||||
let compatData = {};
|
let compatData = {};
|
||||||
Array.forEach(aElements, this._parseAddonCompatElement.bind(this, compatData));
|
Array.forEach(aElements, this._parseAddonCompatElement.bind(this, compatData));
|
||||||
return compatData;
|
return compatData;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Begins a new search if one isn't currently executing
|
// 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) {
|
if (this._searching || aURI == null || aMaxResults <= 0) {
|
||||||
aCallback.searchFailed();
|
aCallback.searchFailed();
|
||||||
return;
|
return;
|
||||||
@ -1366,10 +1366,10 @@ var AddonRepository = {
|
|||||||
this._request.overrideMimeType("text/xml");
|
this._request.overrideMimeType("text/xml");
|
||||||
|
|
||||||
let self = this;
|
let self = this;
|
||||||
this._request.addEventListener("error", function(aEvent) {
|
this._request.addEventListener("error", function beginSearch_errorListener(aEvent) {
|
||||||
self._reportFailure();
|
self._reportFailure();
|
||||||
}, false);
|
}, false);
|
||||||
this._request.addEventListener("load", function(aEvent) {
|
this._request.addEventListener("load", function beginSearch_loadListener(aEvent) {
|
||||||
let request = aEvent.target;
|
let request = aEvent.target;
|
||||||
let responseXML = request.responseXML;
|
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,
|
// Gets the id's of local add-ons, and the sourceURI's of local installs,
|
||||||
// passing the results to aCallback
|
// passing the results to aCallback
|
||||||
_getLocalAddonIds: function(aCallback) {
|
_getLocalAddonIds: function AddonRepo_getLocalAddonIds(aCallback) {
|
||||||
let self = this;
|
let self = this;
|
||||||
let localAddonIds = {ids: null, sourceURIs: null};
|
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)];
|
localAddonIds.ids = [a.id for each (a in aAddons)];
|
||||||
if (localAddonIds.sourceURIs)
|
if (localAddonIds.sourceURIs)
|
||||||
aCallback(localAddonIds);
|
aCallback(localAddonIds);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddonManager.getAllInstalls(function(aInstalls) {
|
AddonManager.getAllInstalls(function getLocalAddonIds_getAllInstalls(aInstalls) {
|
||||||
localAddonIds.sourceURIs = [];
|
localAddonIds.sourceURIs = [];
|
||||||
aInstalls.forEach(function(aInstall) {
|
aInstalls.forEach(function(aInstall) {
|
||||||
if (aInstall.state != AddonManager.STATE_AVAILABLE)
|
if (aInstall.state != AddonManager.STATE_AVAILABLE)
|
||||||
@ -1420,7 +1420,7 @@ var AddonRepository = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Create url from preference, returning null if preference does not exist
|
// Create url from preference, returning null if preference does not exist
|
||||||
_formatURLPref: function(aPreference, aSubstitutions) {
|
_formatURLPref: function AddonRepo_formatURLPref(aPreference, aSubstitutions) {
|
||||||
let url = null;
|
let url = null;
|
||||||
try {
|
try {
|
||||||
url = Services.prefs.getCharPref(aPreference);
|
url = Services.prefs.getCharPref(aPreference);
|
||||||
@ -1429,7 +1429,7 @@ var AddonRepository = {
|
|||||||
return null;
|
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;
|
return (aKey in aSubstitutions) ? aSubstitutions[aKey] : aMatch;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1438,7 +1438,7 @@ var AddonRepository = {
|
|||||||
|
|
||||||
// Find a AddonCompatibilityOverride that matches a given aAddonVersion and
|
// Find a AddonCompatibilityOverride that matches a given aAddonVersion and
|
||||||
// application/platform version.
|
// application/platform version.
|
||||||
findMatchingCompatOverride: function AR_findMatchingCompatOverride(aAddonVersion,
|
findMatchingCompatOverride: function AddonRepo_findMatchingCompatOverride(aAddonVersion,
|
||||||
aCompatOverrides,
|
aCompatOverrides,
|
||||||
aAppVersion,
|
aAppVersion,
|
||||||
aPlatformVersion) {
|
aPlatformVersion) {
|
||||||
@ -1570,7 +1570,7 @@ var AddonDatabase = {
|
|||||||
let dbfile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_DATABASE], true);
|
let dbfile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_DATABASE], true);
|
||||||
let dbMissing = !dbfile.exists();
|
let dbMissing = !dbfile.exists();
|
||||||
|
|
||||||
var tryAgain = (function() {
|
var tryAgain = (function openConnection_tryAgain() {
|
||||||
LOG("Deleting database, and attempting openConnection again");
|
LOG("Deleting database, and attempting openConnection again");
|
||||||
this.initialized = false;
|
this.initialized = false;
|
||||||
if (this.connection.connectionReady)
|
if (this.connection.connectionReady)
|
||||||
@ -1684,7 +1684,7 @@ var AddonDatabase = {
|
|||||||
|
|
||||||
// Re-create the connection smart getter to allow the database to be
|
// Re-create the connection smart getter to allow the database to be
|
||||||
// re-loaded during testing.
|
// re-loaded during testing.
|
||||||
this.__defineGetter__("connection", function() {
|
this.__defineGetter__("connection", function shutdown_connectionGetter() {
|
||||||
return this.openConnection();
|
return this.openConnection();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1699,7 +1699,7 @@ var AddonDatabase = {
|
|||||||
* An optional callback to call once complete
|
* An optional callback to call once complete
|
||||||
*/
|
*/
|
||||||
delete: function AD_delete(aCallback) {
|
delete: function AD_delete(aCallback) {
|
||||||
this.shutdown(function() {
|
this.shutdown(function delete_shutdown() {
|
||||||
let dbfile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_DATABASE], true);
|
let dbfile = FileUtils.getFile(KEY_PROFILEDIR, [FILE_DATABASE], true);
|
||||||
if (dbfile.exists())
|
if (dbfile.exists())
|
||||||
dbfile.remove(false);
|
dbfile.remove(false);
|
||||||
@ -1745,7 +1745,7 @@ var AddonDatabase = {
|
|||||||
// Retrieve all data from the addon table
|
// Retrieve all data from the addon table
|
||||||
function getAllAddons() {
|
function getAllAddons() {
|
||||||
self.getAsyncStatement("getAllAddons").executeAsync({
|
self.getAsyncStatement("getAllAddons").executeAsync({
|
||||||
handleResult: function(aResults) {
|
handleResult: function getAllAddons_handleResult(aResults) {
|
||||||
let row = null;
|
let row = null;
|
||||||
while (row = aResults.getNextRow()) {
|
while (row = aResults.getNextRow()) {
|
||||||
let internal_id = row.getResultByName("internal_id");
|
let internal_id = row.getResultByName("internal_id");
|
||||||
@ -1755,7 +1755,7 @@ var AddonDatabase = {
|
|||||||
|
|
||||||
handleError: self.asyncErrorLogger,
|
handleError: self.asyncErrorLogger,
|
||||||
|
|
||||||
handleCompletion: function(aReason) {
|
handleCompletion: function getAllAddons_handleCompletion(aReason) {
|
||||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||||
ERROR("Error retrieving add-ons from database. Returning empty results");
|
ERROR("Error retrieving add-ons from database. Returning empty results");
|
||||||
aCallback({});
|
aCallback({});
|
||||||
@ -1770,7 +1770,7 @@ var AddonDatabase = {
|
|||||||
// Retrieve all data from the developer table
|
// Retrieve all data from the developer table
|
||||||
function getAllDevelopers() {
|
function getAllDevelopers() {
|
||||||
self.getAsyncStatement("getAllDevelopers").executeAsync({
|
self.getAsyncStatement("getAllDevelopers").executeAsync({
|
||||||
handleResult: function(aResults) {
|
handleResult: function getAllDevelopers_handleResult(aResults) {
|
||||||
let row = null;
|
let row = null;
|
||||||
while (row = aResults.getNextRow()) {
|
while (row = aResults.getNextRow()) {
|
||||||
let addon_internal_id = row.getResultByName("addon_internal_id");
|
let addon_internal_id = row.getResultByName("addon_internal_id");
|
||||||
@ -1789,7 +1789,7 @@ var AddonDatabase = {
|
|||||||
|
|
||||||
handleError: self.asyncErrorLogger,
|
handleError: self.asyncErrorLogger,
|
||||||
|
|
||||||
handleCompletion: function(aReason) {
|
handleCompletion: function getAllDevelopers_handleCompletion(aReason) {
|
||||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||||
ERROR("Error retrieving developers from database. Returning empty results");
|
ERROR("Error retrieving developers from database. Returning empty results");
|
||||||
aCallback({});
|
aCallback({});
|
||||||
@ -1804,7 +1804,7 @@ var AddonDatabase = {
|
|||||||
// Retrieve all data from the screenshot table
|
// Retrieve all data from the screenshot table
|
||||||
function getAllScreenshots() {
|
function getAllScreenshots() {
|
||||||
self.getAsyncStatement("getAllScreenshots").executeAsync({
|
self.getAsyncStatement("getAllScreenshots").executeAsync({
|
||||||
handleResult: function(aResults) {
|
handleResult: function getAllScreenshots_handleResult(aResults) {
|
||||||
let row = null;
|
let row = null;
|
||||||
while (row = aResults.getNextRow()) {
|
while (row = aResults.getNextRow()) {
|
||||||
let addon_internal_id = row.getResultByName("addon_internal_id");
|
let addon_internal_id = row.getResultByName("addon_internal_id");
|
||||||
@ -1822,7 +1822,7 @@ var AddonDatabase = {
|
|||||||
|
|
||||||
handleError: self.asyncErrorLogger,
|
handleError: self.asyncErrorLogger,
|
||||||
|
|
||||||
handleCompletion: function(aReason) {
|
handleCompletion: function getAllScreenshots_handleCompletion(aReason) {
|
||||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||||
ERROR("Error retrieving screenshots from database. Returning empty results");
|
ERROR("Error retrieving screenshots from database. Returning empty results");
|
||||||
aCallback({});
|
aCallback({});
|
||||||
@ -1836,7 +1836,7 @@ var AddonDatabase = {
|
|||||||
|
|
||||||
function getAllCompatOverrides() {
|
function getAllCompatOverrides() {
|
||||||
self.getAsyncStatement("getAllCompatOverrides").executeAsync({
|
self.getAsyncStatement("getAllCompatOverrides").executeAsync({
|
||||||
handleResult: function(aResults) {
|
handleResult: function getAllCompatOverrides_handleResult(aResults) {
|
||||||
let row = null;
|
let row = null;
|
||||||
while (row = aResults.getNextRow()) {
|
while (row = aResults.getNextRow()) {
|
||||||
let addon_internal_id = row.getResultByName("addon_internal_id");
|
let addon_internal_id = row.getResultByName("addon_internal_id");
|
||||||
@ -1854,7 +1854,7 @@ var AddonDatabase = {
|
|||||||
|
|
||||||
handleError: self.asyncErrorLogger,
|
handleError: self.asyncErrorLogger,
|
||||||
|
|
||||||
handleCompletion: function(aReason) {
|
handleCompletion: function getAllCompatOverrides_handleCompletion(aReason) {
|
||||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||||
ERROR("Error retrieving compatibility overrides from database. Returning empty results");
|
ERROR("Error retrieving compatibility overrides from database. Returning empty results");
|
||||||
aCallback({});
|
aCallback({});
|
||||||
@ -1922,10 +1922,10 @@ var AddonDatabase = {
|
|||||||
let stmts = [this.getAsyncStatement("emptyAddon")];
|
let stmts = [this.getAsyncStatement("emptyAddon")];
|
||||||
|
|
||||||
this.connection.executeAsync(stmts, stmts.length, {
|
this.connection.executeAsync(stmts, stmts.length, {
|
||||||
handleResult: function() {},
|
handleResult: function emptyAddon_handleResult() {},
|
||||||
handleError: self.asyncErrorLogger,
|
handleError: self.asyncErrorLogger,
|
||||||
|
|
||||||
handleCompletion: function(aReason) {
|
handleCompletion: function emptyAddon_handleCompletion(aReason) {
|
||||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED)
|
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED)
|
||||||
ERROR("Error emptying database. Attempting to continue repopulating database");
|
ERROR("Error emptying database. Attempting to continue repopulating database");
|
||||||
|
|
||||||
@ -2028,9 +2028,9 @@ var AddonDatabase = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.connection.executeAsync(stmts, stmts.length, {
|
self.connection.executeAsync(stmts, stmts.length, {
|
||||||
handleResult: function() {},
|
handleResult: function insertAdditionalData_handleResult() {},
|
||||||
handleError: self.asyncErrorLogger,
|
handleError: self.asyncErrorLogger,
|
||||||
handleCompletion: function(aReason) {
|
handleCompletion: function insertAdditionalData_handleCompletion(aReason) {
|
||||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||||
ERROR("Error inserting additional addon metadata into database. Attempting to continue");
|
ERROR("Error inserting additional addon metadata into database. Attempting to continue");
|
||||||
self.connection.rollbackTransaction();
|
self.connection.rollbackTransaction();
|
||||||
@ -2046,10 +2046,10 @@ var AddonDatabase = {
|
|||||||
|
|
||||||
// Insert add-on into database
|
// Insert add-on into database
|
||||||
this._makeAddonStatement(aAddon).executeAsync({
|
this._makeAddonStatement(aAddon).executeAsync({
|
||||||
handleResult: function() {},
|
handleResult: function makeAddonStatement_handleResult() {},
|
||||||
handleError: self.asyncErrorLogger,
|
handleError: self.asyncErrorLogger,
|
||||||
|
|
||||||
handleCompletion: function(aReason) {
|
handleCompletion: function makeAddonStatement_handleCompletion(aReason) {
|
||||||
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED) {
|
||||||
ERROR("Error inserting add-ons into database. Attempting to continue.");
|
ERROR("Error inserting add-ons into database. Attempting to continue.");
|
||||||
self.connection.rollbackTransaction();
|
self.connection.rollbackTransaction();
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user