diff --git a/.eslintrc.js b/.eslintrc.js index fe9f4f3a8058..88971d903c07 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -45,7 +45,6 @@ module.exports = { "overrides": [{ "files": [ "devtools/**", - "parser/**", "python/**", "remote/**", "security/**", diff --git a/.prettierignore b/.prettierignore index d9402ba07d10..e59973a18136 100644 --- a/.prettierignore +++ b/.prettierignore @@ -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/** diff --git a/parser/htmlparser/tests/mochitest/browser_viewsource.js b/parser/htmlparser/tests/mochitest/browser_viewsource.js index 33a7a7c31186..c7469f7537c5 100644 --- a/parser/htmlparser/tests/mochitest/browser_viewsource.js +++ b/parser/htmlparser/tests/mochitest/browser_viewsource.js @@ -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); }); - diff --git a/parser/htmlparser/tests/mochitest/file_bug688580.js b/parser/htmlparser/tests/mochitest/file_bug688580.js index e3319caba0de..bee04dde2345 100644 --- a/parser/htmlparser/tests/mochitest/file_bug688580.js +++ b/parser/htmlparser/tests/mochitest/file_bug688580.js @@ -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"; - diff --git a/parser/htmlparser/tests/mochitest/file_defer_bug1104732.js b/parser/htmlparser/tests/mochitest/file_defer_bug1104732.js index 7ba406c8bd9c..5ba15f287bd2 100644 --- a/parser/htmlparser/tests/mochitest/file_defer_bug1104732.js +++ b/parser/htmlparser/tests/mochitest/file_defer_bug1104732.js @@ -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"; - diff --git a/parser/htmlparser/tests/mochitest/parser_datreader.js b/parser/htmlparser/tests/mochitest/parser_datreader.js index 97298208f913..de310371500f 100644 --- a/parser/htmlparser/tests/mochitest/parser_datreader.js +++ b/parser/htmlparser/tests/mochitest/parser_datreader.js @@ -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 += ""; break; @@ -185,7 +195,7 @@ function addLevels(walker, buf, indent) { buf += ""; 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; } - diff --git a/parser/htmlparser/tests/mochitest/parser_web_testrunner.js b/parser/htmlparser/tests/mochitest/parser_web_testrunner.js index 6fc2d0934a14..57807f5b6c10 100644 --- a/parser/htmlparser/tests/mochitest/parser_web_testrunner.js +++ b/parser/htmlparser/tests/mochitest/parser_web_testrunner.js @@ -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; diff --git a/parser/xml/test/unit/results.js b/parser/xml/test/unit/results.js index 4db9f9094bd2..652cf53a7067 100644 --- a/parser/xml/test/unit/results.js +++ b/parser/xml/test/unit/results.js @@ -2,843 +2,987 @@ var vectors = [ { - "data": "
", - "sanitized": "", + data: + '', + sanitized: "", }, { - "data": "&ADz&AGn&AG0&AEf&ACA&AHM&AHI&AGO&AD0&AGn&ACA&AG8Abg&AGUAcgByAG8AcgA9AGEAbABlAHIAdAAoADEAKQ&ACAAPABi", - "sanitized": "&ADz&AGn&AG0&AEf&ACA&AHM&AHI&AGO&AD0&AGn&ACA&AG8Abg&AGUAcgByAG8AcgA9AGEAbABlAHIAdAAoADEAKQ&ACAAPABi", + data: + '&ADz&AGn&AG0&AEf&ACA&AHM&AHI&AGO&AD0&AGn&ACA&AG8Abg&AGUAcgByAG8AcgA9AGEAbABlAHIAdAAoADEAKQ&ACAAPABi', + sanitized: + "&ADz&AGn&AG0&AEf&ACA&AHM&AHI&AGO&AD0&AGn&ACA&AG8Abg&AGUAcgByAG8AcgA9AGEAbABlAHIAdAAoADEAKQ&ACAAPABi", }, { - "data": "& :postMessage(importScripts('data:;base64,cG9zdE1lc3NhZ2UoJ2FsZXJ0KDEpJyk'))", - "sanitized": "0? :postMessage(importScripts('data:;base64,cG9zdE1lc3NhZ2UoJ2FsZXJ0KDEpJyk'))", + data: + "0? :postMessage(importScripts('data:;base64,cG9zdE1lc3NhZ2UoJ2FsZXJ0KDEpJyk'))", + sanitized: + "0? :postMessage(importScripts('data:;base64,cG9zdE1lc3NhZ2UoJ2FsZXJ0KDEpJyk'))", }, { - "data": "", - "sanitized": "", + data: + "", + sanitized: "", }, { - "data": "", - "sanitized": "", + data: "", + sanitized: "", }, { - "data": "", - "sanitized": "", + data: "", + sanitized: "", }, { - "data": "", - "sanitized": "", + data: "", + sanitized: "", }, { - "data": "X", - "sanitized": "X", + data: + "X", + sanitized: "X", }, { - "data": "", - "sanitized": "", + data: "", + sanitized: + '', }, { - "data": "", - "sanitized": "", + data: + '', + sanitized: "", }, { - "data": "