/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// We expect this to be defined in the global scope by runtest.py. /* global _TEST_PREFIX */
/** *Below,we'llusemakeTagFunctocreateafunctionforeachofthe *stringsin'tags'.Thiswillallowustouses-expressionlikesyntax *tocreateHTML.
*/ function makeTagFunc(tagName) { returnfunction (attrs /* rest... */) { var startChildren = 0; var response = "";
// write the start tag and attributes
response += "<" + tagName; // if attr is an object, write attributes if (attrs && typeof attrs == "object") {
startChildren = 1;
for (let key in attrs) { const value = attrs[key]; var val = "" + value;
response += " " + key + '="' + val.replace('"', """) + '"';
}
}
response += ">";
// iterate through the rest of the args for (var i = startChildren; i < arguments.length; i++) { if (typeof arguments[i] == "function") {
response += arguments[i]();
} else {
response += arguments[i];
}
}
// write the close tag
response += "</" + tagName + ">\n"; return response;
};
}
function makeTags() { // map our global HTML generation functions for (let tag of tags) { this[tag] = makeTagFunc(tag.toLowerCase());
}
}
/** *Createsageneratorthatiteratesoverthecontentsof *annsIFiledirectory.
*/ function* dirIter(dir) { var en = dir.directoryEntries; while (en.hasMoreElements()) {
yield en.nextFile;
}
}
/** *Buildsanoptionallynestedobjectcontaininglinkstothe *filesanddirectorieswithindir.
*/ function list(requestPath, directory, recurse) { var count = 0; var path = requestPath; if (path.charAt(path.length - 1) != "/") {
path += "/";
}
var dir = directory.QueryInterface(Ci.nsIFile); var links = {};
// The SimpleTest directory is hidden
let files = []; for (let file of dirIter(dir)) { if (file.exists() && !file.path.includes("SimpleTest")) {
files.push(file);
}
}
// Sort files by name, so that tests can be run in a pre-defined order inside // a given directory (see bug 384823) function leafNameComparator(first, second) { if (first.leafName < second.leafName) { return -1;
} if (first.leafName > second.leafName) { return1;
} return0;
}
files.sort(leafNameComparator);
count = files.length; for (let file of files) { var key = path + file.leafName; var childCount = 0; if (file.isDirectory()) {
key += "/";
} if (recurse && file.isDirectory()) {
[links[key], childCount] = list(key, file, recurse);
count += childCount;
} elseif (file.leafName.charAt(0) != ".") {
links[key] = { test: { url: key, expected: "pass" } };
}
}
return [links, count];
}
/** *Heuristicfunctionthatdetermineswhetheragivenpath *isatestcasetobeexecutedintheharness,orjust *asupportingfile.
*/ function isTest(filename, pattern) { if (pattern) { return pattern.test(filename);
}
// File name is a URL style path to a test file, make sure that we check for // tests that start with the appropriate prefix. var testPrefix = typeof _TEST_PREFIX == "string" ? _TEST_PREFIX : "test_"; var testPattern = new RegExp("^" + testPrefix);
/** *TransformnestedhashtablesofpathstonestedHTMLlists.
*/ function linksToListItems(links) { var response = ""; var children = ""; for (let link in links) { const value = links[link]; var classVal =
!isTest(link) && !(value instanceof Object)
? "non-test invisible"
: "test"; if (value instanceof Object) {
children = UL({ class: "testdir" }, linksToListItems(value));
} else {
children = "";
}
var bug_title = link.match(/test_bug\S+/); var bug_num = null; if (bug_title != null) {
bug_num = bug_title[0].match(/\d+/);
}
/** *Transformnestedhashtablesofpathstoaflattablerows.
*/ function linksToTableRows(links, recursionLevel) { var response = ""; for (let link in links) { const value = links[link]; var classVal =
!isTest(link) && value instanceof Object && "test" in value
? "non-test invisible"
: "";
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.