Backed out changeset 32871d284eef (bug 1622978) for perma failures on test_distribution.js. CLOSED TREE

This commit is contained in:
Razvan Maries 2020-04-08 02:34:51 +03:00
Родитель 6d42c8f893
Коммит 95bcfbaafd
4 изменённых файлов: 52 добавлений и 69 удалений

Просмотреть файл

@ -1126,7 +1126,47 @@ SearchService.prototype = {
async _loadEngines(cache, isReload) {
SearchUtils.log("_loadEngines: start");
let engines = await this._findEngines();
let distDirs = await this._getDistibutionEngineDirectories();
// Get the non-empty distribution directories into distDirs...
let distDirs = [];
let locations;
try {
locations = Services.dirsvc.get(
NS_APP_DISTRIBUTION_SEARCH_DIR_LIST,
Ci.nsISimpleEnumerator
);
} catch (e) {
// NS_APP_DISTRIBUTION_SEARCH_DIR_LIST is defined by each app
// so this throws during unit tests (but not xpcshell tests).
locations = [];
}
for (let dir of locations) {
let iterator = new OS.File.DirectoryIterator(dir.path, {
winPattern: "*.xml",
});
try {
// Add dir to distDirs if it contains any files.
let { done } = await iterator.next();
if (!done) {
distDirs.push(dir);
}
} catch (ex) {
if (!(ex instanceof OS.File.Error)) {
throw ex;
}
if (ex.becauseAccessDenied) {
Cu.reportError(
"Not loading distribution files because access was denied."
);
} else if (!ex.becauseNoSuchFile) {
throw ex;
}
} finally {
// If there's an issue on close, we can't do anything about it. It could
// be that reading the iterator never fully opened.
iterator.close().catch(Cu.reportError);
}
}
let buildID = Services.appinfo.platformBuildID;
let rebuildCache =
@ -1295,59 +1335,6 @@ SearchService.prototype = {
return engines;
},
/**
* Get the directories that contain distribution engines.
*
* @returns {array}
* Returns an array of directories that contain distribution engines.
*/
async _getDistibutionEngineDirectories() {
if (gModernConfig) {
return [];
}
// Get the non-empty distribution directories into distDirs...
let distDirs = [];
let locations;
try {
locations = Services.dirsvc.get(
NS_APP_DISTRIBUTION_SEARCH_DIR_LIST,
Ci.nsISimpleEnumerator
);
} catch (e) {
// NS_APP_DISTRIBUTION_SEARCH_DIR_LIST is defined by each app
// so this throws during unit tests (but not xpcshell tests).
locations = [];
}
for (let dir of locations) {
let iterator = new OS.File.DirectoryIterator(dir.path, {
winPattern: "*.xml",
});
try {
// Add dir to distDirs if it contains any files.
let { done } = await iterator.next();
if (!done) {
distDirs.push(dir);
}
} catch (ex) {
if (!(ex instanceof OS.File.Error)) {
throw ex;
}
if (ex.becauseAccessDenied) {
Cu.reportError(
"Not loading distribution files because access was denied."
);
} else if (!ex.becauseNoSuchFile) {
throw ex;
}
} finally {
// If there's an issue on close, we can't do anything about it. It could
// be that reading the iterator never fully opened.
iterator.close().catch(Cu.reportError);
}
}
return distDirs;
},
/**
* Ensures a built in search WebExtension is installed, installing
* it if necessary.

Просмотреть файл

@ -29,9 +29,8 @@ const SUBMISSION_NO = new Map([
add_task(async function setup() {
await useTestEngines("data1");
if (!gModernConfig) {
installDistributionEngine();
}
installDistributionEngine();
await AddonTestUtils.promiseStartupManager();
});
@ -81,9 +80,6 @@ add_task(async function test_submission_url_built_in() {
});
add_task(async function test_submission_url_distribution() {
if (gModernConfig) {
return;
}
const engine = Services.search.getEngineByName("basic");
await Services.search.setDefault(engine);

Просмотреть файл

@ -3,6 +3,7 @@
[test_addEngineWithDetailsObject.js]
[test_addEngineWithExtensionID.js]
[test_async_addon.js]
[test_async_distribution.js]
[test_async_disthidden.js]
[test_async.js]
[test_big_icon.js]
@ -27,6 +28,13 @@ skip-if = os == "win" # Windows doesn't have the same sort of permissions manage
[test_ignorelist.js]
[test_invalid_engine_from_dir.js]
[test_json_cache_broken.js]
[test_json_cache_good_distro.js]
support-files =
data1/engine1/manifest.json
data1/engine2/manifest.json
data1/list.json
data1/engines.json
data1/engine3.xml
[test_json_cache_good.js]
[test_json_cache_ignorelist.js]
support-files = data/search_ignorelist.json
@ -60,6 +68,7 @@ support-files =
[test_purpose.js]
[test_rel_searchform.js]
[test_require_engines_in_cache.js]
[test_remove_distro_engine.js]
[test_remove_profile_engine.js]
[test_resultDomain.js]
[test_save_sorted_engines.js]

Просмотреть файл

@ -63,12 +63,3 @@ skip-if = ccov || tsan # Bug 1590254, tsan: bug 1612707
[test_legacy_reload_engines.js]
[test_geodefaults.js]
[test_hidden.js]
[test_async_distribution.js]
[test_remove_distro_engine.js]
[test_json_cache_good_distro.js]
support-files =
data1/engine1/manifest.json
data1/engine2/manifest.json
data1/list.json
data1/engines.json
data1/engine3.xml