Bug 1561435 - Format parser/, a=automatic-formatting

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D35923

--HG--
extra : source : 03ab20f6337a695a31afb301410182972e4195a9
This commit is contained in:
Victor Porof 2019-07-05 10:56:19 +02:00
Родитель 27cc1e6092
Коммит 572c392d30
9 изменённых файлов: 659 добавлений и 481 удалений

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

@ -45,7 +45,6 @@ module.exports = {
"overrides": [{
"files": [
"devtools/**",
"parser/**",
"python/**",
"remote/**",
"security/**",

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

@ -40,7 +40,6 @@ toolkit/components/telemetry/datareporting-prefs.js
toolkit/components/telemetry/healthreport-prefs.js
# Ignore all top-level directories for now.
parser/**
python/**
remote/**
security/**

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

@ -2,7 +2,10 @@
add_task(async function() {
const PAGE_URL = getRootDirectory(gTestPath) + "file_viewsource.html";
let viewSourceTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, "view-source:" + PAGE_URL);
let viewSourceTab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
"view-source:" + PAGE_URL
);
let xhrPromise = new Promise(resolve => {
let xhr = new XMLHttpRequest();
@ -11,12 +14,15 @@ add_task(async function() {
xhr.send();
});
let viewSourceContentPromise = ContentTask.spawn(viewSourceTab.linkedBrowser, null, async function() {
return content.document.body.textContent;
});
let viewSourceContentPromise = ContentTask.spawn(
viewSourceTab.linkedBrowser,
null,
async function() {
return content.document.body.textContent;
}
);
let results = await Promise.all([viewSourceContentPromise, xhrPromise]);
is(results[0], results[1], "Sources should match");
BrowserTestUtils.removeTab(viewSourceTab);
});

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

@ -1,5 +1,8 @@
/* globals state:true */
is(document.readyState, "interactive", "readyState should be interactive during defer.");
is(
document.readyState,
"interactive",
"readyState should be interactive during defer."
);
is(state, "readyState interactive", "Bad state upon defer");
state = "defer";

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

@ -1,4 +1,7 @@
/* globals state:true */
is(document.readyState, "interactive", "readyState should be interactive during defer.");
is(
document.readyState,
"interactive",
"readyState should be interactive during defer."
);
state = "defer";

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

@ -13,16 +13,14 @@
/**
* A few utility functions.
*/
function log(entry) {
}
function log(entry) {}
function startsWith(s, s2) {
return s.indexOf(s2) == 0;
}
function trimString(s) {
return (s.replace(/^\s+/, "").replace(/\s+$/, ""));
return s.replace(/^\s+/, "").replace(/\s+$/, "");
}
/**
@ -40,8 +38,9 @@ function parseTestcase(testcase) {
if (!line || startsWith(line, "##")) {
continue;
}
if (line == "#data")
if (line == "#data") {
break;
}
log(lines);
throw new Error("Unknown test format.");
}
@ -56,10 +55,14 @@ function parseTestcase(testcase) {
todo(false, line.substring(6));
continue;
}
if (!(startsWith(line, "#error") ||
startsWith(line, "#document") ||
startsWith(line, "#document-fragment") ||
startsWith(line, "#data"))) {
if (
!(
startsWith(line, "#error") ||
startsWith(line, "#document") ||
startsWith(line, "#document-fragment") ||
startsWith(line, "#data")
)
) {
currentList.push(line);
} else if (line == "#errors") {
currentList = errors;
@ -110,10 +113,11 @@ function docToTestOutput(doc) {
* @param an element
*/
function createFragmentWalker(elt) {
return elt.ownerDocument.createTreeWalker(elt, NodeFilter.SHOW_ALL,
function(node) {
return elt == node ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
});
return elt.ownerDocument.createTreeWalker(elt, NodeFilter.SHOW_ALL, function(
node
) {
return elt == node ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
});
}
/**
@ -165,19 +169,25 @@ function addLevels(walker, buf, indent) {
}
var keys = Object.keys(valuesByName).sort();
for (let i = 0; i < keys.length; ++i) {
buf += "\n" + indent + " " + keys[i] +
"=\"" + valuesByName[keys[i]] + "\"";
buf +=
"\n" +
indent +
" " +
keys[i] +
'="' +
valuesByName[keys[i]] +
'"';
}
}
break;
case Node.DOCUMENT_TYPE_NODE:
buf += "<!DOCTYPE " + walker.currentNode.name;
if (walker.currentNode.publicId || walker.currentNode.systemId) {
buf += " \"";
buf += ' "';
buf += walker.currentNode.publicId;
buf += "\" \"";
buf += '" "';
buf += walker.currentNode.systemId;
buf += "\"";
buf += '"';
}
buf += ">";
break;
@ -185,7 +195,7 @@ function addLevels(walker, buf, indent) {
buf += "<!-- " + walker.currentNode.nodeValue + " -->";
break;
case Node.TEXT_NODE:
buf += "\"" + walker.currentNode.nodeValue + "\"";
buf += '"' + walker.currentNode.nodeValue + '"';
break;
}
buf += "\n";
@ -204,4 +214,3 @@ function addLevels(walker, buf, indent) {
}
return buf;
}

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

@ -21,13 +21,17 @@
var functionsToRunAsync = [];
window.addEventListener("message", function(event) {
if (event.source == window && event.data == "async-run") {
event.stopPropagation();
var fn = functionsToRunAsync.shift();
fn();
}
}, true);
window.addEventListener(
"message",
function(event) {
if (event.source == window && event.data == "async-run") {
event.stopPropagation();
var fn = functionsToRunAsync.shift();
fn();
}
},
true
);
function asyncRun(fn) {
functionsToRunAsync.push(fn);
@ -74,22 +78,24 @@ function makeTestChecker(input, expected, errors) {
};
}
function makeFragmentTestChecker(input,
expected,
errors,
fragment,
testframe) {
function makeFragmentTestChecker(input, expected, errors, fragment, testframe) {
return function() {
var context;
if (fragment.startsWith("svg ")) {
context = document.createElementNS("http://www.w3.org/2000/svg",
fragment.substring(4));
context = document.createElementNS(
"http://www.w3.org/2000/svg",
fragment.substring(4)
);
} else if (fragment.startsWith("math ")) {
context = document.createElementNS("http://www.w3.org/1998/Math/MathML",
fragment.substring(5));
context = document.createElementNS(
"http://www.w3.org/1998/Math/MathML",
fragment.substring(5)
);
} else {
context = document.createElementNS("http://www.w3.org/1999/xhtml",
fragment);
context = document.createElementNS(
"http://www.w3.org/1999/xhtml",
fragment
);
}
// eslint-disable-next-line no-unsanitized/property
context.innerHTML = input;
@ -104,18 +110,16 @@ function makeFragmentTestChecker(input,
var testcases;
function nextTest(testframe) {
var {done, value} = testcases.next();
var { done, value } = testcases.next();
if (done) {
SimpleTest.finish();
return;
}
var [input, output, errors, fragment] = value;
if (fragment) {
asyncRun(makeFragmentTestChecker(input,
output,
errors,
fragment,
testframe));
asyncRun(
makeFragmentTestChecker(input, output, errors, fragment, testframe)
);
} else {
testframe.onload = makeTestChecker(input, output, errors);
testframe.srcdoc = input;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,4 +1,6 @@
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
if (AppConstants.platform != "android") {
// We load HTML documents, which try to track link state, which requires
// the history service, which requires a profile.
@ -20,17 +22,26 @@ function run_test() {
// is set to true *before* profile-change-teardown notifications are fired.
// To work around this, just force the history service to be created earlier:
let {PlacesUtils} = ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
Assert.ok(PlacesUtils.history.databaseStatus <= 1, "ensure places database is successfully initialized.");
let { PlacesUtils } = ChromeUtils.import(
"resource://gre/modules/PlacesUtils.jsm"
);
Assert.ok(
PlacesUtils.history.databaseStatus <= 1,
"ensure places database is successfully initialized."
);
}
var ParserUtils = Cc["@mozilla.org/parserutils;1"].getService(Ci.nsIParserUtils);
var sanitizeFlags = ParserUtils.SanitizerCidEmbedsOnly | ParserUtils.SanitizerDropForms | ParserUtils.SanitizerDropNonCSSPresentation;
var ParserUtils = Cc["@mozilla.org/parserutils;1"].getService(
Ci.nsIParserUtils
);
var sanitizeFlags =
ParserUtils.SanitizerCidEmbedsOnly |
ParserUtils.SanitizerDropForms |
ParserUtils.SanitizerDropNonCSSPresentation;
// flags according to
// http://mxr.mozilla.org/comm-central/source/mailnews/mime/src/mimemoz2.cpp#2218
// and default settings
for (var item in vectors) {
var evil = vectors[item].data;
var sanitized = vectors[item].sanitized;