зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1402064 Switch to modern AMO metadata API r=kmag
Switch from the old XML-based AMO metadata API to the modern JSON based API. This turned into something between a modest update and complete rewrite. Most notably, external APIs became (mostly) promise-based. The exception is getCachedAddonById() which XPIInstall.jsm requires a synchronous callback from. Also, hopefully we will be able to get rid of a bunch of this metadata handling soon. If this code had a long life ahead of it, the unit tests could use some more attention, but I mostly did the minimum here just to keep them running for now with the expectation that we'll be able to get rid of them within some small number of months. MozReview-Commit-ID: 3DRaBdWGaiJ --HG-- rename : services/sync/tests/unit/addon1-search.xml => services/sync/tests/unit/addon1-search.json rename : services/sync/tests/unit/bootstrap1-search.xml => services/sync/tests/unit/bootstrap1-search.json rename : services/sync/tests/unit/missing-sourceuri.xml => services/sync/tests/unit/missing-sourceuri.json rename : services/sync/tests/unit/missing-xpi-search.xml => services/sync/tests/unit/missing-xpi-search.json rename : services/sync/tests/unit/rewrite-search.xml => services/sync/tests/unit/rewrite-search.json rename : services/sync/tests/unit/systemaddon-search.xml => services/sync/tests/unit/systemaddon-search.json extra : rebase_source : f25d78b938768041c5c05b72a1f7ff3a7dee8275
This commit is contained in:
Родитель
45a6d26761
Коммит
aeee120808
|
@ -43,8 +43,8 @@ pref("extensions.webextOptionalPermissionPrompts", true);
|
|||
|
||||
// Preferences for AMO integration
|
||||
pref("extensions.getAddons.cache.enabled", true);
|
||||
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=%OS%&appVersion=%VERSION%");
|
||||
pref("extensions.getAddons.getWithPerformance.url", "https://services.addons.mozilla.org/%LOCALE%/firefox/api/%API_VERSION%/search/guid:%IDS%?src=firefox&appOS=%OS%&appVersion=%VERSION%&tMain=%TIME_MAIN%&tFirstPaint=%TIME_FIRST_PAINT%&tSessionRestored=%TIME_SESSION_RESTORED%");
|
||||
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v3/addons/search/?guid=%IDS%&lang=%LOCALE%");
|
||||
pref("extensions.getAddons.compatOverides.url", "https://services.addons.mozilla.org/api/v3/addons/compat-override/?guid=%IDS%&lang=%LOCALE%");
|
||||
pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/firefox/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
|
||||
pref("extensions.webservice.discoverURL", "https://discovery.addons.mozilla.org/%LOCALE%/firefox/discovery/pane/%VERSION%/%OS%/%COMPATIBILITY_MODE%");
|
||||
pref("extensions.getAddons.link.url", "https://addons.mozilla.org/%LOCALE%/firefox/");
|
||||
|
|
|
@ -212,8 +212,8 @@ pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla
|
|||
pref("extensions.getAddons.cache.enabled", true);
|
||||
pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/android/search?q=%TERMS%&platform=%OS%&appver=%VERSION%");
|
||||
pref("extensions.getAddons.browseAddons", "https://addons.mozilla.org/%LOCALE%/android/");
|
||||
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/%LOCALE%/android/api/%API_VERSION%/search/guid:%IDS%?src=mobile&appOS=%OS%&appVersion=%VERSION%");
|
||||
pref("extensions.getAddons.getWithPerformance.url", "https://services.addons.mozilla.org/%LOCALE%/android/api/%API_VERSION%/search/guid:%IDS%?src=mobile&appOS=%OS%&appVersion=%VERSION%&tMain=%TIME_MAIN%&tFirstPaint=%TIME_FIRST_PAINT%&tSessionRestored=%TIME_SESSION_RESTORED%");
|
||||
pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v3/addons/search/?guid=%IDS%&lang=%LOCALE%");
|
||||
pref("extensions.getAddons.compatOverides.url", "https://services.addons.mozilla.org/api/v3/addons/compat-override/?guid=%IDS%&lang=%LOCALE%");
|
||||
|
||||
/* preference for the locale picker */
|
||||
pref("extensions.getLocales.get.url", "");
|
||||
|
|
|
@ -202,19 +202,9 @@ AddonUtilsInternal.prototype = {
|
|||
ids.push(addon.id);
|
||||
}
|
||||
|
||||
const {addons, addonsLength} = await new Promise((res, rej) => {
|
||||
AddonRepository.getAddonsByIDs(ids, {
|
||||
searchSucceeded: (addons, addonsLength, total) => {
|
||||
res({addons, addonsLength});
|
||||
},
|
||||
searchFailed() {
|
||||
rej(new Error("AddonRepository search failed"));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this._log.info("Found " + addonsLength + "/" + ids.length +
|
||||
" add-ons during repository search.");
|
||||
let addons = await AddonRepository.getAddonsByIDs(ids);
|
||||
this._log.info(`Found ${addons.length} / ${ids.length}` +
|
||||
" add-ons during repository search.");
|
||||
|
||||
let ourResult = {
|
||||
installedIDs: [],
|
||||
|
@ -224,10 +214,6 @@ AddonUtilsInternal.prototype = {
|
|||
errors: []
|
||||
};
|
||||
|
||||
if (!addonsLength) {
|
||||
return ourResult;
|
||||
}
|
||||
|
||||
let toInstall = [];
|
||||
|
||||
// Rewrite the "src" query string parameter of the source URI to note
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"next": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "Non-Restartless Test Extension",
|
||||
"type": "extension",
|
||||
"guid": "addon1@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.0",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"size": 485,
|
||||
"url": "http://127.0.0.1:8888/addon1.xpi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"last_updated": "2011-09-05T20:42:09Z"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<searchresults total_results="1">
|
||||
<addon id="5617">
|
||||
<name>Non-Restartless Test Extension</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon1@tests.mozilla.org</guid>
|
||||
<slug>addon11</slug>
|
||||
<version>1.0</version>
|
||||
|
||||
<compatible_applications><application>
|
||||
<name>Firefox</name>
|
||||
<application_id>1</application_id>
|
||||
<min_version>3.6</min_version>
|
||||
<max_version>*</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application></compatible_applications>
|
||||
<all_compatible_os><os>ALL</os></all_compatible_os>
|
||||
|
||||
<install os="ALL" size="485">http://127.0.0.1:8888/addon1.xpi</install>
|
||||
<created epoch="1252903662">
|
||||
2009-09-14T04:47:42Z
|
||||
</created>
|
||||
<last_updated epoch="1315255329">
|
||||
2011-09-05T20:42:09Z
|
||||
</last_updated>
|
||||
</addon>
|
||||
</searchresults>
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"next": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "Restartless Test Extension",
|
||||
"type": "extension",
|
||||
"guid": "bootstrap1@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.0",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"size": 485,
|
||||
"url": "http://127.0.0.1:8888/bootstrap1.xpi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"last_updated": "2011-09-05T20:42:09Z"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<searchresults total_results="1">
|
||||
<addon id="5617">
|
||||
<name>Restartless Test Extension</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>bootstrap1@tests.mozilla.org</guid>
|
||||
<slug>bootstrap1</slug>
|
||||
<version>1.0</version>
|
||||
|
||||
<compatible_applications><application>
|
||||
<name>Firefox</name>
|
||||
<application_id>1</application_id>
|
||||
<min_version>3.6</min_version>
|
||||
<max_version>*</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application></compatible_applications>
|
||||
<all_compatible_os><os>ALL</os></all_compatible_os>
|
||||
|
||||
<install os="ALL" size="485">http://127.0.0.1:8888/bootstrap1.xpi</install>
|
||||
<created epoch="1252903662">
|
||||
2009-09-14T04:47:42Z
|
||||
</created>
|
||||
<last_updated epoch="1315255329">
|
||||
2011-09-05T20:42:09Z
|
||||
</last_updated>
|
||||
</addon>
|
||||
</searchresults>
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"next": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "Restartless Test Extension",
|
||||
"type": "extension",
|
||||
"guid": "missing-sourceuri@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.0",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"size": 485
|
||||
}
|
||||
]
|
||||
},
|
||||
"last_updated": "2011-09-05T20:42:09Z"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<searchresults total_results="1">
|
||||
<addon id="5617">
|
||||
<name>Restartless Test Extension</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>missing-sourceuri@tests.mozilla.org</guid>
|
||||
<slug>missing-sourceuri</slug>
|
||||
<version>1.0</version>
|
||||
|
||||
<compatible_applications><application>
|
||||
<name>Firefox</name>
|
||||
<application_id>1</application_id>
|
||||
<min_version>3.6</min_version>
|
||||
<max_version>*</max_version>
|
||||
<appID>{3e3ba16c-1675-4e88-b9c8-afef81b3d2ef}</appID>
|
||||
</application></compatible_applications>
|
||||
<all_compatible_os><os>ALL</os></all_compatible_os>
|
||||
|
||||
<install os="ALL" size="485"></install>
|
||||
<created epoch="1252903662">
|
||||
2009-09-14T04:47:42Z
|
||||
</created>
|
||||
<last_updated epoch="1315255329">
|
||||
2011-09-05T20:42:09Z
|
||||
</last_updated>
|
||||
</addon>
|
||||
</searchresults>
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"next": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "Non-Restartless Test Extension",
|
||||
"type": "extension",
|
||||
"guid": "missing-xpi@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.0",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"size": 485,
|
||||
"url": "http://127.0.0.1:8888/THIS_DOES_NOT_EXIST.xpi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"last_updated": "2011-09-05T20:42:09Z"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<searchresults total_results="1">
|
||||
<addon id="5617">
|
||||
<name>Restartless Test Extension</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>missing-xpi@tests.mozilla.org</guid>
|
||||
<slug>missing-xpi</slug>
|
||||
<version>1.0</version>
|
||||
|
||||
<compatible_applications><application>
|
||||
<name>Firefox</name>
|
||||
<application_id>1</application_id>
|
||||
<min_version>3.6</min_version>
|
||||
<max_version>*</max_version>
|
||||
<appID>{3e3ba16c-1675-4e88-b9c8-afef81b3d2ef}</appID>
|
||||
</application></compatible_applications>
|
||||
<all_compatible_os><os>ALL</os></all_compatible_os>
|
||||
|
||||
<install os="ALL" size="485">http://127.0.0.1:8888/THIS_DOES_NOT_EXIST.xpi</install>
|
||||
<created epoch="1252903662">
|
||||
2009-09-14T04:47:42Z
|
||||
</created>
|
||||
<last_updated epoch="1315255329">
|
||||
2011-09-05T20:42:09Z
|
||||
</last_updated>
|
||||
</addon>
|
||||
</searchresults>
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"next": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "Rewrite Test Extension",
|
||||
"type": "extension",
|
||||
"guid": "rewrite@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.0",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"size": 485,
|
||||
"url": "http://127.0.0.1:8888/require.xpi?src=api"
|
||||
}
|
||||
]
|
||||
},
|
||||
"last_updated": "2011-09-05T20:42:09Z"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<searchresults total_results="1">
|
||||
<addon id="5617">
|
||||
<name>Rewrite Test Extension</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>rewrite@tests.mozilla.org</guid>
|
||||
<slug>rewrite</slug>
|
||||
<version>1.0</version>
|
||||
|
||||
<compatible_applications><application>
|
||||
<name>Firefox</name>
|
||||
<application_id>1</application_id>
|
||||
<min_version>3.6</min_version>
|
||||
<max_version>*</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application></compatible_applications>
|
||||
<all_compatible_os><os>ALL</os></all_compatible_os>
|
||||
|
||||
<install os="ALL" size="485">http://127.0.0.1:8888/require.xpi?src=api</install>
|
||||
<created epoch="1252903662">
|
||||
2009-09-14T04:47:42Z
|
||||
</created>
|
||||
<last_updated epoch="1315255329">
|
||||
2011-09-05T20:42:09Z
|
||||
</last_updated>
|
||||
</addon>
|
||||
</searchresults>
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"next": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "System Add-on Test",
|
||||
"type": "extension",
|
||||
"guid": "system1@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.0",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"size": 999,
|
||||
"url": "http://127.0.0.1:8888/system.xpi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"last_updated": "2011-09-05T20:42:09Z"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<searchresults total_results="1">
|
||||
<addon id="5618">
|
||||
<name>System Add-on Test</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>system1@tests.mozilla.org</guid>
|
||||
<slug>addon11</slug>
|
||||
<version>1.0</version>
|
||||
|
||||
<compatible_applications><application>
|
||||
<name>Firefox</name>
|
||||
<application_id>1</application_id>
|
||||
<min_version>3.6</min_version>
|
||||
<max_version>*</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application></compatible_applications>
|
||||
<all_compatible_os><os>ALL</os></all_compatible_os>
|
||||
|
||||
<install os="ALL" size="999">http://127.0.0.1:8888/system.xpi</install>
|
||||
<created epoch="1252903662">
|
||||
2009-09-14T04:47:42Z
|
||||
</created>
|
||||
<last_updated epoch="1315255329">
|
||||
2011-09-05T20:42:09Z
|
||||
</last_updated>
|
||||
</addon>
|
||||
</searchresults>
|
|
@ -24,10 +24,10 @@ function createAndStartHTTPServer(port = HTTP_PORT) {
|
|||
let server = new HttpServer();
|
||||
|
||||
server.registerFile("/search/guid:missing-sourceuri%40tests.mozilla.org",
|
||||
do_get_file("missing-sourceuri.xml"));
|
||||
do_get_file("missing-sourceuri.json"));
|
||||
|
||||
server.registerFile("/search/guid:rewrite%40tests.mozilla.org",
|
||||
do_get_file("rewrite-search.xml"));
|
||||
do_get_file("rewrite-search.json"));
|
||||
|
||||
server.start(port);
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ add_task(async function test_disabled_install_semantics() {
|
|||
|
||||
let amoServer = new HttpServer();
|
||||
amoServer.registerFile("/search/guid:addon1%40tests.mozilla.org",
|
||||
do_get_file("addon1-search.xml"));
|
||||
do_get_file("addon1-search.json"));
|
||||
|
||||
let installXPI = ExtensionsTestPath("/addons/test_install1.xpi");
|
||||
amoServer.registerFile("/addon1.xpi", do_get_file(installXPI));
|
||||
|
|
|
@ -70,14 +70,14 @@ function createAndStartHTTPServer(port) {
|
|||
let bootstrap1XPI = ExtensionsTestPath("/addons/test_bootstrap1_1.xpi");
|
||||
|
||||
server.registerFile("/search/guid:bootstrap1%40tests.mozilla.org",
|
||||
do_get_file("bootstrap1-search.xml"));
|
||||
do_get_file("bootstrap1-search.json"));
|
||||
server.registerFile("/bootstrap1.xpi", do_get_file(bootstrap1XPI));
|
||||
|
||||
server.registerFile("/search/guid:missing-xpi%40tests.mozilla.org",
|
||||
do_get_file("missing-xpi-search.xml"));
|
||||
do_get_file("missing-xpi-search.json"));
|
||||
|
||||
server.registerFile("/search/guid:system1%40tests.mozilla.org",
|
||||
do_get_file("systemaddon-search.xml"));
|
||||
do_get_file("systemaddon-search.json"));
|
||||
server.registerFile("/system.xpi", systemAddonFile);
|
||||
|
||||
server.start(port);
|
||||
|
|
|
@ -3,14 +3,14 @@ head = head_appinfo.js ../../../common/tests/unit/head_helpers.js head_helpers.j
|
|||
firefox-appdir = browser
|
||||
skip-if = asan # asan crashes, bug 1344085
|
||||
support-files =
|
||||
addon1-search.xml
|
||||
bootstrap1-search.xml
|
||||
missing-sourceuri.xml
|
||||
missing-xpi-search.xml
|
||||
addon1-search.json
|
||||
bootstrap1-search.json
|
||||
missing-sourceuri.json
|
||||
missing-xpi-search.json
|
||||
places_v10_from_v11.sqlite
|
||||
rewrite-search.xml
|
||||
rewrite-search.json
|
||||
sync_ping_schema.json
|
||||
systemaddon-search.xml
|
||||
systemaddon-search.json
|
||||
!/services/common/tests/unit/head_helpers.js
|
||||
!/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
|
||||
!/toolkit/components/extensions/test/xpcshell/head_sync.js
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1622,12 +1622,15 @@ class AddonInstall {
|
|||
// makes it impossible to delete on Windows.
|
||||
|
||||
// Try to load from the existing cache first
|
||||
let repoAddon = await new Promise(resolve => AddonRepository.getCachedAddonByID(this.addon.id, resolve));
|
||||
let repoAddon = await AddonRepository.getCachedAddonByID(this.addon.id);
|
||||
|
||||
// It wasn't there so try to re-download it
|
||||
if (!repoAddon) {
|
||||
await new Promise(resolve => AddonRepository.cacheAddons([this.addon.id], resolve));
|
||||
repoAddon = await new Promise(resolve => AddonRepository.getCachedAddonByID(this.addon.id, resolve));
|
||||
try {
|
||||
[repoAddon] = await AddonRepository.cacheAddons([this.addon.id]);
|
||||
} catch (err) {
|
||||
logger.debug(`Error getting metadata for ${this.addon.id}: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
this.addon._repositoryAddon = repoAddon;
|
||||
|
|
|
@ -3934,8 +3934,8 @@ var XPIProvider = {
|
|||
}
|
||||
|
||||
for (let addon of aAddons) {
|
||||
AddonRepository.getCachedAddonByID(addon.id, aRepoAddon => {
|
||||
if (aRepoAddon) {
|
||||
AddonRepository.getCachedAddonByID(addon.id).then(aRepoAddon => {
|
||||
if (aRepoAddon || AddonRepository.getCompatibilityOverridesSync(addon.id)) {
|
||||
logger.debug("updateAddonRepositoryData got info for " + addon.id);
|
||||
addon._repositoryAddon = aRepoAddon;
|
||||
this.updateAddonDisabledState(addon);
|
||||
|
@ -5756,7 +5756,7 @@ function defineAddonWrapperProperty(name, getter) {
|
|||
|
||||
["fullDescription", "developerComments", "supportURL",
|
||||
"contributionURL", "averageRating", "reviewCount",
|
||||
"reviewURL"].forEach(function(aProp) {
|
||||
"reviewURL", "weeklyDownloads"].forEach(function(aProp) {
|
||||
defineAddonWrapperProperty(aProp, function() {
|
||||
let addon = addonFor(this);
|
||||
if (addon._repositoryAddon)
|
||||
|
|
|
@ -76,11 +76,10 @@ function getRepositoryAddon(aAddon, aCallback) {
|
|||
aCallback(aAddon);
|
||||
return;
|
||||
}
|
||||
function completeAddon(aRepositoryAddon) {
|
||||
aAddon._repositoryAddon = aRepositoryAddon;
|
||||
AddonRepository.getCachedAddonByID(aAddon.id, repoAddon => {
|
||||
aAddon._repositoryAddon = repoAddon;
|
||||
aCallback(aAddon);
|
||||
}
|
||||
AddonRepository.getCachedAddonByID(aAddon.id, completeAddon);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,6 @@ tags = blocklist
|
|||
skip-if = buildapp == 'mulet'
|
||||
[browser_about.js]
|
||||
skip-if = os == 'linux' || os == 'win' # bug 632290
|
||||
[browser_addonrepository_performance.js]
|
||||
[browser_bug523784.js]
|
||||
[browser_bug562797.js]
|
||||
[browser_bug562854.js]
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that the metadata request includes startup time measurements
|
||||
|
||||
var tmp = {};
|
||||
ChromeUtils.import("resource://gre/modules/addons/AddonRepository.jsm", tmp);
|
||||
var AddonRepository = tmp.AddonRepository;
|
||||
|
||||
var gProvider;
|
||||
|
||||
function parseParams(aQuery) {
|
||||
let params = {};
|
||||
|
||||
for (let param of aQuery.split("&")) {
|
||||
let [key, value] = param.split("=");
|
||||
params[key] = value;
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
var gSeenRequest = false;
|
||||
|
||||
gProvider = new MockProvider();
|
||||
gProvider.createAddons([{
|
||||
id: "test1@tests.mozilla.org",
|
||||
name: "Test add-on"
|
||||
}]);
|
||||
|
||||
function observe(aSubject, aTopic, aData) {
|
||||
aSubject.QueryInterface(Ci.nsIChannel);
|
||||
let url = aSubject.URI.QueryInterface(Ci.nsIURL);
|
||||
if (url.filePath != "/extensions-dummy/metadata") {
|
||||
return;
|
||||
}
|
||||
info(url.query);
|
||||
|
||||
// Check if we encountered telemetry errors and turn the tests for which
|
||||
// we don't have valid data into known failures.
|
||||
let snapshot = Services.telemetry.getHistogramById("STARTUP_MEASUREMENT_ERRORS")
|
||||
.snapshot();
|
||||
|
||||
let tProcessValid = (snapshot.counts[0] == 0);
|
||||
let tMainValid = tProcessValid && (snapshot.counts[2] == 0);
|
||||
let tFirstPaintValid = tProcessValid && (snapshot.counts[5] == 0);
|
||||
let tSessionRestoredValid = tProcessValid && (snapshot.counts[6] == 0);
|
||||
|
||||
let params = parseParams(url.query);
|
||||
|
||||
is(params.appOS, Services.appinfo.OS, "OS should be correct");
|
||||
is(params.appVersion, Services.appinfo.version, "Version should be correct");
|
||||
|
||||
if (tMainValid) {
|
||||
ok(params.tMain >= 0, "Should be a sensible tMain");
|
||||
} else {
|
||||
todo(false, "An error occurred while recording the startup timestamps, skipping this test");
|
||||
}
|
||||
|
||||
if (tFirstPaintValid) {
|
||||
ok(params.tFirstPaint >= 0, "Should be a sensible tFirstPaint");
|
||||
} else {
|
||||
todo(false, "An error occurred while recording the startup timestamps, skipping this test");
|
||||
}
|
||||
|
||||
if (tSessionRestoredValid) {
|
||||
ok(params.tSessionRestored >= 0, "Should be a sensible tSessionRestored");
|
||||
} else {
|
||||
todo(false, "An error occurred while recording the startup timestamps, skipping this test");
|
||||
}
|
||||
|
||||
gSeenRequest = true;
|
||||
}
|
||||
|
||||
const PREF = "extensions.getAddons.getWithPerformance.url";
|
||||
|
||||
// Watch HTTP requests
|
||||
Services.obs.addObserver(observe, "http-on-modify-request");
|
||||
Services.prefs.setCharPref(PREF,
|
||||
"http://127.0.0.1:8888/extensions-dummy/metadata?appOS=%OS%&appVersion=%VERSION%&tMain=%TIME_MAIN%&tFirstPaint=%TIME_FIRST_PAINT%&tSessionRestored=%TIME_SESSION_RESTORED%");
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.obs.removeObserver(observe, "http-on-modify-request");
|
||||
});
|
||||
|
||||
AddonRepository._beginGetAddons(["test1@tests.mozilla.org"], {
|
||||
searchFailed() {
|
||||
ok(gSeenRequest, "Should have seen metadata request");
|
||||
finish();
|
||||
}
|
||||
}, true);
|
||||
}
|
|
@ -12,8 +12,6 @@ const BAD_FRAMED_URL = "https://example.org/" + RELATIVE_DIR + "discovery_frame.
|
|||
|
||||
const PREF_INSTALL_REQUIREBUILTINCERTS = "extensions.install.requireBuiltInCerts";
|
||||
|
||||
// Temporarily enable caching
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
// Allow SSL from non-built-in certs
|
||||
Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
|
||||
// Allow installs from the test site
|
||||
|
|
|
@ -1,820 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="1111">
|
||||
<!-- Passes all requirements -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.1</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator 1</name>
|
||||
<link>http://localhost:%PORT%/creator1.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id="8">Preliminarily Reviewed</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<!-- Test that a negative rating is ignored -->
|
||||
<rating>-2</rating>
|
||||
<!-- Test that a <reviews> with a blank review URL is ignored -->
|
||||
<reviews num=" 1111 "> </reviews>
|
||||
<!-- Test that a negative total_downloads is ignored -->
|
||||
<total_downloads>-2</total_downloads>
|
||||
<install>http://localhost:%PORT%/test1.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Passes requirements. Tests optional attributes. Also tests that
|
||||
integer properties that are NaN in the XML are ignored -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<!-- Test that extensions pass -->
|
||||
<type id="1">Extension</type>
|
||||
<guid>test2@tests.mozilla.org</guid>
|
||||
<version>1.2</version>
|
||||
<authors>
|
||||
<!-- Test that the first author becomes the creator,
|
||||
and the second one is a developer -->
|
||||
<author>
|
||||
<name>Test Creator 2</name>
|
||||
<link>http://localhost:%PORT%/creator2.html</link>
|
||||
</author>
|
||||
<author>
|
||||
<name>Test Developer 2</name>
|
||||
<link>http://localhost:%PORT%/developer2.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<summary><h1>Test Summary 2</h1><p>paragraph</p></summary>
|
||||
<description>Test Description 2<br>newline</description>
|
||||
<developer_comments>Test Developer
|
||||
Comments 2</developer_comments>
|
||||
<eula>Test EULA 2</eula>
|
||||
<icon size="64">http://localhost:%PORT%/icon2-64.png</icon>
|
||||
<icon size="48">http://localhost:%PORT%/icon2-48.png</icon>
|
||||
<icon size="32">http://localhost:%PORT%/icon2-32.png</icon>
|
||||
<status id="4">Public</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<!-- Test that multiple preview images are correctly parsed -->
|
||||
<previews>
|
||||
<preview primary="0">
|
||||
<full type="image/png">http://localhost:%PORT%/full1-2.png</full>
|
||||
<thumbnail type="image/png">http://localhost:%PORT%/thumbnail1-2.png</thumbnail>
|
||||
</preview>
|
||||
<preview primary="0">
|
||||
<full type="image/png">http://localhost:%PORT%/full2-2.png</full>
|
||||
<thumbnail type="image/png">http://localhost:%PORT%/thumbnail2-2.png</thumbnail>
|
||||
<caption>Caption 2</caption>
|
||||
</preview>
|
||||
</previews>
|
||||
<rating>NaN</rating>
|
||||
<!-- Test that learnmore is used as the add-on's homepageURL
|
||||
if there is no homepage defined -->
|
||||
<learnmore>http://localhost:%PORT%/learnmore2.html</learnmore>
|
||||
<homepage/>
|
||||
<support>http://localhost:%PORT%/support2.html</support>
|
||||
<contribution_data>
|
||||
<link>http://localhost:%PORT%/contribution2.html</link>
|
||||
<meet_developers>http://localhost:%PORT%/meetDevelopers2.html</meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num="NaN">http://localhost:%PORT%/review2.html</reviews>
|
||||
<total_downloads>NaN</total_downloads>
|
||||
<weekly_downloads>NaN</weekly_downloads>
|
||||
<daily_users>NaN</daily_users>
|
||||
<last_updated epoch="NaN">Not an acual date</last_updated>
|
||||
<install size="NaN" os="ALL">http://localhost:%PORT%/test2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Passes requirements. Tests optional attributes with extra whitespace. -->
|
||||
<addon>
|
||||
<name> PASS </name>
|
||||
<!-- Test that themes pass -->
|
||||
<type id=" 2 ">Theme</type>
|
||||
<guid> test3@tests.mozilla.org </guid>
|
||||
<version> 1.3 </version>
|
||||
<authors>
|
||||
<!-- Test that authors with blank names are ignored -->
|
||||
<author>
|
||||
<name> </name>
|
||||
<link> http://localhost:%PORT%/ignore3.html </link>
|
||||
</author>
|
||||
<!-- Test that authors with blank links are ignored -->
|
||||
<author>
|
||||
<name> Test Creator Ignore </name>
|
||||
<link> </link>
|
||||
</author>
|
||||
<author>
|
||||
<name> Test Creator 3 </name>
|
||||
<link> http://localhost:%PORT%/creator3.html </link>
|
||||
</author>
|
||||
<author>
|
||||
<name> First Test Developer 3 </name>
|
||||
<link> http://localhost:%PORT%/developer1-3.html </link>
|
||||
</author>
|
||||
<author>
|
||||
<name> </name>
|
||||
<link> </link>
|
||||
</author>
|
||||
<author>
|
||||
<name> Second Test Developer 3 </name>
|
||||
<link> http://localhost:%PORT%/developer2-3.html </link>
|
||||
</author>
|
||||
</authors>
|
||||
<summary> Test Summary 3 </summary>
|
||||
<description> Test Description 3<br><ul><li>List item 1<li>List item 2</ul> </description>
|
||||
<developer_comments> Test Developer Comments 3 </developer_comments>
|
||||
<eula> Test EULA 3 </eula>
|
||||
<icon size="32"> http://localhost:%PORT%/icon3.png </icon>
|
||||
<status id=" 8 ">Preliminarily Reviewed</status>
|
||||
<!-- Test that an incompatible + compatible application list passes -->
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID> unknown@tests.mozilla.org </appID>
|
||||
<min_version> 1 </min_version>
|
||||
<max_version> 1 </max_version>
|
||||
</application>
|
||||
<application>
|
||||
<appID> xpcshell@tests.mozilla.org </appID>
|
||||
<min_version> 1 </min_version>
|
||||
<max_version> 1 </max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<!-- Test that primary images appear first in the add-on's screenshots array -->
|
||||
<previews>
|
||||
<preview primary=" 0 ">
|
||||
<full type=" image/png "> http://localhost:%PORT%/full2-3.png </full>
|
||||
<caption> Caption 2 - 3 </caption>
|
||||
</preview>
|
||||
<!-- Test that a preview without a <full> element is ignored -->
|
||||
<preview primary=" 0 ">
|
||||
<caption> Caption ignore - 3 </caption>
|
||||
</preview>
|
||||
<!-- Test that a preview with an empty <full> element is ignored -->
|
||||
<preview primary=" 0 ">
|
||||
<full type=" image/png "> </full>
|
||||
<caption> Caption ignore - 3 </caption>
|
||||
<preview primary=" 1 ">
|
||||
<full type=" image/png "> http://localhost:%PORT%/full1-3.png </full>
|
||||
<thumbnail type=" image/png "> http://localhost:%PORT%/thumbnail1-3.png </thumbnail>
|
||||
<caption> Caption 1 - 3 </caption>
|
||||
</preview>
|
||||
<preview primary=" 0 ">
|
||||
<full type=" image/png "> http://localhost:%PORT%/full3-3.png </full>
|
||||
<thumbnail type=" image/png "> http://localhost:%PORT%/thumbnail3-3.png </thumbnail>
|
||||
<caption> Caption 3 - 3 </caption>
|
||||
</preview>
|
||||
</preview>
|
||||
</previews>
|
||||
<!-- Test that a rating between 1 and 5 is correctly parsed -->
|
||||
<rating> 2 </rating>
|
||||
<!-- Test that hompage is used as the add-on's homepageURL
|
||||
even if learnmore is defined -->
|
||||
<learnmore> http://localhost:%PORT%/learnmore3.html </learnmore>
|
||||
<homepage> http://localhost:%PORT%/homepage3.html </homepage>
|
||||
<support> http://localhost:%PORT%/support3.html </support>
|
||||
<contribution_data>
|
||||
<link> http://localhost:%PORT%/contribution3.html </link>
|
||||
<suggested_amount currency="USD"> $11.11 </suggested_amount>
|
||||
<meet_developers> http://localhost:%PORT%/meetDevelopers3.html </meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num=" 1111 "> http://localhost:%PORT%/review3.html </reviews>
|
||||
<total_downloads> 2222 </total_downloads>
|
||||
<weekly_downloads> 3333 </weekly_downloads>
|
||||
<daily_users> 4444 </daily_users>
|
||||
<last_updated epoch=" 1265033045 "> 2010-02-01T14:04:05Z </last_updated>
|
||||
<!-- Test that an incompatible install is ignored -->
|
||||
<install size=" 9999 " os=" UNKNOWN "> http://localhost:%PORT%/fail3.xpi </install>
|
||||
<!-- Test that OS matching is case-insensitive -->
|
||||
<install size=" 5555 " os=" xpCShell " hash=" sha1:c26f0b0d62e5dcddcda95074d3f3fedb9bbc26e3 "> http://localhost:%PORT%/test3.xpi </install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because name is undefined -->
|
||||
<addon>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test4@tests.mozilla.org</guid>
|
||||
<version>1.4</version>
|
||||
<authors><author><name>Test Creator 4</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined name should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test4.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because name is empty-->
|
||||
<addon>
|
||||
<name> </name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test5@tests.mozilla.org</guid>
|
||||
<version>1.5</version>
|
||||
<authors><author><name>Test Creator 5</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with empty name should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test5.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because type is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<guid>test6@tests.mozilla.org</guid>
|
||||
<version>1.6</version>
|
||||
<authors><author><name>Test Creator 6</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined type should be ignored</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test6.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because type is empty -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="">Empty id attribute</type>
|
||||
<guid>test7@tests.mozilla.org</guid>
|
||||
<version>1.7</version>
|
||||
<authors><author><name>Test Creator 7</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with empty type should be ignored</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test7.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because type is unknown -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="9999">Unknown</type>
|
||||
<guid>test8@tests.mozilla.org</guid>
|
||||
<version>1.8</version>
|
||||
<authors><author><name>Test Creator 8</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with unknown type should be ignored</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test8.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<version>1.9</version>
|
||||
<authors><author><name>Test Creator 9</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined guid should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test9.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid is empty -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid> </guid>
|
||||
<version>1.10</version>
|
||||
<authors><author><name>Test Creator 10</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with empty guid should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test10.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid matches previously successful result -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.11</version>
|
||||
<authors><author><name>Test Creator 11</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with a guid that matches a previously successful result should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test11.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid matches already installed add-on -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test_AddonRepository_1@tests.mozilla.org</guid>
|
||||
<version>1.12</version>
|
||||
<authors><author><name>Test Creator 12</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with a guid that matches an installed Addon should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test12.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because version is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test13@tests.mozilla.org</guid>
|
||||
<authors><author><name>Test Creator 13</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test13.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because version is empty -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test14@tests.mozilla.org</guid>
|
||||
<version> </version>
|
||||
<authors><author><name>Test Creator 14</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with empty version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test14.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because authors undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test15@tests.mozilla.org</guid>
|
||||
<version>1.15</version>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined authors should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test15.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because it has no defined author elements -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test16@tests.mozilla.org</guid>
|
||||
<version>1.16</version>
|
||||
<authors></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with no defined author elements should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test16.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because no non-empty author elements -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test17@tests.mozilla.org</guid>
|
||||
<version>1.17</version>
|
||||
<authors>
|
||||
<author><name></name></author>
|
||||
<author><name></name> </author>
|
||||
</authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with no non-empty author elements should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test17.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because status is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test18@tests.mozilla.org</guid>
|
||||
<version>1.18</version>
|
||||
<authors><author><name>Test Creator 18</name></author></authors>
|
||||
<summary>Add-on with undefined status should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test18.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because status is not Public -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test19@tests.mozilla.org</guid>
|
||||
<version>1.19</version>
|
||||
<authors><author><name>Test Creator 19</name></author></authors>
|
||||
<status id="9999">Unknown</status>
|
||||
<summary>Add-on with non-Public status should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test19.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible_applications is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test20@tests.mozilla.org</guid>
|
||||
<version>1.20</version>
|
||||
<authors><author><name>Test Creator 20</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined compatible_applications should be ignored.</summary>
|
||||
<install>http://localhost:%PORT%/test20.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because no compatible applications matched -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test21@tests.mozilla.org</guid>
|
||||
<version>1.21</version>
|
||||
<authors><author><name>Test Creator 21</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with no compatible applications should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>unknown@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test21.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible application's min version is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test22@tests.mozilla.org</guid>
|
||||
<version>1.22</version>
|
||||
<authors><author><name>Test Creator 22</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with too high of a compatible application min version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<max_version>2.0</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test22.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible application's min version too high -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test23@tests.mozilla.org</guid>
|
||||
<version>1.23</version>
|
||||
<authors><author><name>Test Creator 23</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with too high of a compatible application min version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1.1</min_version>
|
||||
<max_version>2.0</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test23.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible application's max version is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test24@tests.mozilla.org</guid>
|
||||
<version>1.24</version>
|
||||
<authors><author><name>Test Creator 24</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with too low of a compatible application max version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>0.9</min_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test24.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because compatible application's max version is too low -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test25@tests.mozilla.org</guid>
|
||||
<version>1.25</version>
|
||||
<authors><author><name>Test Creator 25</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with too low of a compatible application max version should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>0.9</min_version>
|
||||
<max_version>0.9.9</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test25.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because XPI URL is undefined -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test26@tests.mozilla.org</guid>
|
||||
<version>1.26</version>
|
||||
<authors><author><name>Test Creator 26</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with undefined XPI URL should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because XPI URL is empty -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test27@tests.mozilla.org</guid>
|
||||
<version>1.27</version>
|
||||
<authors><author><name>Test Creator 27</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with an empty XPI URL should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install> </install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because install not compatible with OS -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test28@tests.mozilla.org</guid>
|
||||
<version>1.28</version>
|
||||
<authors><author><name>Test Creator 28</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with no installs with compatible OS should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install os="UNKNOWN1">http://localhost:%PORT%/test28.xpi</install>
|
||||
<install os="UNKNOWN2">http://localhost:%PORT%/test28.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because XPI URL matches an installing AddonInstall -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test29@tests.mozilla.org</guid>
|
||||
<version>1.29</version>
|
||||
<authors><author><name>Test Creator 29</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with an XPI URL that matches an installing AddonInstall should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/addons/test_AddonRepository_2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Passes because the add-on has the right payment info -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>purchase1@tests.mozilla.org</guid>
|
||||
<version>2.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator - Last Passing</name>
|
||||
<link>http://localhost:%PORT%/creatorLastPassing.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id="4">Public</status>
|
||||
<all_compatible_os>
|
||||
<os>ALL</os>
|
||||
</all_compatible_os>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<rating>5</rating>
|
||||
<payment_data>
|
||||
<link>http://localhost:%PORT%/purchaseURL1</link>
|
||||
<amount amount="5">$5</amount>
|
||||
</payment_data>
|
||||
</addon>
|
||||
|
||||
<!-- Passes because the add-on has the right payment info -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>purchase2@tests.mozilla.org</guid>
|
||||
<version>2.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator - Last Passing</name>
|
||||
<link>http://localhost:%PORT%/creatorLastPassing.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id="4">Public</status>
|
||||
<all_compatible_os>
|
||||
<os>XPCShell</os>
|
||||
</all_compatible_os>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<rating>5</rating>
|
||||
<payment_data>
|
||||
<link>http://localhost:%PORT%/purchaseURL2</link>
|
||||
<amount amount="10.0">$10</amount>
|
||||
</payment_data>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because the add-on doesn't match the platform -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>purchase3@tests.mozilla.org</guid>
|
||||
<version>2.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator - Last Passing</name>
|
||||
<link>http://localhost:%PORT%/creatorLastPassing.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id="4">Public</status>
|
||||
<all_compatible_os>
|
||||
<os>FOO</os>
|
||||
</all_compatible_os>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<rating>5</rating>
|
||||
<payment_data>
|
||||
<link>http://localhost:%PORT%/purchaseURL3</link>
|
||||
<amount amount="10">$10</amount>
|
||||
</payment_data>
|
||||
</addon>
|
||||
|
||||
<!-- Passes because the Addon that has a matching XPI URL
|
||||
has a state = STATE_AVAILABLE (non-active install). This is the
|
||||
last passing add-on. -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test-lastPassing@tests.mozilla.org</guid>
|
||||
<version>2.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator - Last Passing</name>
|
||||
<link>http://localhost:%PORT%/creatorLastPassing.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id="4">Public</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<!-- Test that a rating > 5 becomes a rating = 5 -->
|
||||
<rating>10</rating>
|
||||
<install>http://localhost:%PORT%/addons/test_AddonRepository_3.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because of MAX_RESULTS limit. The previous <addon> should
|
||||
be the last passing add-on in order to correctly test the limit. -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test-surpassesLimit@tests.mozilla.org</guid>
|
||||
<version>9.9</version>
|
||||
<authors><author><name>Test Creator - Surpasses Limit</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on should not be added because doing so would surpass MAX_RESULTS limit</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test-surpassesLimit.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
{
|
||||
"page_size": 25,
|
||||
"page_count": 1,
|
||||
"count": 4,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "Repo Add-on 1",
|
||||
"type": "extension",
|
||||
"guid": "test_AddonRepository_1@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "2.1",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"size": 9,
|
||||
"url": "http://localhost:4444/repo/1/install.xpi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Repo Add-on 1 - Creator",
|
||||
"url": "http://localhost:4444/repo/1/creator.html"
|
||||
},
|
||||
{
|
||||
"name": "Repo Add-on 1 - First Developer",
|
||||
"url": "http://localhost:4444/repo/1/firstDeveloper.html"
|
||||
},
|
||||
{
|
||||
"name": "Repo Add-on 1 - Second Developer",
|
||||
"url": "http://localhost:4444/repo/1/secondDeveloper.html"
|
||||
}
|
||||
],
|
||||
"summary": "Repo Add-on 1 - Description<br>Second line",
|
||||
"description": "<p>Repo Add-on 1 - Full Description & some extra</p>",
|
||||
"icons": {
|
||||
"32": "http://localhost/repo/1/icon.png"
|
||||
},
|
||||
"ratings": {
|
||||
"count": 1111,
|
||||
"average": 1
|
||||
},
|
||||
"homepage": "http://localhost/repo/1/homepage.html",
|
||||
"support_url": "http://localhost/repo/1/support.html",
|
||||
"contributions_url": "http://localhost/repo/1/meetDevelopers.html",
|
||||
"ratings_url": "http://localhost/repo/1/review.html",
|
||||
"weekly_downloads": 3331,
|
||||
"last_updated": "1970-01-01T00:00:09Z"
|
||||
},
|
||||
{
|
||||
"name": "Repo Add-on 2",
|
||||
"type": "theme",
|
||||
"guid": "test_AddonRepository_2@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "2.2",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"size": 9,
|
||||
"url": "http://localhost:4444/repo/2/install.xpi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Repo Add-on 2 - Creator",
|
||||
"url": "http://localhost:4444/repo/2/creator.html"
|
||||
},
|
||||
{
|
||||
"name": "Repo Add-on 2 - First Developer",
|
||||
"url": "http://localhost:4444/repo/2/firstDeveloper.html"
|
||||
},
|
||||
{
|
||||
"name": "Repo Add-on 2 - Second Developer",
|
||||
"url": "http://localhost:4444/repo/2/secondDeveloper.html"
|
||||
}
|
||||
],
|
||||
"summary": "Repo Add-on 2 - Description",
|
||||
"description": "Repo Add-on 2 - Full Description",
|
||||
"icons": {
|
||||
"32": "http://localhost/repo/2/icon.png"
|
||||
},
|
||||
"previews": [
|
||||
{
|
||||
"image_url": "http://localhost:4444/repo/2/firstFull.png",
|
||||
"thumbnail_url": "http://localhost:4444/repo/2/firstThumbnail.png",
|
||||
"caption": "Repo Add-on 2 - First Caption"
|
||||
},
|
||||
{
|
||||
"image_url": "http://localhost:4444/repo/2/secondFull.png",
|
||||
"thumbnail_url": "http://localhost:4444/repo/2/secondThumbnail.png",
|
||||
"caption": "Repo Add-on 2 - Second Caption"
|
||||
}
|
||||
],
|
||||
"ratings": {
|
||||
"count": 1112,
|
||||
"average": 2
|
||||
},
|
||||
"homepage": "http://localhost/repo/2/homepage.html",
|
||||
"support_url": "http://localhost/repo/2/support.html",
|
||||
"contributions_url": "http://localhost/repo/2/meetDevelopers.html",
|
||||
"ratings_url": "http://localhost/repo/2/review.html",
|
||||
"weekly_downloads": 3332,
|
||||
"last_updated": "1970-01-01T00:00:09Z"
|
||||
},
|
||||
{
|
||||
"name": "Repo Add-on 3",
|
||||
"type": "theme",
|
||||
"guid": "test_AddonRepository_3@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "2.3"
|
||||
},
|
||||
"icons": {
|
||||
"32": "http://localhost/repo/3/icon.png"
|
||||
},
|
||||
"previews": [
|
||||
{
|
||||
"image_url": "http://localhost:4444/repo/3/firstFull.png",
|
||||
"thumbnail_url": "http://localhost:4444/repo/3/firstThumbnail.png",
|
||||
"caption": "Repo Add-on 3 - First Caption"
|
||||
},
|
||||
{
|
||||
"image_url": "http://localhost:4444/repo/3/secondFull.png",
|
||||
"thumbnail_url": "http://localhost:4444/repo/3/secondThumbnail.png",
|
||||
"caption": "Repo Add-on 3 - Second Caption"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,182 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="1111">
|
||||
<addon>
|
||||
<name>Repo Add-on 1</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test_AddonRepository_1@tests.mozilla.org</guid>
|
||||
<version>2.1</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Repo Add-on 1 - Creator</name>
|
||||
<link>http://localhost:4444/repo/1/creator.html</link>
|
||||
</author>
|
||||
<author>
|
||||
<name>Repo Add-on 1 - First Developer</name>
|
||||
<link>http://localhost:4444/repo/1/firstDeveloper.html</link>
|
||||
</author>
|
||||
<author>
|
||||
<name>Repo Add-on 1 - Second Developer</name>
|
||||
<link>http://localhost:4444/repo/1/secondDeveloper.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<summary>Repo Add-on 1 - Description<br>Second line</summary>
|
||||
<description><p>Repo Add-on 1 - Full Description &amp; some extra</p></description>
|
||||
<eula>Repo Add-on 1 - EULA</eula>
|
||||
<developer_comments>Repo Add-on 1
|
||||
Developer Comments</developer_comments>
|
||||
<icon size="32">http://localhost/repo/1/icon.png</icon>
|
||||
<status id="4">Public</status>
|
||||
<rating>1</rating>
|
||||
<learnmore>http://localhost/repo/1/learnmore.html</learnmore>
|
||||
<homepage>http://localhost/repo/1/homepage.html</homepage>
|
||||
<support>http://localhost/repo/1/support.html</support>
|
||||
<contribution_data>
|
||||
<link>http://localhost/repo/1/contribution.html</link>
|
||||
<suggested_amount currency="USD">$11.11</suggested_amount>
|
||||
<meet_developers>http://localhost/repo/1/meetDevelopers.html</meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num="1111">http://localhost/repo/1/review.html</reviews>
|
||||
<total_downloads>2221</total_downloads>
|
||||
<weekly_downloads>3331</weekly_downloads>
|
||||
<daily_users>4441</daily_users>
|
||||
<last_updated epoch="9">1970-01-01T00:00:09Z</last_updated>
|
||||
<install size="9">http://localhost:4444/repo/1/install.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>Repo Add-on 2</name>
|
||||
<type id="2">Theme</type>
|
||||
<guid>test_AddonRepository_2@tests.mozilla.org</guid>
|
||||
<version>2.2</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Repo Add-on 2 - Creator</name>
|
||||
<link>http://localhost:4444/repo/2/creator.html</link>
|
||||
</author>
|
||||
<author>
|
||||
<name>Repo Add-on 2 - First Developer</name>
|
||||
<link>http://localhost:4444/repo/2/firstDeveloper.html</link>
|
||||
</author>
|
||||
<author>
|
||||
<name>Repo Add-on 2 - Second Developer</name>
|
||||
<link>http://localhost:4444/repo/2/secondDeveloper.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<summary>Repo Add-on 2 - Description</summary>
|
||||
<description>Repo Add-on 2 - Full Description</description>
|
||||
<eula>Repo Add-on 2 - EULA</eula>
|
||||
<developer_comments>Repo Add-on 2 - Developer Comments</developer_comments>
|
||||
<icon size="32">http://localhost/repo/2/icon.png</icon>
|
||||
<status id="9">Unknown</status>
|
||||
<previews>
|
||||
<preview primary="1">
|
||||
<full type="image/png">http://localhost:4444/repo/2/firstFull.png</full>
|
||||
<thumbnail type="image/png">http://localhost:4444/repo/2/firstThumbnail.png</thumbnail>
|
||||
<caption>Repo Add-on 2 - First Caption</caption>
|
||||
</preview>
|
||||
<preview primary="0">
|
||||
<full type="image/png">http://localhost:4444/repo/2/secondFull.png</full>
|
||||
<thumbnail type="image/png">http://localhost:4444/repo/2/secondThumbnail.png</thumbnail>
|
||||
<caption>Repo Add-on 2 - Second Caption</caption>
|
||||
</preview>
|
||||
</previews>
|
||||
<rating>2</rating>
|
||||
<learnmore>http://localhost/repo/2/learnmore.html</learnmore>
|
||||
<homepage>http://localhost/repo/2/homepage.html</homepage>
|
||||
<support>http://localhost/repo/2/support.html</support>
|
||||
<contribution_data>
|
||||
<link>http://localhost/repo/2/contribution.html</link>
|
||||
<meet_developers>http://localhost/repo/2/meetDevelopers.html</meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num="1112">http://localhost/repo/2/review.html</reviews>
|
||||
<total_downloads>2222</total_downloads>
|
||||
<weekly_downloads>3332</weekly_downloads>
|
||||
<daily_users>4442</daily_users>
|
||||
<last_updated epoch="9">1970-01-01T00:00:09Z</last_updated>
|
||||
<install size="9">http://localhost:4444/repo/2/install.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>Repo Add-on 3</name>
|
||||
<type id="2">Theme</type>
|
||||
<guid>test_AddonRepository_3@tests.mozilla.org</guid>
|
||||
<version>2.3</version>
|
||||
<icon size="32">http://localhost/repo/3/icon.png</icon>
|
||||
<previews>
|
||||
<preview primary="1">
|
||||
<full type="image/png">http://localhost:4444/repo/3/firstFull.png</full>
|
||||
<thumbnail type="image/png">http://localhost:4444/repo/3/firstThumbnail.png</thumbnail>
|
||||
<caption>Repo Add-on 3 - First Caption</caption>
|
||||
</preview>
|
||||
<preview primary="0">
|
||||
<full type="image/png">http://localhost:4444/repo/3/secondFull.png</full>
|
||||
<thumbnail type="image/png">http://localhost:4444/repo/3/secondThumbnail.png</thumbnail>
|
||||
<caption>Repo Add-on 3 - Second Caption</caption>
|
||||
</preview>
|
||||
</previews>
|
||||
</addon>
|
||||
|
||||
<addon_compatibility hosted="true" id="123">
|
||||
<guid>test_AddonRepository_1@tests.mozilla.org</guid>
|
||||
<name>PASS</name>
|
||||
<version_ranges>
|
||||
<!-- Will be included -->
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.1</min_version>
|
||||
<max_version>0.2</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<application_id>666</application_id>
|
||||
<min_version>3.0</min_version>
|
||||
<max_version>4.0</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
<!-- Will be included -->
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.2</min_version>
|
||||
<max_version>0.3</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<application_id>666</application_id>
|
||||
<min_version>5.0</min_version>
|
||||
<max_version>6.0</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
<!-- Won't be included - invalid type attribute -->
|
||||
<version_range type="unknown">
|
||||
<min_version>9</min_version>
|
||||
<max_version>10</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<application_id>666</application_id>
|
||||
<min_version>10.0</min_version>
|
||||
<max_version>11.0</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
<!-- Won't be included - no matching appID -->
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.2</min_version>
|
||||
<max_version>0.3</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>Unknown App</name>
|
||||
<application_id>123</application_id>
|
||||
<min_version>1.0</min_version>
|
||||
<max_version>999.0</max_version>
|
||||
<appID>unknown-app@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
</searchresults>
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"page_size": 25,
|
||||
"page_count": 1,
|
||||
"count": 4,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "PASS",
|
||||
"addon_guid": "test_AddonRepository_1@tests.mozilla.org",
|
||||
"version_ranges": [
|
||||
{
|
||||
"addon_min_version": "0.1",
|
||||
"addon_max_version": "0.2",
|
||||
"applications": [
|
||||
{
|
||||
"name": "XPCShell",
|
||||
"guid": "xpcshell@tests.mozilla.org",
|
||||
"min_version": "3.0",
|
||||
"max_version": "4.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"addon_min_version": "0.2",
|
||||
"addon_max_version": "0.3",
|
||||
"applications": [
|
||||
{
|
||||
"name": "XPCShell",
|
||||
"guid": "xpcshell@tests.mozilla.org",
|
||||
"min_version": "5.0",
|
||||
"max_version": "6.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"addon_min_version": "0.2",
|
||||
"addon_max_version": "0.3",
|
||||
"applications": [
|
||||
{
|
||||
"name": "Unknown App",
|
||||
"guid": "unknown-app@tests.mozilla.org",
|
||||
"min_version": "1.0",
|
||||
"max_version": "999.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"page_size": 25,
|
||||
"count": 0,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": []
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="9999" />
|
||||
|
|
@ -0,0 +1 @@
|
|||
this should yield a json parse error
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="9999">
|
||||
<!-- Cause XML parse error so that the search fails -->
|
||||
<!-- <addon> -->
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.1</version>
|
||||
<authors><author><name>Test Creator 1</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test1.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
"page_size": 25,
|
||||
"page_count": 1,
|
||||
"count": 4,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "PASS",
|
||||
"type": "extension",
|
||||
"guid": "test1@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.1",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"url": "http://localhost:%PORT%/addons/test_AddonRepository_2.xpi",
|
||||
"size": 5555
|
||||
}
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Test Creator 1",
|
||||
"url": "http://localhost:%PORT%/creator1.html"
|
||||
},
|
||||
{
|
||||
"name": "Test Developer 1",
|
||||
"url": "http://localhost:%PORT%/developer1.html"
|
||||
}
|
||||
],
|
||||
"summary": "Test Summary 1",
|
||||
"description": "Test Description 1",
|
||||
"icons": {
|
||||
"32": "http://localhost:%PORT%/icon1.png"
|
||||
},
|
||||
"previews": [
|
||||
{
|
||||
"caption": "Caption 1 - 1",
|
||||
"image_size": [400, 300],
|
||||
"image_url": "http://localhost:%PORT%/full1-1.png",
|
||||
"thumbnail_size": [200, 150],
|
||||
"thumbnail_url": "http://localhost:%PORT%/thumbnail1-1.png"
|
||||
},
|
||||
{
|
||||
"caption": "Caption 2 - 1",
|
||||
"image_url": "http://localhost:%PORT%/full2-1.png",
|
||||
"thumbnail_url": "http://localhost:%PORT%/thumbnail2-1.png"
|
||||
}
|
||||
],
|
||||
"ratings": {
|
||||
"count": 1111,
|
||||
"average": 4
|
||||
},
|
||||
"ratings_url": "http://localhost:%PORT%/review1.html",
|
||||
"support_url": "http://localhost:%PORT%/support1.html",
|
||||
"contributions_url": "http://localhost:%PORT%/contribution1.html",
|
||||
"weekly_downloads": 3333,
|
||||
"last_updated": "2010-02-01T14:04:05Z"
|
||||
},
|
||||
{
|
||||
"name": "FAIL",
|
||||
"type": "extension",
|
||||
"guid": "notRequested@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.3",
|
||||
"files": [
|
||||
{
|
||||
"platform": "all",
|
||||
"url": "http://localhost:%PORT%/test3.xpi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Test Creator 3"
|
||||
}
|
||||
],
|
||||
"summary": "Add-on with a guid that wasn't requested should be ignored."
|
||||
},
|
||||
{
|
||||
"name": "PASS",
|
||||
"type": "theme",
|
||||
"guid": "test_AddonRepository_1@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.4",
|
||||
"files": [
|
||||
{
|
||||
"platform": "UNKNOWN1",
|
||||
"url": "http://localhost:%PORT%/test4.xpi"
|
||||
},
|
||||
{
|
||||
"platform": "UNKNOWN2",
|
||||
"url": "http://localhost:%PORT%/test4.xpi"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="1111">
|
||||
<!-- Passes even though XPI URL matches an installing AddonInstall.
|
||||
Tests optional attributes. -->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.1</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator 1</name>
|
||||
<link>http://localhost:%PORT%/creator1.html</link>
|
||||
</author>
|
||||
<author>
|
||||
<name>Test Developer 1</name>
|
||||
<link>http://localhost:%PORT%/developer1.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<summary>Test Summary 1</summary>
|
||||
<description>Test Description 1</description>
|
||||
<eula>Test EULA 1</eula>
|
||||
<developer_comments>Test Developer Comments 1</developer_comments>
|
||||
<icon size="32">http://localhost:%PORT%/icon1.png</icon>
|
||||
<status id="8">Preliminarily Reviewed</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<previews>
|
||||
<preview primary="1">
|
||||
<full type="image/png" width="400" height="300">
|
||||
http://localhost:%PORT%/full1-1.png
|
||||
</full>
|
||||
<thumbnail type="image/png" width="200" height="150">
|
||||
http://localhost:%PORT%/thumbnail1-1.png
|
||||
</thumbnail>
|
||||
<caption>Caption 1 - 1</caption>
|
||||
</preview>
|
||||
<preview primary="0">
|
||||
<full type="image/png">http://localhost:%PORT%/full2-1.png</full>
|
||||
<thumbnail type="image/png">http://localhost:%PORT%/thumbnail2-1.png</thumbnail>
|
||||
<caption>Caption 2 - 1</caption>
|
||||
</preview>
|
||||
</previews>
|
||||
<rating>4</rating>
|
||||
<learnmore>http://localhost:%PORT%/learnmore1.html</learnmore>
|
||||
<support>http://localhost:%PORT%/support1.html</support>
|
||||
<contribution_data>
|
||||
<link>http://localhost:%PORT%/contribution1.html</link>
|
||||
<suggested_amount currency="USD">$11.11</suggested_amount>
|
||||
<meet_developers>http://localhost:%PORT%/meetDevelopers1.html</meet_developers>
|
||||
</contribution_data>
|
||||
<reviews num="1111">http://localhost:%PORT%/review1.html</reviews>
|
||||
<total_downloads>2222</total_downloads>
|
||||
<weekly_downloads>3333</weekly_downloads>
|
||||
<daily_users>4444</daily_users>
|
||||
<last_updated epoch="1265033045">2010-02-01T14:04:05Z</last_updated>
|
||||
<install size="5555">http://localhost:%PORT%/addons/test_AddonRepository_2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon_compatibility hosted="true" id="123">
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<name>PASS</name>
|
||||
<version_ranges>
|
||||
<!-- Will be included -->
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.1</min_version>
|
||||
<max_version>0.2</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<application_id>666</application_id>
|
||||
<min_version>3.0</min_version>
|
||||
<max_version>4.0</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
<!-- Will be included -->
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.2</min_version>
|
||||
<max_version>0.3</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<application_id>666</application_id>
|
||||
<min_version>5.0</min_version>
|
||||
<max_version>6.0</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
<!-- Won't be included - invalid type attribute -->
|
||||
<version_range type="unknown">
|
||||
<min_version>9</min_version>
|
||||
<max_version>10</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<application_id>666</application_id>
|
||||
<min_version>10.0</min_version>
|
||||
<max_version>11.0</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
<!-- Won't be included - no matching appID -->
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.2</min_version>
|
||||
<max_version>0.3</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>Unknown App</name>
|
||||
<application_id>123</application_id>
|
||||
<min_version>1.0</min_version>
|
||||
<max_version>999.0</max_version>
|
||||
<appID>unknown-app@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
|
||||
<!-- Fails because guid matches previously successful result -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>test1@tests.mozilla.org</guid>
|
||||
<version>1.2</version>
|
||||
<authors><author><name>Test Creator 2</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with a guid that matches a previously successful result should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Fails because guid was not requested -->
|
||||
<addon>
|
||||
<name>FAIL</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>notRequested@tests.mozilla.org</guid>
|
||||
<version>1.3</version>
|
||||
<authors><author><name>Test Creator 3</name></author></authors>
|
||||
<status id="4">Public</status>
|
||||
<summary>Add-on with a guid that wasn't requested should be ignored.</summary>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://localhost:%PORT%/test3.xpi</install>
|
||||
</addon>
|
||||
|
||||
<!-- Passes even though guid matches already installed add-on,
|
||||
type is unknown, no defined author elements, status is not Public,
|
||||
no compatible applications matched, no installs compatible with OS
|
||||
-->
|
||||
<addon>
|
||||
<name>PASS</name>
|
||||
<type id="2">Theme</type>
|
||||
<guid>test_AddonRepository_1@tests.mozilla.org</guid>
|
||||
<version>1.4</version>
|
||||
<status id="9999">Unknown</status>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>unknown@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install os="UNKNOWN1">http://localhost:%PORT%/test4.xpi</install>
|
||||
<install os="UNKNOWN2">http://localhost:%PORT%/test4.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
||||
|
|
@ -1,228 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="9">
|
||||
<addon>
|
||||
<name>Test addon 2</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon2@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
</addon>
|
||||
|
||||
<addon>
|
||||
<name>Test addon 3</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon3@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
</addon>
|
||||
<addon_compatibility hosted="true">
|
||||
<name>Test addon 3</name>
|
||||
<guid>addon3@tests.mozilla.org</guid>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.9</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
|
||||
<addon>
|
||||
<name>Test addon 4</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon4@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
</addon>
|
||||
<addon_compatibility hosted="true">
|
||||
<name>Test addon 4</name>
|
||||
<guid>addon4@tests.mozilla.org</guid>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.9</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
|
||||
<addon>
|
||||
<name>Test addon 5</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon5@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
</addon>
|
||||
<addon_compatibility hosted="true">
|
||||
<name>Test addon 5</name>
|
||||
<guid>addon5@tests.mozilla.org</guid>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.9</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>Unknown App</name>
|
||||
<appID>unknown-app@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
|
||||
<addon>
|
||||
<name>Test addon 6</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon6@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
</addon>
|
||||
<addon_compatibility hosted="true">
|
||||
<name>Test addon 6</name>
|
||||
<guid>addon6@tests.mozilla.org</guid>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.5</min_version>
|
||||
<max_version>0.9</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
|
||||
<addon>
|
||||
<name>Test addon 7</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon7@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
</addon>
|
||||
<addon_compatibility hosted="true">
|
||||
<name>Test addon 7</name>
|
||||
<guid>addon7@tests.mozilla.org</guid>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.5</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>0.1</min_version>
|
||||
<max_version>0.9</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
|
||||
<addon>
|
||||
<name>Test addon 8</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon8@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
</addon>
|
||||
<addon_compatibility hosted="true">
|
||||
<name>Test addon 8</name>
|
||||
<guid>addon8@tests.mozilla.org</guid>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>6</min_version>
|
||||
<max_version>6.2</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>0.9</min_version>
|
||||
<max_version>9</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.5</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>0.1</min_version>
|
||||
<max_version>9</max_version>
|
||||
</application>
|
||||
<application>
|
||||
<name>Unknown app</name>
|
||||
<appID>unknown-app@tests.mozilla.org</appID>
|
||||
<min_version>0.1</min_version>
|
||||
<max_version>9</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.1</min_version>
|
||||
<max_version>0.2</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>0.1</min_version>
|
||||
<max_version>0.9</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
|
||||
<addon_compatibility hosted="false">
|
||||
<name>Test addon 9</name>
|
||||
<guid>addon9@tests.mozilla.org</guid>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>0.5</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
|
||||
<addon_compatibility hosted="false">
|
||||
<name>Test addon 10</name>
|
||||
<guid>addon10@tests.mozilla.org</guid>
|
||||
<version_ranges>
|
||||
<version_range type="compatible">
|
||||
<min_version>0.5</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>2</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
|
||||
</searchresults>
|
|
@ -1,53 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="1">
|
||||
<addon>
|
||||
<name>Real Test 2</name>
|
||||
<type id='1'>Extension</type>
|
||||
<guid>addon2@tests.mozilla.org</guid>
|
||||
<version>1.0</version>
|
||||
<authors>
|
||||
<author>
|
||||
<name>Test Creator</name>
|
||||
<link>http://example.com/creator.html</link>
|
||||
</author>
|
||||
</authors>
|
||||
<status id='4'>Public</status>
|
||||
<summary>Repository summary</summary>
|
||||
<description>Repository description</description>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>Firefox</name>
|
||||
<appID>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</appID>
|
||||
<min_version>0</min_version>
|
||||
<max_version>*</max_version>
|
||||
</application>
|
||||
<application>
|
||||
<name>SeaMonkey</name>
|
||||
<appID>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</appID>
|
||||
<min_version>0</min_version>
|
||||
<max_version>*</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<compatible_os>ALL</compatible_os>
|
||||
<install size="2">http://example.com/browser/toolkit/mozapps/extensions/test/browser/addons/browser_install1_2.xpi</install>
|
||||
</addon>
|
||||
|
||||
<addon_compatibility hosted="false">
|
||||
<guid>addon6@tests.mozilla.org</guid>
|
||||
<name>Addon Test 6</name>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>1.0</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<min_version>1.0</min_version>
|
||||
<max_version>1.0</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
</searchresults>
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"page_size": 25,
|
||||
"page_count": 1,
|
||||
"count": 1,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "Real Test 2",
|
||||
"type": "extension",
|
||||
"guid": "addon2@tests.mozilla.org",
|
||||
"current_version": {
|
||||
"version": "1.0",
|
||||
"files": [
|
||||
{
|
||||
"size": 2,
|
||||
"url": "http://example.com/browser/toolkit/mozapps/extensions/test/browser/addons/browser_install1_2.xpi"
|
||||
}
|
||||
]
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Test Creator",
|
||||
"url": "http://example.com/creator.html"
|
||||
}
|
||||
],
|
||||
"summary": "Repository summary",
|
||||
"description": "Repository description"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"page_size": 25,
|
||||
"page_count": 1,
|
||||
"count": 1,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": [
|
||||
{
|
||||
"addon_guid": "addon6@tests.mozilla.org",
|
||||
"name": "Addon Test 6",
|
||||
"version_ranges": [
|
||||
{
|
||||
"addon_min_version": "1.0",
|
||||
"addon_max_version": "1.0",
|
||||
"applications": [
|
||||
{
|
||||
"name": "XPCShell",
|
||||
"guid": "xpcshell@tests.mozilla.org",
|
||||
"min_version": "1.0",
|
||||
"max_version": "1.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="1">
|
||||
<!-- Passes all requirements -->
|
||||
<addon>
|
||||
<name>Test</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon@tests.mozilla.org</guid>
|
||||
<version>1</version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
<install>http://www.example.com/testaddon.xpi</install>
|
||||
</addon>
|
||||
</searchresults>
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<searchresults total_results="11">
|
||||
<addon>
|
||||
<name>Test Addon 9</name>
|
||||
<type id="1">Extension</type>
|
||||
<guid>addon9@tests.mozilla.org</guid>
|
||||
</addon>
|
||||
<addon_compatibility hosted="true">
|
||||
<guid>addon9@tests.mozilla.org</guid>
|
||||
<name>Test Addon 9</name>
|
||||
<version_ranges>
|
||||
<version_range type="incompatible">
|
||||
<min_version>4</min_version>
|
||||
<max_version>4</max_version>
|
||||
<compatible_applications>
|
||||
<application>
|
||||
<name>XPCShell</name>
|
||||
<min_version>1</min_version>
|
||||
<max_version>1</max_version>
|
||||
<appID>xpcshell@tests.mozilla.org</appID>
|
||||
</application>
|
||||
</compatible_applications>
|
||||
</version_range>
|
||||
</version_ranges>
|
||||
</addon_compatibility>
|
||||
</searchresults>
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"page_size": 25,
|
||||
"page_count": 1,
|
||||
"count": 1,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": [
|
||||
{
|
||||
"name": "Ttest Addon 9",
|
||||
"type": "extension",
|
||||
"guid": "addon9@tests.mozilla.org"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"page_size": 25,
|
||||
"page_count": 1,
|
||||
"count": 1,
|
||||
"next": null,
|
||||
"previous": null,
|
||||
"results": [
|
||||
{
|
||||
"addon_guid": "addon9@tests.mozilla.org",
|
||||
"name": "Test Addon 9",
|
||||
"version_ranges": [
|
||||
{
|
||||
"addon_min_version": "4",
|
||||
"addon_max_version": "4",
|
||||
"applications": [
|
||||
{
|
||||
"name": "XPCShell",
|
||||
"id": "XPCShell",
|
||||
"guid": "xpcshell@tests.mozilla.org",
|
||||
"min_version": "1",
|
||||
"max_version": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -18,7 +18,7 @@ const PREF_EM_STRICT_COMPATIBILITY = "extensions.strictCompatibility";
|
|||
const PREF_EM_MIN_COMPAT_APP_VERSION = "extensions.minCompatibleAppVersion";
|
||||
const PREF_EM_MIN_COMPAT_PLATFORM_VERSION = "extensions.minCompatiblePlatformVersion";
|
||||
const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
|
||||
const PREF_GETADDONS_BYIDS_PERFORMANCE = "extensions.getAddons.getWithPerformance.url";
|
||||
const PREF_COMPAT_OVERRIDES = "extensions.getAddons.compatOverides.url";
|
||||
const PREF_XPI_SIGNATURES_REQUIRED = "xpinstall.signatures.required";
|
||||
const PREF_SYSTEM_ADDON_SET = "extensions.systemAddonSet";
|
||||
const PREF_SYSTEM_ADDON_UPDATE_URL = "extensions.systemAddon.update.url";
|
||||
|
|
|
@ -27,14 +27,12 @@ const INSTALL_URL3 = "/addons/test_AddonRepository_3.xpi";
|
|||
// Properties of an individual add-on that should be checked
|
||||
// Note: name is checked separately
|
||||
var ADDON_PROPERTIES = ["id", "type", "version", "creator", "developers",
|
||||
"description", "fullDescription", "developerComments",
|
||||
"eula", "iconURL", "icons", "screenshots", "homepageURL",
|
||||
"supportURL", "contributionURL", "contributionAmount",
|
||||
"description", "fullDescription",
|
||||
"iconURL", "icons", "screenshots",
|
||||
"supportURL", "contributionURL",
|
||||
"averageRating", "reviewCount", "reviewURL",
|
||||
"totalDownloads", "weeklyDownloads", "dailyUsers",
|
||||
"sourceURI", "repositoryStatus", "size", "updateDate",
|
||||
"purchaseURL", "purchaseAmount", "purchaseDisplayAmount",
|
||||
"compatibilityOverrides"];
|
||||
"weeklyDownloads", "dailyUsers",
|
||||
"sourceURI", "size", "updateDate"];
|
||||
|
||||
// Results of getAddonsByIDs
|
||||
var GET_RESULTS = [{
|
||||
|
@ -51,8 +49,6 @@ var GET_RESULTS = [{
|
|||
}],
|
||||
description: "Test Summary 1",
|
||||
fullDescription: "Test Description 1",
|
||||
developerComments: "Test Developer Comments 1",
|
||||
eula: "Test EULA 1",
|
||||
iconURL: BASE_URL + "/icon1.png",
|
||||
icons: { "32": BASE_URL + "/icon1.png" },
|
||||
screenshots: [{
|
||||
|
@ -68,64 +64,38 @@ var GET_RESULTS = [{
|
|||
thumbnailURL: BASE_URL + "/thumbnail2-1.png",
|
||||
caption: "Caption 2 - 1"
|
||||
}],
|
||||
homepageURL: BASE_URL + "/learnmore1.html",
|
||||
learnmoreURL: BASE_URL + "/learnmore1.html",
|
||||
supportURL: BASE_URL + "/support1.html",
|
||||
contributionURL: BASE_URL + "/meetDevelopers1.html",
|
||||
contributionAmount: "$11.11",
|
||||
contributionURL: BASE_URL + "/contribution1.html",
|
||||
averageRating: 4,
|
||||
reviewCount: 1111,
|
||||
reviewURL: BASE_URL + "/review1.html",
|
||||
totalDownloads: 2222,
|
||||
weeklyDownloads: 3333,
|
||||
dailyUsers: 4444,
|
||||
sourceURI: BASE_URL + INSTALL_URL2,
|
||||
repositoryStatus: 8,
|
||||
size: 5555,
|
||||
updateDate: new Date(1265033045000),
|
||||
compatibilityOverrides: [{
|
||||
type: "incompatible",
|
||||
minVersion: 0.1,
|
||||
maxVersion: 0.2,
|
||||
appID: "xpcshell@tests.mozilla.org",
|
||||
appMinVersion: 3.0,
|
||||
appMaxVersion: 4.0
|
||||
}, {
|
||||
type: "incompatible",
|
||||
minVersion: 0.2,
|
||||
maxVersion: 0.3,
|
||||
appID: "xpcshell@tests.mozilla.org",
|
||||
appMinVersion: 5.0,
|
||||
appMaxVersion: 6.0
|
||||
}]
|
||||
}, {
|
||||
id: "test_AddonRepository_1@tests.mozilla.org",
|
||||
type: "theme",
|
||||
version: "1.4",
|
||||
repositoryStatus: 9999,
|
||||
icons: {}
|
||||
}];
|
||||
|
||||
// Values for testing AddonRepository.getAddonsByIDs()
|
||||
var GET_TEST = {
|
||||
preference: PREF_GETADDONS_BYIDS,
|
||||
preferenceValue: BASE_URL + "/%OS%/%VERSION%/%API_VERSION%/" +
|
||||
"%API_VERSION%/%IDS%",
|
||||
preferenceValue: BASE_URL + "/%OS%/%VERSION%/%IDS%",
|
||||
failedIDs: ["test1@tests.mozilla.org"],
|
||||
failedURL: "/XPCShell/1/1.5/1.5/test1%40tests.mozilla.org",
|
||||
failedURL: "/XPCShell/1/test1%40tests.mozilla.org",
|
||||
successfulIDs: ["test1@tests.mozilla.org",
|
||||
"{00000000-1111-2222-3333-444444444444}",
|
||||
"test_AddonRepository_1@tests.mozilla.org"],
|
||||
successfulURL: "/XPCShell/1/1.5/1.5/test1%40tests.mozilla.org," +
|
||||
"%7B00000000-1111-2222-3333-444444444444%7D," +
|
||||
successfulURL: "/XPCShell/1/test1%40tests.mozilla.org%2C" +
|
||||
"%7B00000000-1111-2222-3333-444444444444%7D%2C" +
|
||||
"test_AddonRepository_1%40tests.mozilla.org"
|
||||
};
|
||||
|
||||
// Test that actual results and expected results are equal
|
||||
function check_results(aActualAddons, aExpectedAddons, aAddonCount, aInstallNull) {
|
||||
Assert.ok(!AddonRepository.isSearching);
|
||||
|
||||
Assert.equal(aActualAddons.length, aAddonCount);
|
||||
function check_results(aActualAddons, aExpectedAddons) {
|
||||
do_check_addons(aActualAddons, aExpectedAddons, ADDON_PROPERTIES);
|
||||
|
||||
// Additional tests
|
||||
|
@ -136,56 +106,9 @@ function check_results(aActualAddons, aExpectedAddons, aAddonCount, aInstallNull
|
|||
if (aActualAddon.name != "PASS")
|
||||
do_throw(aActualAddon.id + " - invalid add-on name " + aActualAddon.name);
|
||||
|
||||
Assert.equal(aActualAddon.install == null, !!aInstallNull || !aActualAddon.sourceURI);
|
||||
|
||||
// Check that sourceURI property consistent within actual addon
|
||||
if (aActualAddon.install)
|
||||
Assert.equal(aActualAddon.install.sourceURI.spec, aActualAddon.sourceURI.spec);
|
||||
});
|
||||
}
|
||||
|
||||
// Complete a search, also testing cancelSearch() and isSearching
|
||||
function complete_search(aSearch, aSearchCallback) {
|
||||
var failCallback = {
|
||||
searchSucceeded(addons, length, total) {
|
||||
do_throw("failCallback.searchSucceeded should not be called");
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed() {
|
||||
do_throw("failCallback.searchFailed should not be called");
|
||||
end_test();
|
||||
}
|
||||
};
|
||||
|
||||
var callbackCalled = false;
|
||||
var testCallback = {
|
||||
searchSucceeded(addons, length, total) {
|
||||
do_throw("testCallback.searchSucceeded should not be called");
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed() {
|
||||
callbackCalled = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Should fail because cancelled it immediately
|
||||
aSearch(failCallback);
|
||||
Assert.ok(AddonRepository.isSearching);
|
||||
AddonRepository.cancelSearch();
|
||||
Assert.ok(!AddonRepository.isSearching);
|
||||
|
||||
aSearch(aSearchCallback);
|
||||
Assert.ok(AddonRepository.isSearching);
|
||||
|
||||
// searchFailed should be called immediately because already searching
|
||||
aSearch(testCallback);
|
||||
Assert.ok(callbackCalled);
|
||||
Assert.ok(AddonRepository.isSearching);
|
||||
}
|
||||
|
||||
|
||||
function run_test() {
|
||||
// Setup for test
|
||||
do_test_pending();
|
||||
|
@ -205,12 +128,12 @@ function run_test() {
|
|||
|
||||
// Register files used to test search failure
|
||||
mapUrlToFile(GET_TEST.failedURL,
|
||||
do_get_file("data/test_AddonRepository_failed.xml"),
|
||||
do_get_file("data/test_AddonRepository_fail.json"),
|
||||
gServer);
|
||||
|
||||
// Register files used to test search success
|
||||
mapUrlToFile(GET_TEST.successfulURL,
|
||||
do_get_file("data/test_AddonRepository_getAddonsByIDs.xml"),
|
||||
do_get_file("data/test_AddonRepository_getAddonsByIDs.json"),
|
||||
gServer);
|
||||
|
||||
// Create an active AddonInstall so can check that it isn't returned in the results
|
||||
|
@ -312,39 +235,21 @@ function run_test_1() {
|
|||
// Tests failure of AddonRepository.getAddonsByIDs()
|
||||
function run_test_getAddonsByID_fails() {
|
||||
Services.prefs.setCharPref(GET_TEST.preference, GET_TEST.preferenceValue);
|
||||
var callback = {
|
||||
searchSucceeded(aAddonsList, aAddonCount, aTotalResults) {
|
||||
do_throw("searchAddons should not have succeeded");
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed() {
|
||||
Assert.ok(!AddonRepository.isSearching);
|
||||
run_test_getAddonsByID_succeeds();
|
||||
}
|
||||
};
|
||||
|
||||
complete_search(function complete_search_fail_callback(aCallback) {
|
||||
AddonRepository.getAddonsByIDs(GET_TEST.failedIDs, aCallback);
|
||||
}, callback);
|
||||
AddonRepository.getAddonsByIDs(GET_TEST.failedIDs).then(result => {
|
||||
do_throw("getAddonsByIDs should not have succeeded");
|
||||
end_test();
|
||||
}).catch(err => {
|
||||
run_test_getAddonsByID_succeeds();
|
||||
});
|
||||
}
|
||||
|
||||
// Tests success of AddonRepository.getAddonsByIDs()
|
||||
function run_test_getAddonsByID_succeeds() {
|
||||
var callback = {
|
||||
searchSucceeded(aAddonsList, aAddonCount, aTotalResults) {
|
||||
Assert.equal(aTotalResults, -1);
|
||||
check_results(aAddonsList, GET_RESULTS, aAddonCount, true);
|
||||
end_test();
|
||||
},
|
||||
|
||||
searchFailed() {
|
||||
do_throw("searchAddons should not have failed");
|
||||
end_test();
|
||||
}
|
||||
};
|
||||
|
||||
complete_search(function complete_search_succeed_callback(aCallback) {
|
||||
AddonRepository.getAddonsByIDs(GET_TEST.successfulIDs, aCallback);
|
||||
}, callback);
|
||||
AddonRepository.getAddonsByIDs(GET_TEST.successfulIDs).then(result => {
|
||||
check_results(result, GET_RESULTS);
|
||||
end_test();
|
||||
}).catch(err => {
|
||||
do_throw(err);
|
||||
end_test();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,9 +13,10 @@ const BASE_URL = "http://localhost:" + PORT;
|
|||
|
||||
const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
|
||||
const PREF_GETADDONS_CACHE_TYPES = "extensions.getAddons.cache.types";
|
||||
const GETADDONS_RESULTS = BASE_URL + "/data/test_AddonRepository_cache.xml";
|
||||
const GETADDONS_EMPTY = BASE_URL + "/data/test_AddonRepository_empty.xml";
|
||||
const GETADDONS_FAILED = BASE_URL + "/data/test_AddonRepository_failed.xml";
|
||||
const GETADDONS_RESULTS = BASE_URL + "/data/test_AddonRepository_cache.json";
|
||||
const COMPAT_RESULTS = BASE_URL + "/data/test_AddonRepository_cache_compat.json";
|
||||
const EMPTY_RESULT = BASE_URL + "/data/test_AddonRepository_empty.json";
|
||||
const FAILED_RESULT = BASE_URL + "/data/test_AddonRepository_fail.json";
|
||||
|
||||
const FILE_DATABASE = "addons.json";
|
||||
const ADDON_NAMES = ["test_AddonRepository_1",
|
||||
|
@ -32,13 +33,11 @@ const PREF_ADDON1_CACHE_ENABLED = "extensions." + ADDON_IDS[1] + ".getAddons.cac
|
|||
const ADDON_PROPERTIES = ["id", "type", "name", "version", "creator",
|
||||
"developers", "translators", "contributors",
|
||||
"description", "fullDescription",
|
||||
"developerComments", "eula", "iconURL", "icons",
|
||||
"iconURL", "icons",
|
||||
"screenshots", "homepageURL", "supportURL",
|
||||
"optionsURL", "aboutURL", "contributionURL",
|
||||
"contributionAmount", "averageRating", "reviewCount",
|
||||
"reviewURL", "totalDownloads", "weeklyDownloads",
|
||||
"dailyUsers", "sourceURI", "repositoryStatus",
|
||||
"compatibilityOverrides"];
|
||||
"averageRating", "reviewCount",
|
||||
"reviewURL", "weeklyDownloads", "sourceURI"];
|
||||
|
||||
// The size and updateDate properties are annoying to test for XPI add-ons.
|
||||
// However, since we only care about whether the repository value vs. the
|
||||
|
@ -75,37 +74,16 @@ const REPOSITORY_ADDONS = [{
|
|||
}],
|
||||
description: "Repo Add-on 1 - Description\nSecond line",
|
||||
fullDescription: "Repo Add-on 1 - Full Description & some extra",
|
||||
developerComments: "Repo Add-on 1\nDeveloper Comments",
|
||||
eula: "Repo Add-on 1 - EULA",
|
||||
iconURL: BASE_URL + "/repo/1/icon.png",
|
||||
icons: { "32": BASE_URL + "/repo/1/icon.png" },
|
||||
homepageURL: BASE_URL + "/repo/1/homepage.html",
|
||||
supportURL: BASE_URL + "/repo/1/support.html",
|
||||
contributionURL: BASE_URL + "/repo/1/meetDevelopers.html",
|
||||
contributionAmount: "$11.11",
|
||||
averageRating: 1,
|
||||
reviewCount: 1111,
|
||||
reviewURL: BASE_URL + "/repo/1/review.html",
|
||||
totalDownloads: 2221,
|
||||
weeklyDownloads: 3331,
|
||||
dailyUsers: 4441,
|
||||
sourceURI: BASE_URL + "/repo/1/install.xpi",
|
||||
repositoryStatus: 4,
|
||||
compatibilityOverrides: [{
|
||||
type: "incompatible",
|
||||
minVersion: 0.1,
|
||||
maxVersion: 0.2,
|
||||
appID: "xpcshell@tests.mozilla.org",
|
||||
appMinVersion: 3.0,
|
||||
appMaxVersion: 4.0
|
||||
}, {
|
||||
type: "incompatible",
|
||||
minVersion: 0.2,
|
||||
maxVersion: 0.3,
|
||||
appID: "xpcshell@tests.mozilla.org",
|
||||
appMinVersion: 5.0,
|
||||
appMaxVersion: 6.0
|
||||
}]
|
||||
sourceURI: BASE_URL + "/repo/1/install.xpi"
|
||||
}, {
|
||||
id: ADDON_IDS[1],
|
||||
type: "theme",
|
||||
|
@ -124,8 +102,6 @@ const REPOSITORY_ADDONS = [{
|
|||
}],
|
||||
description: "Repo Add-on 2 - Description",
|
||||
fullDescription: "Repo Add-on 2 - Full Description",
|
||||
developerComments: "Repo Add-on 2 - Developer Comments",
|
||||
eula: "Repo Add-on 2 - EULA",
|
||||
iconURL: BASE_URL + "/repo/2/icon.png",
|
||||
icons: { "32": BASE_URL + "/repo/2/icon.png" },
|
||||
screenshots: [{
|
||||
|
@ -140,15 +116,11 @@ const REPOSITORY_ADDONS = [{
|
|||
homepageURL: BASE_URL + "/repo/2/homepage.html",
|
||||
supportURL: BASE_URL + "/repo/2/support.html",
|
||||
contributionURL: BASE_URL + "/repo/2/meetDevelopers.html",
|
||||
contributionAmount: null,
|
||||
averageRating: 2,
|
||||
reviewCount: 1112,
|
||||
reviewURL: BASE_URL + "/repo/2/review.html",
|
||||
totalDownloads: 2222,
|
||||
weeklyDownloads: 3332,
|
||||
dailyUsers: 4442,
|
||||
sourceURI: BASE_URL + "/repo/2/install.xpi",
|
||||
repositoryStatus: 9
|
||||
}, {
|
||||
id: ADDON_IDS[2],
|
||||
type: "theme",
|
||||
|
@ -229,7 +201,6 @@ const WITH_CACHE = [{
|
|||
{ name: "XPI Add-on 1 - Second Contributor" }],
|
||||
description: "XPI Add-on 1 - Description",
|
||||
fullDescription: "Repo Add-on 1 - Full Description & some extra",
|
||||
developerComments: "Repo Add-on 1\nDeveloper Comments",
|
||||
eula: "Repo Add-on 1 - EULA",
|
||||
iconURL: BASE_URL + "/xpi/1/icon.png",
|
||||
icons: { "32": BASE_URL + "/xpi/1/icon.png" },
|
||||
|
@ -247,21 +218,6 @@ const WITH_CACHE = [{
|
|||
dailyUsers: 4441,
|
||||
sourceURI: NetUtil.newURI(ADDON_FILES[0]).spec,
|
||||
repositoryStatus: 4,
|
||||
compatibilityOverrides: [{
|
||||
type: "incompatible",
|
||||
minVersion: 0.1,
|
||||
maxVersion: 0.2,
|
||||
appID: "xpcshell@tests.mozilla.org",
|
||||
appMinVersion: 3.0,
|
||||
appMaxVersion: 4.0
|
||||
}, {
|
||||
type: "incompatible",
|
||||
minVersion: 0.2,
|
||||
maxVersion: 0.3,
|
||||
appID: "xpcshell@tests.mozilla.org",
|
||||
appMinVersion: 5.0,
|
||||
appMaxVersion: 6.0
|
||||
}]
|
||||
}, {
|
||||
id: ADDON_IDS[1],
|
||||
type: "theme",
|
||||
|
@ -280,7 +236,6 @@ const WITH_CACHE = [{
|
|||
}],
|
||||
description: "Repo Add-on 2 - Description",
|
||||
fullDescription: "Repo Add-on 2 - Full Description",
|
||||
developerComments: "Repo Add-on 2 - Developer Comments",
|
||||
eula: "Repo Add-on 2 - EULA",
|
||||
iconURL: BASE_URL + "/repo/2/icon.png",
|
||||
icons: { "32": BASE_URL + "/repo/2/icon.png" },
|
||||
|
@ -346,7 +301,6 @@ const WITH_EXTENSION_CACHE = [{
|
|||
{ name: "XPI Add-on 1 - Second Contributor" }],
|
||||
description: "XPI Add-on 1 - Description",
|
||||
fullDescription: "Repo Add-on 1 - Full Description & some extra",
|
||||
developerComments: "Repo Add-on 1\nDeveloper Comments",
|
||||
eula: "Repo Add-on 1 - EULA",
|
||||
iconURL: BASE_URL + "/xpi/1/icon.png",
|
||||
icons: { "32": BASE_URL + "/xpi/1/icon.png" },
|
||||
|
@ -364,21 +318,6 @@ const WITH_EXTENSION_CACHE = [{
|
|||
dailyUsers: 4441,
|
||||
sourceURI: NetUtil.newURI(ADDON_FILES[0]).spec,
|
||||
repositoryStatus: 4,
|
||||
compatibilityOverrides: [{
|
||||
type: "incompatible",
|
||||
minVersion: 0.1,
|
||||
maxVersion: 0.2,
|
||||
appID: "xpcshell@tests.mozilla.org",
|
||||
appMinVersion: 3.0,
|
||||
appMaxVersion: 4.0
|
||||
}, {
|
||||
type: "incompatible",
|
||||
minVersion: 0.2,
|
||||
maxVersion: 0.3,
|
||||
appID: "xpcshell@tests.mozilla.org",
|
||||
appMinVersion: 5.0,
|
||||
appMaxVersion: 6.0
|
||||
}]
|
||||
}, {
|
||||
id: ADDON_IDS[1],
|
||||
type: "theme",
|
||||
|
@ -523,25 +462,28 @@ add_task(async function run_test_2() {
|
|||
add_task(async function run_test_3() {
|
||||
Assert.ok(gDBFile.exists());
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_FAILED);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, FAILED_RESULT);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES, FAILED_RESULT);
|
||||
|
||||
await AddonRepository.repopulateCache();
|
||||
await AddonRepository.backgroundUpdateCheck();
|
||||
await check_initialized_cache([false, false, false]);
|
||||
});
|
||||
|
||||
// Tests repopulateCache when search returns no results
|
||||
add_task(async function run_test_4() {
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_EMPTY);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, EMPTY_RESULT);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES, FAILED_RESULT);
|
||||
|
||||
await AddonRepository.repopulateCache();
|
||||
await AddonRepository.backgroundUpdateCheck();
|
||||
await check_initialized_cache([false, false, false]);
|
||||
});
|
||||
|
||||
// Tests repopulateCache when search returns results
|
||||
add_task(async function run_test_5() {
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_RESULTS);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES, COMPAT_RESULTS);
|
||||
|
||||
await AddonRepository.repopulateCache();
|
||||
await AddonRepository.backgroundUpdateCheck();
|
||||
await check_initialized_cache([true, true, true]);
|
||||
});
|
||||
|
||||
|
@ -549,7 +491,7 @@ add_task(async function run_test_5() {
|
|||
add_task(async function run_test_5_1() {
|
||||
Services.prefs.setBoolPref(PREF_ADDON0_CACHE_ENABLED, false);
|
||||
|
||||
await AddonRepository.repopulateCache();
|
||||
await AddonRepository.backgroundUpdateCheck();
|
||||
|
||||
// Reset pref for next test
|
||||
Services.prefs.setBoolPref(PREF_ADDON0_CACHE_ENABLED, true);
|
||||
|
@ -562,7 +504,7 @@ add_task(async function run_test_6() {
|
|||
Assert.ok(gDBFile.exists());
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, false);
|
||||
|
||||
await AddonRepository.repopulateCache();
|
||||
await AddonRepository.backgroundUpdateCheck();
|
||||
// Database should have been deleted
|
||||
Assert.ok(!gDBFile.exists());
|
||||
|
||||
|
@ -574,19 +516,17 @@ add_task(async function run_test_6() {
|
|||
// Tests cacheAddons when the search fails
|
||||
add_task(async function run_test_7() {
|
||||
Assert.ok(gDBFile.exists());
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_FAILED);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, FAILED_RESULT);
|
||||
|
||||
await new Promise((resolve, reject) =>
|
||||
AddonRepository.cacheAddons(ADDON_IDS, resolve));
|
||||
await AddonRepository.cacheAddons(ADDON_IDS);
|
||||
await check_initialized_cache([false, false, false]);
|
||||
});
|
||||
|
||||
// Tests cacheAddons when the search returns no results
|
||||
add_task(async function run_test_8() {
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_EMPTY);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, EMPTY_RESULT);
|
||||
|
||||
await new Promise((resolve, reject) =>
|
||||
AddonRepository.cacheAddons(ADDON_IDS, resolve));
|
||||
await AddonRepository.cacheAddons(ADDON_IDS);
|
||||
await check_initialized_cache([false, false, false]);
|
||||
});
|
||||
|
||||
|
@ -594,8 +534,7 @@ add_task(async function run_test_8() {
|
|||
add_task(async function run_test_9() {
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_RESULTS);
|
||||
|
||||
await new Promise((resolve, reject) =>
|
||||
AddonRepository.cacheAddons([ADDON_IDS[0]], resolve));
|
||||
await AddonRepository.cacheAddons([ADDON_IDS[0]]);
|
||||
await check_initialized_cache([true, false, false]);
|
||||
});
|
||||
|
||||
|
@ -603,8 +542,7 @@ add_task(async function run_test_9() {
|
|||
add_task(async function run_test_9_1() {
|
||||
Services.prefs.setBoolPref(PREF_ADDON1_CACHE_ENABLED, false);
|
||||
|
||||
await new Promise((resolve, reject) =>
|
||||
AddonRepository.cacheAddons(ADDON_IDS, resolve));
|
||||
await AddonRepository.cacheAddons(ADDON_IDS);
|
||||
|
||||
// Reset pref for next test
|
||||
Services.prefs.setBoolPref(PREF_ADDON1_CACHE_ENABLED, true);
|
||||
|
@ -614,8 +552,7 @@ add_task(async function run_test_9_1() {
|
|||
|
||||
// Tests cacheAddons for multiple add-ons, some already in the cache,
|
||||
add_task(async function run_test_10() {
|
||||
await new Promise((resolve, reject) =>
|
||||
AddonRepository.cacheAddons(ADDON_IDS, resolve));
|
||||
await AddonRepository.cacheAddons(ADDON_IDS);
|
||||
await check_initialized_cache([true, true, true]);
|
||||
});
|
||||
|
||||
|
@ -624,8 +561,7 @@ add_task(async function run_test_11() {
|
|||
Assert.ok(gDBFile.exists());
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, false);
|
||||
|
||||
await new Promise((resolve, reject) =>
|
||||
AddonRepository.cacheAddons(ADDON_IDS, resolve));
|
||||
await AddonRepository.cacheAddons(ADDON_IDS);
|
||||
Assert.ok(gDBFile.exists());
|
||||
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
|
@ -647,7 +583,7 @@ add_task(async function run_test_12() {
|
|||
// database, and that XPI add-ons still do not use any of repository properties
|
||||
add_task(async function run_test_13() {
|
||||
Assert.ok(gDBFile.exists());
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE, GETADDONS_EMPTY);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, EMPTY_RESULT);
|
||||
|
||||
await AddonManagerInternal.backgroundUpdateCheck();
|
||||
// Database should have been deleted
|
||||
|
@ -673,7 +609,7 @@ add_task(async function run_test_14() {
|
|||
// Tests that the XPI add-ons correctly use the repository properties when
|
||||
// caching is enabled and the repository information is available
|
||||
add_task(async function run_test_15() {
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE, GETADDONS_RESULTS);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_RESULTS);
|
||||
|
||||
await AddonManagerInternal.backgroundUpdateCheck();
|
||||
let aAddons = await promiseAddonsByIDs(ADDON_IDS);
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
|
||||
// Test that AMO api results that are returned in muliple pages are
|
||||
// properly handled.
|
||||
add_task(async function test_paged_api() {
|
||||
const MAX_ADDON = 3;
|
||||
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "2");
|
||||
|
||||
let testserver = createHttpServer();
|
||||
const PORT = testserver.identity.primaryPort;
|
||||
|
||||
const EMPTY_RESPONSE = {
|
||||
next: null,
|
||||
results: [],
|
||||
};
|
||||
|
||||
function name(n) { return `Addon ${n}`; }
|
||||
function id(n) { return `test${n}@tests.mozilla.org`; }
|
||||
function summary(n) { return `Summary for addon ${n}`; }
|
||||
function description(n) { return `Description for addon ${n}`; }
|
||||
|
||||
testserver.registerPathHandler("/empty", (request, response) => {
|
||||
response.setHeader("content-type", "application/json");
|
||||
response.write(JSON.stringify(EMPTY_RESPONSE));
|
||||
});
|
||||
|
||||
testserver.registerPrefixHandler("/addons/", (request, response) => {
|
||||
let [page, ] = /\d+/.exec(request.path);
|
||||
page = page ? parseInt(page, 10) : 0;
|
||||
page = Math.min(page, MAX_ADDON);
|
||||
|
||||
let result = {
|
||||
next: (page == MAX_ADDON) ? null : `http://localhost:${PORT}/addons/${page + 1}`,
|
||||
results: [
|
||||
{
|
||||
name: name(page),
|
||||
type: "extension",
|
||||
guid: id(page),
|
||||
summary: summary(page),
|
||||
description: description(page),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
response.setHeader("content-type", "application/json");
|
||||
response.write(JSON.stringify(result));
|
||||
});
|
||||
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, `http://localhost:${PORT}/addons/0`);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES, `http://localhost:${PORT}/empty`);
|
||||
|
||||
await promiseStartupManager();
|
||||
|
||||
for (let i = 0; i <= MAX_ADDON; i++) {
|
||||
await promiseInstallWebExtension({
|
||||
manifest: {
|
||||
applications: {gecko: {id: id(i)}},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
await AddonManagerInternal.backgroundUpdateCheck();
|
||||
|
||||
let ids = [];
|
||||
for (let i = 0; i <= MAX_ADDON; i++) {
|
||||
ids.push(id(i));
|
||||
}
|
||||
let addons = await AddonRepository.getAddonsByIDs(ids);
|
||||
|
||||
equal(addons.length, MAX_ADDON + 1);
|
||||
for (let i = 0; i <= MAX_ADDON; i++) {
|
||||
equal(addons[i].name, name(i));
|
||||
equal(addons[i].id, id(i));
|
||||
equal(addons[i].description, summary(i));
|
||||
equal(addons[i].fullDescription, description(i));
|
||||
}
|
||||
|
||||
await promiseShutdownManager();
|
||||
});
|
|
@ -14,15 +14,181 @@ gPort = gServer.identity.primaryPort;
|
|||
|
||||
const PORT = gPort;
|
||||
const BASE_URL = "http://localhost:" + PORT;
|
||||
const REQ_URL = "/data.xml";
|
||||
|
||||
// register static file and mark it for interpolation
|
||||
mapUrlToFile(REQ_URL, do_get_file("data/test_compatoverrides.xml"), gServer);
|
||||
const GETADDONS_RESPONSE = {
|
||||
next: null,
|
||||
previous: null,
|
||||
results: [],
|
||||
};
|
||||
gServer.registerPathHandler("/addons.json", (request, response) => {
|
||||
response.setHeader("content-type", "application/json");
|
||||
response.write(JSON.stringify(GETADDONS_RESPONSE));
|
||||
});
|
||||
|
||||
const COMPAT_RESPONSE = {
|
||||
next: null,
|
||||
previous: null,
|
||||
results: [
|
||||
{
|
||||
addon_guid: "addon3@tests.mozilla.org",
|
||||
version_ranges: [
|
||||
{
|
||||
addon_min_version: "0.9",
|
||||
addon_max_version: "1.0",
|
||||
applications: [
|
||||
{
|
||||
name: "XPCShell",
|
||||
guid: "xpcshell@tests.mozilla.org",
|
||||
min_version: "1",
|
||||
max_version: "2",
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
addon_guid: "addon4@tests.mozilla.org",
|
||||
version_ranges: [
|
||||
{
|
||||
addon_min_version: "0.9",
|
||||
addon_max_version: "1.0",
|
||||
applications: [
|
||||
{
|
||||
name: "XPCShell",
|
||||
guid: "xpcshell@tests.mozilla.org",
|
||||
min_version: "1",
|
||||
max_version: "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
addon_guid: "addon5@tests.mozilla.org",
|
||||
version_ranges: [
|
||||
{
|
||||
addon_min_version: "0.9",
|
||||
addon_max_version: "1.0",
|
||||
applications: [
|
||||
{
|
||||
name: "Unknown App",
|
||||
guid: "unknown-app@tests.mozilla.org",
|
||||
min_version: "1",
|
||||
max_version: "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
addon_guid: "addon6@tests.mozilla.org",
|
||||
version_ranges: [
|
||||
{
|
||||
addon_min_version: "0.5",
|
||||
addon_max_version: "0.9",
|
||||
applications: [
|
||||
{
|
||||
name: "XPCShell",
|
||||
guid: "xpcshell@tests.mozilla.org",
|
||||
min_version: "1",
|
||||
max_version: "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
addon_guid: "addon7@tests.mozilla.org",
|
||||
version_ranges: [
|
||||
{
|
||||
addon_min_version: "0.5",
|
||||
addon_max_version: "1.0",
|
||||
applications: [
|
||||
{
|
||||
name: "XPCShell",
|
||||
guid: "xpcshell@tests.mozilla.org",
|
||||
min_version: "0.1",
|
||||
max_version: "0.9",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
addon_guid: "addon8@tests.mozilla.org",
|
||||
version_ranges: [
|
||||
{
|
||||
addon_min_version: "6",
|
||||
addon_max_version: "6.2",
|
||||
applications: [
|
||||
{
|
||||
name: "XPCShell",
|
||||
guid: "xpcshell@tests.mozilla.org",
|
||||
min_version: "0.9",
|
||||
max_version: "9",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
addon_min_version: "0.5",
|
||||
addon_max_version: "1.0",
|
||||
applications: [
|
||||
{
|
||||
name: "XPCShell",
|
||||
guid: "xpcshell@tests.mozilla.org",
|
||||
min_version: "0.1",
|
||||
max_version: "9",
|
||||
},
|
||||
{
|
||||
name: "Unknown app",
|
||||
guid: "unknown-app@tests.mozilla.org",
|
||||
min_version: "0.1",
|
||||
max_version: "9",
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
addon_min_version: "0.1",
|
||||
addon_max_version: "0.2",
|
||||
applications: [
|
||||
{
|
||||
name: "XPCShell",
|
||||
guid: "xpcshell@tests.mozilla.org",
|
||||
min_version: "0.1",
|
||||
max_version: "0.9",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
addon_guid: "addon9@tests.mozilla.org",
|
||||
version_ranges: [
|
||||
{
|
||||
addon_min_version: "0.5",
|
||||
addon_max_version: "1.0",
|
||||
applications: [
|
||||
{
|
||||
name: "XPCShell",
|
||||
guid: "xpcshell@tests.mozilla.org",
|
||||
min_version: "1",
|
||||
max_version: "2",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
gServer.registerPathHandler("/compat.json", (request, response) => {
|
||||
response.setHeader("content-type", "application/json");
|
||||
response.write(JSON.stringify(COMPAT_RESPONSE));
|
||||
});
|
||||
|
||||
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE,
|
||||
BASE_URL + REQ_URL);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, `${BASE_URL}/addons.json`);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES, `${BASE_URL}/compat.json`);
|
||||
|
||||
|
||||
// Not hosted, no overrides
|
||||
|
@ -133,19 +299,6 @@ var addon9 = {
|
|||
}]
|
||||
};
|
||||
|
||||
// Not hosted, override is of unsupported type (compatible)
|
||||
var addon10 = {
|
||||
id: "addon10@tests.mozilla.org",
|
||||
version: "1.0",
|
||||
name: "Test addon 10",
|
||||
targetApplications: [{
|
||||
id: "xpcshell@tests.mozilla.org",
|
||||
minVersion: "1",
|
||||
maxVersion: "1"
|
||||
}]
|
||||
};
|
||||
|
||||
|
||||
const profileDir = gProfD.clone();
|
||||
profileDir.append("extensions");
|
||||
|
||||
|
@ -162,7 +315,6 @@ function run_test() {
|
|||
writeInstallRDFForExtension(addon7, profileDir);
|
||||
writeInstallRDFForExtension(addon8, profileDir);
|
||||
writeInstallRDFForExtension(addon9, profileDir);
|
||||
writeInstallRDFForExtension(addon10, profileDir);
|
||||
|
||||
startupManager();
|
||||
|
||||
|
@ -182,9 +334,8 @@ function check_compat_status(aCallback) {
|
|||
"addon6@tests.mozilla.org",
|
||||
"addon7@tests.mozilla.org",
|
||||
"addon8@tests.mozilla.org",
|
||||
"addon9@tests.mozilla.org",
|
||||
"addon10@tests.mozilla.org"],
|
||||
function([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]) {
|
||||
"addon9@tests.mozilla.org"],
|
||||
function([a1, a2, a3, a4, a5, a6, a7, a8, a9]) {
|
||||
|
||||
Assert.notEqual(a1, null);
|
||||
Assert.equal(AddonRepository.getCompatibilityOverridesSync(a1.id), null);
|
||||
|
@ -243,11 +394,6 @@ function check_compat_status(aCallback) {
|
|||
Assert.ok(!a9.isCompatible);
|
||||
Assert.ok(a9.appDisabled);
|
||||
|
||||
Assert.notEqual(a10, null);
|
||||
Assert.equal(AddonRepository.getCompatibilityOverridesSync(a10.id), null);
|
||||
Assert.ok(a10.isCompatible);
|
||||
Assert.ok(!a10.appDisabled);
|
||||
|
||||
executeSoon(aCallback);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -983,7 +983,9 @@ function run_test_18_1() {
|
|||
|
||||
Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
|
||||
"http://localhost:" + gPort + "/data/test_install.xml");
|
||||
"http://localhost:" + gPort + "/data/test_install_addons.json");
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
|
||||
"http://localhost:" + gPort + "/data/test_install_compat.json");
|
||||
|
||||
Services.prefs.setBoolPref("extensions.addon2@tests.mozilla.org.getAddons.cache.enabled", false);
|
||||
|
||||
|
|
|
@ -962,7 +962,9 @@ function run_test_18_1() {
|
|||
|
||||
Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
|
||||
"http://localhost:4444/data/test_install.xml");
|
||||
"http://localhost:4444/data/test_install_addons.json");
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
|
||||
"http://localhost:4444/data/test_install_compat.json");
|
||||
|
||||
Services.prefs.setBoolPref("extensions.addon2@tests.mozilla.org.getAddons.cache.enabled", false);
|
||||
|
||||
|
|
|
@ -37,9 +37,43 @@ function backgroundUpdate(aCallback) {
|
|||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
mapUrlToFile("/cache.xml", do_get_file("data/test_sourceURI.xml"), gServer);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, BASE_URL + "/cache.xml");
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE, BASE_URL + "/cache.xml");
|
||||
const GETADDONS_RESPONSE = {
|
||||
page_size: 25,
|
||||
next: null,
|
||||
previous: null,
|
||||
results: [
|
||||
{
|
||||
name: "Test",
|
||||
type: "extension",
|
||||
guid: "addon@tests.mozilla.org",
|
||||
current_version: {
|
||||
version: "1",
|
||||
files: [
|
||||
{
|
||||
platform: "all",
|
||||
url: "http://www.example.com/testaddon.xpi"
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
],
|
||||
};
|
||||
gServer.registerPathHandler("/addons.json", (request, response) => {
|
||||
response.setHeader("content-type", "application/json");
|
||||
response.write(JSON.stringify(GETADDONS_RESPONSE));
|
||||
});
|
||||
|
||||
const COMPAT_RESPONSE = {
|
||||
next: null,
|
||||
results: [],
|
||||
};
|
||||
gServer.registerPathHandler("/compat.json", (request, response) => {
|
||||
response.setHeader("content-type", "application/json");
|
||||
response.write(JSON.stringify(COMPAT_RESPONSE));
|
||||
});
|
||||
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, `${BASE_URL}/addons.json`);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES, `${BASE_URL}/compat.json`);
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
|
||||
|
|
|
@ -17,14 +17,11 @@ registerDirectory("XREAppFeat", distroDir);
|
|||
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "0");
|
||||
|
||||
function getCachedAddon(id) {
|
||||
return new Promise(resolve => AddonRepository.getCachedAddonByID(id, resolve));
|
||||
}
|
||||
|
||||
// Test with a missing features directory
|
||||
add_task(async function test_app_addons() {
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, `http://localhost:${gServer.identity.primaryPort}/get?%IDS%`);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES, `http://localhost:${gServer.identity.primaryPort}/get?%IDS%`);
|
||||
|
||||
gServer.registerPathHandler("/get", (request, response) => {
|
||||
do_throw("Unexpected request to server.");
|
||||
|
@ -34,19 +31,17 @@ add_task(async function test_app_addons() {
|
|||
|
||||
startupManager();
|
||||
|
||||
await new Promise((resolve) => {
|
||||
AddonRepository.cacheAddons(["system1@tests.mozilla.org",
|
||||
"system2@tests.mozilla.org",
|
||||
"system3@tests.mozilla.org"], resolve);
|
||||
});
|
||||
await AddonRepository.cacheAddons(["system1@tests.mozilla.org",
|
||||
"system2@tests.mozilla.org",
|
||||
"system3@tests.mozilla.org"]);
|
||||
|
||||
let cached = await getCachedAddon("system1@tests.mozilla.org");
|
||||
let cached = await AddonRepository.getCachedAddonByID("system1@tests.mozilla.org");
|
||||
Assert.equal(cached, null);
|
||||
|
||||
cached = await getCachedAddon("system2@tests.mozilla.org");
|
||||
cached = await AddonRepository.getCachedAddonByID("system2@tests.mozilla.org");
|
||||
Assert.equal(cached, null);
|
||||
|
||||
cached = await getCachedAddon("system3@tests.mozilla.org");
|
||||
cached = await AddonRepository.getCachedAddonByID("system3@tests.mozilla.org");
|
||||
Assert.equal(cached, null);
|
||||
|
||||
await promiseShutdownManager();
|
||||
|
|
|
@ -25,7 +25,8 @@ var testserver = createHttpServer();
|
|||
gPort = testserver.identity.primaryPort;
|
||||
mapFile("/data/test_update.rdf", testserver);
|
||||
mapFile("/data/test_update.json", testserver);
|
||||
mapFile("/data/test_update.xml", testserver);
|
||||
mapFile("/data/test_update_addons.json", testserver);
|
||||
mapFile("/data/test_update_compat.json", testserver);
|
||||
testserver.registerDirectory("/addons/", do_get_file("addons"));
|
||||
|
||||
const profileDir = gProfD.clone();
|
||||
|
@ -1038,9 +1039,9 @@ for (let test of testParams) {
|
|||
});
|
||||
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
|
||||
"http://localhost:" + gPort + "/data/test_update.xml");
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE,
|
||||
"http://localhost:" + gPort + "/data/test_update.xml");
|
||||
`http://localhost:${gPort}/data/test_update_addons.json`);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
|
||||
`http://localhost:${gPort}/data/test_update_compat.json`);
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
|
||||
AddonManagerInternal.backgroundUpdateCheck();
|
||||
|
|
|
@ -15,7 +15,8 @@ var testserver = createHttpServer();
|
|||
gPort = testserver.identity.primaryPort;
|
||||
mapFile("/data/test_update.rdf", testserver);
|
||||
mapFile("/data/test_update.json", testserver);
|
||||
mapFile("/data/test_update.xml", testserver);
|
||||
mapFile("/data/test_update_addons.json", testserver);
|
||||
mapFile("/data/test_update_compat.json", testserver);
|
||||
testserver.registerDirectory("/addons/", do_get_file("addons"));
|
||||
|
||||
const profileDir = gProfD.clone();
|
||||
|
@ -62,8 +63,10 @@ for (let test of testParams) {
|
|||
}
|
||||
});
|
||||
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE,
|
||||
"http://localhost:" + gPort + "/data/" + updateFile);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
|
||||
`http://localhost:${gPort}/data/test_update_addons.json`);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
|
||||
`http://localhost:${gPort}/data/test_update_compat.json`);
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
|
||||
AddonManagerInternal.backgroundUpdateCheck();
|
||||
|
|
|
@ -25,7 +25,8 @@ var testserver = createHttpServer();
|
|||
gPort = testserver.identity.primaryPort;
|
||||
mapFile("/data/test_update.rdf", testserver);
|
||||
mapFile("/data/test_update.json", testserver);
|
||||
mapFile("/data/test_update.xml", testserver);
|
||||
mapFile("/data/test_update_addons.json", testserver);
|
||||
mapFile("/data/test_update_compat.json", testserver);
|
||||
testserver.registerDirectory("/addons/", do_get_file("addons"));
|
||||
|
||||
const profileDir = gProfD.clone();
|
||||
|
@ -977,9 +978,9 @@ for (let test of testParams) {
|
|||
});
|
||||
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS,
|
||||
"http://localhost:" + gPort + "/data/test_update.xml");
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE,
|
||||
"http://localhost:" + gPort + "/data/test_update.xml");
|
||||
`http://localhost:${gPort}/data/test_update_addons.json`);
|
||||
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES,
|
||||
`http://localhost:${gPort}/data/test_update_compat.json`);
|
||||
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
|
||||
|
||||
AddonManagerInternal.backgroundUpdateCheck();
|
||||
|
|
|
@ -60,10 +60,10 @@ add_task(async function setup_to_default_browserish_state() {
|
|||
name: "Bling",
|
||||
description: "SO MUCH BLING!",
|
||||
author: "Pixel Pusher",
|
||||
homepageURL: "http://mochi.test:8888/data/index.html",
|
||||
headerURL: "http://mochi.test:8888/data/header.png",
|
||||
previewURL: "http://mochi.test:8888/data/preview.png",
|
||||
iconURL: "http://mochi.test:8888/data/icon.png",
|
||||
homepageURL: "http://localhost:8888/data/index.html",
|
||||
headerURL: "http://localhost:8888/data/header.png",
|
||||
previewURL: "http://localhost:8888/data/preview.png",
|
||||
iconURL: "http://localhost:8888/data/icon.png",
|
||||
textcolor: Math.random().toString(),
|
||||
accentcolor: Math.random().toString()
|
||||
};
|
||||
|
|
|
@ -11,9 +11,9 @@ skip-if = os == "android" || os == "win"
|
|||
tags = webextensions
|
||||
[test_AddonRepository_cache.js]
|
||||
# Bug 676992: test consistently hangs on Android
|
||||
# Bug 1026805: frequent hangs on OSX 10.8
|
||||
skip-if = os == "android" || os == "mac"
|
||||
skip-if = os == "android"
|
||||
run-sequentially = Uses hardcoded ports in xpi files.
|
||||
[test_AddonRepository_paging.js]
|
||||
[test_LightweightThemeManager.js]
|
||||
[test_backgroundupdate.js]
|
||||
[test_bad_json.js]
|
||||
|
@ -284,8 +284,7 @@ tags = webextensions
|
|||
# Bug 676992: test consistently hangs on Android
|
||||
skip-if = os == "android"
|
||||
[test_update_ignorecompat.js]
|
||||
# Bug 676992: test consistently hangs on Android
|
||||
skip-if = os == "android"
|
||||
skip-if = true # Bug 676922 Bug 1437697
|
||||
[test_updatecheck.js]
|
||||
# Bug 676992: test consistently hangs on Android
|
||||
skip-if = os == "android"
|
||||
|
|
Загрузка…
Ссылка в новой задаче