forked from mirrors/gecko-dev
Bug 1501931 - Enable ESLint for parser/ (manual fixes) r=Standard8,mrbkap
Depends on D11920 Differential Revision: https://phabricator.services.mozilla.com/D11921 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
4819e4a0ee
commit
f4794a2bfb
14 changed files with 37 additions and 26 deletions
|
|
@ -31,7 +31,6 @@ netwerk/cookie/test/browser/**
|
||||||
netwerk/test/browser/**
|
netwerk/test/browser/**
|
||||||
netwerk/test/mochitests/**
|
netwerk/test/mochitests/**
|
||||||
netwerk/test/unit*/**
|
netwerk/test/unit*/**
|
||||||
parser/**
|
|
||||||
tools/update-packaging/**
|
tools/update-packaging/**
|
||||||
uriloader/exthandler/**
|
uriloader/exthandler/**
|
||||||
uriloader/exthandler/tests/mochitest/**
|
uriloader/exthandler/tests/mochitest/**
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* 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");
|
is(state, "readyState interactive", "Bad state upon defer");
|
||||||
state = "defer";
|
state = "defer";
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* 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";
|
state = "defer";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
request.send(null);
|
request.send(null);
|
||||||
is(request.status, 200, "Getting status from sjs helper should succeed");
|
is(request.status, 200, "Getting status from sjs helper should succeed");
|
||||||
if (request.status === 200) {
|
if (request.status === 200) {
|
||||||
var preloadedImages = JSON.parse(request.responseText);
|
preloadedImages = JSON.parse(request.responseText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,7 +146,7 @@
|
||||||
for (var img of images) {
|
for (var img of images) {
|
||||||
var imgName = img.id;
|
var imgName = img.id;
|
||||||
if (img.currentSrc) {
|
if (img.currentSrc) {
|
||||||
var split = img.currentSrc.split("?")[1].split(":");
|
split = img.currentSrc.split("?")[1].split(":");
|
||||||
is(split[0], imgName,
|
is(split[0], imgName,
|
||||||
"image " + imgName + " source matches element id");
|
"image " + imgName + " source matches element id");
|
||||||
is(split[1], preloadByName[imgName],
|
is(split[1], preloadByName[imgName],
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ function parseTestcase(testcase) {
|
||||||
var lines = testcase.split("\n");
|
var lines = testcase.split("\n");
|
||||||
|
|
||||||
/* check that the first non-empty, non-comment line is #data */
|
/* check that the first non-empty, non-comment line is #data */
|
||||||
for (var line of lines) {
|
for (let line of lines) {
|
||||||
if (!line || startsWith(line, "##")) {
|
if (!line || startsWith(line, "##")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -51,7 +51,7 @@ function parseTestcase(testcase) {
|
||||||
var errors = [];
|
var errors = [];
|
||||||
var fragment = [];
|
var fragment = [];
|
||||||
var currentList = input;
|
var currentList = input;
|
||||||
for (var line of lines) {
|
for (let line of lines) {
|
||||||
if (startsWith(line, "##todo")) {
|
if (startsWith(line, "##todo")) {
|
||||||
todo(false, line.substring(6));
|
todo(false, line.substring(6));
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -146,7 +146,7 @@ function addLevels(walker, buf, indent) {
|
||||||
if (walker.currentNode.hasAttributes()) {
|
if (walker.currentNode.hasAttributes()) {
|
||||||
var valuesByName = {};
|
var valuesByName = {};
|
||||||
var attrs = walker.currentNode.attributes;
|
var attrs = walker.currentNode.attributes;
|
||||||
for (var i = 0; i < attrs.length; ++i) {
|
for (let i = 0; i < attrs.length; ++i) {
|
||||||
var localName = attrs[i].localName;
|
var localName = attrs[i].localName;
|
||||||
var name;
|
var name;
|
||||||
var attrNs = attrs[i].namespaceURI;
|
var attrNs = attrs[i].namespaceURI;
|
||||||
|
|
@ -164,7 +164,7 @@ function addLevels(walker, buf, indent) {
|
||||||
valuesByName[name] = attrs[i].value;
|
valuesByName[name] = attrs[i].value;
|
||||||
}
|
}
|
||||||
var keys = Object.keys(valuesByName).sort();
|
var keys = Object.keys(valuesByName).sort();
|
||||||
for (var i = 0; i < keys.length; ++i) {
|
for (let i = 0; i < keys.length; ++i) {
|
||||||
buf += "\n" + indent + " " + keys[i] +
|
buf += "\n" + indent + " " + keys[i] +
|
||||||
"=\"" + valuesByName[keys[i]] + "\"";
|
"=\"" + valuesByName[keys[i]] + "\"";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@
|
||||||
* an iframe with id "testframe".
|
* an iframe with id "testframe".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* import-globals-from ./parser_datreader.js */
|
||||||
|
/* import-globals-from ./html5_tree_construction_exceptions.js */
|
||||||
|
/* globals parserDatFiles */
|
||||||
|
|
||||||
var functionsToRunAsync = [];
|
var functionsToRunAsync = [];
|
||||||
|
|
||||||
window.addEventListener("message", function(event) {
|
window.addEventListener("message", function(event) {
|
||||||
|
|
@ -87,6 +91,7 @@ function makeFragmentTestChecker(input,
|
||||||
context = document.createElementNS("http://www.w3.org/1999/xhtml",
|
context = document.createElementNS("http://www.w3.org/1999/xhtml",
|
||||||
fragment);
|
fragment);
|
||||||
}
|
}
|
||||||
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
context.innerHTML = input;
|
context.innerHTML = input;
|
||||||
var domAsString = fragmentToTestOutput(context);
|
var domAsString = fragmentToTestOutput(context);
|
||||||
is(domAsString, expected, "HTML5 expected success. " + new Date());
|
is(domAsString, expected, "HTML5 expected success. " + new Date());
|
||||||
|
|
@ -99,7 +104,6 @@ function makeFragmentTestChecker(input,
|
||||||
|
|
||||||
var testcases;
|
var testcases;
|
||||||
function nextTest(testframe) {
|
function nextTest(testframe) {
|
||||||
var test = 0;
|
|
||||||
var {done, value} = testcases.next();
|
var {done, value} = testcases.next();
|
||||||
if (done) {
|
if (done) {
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
|
|
|
||||||
|
|
@ -37,22 +37,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=339350
|
||||||
</div>
|
</div>
|
||||||
<pre id="test">
|
<pre id="test">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var text1 = 'foo bar';
|
/* eslint-disable no-unsanitized/property */
|
||||||
var text2 = 'foo [bar]';
|
var text1 = "foo bar";
|
||||||
var text3 = 'foo {bar}';
|
var text2 = "foo [bar]";
|
||||||
|
var text3 = "foo {bar}";
|
||||||
|
|
||||||
<!-- This is the long way to write this stuff,
|
// This is the long way to write this stuff,
|
||||||
you can use MochiKit functions too -->
|
// you can use MochiKit functions too
|
||||||
document.getElementById('i1').innerHTML = text1;
|
document.getElementById("i1").innerHTML = text1;
|
||||||
document.getElementById('i2').innerHTML = text2;
|
document.getElementById("i2").innerHTML = text2;
|
||||||
document.getElementById('i3').innerHTML = text3;
|
document.getElementById("i3").innerHTML = text3;
|
||||||
|
|
||||||
document.getElementById('t1').appendChild(document.createTextNode(text1));
|
document.getElementById("t1").appendChild(document.createTextNode(text1));
|
||||||
document.getElementById('t2').appendChild(document.createTextNode(text2));
|
document.getElementById("t2").appendChild(document.createTextNode(text2));
|
||||||
document.getElementById('t3').appendChild(document.createTextNode(text3));
|
document.getElementById("t3").appendChild(document.createTextNode(text3));
|
||||||
|
|
||||||
<!-- The is() function is one way to add a test -->
|
<!-- The is() function is one way to add a test -->
|
||||||
is(document.getElementById('i2').innerHTML, text2, "XHTML innerHTML with trailing brackets ']]'");
|
is(document.getElementById("i2").innerHTML, text2, "XHTML innerHTML with trailing brackets ']]'");
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=396568
|
||||||
|
|
||||||
var reached = false;
|
var reached = false;
|
||||||
try {
|
try {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
noSuchIdentifier;
|
noSuchIdentifier;
|
||||||
reached = true;
|
reached = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
is(e.lineNumber, 36, "Unexpected line number"); // this line number is dependent on the line number of noSuchIdentifier
|
is(e.lineNumber, 37, "Unexpected line number"); // this line number is dependent on the line number of noSuchIdentifier
|
||||||
}
|
}
|
||||||
is(reached, false, "Exception needed to be thrown");
|
is(reached, false, "Exception needed to be thrown");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=460437
|
||||||
</div>
|
</div>
|
||||||
<pre id="test">
|
<pre id="test">
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
|
/* eslint-disable no-unsanitized/property */
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
SimpleTest.expectAssertions(1);
|
SimpleTest.expectAssertions(1);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=566879
|
||||||
</div>
|
</div>
|
||||||
<pre id="test">
|
<pre id="test">
|
||||||
<script class="testbody" type="text/javascript">
|
<script class="testbody" type="text/javascript">
|
||||||
|
var initialState;
|
||||||
|
|
||||||
function runTest() {
|
function runTest() {
|
||||||
initialState = document.getElementById("content").innerHTML;
|
initialState = document.getElementById("content").innerHTML;
|
||||||
document.getElementById("textfield").value = "foo";
|
document.getElementById("textfield").value = "foo";
|
||||||
|
|
@ -39,6 +41,7 @@ function runTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function continuation1() {
|
function continuation1() {
|
||||||
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
document.getElementById("content").innerHTML = initialState;
|
document.getElementById("content").innerHTML = initialState;
|
||||||
setTimeout(continuation2, 1);
|
setTimeout(continuation2, 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ function tick() {
|
||||||
runNumber++;
|
runNumber++;
|
||||||
var f = document.getElementsByTagName("iframe")[0];
|
var f = document.getElementsByTagName("iframe")[0];
|
||||||
var d = f.contentDocument;
|
var d = f.contentDocument;
|
||||||
|
var text;
|
||||||
|
|
||||||
if (runNumber == 1) {
|
if (runNumber == 1) {
|
||||||
d.open();
|
d.open();
|
||||||
|
|
@ -49,14 +50,14 @@ function tick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runNumber == 2) {
|
if (runNumber == 2) {
|
||||||
var text = textChildren(d.body);
|
text = textChildren(d.body);
|
||||||
is(text, "XYZ", "Wrong text before reload.");
|
is(text, "XYZ", "Wrong text before reload.");
|
||||||
f.contentWindow.location.reload();
|
f.contentWindow.location.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runNumber == 3) {
|
if (runNumber == 3) {
|
||||||
var text = textChildren(d.body);
|
text = textChildren(d.body);
|
||||||
is(text, "XYZ", "Wrong text after reload.");
|
is(text, "XYZ", "Wrong text after reload.");
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ function insert_iframe(index, doctype) {
|
||||||
// Iterate over the tests
|
// Iterate over the tests
|
||||||
//
|
//
|
||||||
function doTest() {
|
function doTest() {
|
||||||
for (i = 0; i < doctypes.length; i += 2) {
|
for (var i = 0; i < doctypes.length; i += 2) {
|
||||||
insert_iframe(i, doctypes[i + 1]);
|
insert_iframe(i, doctypes[i + 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,8 @@ function updateDocumentSourceMaps(src) {
|
||||||
|
|
||||||
handleAttributes: function handleAttributes(aAttributes) {
|
handleAttributes: function handleAttributes(aAttributes) {
|
||||||
for (var i = 0; i < aAttributes.length; i++) {
|
for (var i = 0; i < aAttributes.length; i++) {
|
||||||
var attrNamespaceURI = aAttributes.getURI(i);
|
|
||||||
var attrLocalName = aAttributes.getLocalName(i);
|
var attrLocalName = aAttributes.getLocalName(i);
|
||||||
var attrNodeName = aAttributes.getQName(i);
|
var attrNodeName = aAttributes.getQName(i);
|
||||||
var value = aAttributes.getValue(i);
|
|
||||||
do_parse_check(attrLocalName, "Missing attribute local name");
|
do_parse_check(attrLocalName, "Missing attribute local name");
|
||||||
do_parse_check(attrNodeName, "Missing attribute node name");
|
do_parse_check(attrNodeName, "Missing attribute node name");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
function run_test() {
|
function run_test() {
|
||||||
// vectors by the html5security project (https://code.google.com/p/html5security/ & Creative Commons 3.0 BY), see CC-BY-LICENSE for the full license
|
// vectors by the html5security project (https://code.google.com/p/html5security/ & Creative Commons 3.0 BY), see CC-BY-LICENSE for the full license
|
||||||
load("results.js"); // gives us a `vectors' array
|
load("results.js"); // gives us a `vectors' array
|
||||||
|
/* import-globals-from ./results.js */
|
||||||
|
|
||||||
var ParserUtils = Cc["@mozilla.org/parserutils;1"].getService(Ci.nsIParserUtils);
|
var ParserUtils = Cc["@mozilla.org/parserutils;1"].getService(Ci.nsIParserUtils);
|
||||||
var sanitizeFlags = ParserUtils.SanitizerCidEmbedsOnly | ParserUtils.SanitizerDropForms | ParserUtils.SanitizerDropNonCSSPresentation;
|
var sanitizeFlags = ParserUtils.SanitizerCidEmbedsOnly | ParserUtils.SanitizerDropForms | ParserUtils.SanitizerDropNonCSSPresentation;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue