Bug 1391853 - Update the code to receive --filter option from pref. r=jmaher

manifest[""] value is modified from filter string to [filter string, null]
array, in bug 1596567.

Updated the reftest.jsm side to follow the convension, and also added some
runtime check, to catch future change.

Differential Revision: https://phabricator.services.mozilla.com/D105996
This commit is contained in:
Tooru Fujisawa 2021-02-22 20:21:58 +00:00
Родитель ddcaebfbd0
Коммит 500580e010
1 изменённых файлов: 20 добавлений и 2 удалений

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

@ -403,8 +403,26 @@ function ReadTests() {
manifests = JSON.parse(manifests);
g.urlsFilterRegex = manifests[null];
var globalFilter = manifests.hasOwnProperty("") ? new RegExp(manifests[""]) : null;
delete manifests[""];
var globalFilter = null;
if (manifests.hasOwnProperty("")) {
let filterAndId = manifests[""];
if (!Array.isArray(filterAndId)) {
logger.error(`manifest[""] should be an array`);
DoneTests();
}
if (filterAndId.length === 0) {
logger.error(`manifest[""] should contain a filter pattern in the 1st item`);
DoneTests();
}
let filter = filterAndId[0];
if (typeof filter !== "string") {
logger.error(`The first item of manifest[""] should be a string`);
DoneTests();
}
globalFilter = new RegExp(filter);
delete manifests[""];
}
var manifestURLs = Object.keys(manifests);
// Ensure we read manifests from higher up the directory tree first so that we