forked from mirrors/gecko-dev
Bug 1501931 - Enable ESLint for parser/ (automatic fixes) r=Standard8,mrbkap
Differential Revision: https://phabricator.services.mozilla.com/D11920 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
80387730b1
commit
4819e4a0ee
35 changed files with 384 additions and 385 deletions
|
|
@ -7,7 +7,7 @@
|
|||
testdiv
|
||||
</div>
|
||||
<script>
|
||||
var x=document.createElement('div');
|
||||
var x = document.createElement("div");
|
||||
x.innerHTML = '<meta http-equiv="Content-Type" content="text/html;"></meta>';
|
||||
document.getElementById("testdiv").appendChild(x);
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
var preloadedImages = [];
|
||||
while (preloadedImages.length < EXPECTED_PRELOADS) {
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('GET', "./file_img_picture_preload.sjs?status", false);
|
||||
request.open("GET", "./file_img_picture_preload.sjs?status", false);
|
||||
request.send(null);
|
||||
is(request.status, 200, "Getting status from sjs helper should succeed");
|
||||
if (request.status === 200) {
|
||||
|
|
@ -142,7 +142,7 @@
|
|||
}
|
||||
|
||||
// Check all images, ensure each one had a preload
|
||||
var images = document.querySelectorAll('img');
|
||||
var images = document.querySelectorAll("img");
|
||||
for (var img of images) {
|
||||
var imgName = img.id;
|
||||
if (img.currentSrc) {
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
* tests.
|
||||
*/
|
||||
var html5Exceptions = {
|
||||
"<!doctype html><keygen><frameset>" : true, // Bug 101019
|
||||
"<select><keygen>" : true, // Bug 101019
|
||||
"<!DOCTYPE html><body><keygen>A" : true, // Bug 101019
|
||||
"<p><table></p>" : true, // parser_web_testrunner.js uses srcdoc which forces quirks mode
|
||||
"<p><table></table>" : true, // parser_web_testrunner.js uses srcdoc which forces quirks mode
|
||||
}
|
||||
"<!doctype html><keygen><frameset>": true, // Bug 101019
|
||||
"<select><keygen>": true, // Bug 101019
|
||||
"<!DOCTYPE html><body><keygen>A": true, // Bug 101019
|
||||
"<p><table></p>": true, // parser_web_testrunner.js uses srcdoc which forces quirks mode
|
||||
"<p><table></table>": true, // parser_web_testrunner.js uses srcdoc which forces quirks mode
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=599584
|
|||
</head>
|
||||
<body>
|
||||
<script>
|
||||
document.getElementsByTagName("head")[0].innerHTML = '<meta http-equiv="Refresh" content="1; url=iframe_bug599584.html?navigated">'
|
||||
document.getElementsByTagName("head")[0].innerHTML = '<meta http-equiv="Refresh" content="1; url=iframe_bug599584.html?navigated">';
|
||||
parent.startTest();
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
/**
|
||||
* A test suite that runs WHATWG HTML parser tests.
|
||||
* The tests are from html5lib.
|
||||
* The tests are from html5lib.
|
||||
*
|
||||
* http://html5lib.googlecode.com/
|
||||
*/
|
||||
|
|
@ -14,15 +14,15 @@
|
|||
* A few utility functions.
|
||||
*/
|
||||
function log(entry) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function startsWith(s, s2) {
|
||||
return s.indexOf(s2)==0;
|
||||
return s.indexOf(s2) == 0;
|
||||
}
|
||||
|
||||
function trimString(s) {
|
||||
return(s.replace(/^\s+/,'').replace(/\s+$/,''));
|
||||
return (s.replace(/^\s+/, "").replace(/\s+$/, ""));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -43,7 +43,7 @@ function parseTestcase(testcase) {
|
|||
if (line == "#data")
|
||||
break;
|
||||
log(lines);
|
||||
throw "Unknown test format."
|
||||
throw "Unknown test format.";
|
||||
}
|
||||
|
||||
var input = [];
|
||||
|
|
@ -72,7 +72,7 @@ function parseTestcase(testcase) {
|
|||
while (!output[output.length - 1]) {
|
||||
output.pop(); // zap trailing blank lines
|
||||
}
|
||||
//logger.log(input.length, output.length, errors.length);
|
||||
// logger.log(input.length, output.length, errors.length);
|
||||
return [input.join("\n"), output.join("\n"), errors, fragment[0]];
|
||||
}
|
||||
|
||||
|
|
@ -94,14 +94,14 @@ function* test_parser(testlist) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Transforms a DOM document to a string matching the format in
|
||||
* Transforms a DOM document to a string matching the format in
|
||||
* the test cases.
|
||||
*
|
||||
* @param the DOM document
|
||||
*/
|
||||
function docToTestOutput(doc) {
|
||||
var walker = doc.createTreeWalker(doc, NodeFilter.SHOW_ALL, null);
|
||||
return addLevels(walker, "", "| ").slice(0,-1); // remove the last newline
|
||||
return addLevels(walker, "", "| ").slice(0, -1); // remove the last newline
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -111,7 +111,7 @@ function docToTestOutput(doc) {
|
|||
*/
|
||||
function createFragmentWalker(elt) {
|
||||
return elt.ownerDocument.createTreeWalker(elt, NodeFilter.SHOW_ALL,
|
||||
function (node) {
|
||||
function(node) {
|
||||
return elt == node ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
||||
});
|
||||
}
|
||||
|
|
@ -124,16 +124,16 @@ function createFragmentWalker(elt) {
|
|||
*/
|
||||
function fragmentToTestOutput(elt) {
|
||||
var walker = createFragmentWalker(elt);
|
||||
return addLevels(walker, "", "| ").slice(0,-1); // remove the last newline
|
||||
return addLevels(walker, "", "| ").slice(0, -1); // remove the last newline
|
||||
}
|
||||
|
||||
function addLevels(walker, buf, indent) {
|
||||
if(walker.firstChild()) {
|
||||
if (walker.firstChild()) {
|
||||
do {
|
||||
buf += indent;
|
||||
switch (walker.currentNode.nodeType) {
|
||||
case Node.ELEMENT_NODE:
|
||||
buf += "<"
|
||||
buf += "<";
|
||||
var ns = walker.currentNode.namespaceURI;
|
||||
if ("http://www.w3.org/1998/Math/MathML" == ns) {
|
||||
buf += "math ";
|
||||
|
|
@ -165,8 +165,8 @@ function addLevels(walker, buf, indent) {
|
|||
}
|
||||
var keys = Object.keys(valuesByName).sort();
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
buf += "\n" + indent + " " + keys[i] +
|
||||
"=\"" + valuesByName[keys[i]] +"\"";
|
||||
buf += "\n" + indent + " " + keys[i] +
|
||||
"=\"" + valuesByName[keys[i]] + "\"";
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -199,7 +199,7 @@ function addLevels(walker, buf, indent) {
|
|||
buf = addLevels(templateWalker, buf, indent + " ");
|
||||
}
|
||||
buf = addLevels(walker, buf, indent + " ");
|
||||
} while(walker.nextSibling());
|
||||
} while (walker.nextSibling());
|
||||
walker.parentNode();
|
||||
}
|
||||
return buf;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
/**
|
||||
* Runs html5lib-formatted test cases in the browser. Requires SimpleTest.
|
||||
*
|
||||
|
|
@ -32,19 +32,19 @@ function asyncRun(fn) {
|
|||
|
||||
function writeErrorSummary(input, expected, got, isTodo) {
|
||||
if (isTodo) {
|
||||
$("display").appendChild(createEl('h2', null, "Unexpected Success:"));
|
||||
$("display").appendChild(createEl("h2", null, "Unexpected Success:"));
|
||||
} else {
|
||||
$("display").appendChild(createEl('h2', null, "Unexpected Failure:"));
|
||||
$("display").appendChild(createEl("h2", null, "Unexpected Failure:"));
|
||||
}
|
||||
$("display").appendChild(createEl('br'));
|
||||
$("display").appendChild(createEl('span', null, "Matched: "));
|
||||
$("display").appendChild(createEl("br"));
|
||||
$("display").appendChild(createEl("span", null, "Matched: "));
|
||||
$("display").appendChild(document.createTextNode("" + (expected == got)));
|
||||
var pre = createEl('pre');
|
||||
var pre = createEl("pre");
|
||||
pre.appendChild(document.createTextNode("Input: \n" + input, "\n-\n"));
|
||||
pre.appendChild(document.createTextNode("Expected:\n" + expected, "\n-\n"));
|
||||
pre.appendChild(document.createTextNode("Output:\n" + got + "\n-\n"));
|
||||
$("display").appendChild(pre);
|
||||
$("display").appendChild(createEl('hr'));
|
||||
$("display").appendChild(createEl("hr"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -53,7 +53,7 @@ function writeErrorSummary(input, expected, got, isTodo) {
|
|||
* makeFragmentTestChecker() until the 'testcases' iterator is spent.
|
||||
*/
|
||||
function makeTestChecker(input, expected, errors) {
|
||||
return function (e) {
|
||||
return function(e) {
|
||||
var domAsString = docToTestOutput(e.target.contentDocument);
|
||||
if (html5Exceptions[input]) {
|
||||
todo_is(domAsString, expected, "HTML5 expected success.");
|
||||
|
|
@ -67,15 +67,15 @@ function makeTestChecker(input, expected, errors) {
|
|||
}
|
||||
}
|
||||
nextTest(e.target);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function makeFragmentTestChecker(input,
|
||||
expected,
|
||||
errors,
|
||||
fragment,
|
||||
function makeFragmentTestChecker(input,
|
||||
expected,
|
||||
errors,
|
||||
fragment,
|
||||
testframe) {
|
||||
return function () {
|
||||
return function() {
|
||||
var context;
|
||||
if (fragment.startsWith("svg ")) {
|
||||
context = document.createElementNS("http://www.w3.org/2000/svg",
|
||||
|
|
@ -94,7 +94,7 @@ function makeFragmentTestChecker(input,
|
|||
writeErrorSummary(input, expected, domAsString, false);
|
||||
}
|
||||
nextTest(testframe);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var testcases;
|
||||
|
|
@ -107,10 +107,10 @@ function nextTest(testframe) {
|
|||
}
|
||||
var [input, output, errors, fragment] = value;
|
||||
if (fragment) {
|
||||
asyncRun(makeFragmentTestChecker(input,
|
||||
output,
|
||||
errors,
|
||||
fragment,
|
||||
asyncRun(makeFragmentTestChecker(input,
|
||||
output,
|
||||
errors,
|
||||
fragment,
|
||||
testframe));
|
||||
} else {
|
||||
testframe.onload = makeTestChecker(input, output, errors);
|
||||
|
|
@ -123,7 +123,7 @@ function loadNextTestFile() {
|
|||
var datFile = parserDatFiles.shift();
|
||||
if (datFile) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function () {
|
||||
xhr.onreadystatechange = function() {
|
||||
if (this.readyState == 4) {
|
||||
testFileContents.push(this.responseText);
|
||||
loadNextTestFile();
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ var p = new DOMParser();
|
|||
|
||||
var d = p.parseFromString(
|
||||
'<meta charset="windows-1252">' +
|
||||
'\u003cscript>' +
|
||||
"\u003cscript>" +
|
||||
'document.documentElement.setAttribute("data-fail", "FAIL");' +
|
||||
'\u003c/script>' +
|
||||
"\u003c/script>" +
|
||||
'\u003cscript src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs">\u003c/script>' +
|
||||
'\u003cscript src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs" defer>\u003c/script>' +
|
||||
'\u003cscript src="http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_bug102699.sjs" async>\u003c/script>' +
|
||||
|
|
@ -64,7 +64,7 @@ function continueAfterReport() {
|
|||
ok(!d.documentElement.hasAttribute("data-fail"), "Should not have a data-fail attribute.");
|
||||
|
||||
d = p.parseFromString("<!DOCTYPE html>", "text/html");
|
||||
is(d.compatMode, "CSS1Compat", "Should be in the standards mode.");
|
||||
is(d.compatMode, "CSS1Compat", "Should be in the standards mode.");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1104732
|
|||
var asyncState = "not loaded";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
is(document.readyState, "loading", "Document should have been loading.");
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
is(document.readyState, "interactive", "readyState should be interactive during DOMContentLoaded.");
|
||||
is(state, "defer", "Bad state upon DOMContentLoaded");
|
||||
state = "DOMContentLoaded";
|
||||
|
|
@ -35,9 +35,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1104732
|
|||
// it will sometimes be the case...
|
||||
// isnot(asyncState, "loaded", "Async script should not have delayed domcontentloaded");
|
||||
});
|
||||
window.addEventListener("load", function () {
|
||||
window.addEventListener("load", function() {
|
||||
is(document.readyState, "complete", "readyState should be complete during load.");
|
||||
is(state, "DOMContentLoaded", "Bad state upon load")
|
||||
is(state, "DOMContentLoaded", "Bad state upon load");
|
||||
state = "load";
|
||||
is(asyncState, "loaded", "Async script should be loaded upon document load event");
|
||||
SimpleTest.finish();
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ function done() {
|
|||
// have gotten ignored due to the parser still being not-script-created.
|
||||
var iframe = document.getElementById("iframe");
|
||||
var divs = iframe.contentWindow.document.getElementsByTagName("div").length;
|
||||
is(divs, 2, "<div>s are still there.")
|
||||
is(divs, 2, "<div>s are still there.");
|
||||
var ps = iframe.contentWindow.document.getElementsByTagName("p").length;
|
||||
is(ps, 0, "<p> did not get written.")
|
||||
is(ps, 0, "<p> did not get written.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=174351
|
|||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var iframe = document.createElement('iframe');
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "invalidchar.xml";
|
||||
iframe.onload = function () {
|
||||
var doc = document.getElementById('test').childNodes[1].contentDocument;
|
||||
iframe.onload = function() {
|
||||
var doc = document.getElementById("test").childNodes[1].contentDocument;
|
||||
ok(doc.documentElement.tagName != "root", "Since XML has invalid enconding, must throw error");
|
||||
};
|
||||
|
||||
document.getElementById('test').appendChild(iframe);
|
||||
document.getElementById("test").appendChild(iframe);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=358797
|
|||
|
||||
var range = document.createRange();
|
||||
range.selectNode(document.firstChild);
|
||||
var cf = range.createContextualFragment('<span></span>');
|
||||
var cf = range.createContextualFragment("<span></span>");
|
||||
ok(cf != null,
|
||||
"range.createContextualFragment() should work when range node is DocType");
|
||||
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=396568
|
|||
noSuchIdentifier;
|
||||
reached = true;
|
||||
} catch (e) {
|
||||
is(e.lineNumber, 36, "Unexpected line number"); //this line number is dependent on the line number of noSuchIdentifier
|
||||
is(e.lineNumber, 36, "Unexpected line number"); // this line number is dependent on the line number of noSuchIdentifier
|
||||
}
|
||||
is(reached, false, "Exception needed to be thrown");
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ SimpleTest.expectAssertions(1);
|
|||
|
||||
/** Test for Bug 460437 **/
|
||||
|
||||
var s = '<i>invalid</i';
|
||||
var s = "<i>invalid</i";
|
||||
try {
|
||||
document.getElementById('test460437').innerHTML = s;
|
||||
document.getElementById("test460437").innerHTML = s;
|
||||
} catch (e) {
|
||||
}
|
||||
is(document.getElementById('test460437').innerHTML, "", "setting invalid innerHTML should clear it");
|
||||
s = '<i>valid</i>';
|
||||
document.getElementById('test460437').innerHTML = s;
|
||||
is(document.getElementById('test460437').innerHTML, "<i xmlns=\"http://www.w3.org/1999/xhtml\">valid</i>", "failed to set valid innerHTML");
|
||||
is(document.getElementById("test460437").innerHTML, "", "setting invalid innerHTML should clear it");
|
||||
s = "<i>valid</i>";
|
||||
document.getElementById("test460437").innerHTML = s;
|
||||
is(document.getElementById("test460437").innerHTML, "<i xmlns=\"http://www.w3.org/1999/xhtml\">valid</i>", "failed to set valid innerHTML");
|
||||
|
||||
|
||||
]]>
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ Adding a <meta> element by writing to innerHTML should work correctly.
|
|||
<script class="testbody" type="text/javascript">
|
||||
function $(id) { return document.getElementById(id); }
|
||||
|
||||
var iframe=document.createElement("iframe");
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.setAttribute("id", "iframe");
|
||||
iframe.src = "bug_502091_iframe.html";
|
||||
iframe.onload = function () {
|
||||
iframe.onload = function() {
|
||||
var div = $("iframe").contentDocument.getElementById("testdiv");
|
||||
var meta = div.getElementsByTagName("meta");
|
||||
is(meta.length, 1, "meta element not added to div");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ var svgLoadFired = false;
|
|||
<div id="content" style="display: none">
|
||||
<svg>
|
||||
<script>
|
||||
document.getElementsByTagName("svg")[0].addEventListener("SVGLoad",
|
||||
document.getElementsByTagName("svg")[0].addEventListener("SVGLoad",
|
||||
function() { svgLoadFired = true; });
|
||||
</script>
|
||||
</svg>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=563322
|
|||
/** Test for Bug 563322 **/
|
||||
|
||||
var div = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
|
||||
div.innerHTML = "<script>ok(false, 'Script ran but should not have')</script><script>ok(false, 'Script ran but should not have')</script>"
|
||||
div.innerHTML = "<script>ok(false, 'Script ran but should not have')</script><script>ok(false, 'Script ran but should not have')</script>";
|
||||
|
||||
document.getElementById("content").appendChild(div);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,26 +29,26 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=566879
|
|||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
function runTest() {
|
||||
initialState = document.getElementById('content').innerHTML;
|
||||
document.getElementById('textfield').value = "foo";
|
||||
document.getElementById('checkbox').checked = true;
|
||||
document.getElementById('radio2').checked = true;
|
||||
document.getElementById('textarea').value = "foo";
|
||||
document.getElementById('select').value = "foo";
|
||||
initialState = document.getElementById("content").innerHTML;
|
||||
document.getElementById("textfield").value = "foo";
|
||||
document.getElementById("checkbox").checked = true;
|
||||
document.getElementById("radio2").checked = true;
|
||||
document.getElementById("textarea").value = "foo";
|
||||
document.getElementById("select").value = "foo";
|
||||
setTimeout(continuation1, 1);
|
||||
}
|
||||
|
||||
function continuation1() {
|
||||
document.getElementById('content').innerHTML = initialState;
|
||||
document.getElementById("content").innerHTML = initialState;
|
||||
setTimeout(continuation2, 1);
|
||||
}
|
||||
|
||||
function continuation2() {
|
||||
is(document.getElementById('textfield').value, "", "The text field should have gone back to its initial state.");
|
||||
ok(!document.getElementById('checkbox').checked, "The checkbox should have gone back to its initial state.");
|
||||
ok(!document.getElementById('radio2').checked, "The second radio button should have gone back to its initial state.");
|
||||
is(document.getElementById('textarea').value, "", "The text area should have gone back to its initial state.");
|
||||
is(document.getElementById('select').value, "bar", "The select should have gone back to its initial state.");
|
||||
is(document.getElementById("textfield").value, "", "The text field should have gone back to its initial state.");
|
||||
ok(!document.getElementById("checkbox").checked, "The checkbox should have gone back to its initial state.");
|
||||
ok(!document.getElementById("radio2").checked, "The second radio button should have gone back to its initial state.");
|
||||
is(document.getElementById("textarea").value, "", "The text area should have gone back to its initial state.");
|
||||
is(document.getElementById("select").value, "bar", "The select should have gone back to its initial state.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=568470
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// assuming the test runs in less than a year...
|
||||
var time = new Date().getTime() + 1000*60*60*24*365;
|
||||
var time = new Date().getTime() + 1000 * 60 * 60 * 24 * 365;
|
||||
|
||||
var interval = setInterval(function() {
|
||||
var iframe = document.getElementsByTagName("iframe")[0];
|
||||
|
|
@ -27,7 +27,7 @@ var interval = setInterval(function() {
|
|||
if (doc) {
|
||||
if (doc.getElementById("flushable")) {
|
||||
time = new Date();
|
||||
clearInterval(interval);
|
||||
clearInterval(interval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ function startTest() {
|
|||
return;
|
||||
}
|
||||
alreadyRan = true;
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
var iframe = document.getElementsByTagName("iframe")[0];
|
||||
is(iframe.contentWindow.location.search, "", "Should not have navigated with query string.");
|
||||
SimpleTest.finish();
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ var events = [
|
|||
[ "DOMSubtreeModified", null ],
|
||||
[ "DOMNodeInserted", document.body ],
|
||||
[ "DOMNodeInserted", document.body ],
|
||||
[ "DOMSubtreeModified", null ]
|
||||
[ "DOMSubtreeModified", null ],
|
||||
];
|
||||
|
||||
function mutationEventListener(evt) {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ var events = [
|
|||
[ "DOMSubtreeModified", null ],
|
||||
[ "DOMNodeInserted", document.body ],
|
||||
[ "DOMNodeInserted", document.body ],
|
||||
[ "DOMSubtreeModified", null ]
|
||||
[ "DOMSubtreeModified", null ],
|
||||
];
|
||||
|
||||
function mutationEventListener(evt) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ SimpleTest.waitForExplicitFinish();
|
|||
|
||||
function loaded(iframe) {
|
||||
is(SpecialPowers.wrap(iframe).contentWindow.location.href, iframe.src, "should load correct URL");
|
||||
is(SpecialPowers.wrap(iframe).contentDocument.body.textContent, 'CACHE MANIFEST', "text/cache-manifest should be treated as text");
|
||||
is(SpecialPowers.wrap(iframe).contentDocument.body.textContent, "CACHE MANIFEST", "text/cache-manifest should be treated as text");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ function probe() {
|
|||
setTimeout(probe, 0);
|
||||
return;
|
||||
case 2:
|
||||
is(tdsSeen, 1, "Should have seen one td before seeing two.");
|
||||
is(tdsSeen, 1, "Should have seen one td before seeing two.");
|
||||
finishedTesting = true;
|
||||
tryFinishTest();
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ window.onload = function() {
|
|||
|
||||
SimpleTest.monitorConsole(SimpleTest.finish, expectedErrors);
|
||||
runNextTest();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=688580
|
|||
var readyStateCall = 0;
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
is(document.readyState, "loading", "Document should have been loading.");
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
is(document.readyState, "interactive", "readyState should be interactive during DOMContentLoaded.");
|
||||
is(state, "defer", "Bad state upon DOMContentLoaded");
|
||||
state = "DOMContentLoaded";
|
||||
});
|
||||
document.addEventListener("readystatechange", function () {
|
||||
document.addEventListener("readystatechange", function() {
|
||||
readyStateCall++;
|
||||
if (readyStateCall == 1) {
|
||||
is(document.readyState, "interactive", "readyState should have changed to interactive.");
|
||||
|
|
@ -43,9 +43,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=688580
|
|||
ok(false, "Too many readystatechanges");
|
||||
}
|
||||
});
|
||||
window.addEventListener("load", function () {
|
||||
window.addEventListener("load", function() {
|
||||
is(document.readyState, "complete", "readyState should be complete during load.");
|
||||
is(state, "readyState complete", "Bad state upon load")
|
||||
is(state, "readyState complete", "Bad state upon load");
|
||||
state = "load";
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=688580
|
|||
var readyStateCall = 0;
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
is(document.readyState, "loading", "Document should have been loading.");
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
is(document.readyState, "interactive", "readyState should be interactive during DOMContentLoaded.");
|
||||
is(state, "defer", "Bad state upon DOMContentLoaded");
|
||||
state = "DOMContentLoaded";
|
||||
});
|
||||
document.addEventListener("readystatechange", function () {
|
||||
document.addEventListener("readystatechange", function() {
|
||||
readyStateCall++;
|
||||
if (readyStateCall == 1) {
|
||||
is(document.readyState, "interactive", "readyState should have changed to interactive.");
|
||||
|
|
@ -41,9 +41,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=688580
|
|||
ok(false, "Too many readystatechanges");
|
||||
}
|
||||
});
|
||||
window.addEventListener("load", function () {
|
||||
window.addEventListener("load", function() {
|
||||
is(document.readyState, "complete", "readyState should be complete during load.");
|
||||
is(state, "readyState complete", "Bad state upon load")
|
||||
is(state, "readyState complete", "Bad state upon load");
|
||||
state = "load";
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ function tick() {
|
|||
d.close();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (runNumber == 2) {
|
||||
var text = textChildren(d.body);
|
||||
is(text, "XYZ", "Wrong text before reload.");
|
||||
|
|
@ -59,7 +59,7 @@ function tick() {
|
|||
var text = textChildren(d.body);
|
||||
is(text, "XYZ", "Wrong text after reload.");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=716579
|
|||
var html8 = "FAIL";
|
||||
var html16 = "FAIL";
|
||||
var xml8 = "FAIL";
|
||||
var xml16 = "FAIL";
|
||||
var xml16 = "FAIL";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=717180
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
window.addEventListener("load", function () {
|
||||
window.addEventListener("load", function() {
|
||||
var iframe = document.getElementsByTagName("iframe")[0];
|
||||
var d = iframe.contentDocument;
|
||||
d.open();
|
||||
|
|
@ -31,7 +31,7 @@ window.addEventListener("load", function () {
|
|||
SimpleTest.finish();
|
||||
});
|
||||
d.write("\u003Cscript>");
|
||||
d.write("window.location = 'file_bug717180.html';")
|
||||
d.write("window.location = 'file_bug717180.html';");
|
||||
d.write("\u003C/script>");
|
||||
d.write("FAIL");
|
||||
d.close();
|
||||
|
|
|
|||
|
|
@ -20,36 +20,36 @@
|
|||
|
||||
var doctypes = [
|
||||
/* from bug 363883 */
|
||||
'BackCompat' , '<!DOCTYPE>',
|
||||
'BackCompat' , '<!DOCTYPEz>',
|
||||
'BackCompat' , '<! DOCTYPE>',
|
||||
'BackCompat' , '<!zDOCTYPE>',
|
||||
'CSS1Compat' , '<!DOCTYPEHTML>',
|
||||
'BackCompat' , '<!DOCTYPEz HTML>',
|
||||
'CSS1Compat' , '<!DOCTYPE HTML>',
|
||||
'BackCompat' , '<!zDOCTYPE HTML>',
|
||||
'BackCompat' , '<!DOCTYPE HTMLz>',
|
||||
'BackCompat' , '<!DOCTYPE zHTML>',
|
||||
'BackCompat' , '<!DOCTYPE XHTML>',
|
||||
'BackCompat' , '<!DOCTYPE zzHTML>',
|
||||
'BackCompat' , '<!DOCTYPEzHTML>',
|
||||
'BackCompat' , '<!DOCTYPEzzHTML>',
|
||||
'BackCompat' , '<!DOCTYPE "bla">',
|
||||
'BackCompat' , '<!DOCTYPE HTML "bla">',
|
||||
'BackCompat' , '<!DOCTYPE HTML "html">',
|
||||
'BackCompat' , '<!DOCTYPE PUBLIC>',
|
||||
'BackCompat' , '<!DOCTYPE PUBLIC "bla">',
|
||||
'BackCompat' , '<!DOCTYPE PUBLIC "html">',
|
||||
'CSS1Compat' , '<!DOCTYPE HTML PUBLIC "bla">',
|
||||
'BackCompat' , '<!DOCTYPE HTML PUBLIC "html">',
|
||||
'BackCompat' , '<!DOCTYPEz HTML PUBLIC "html">',
|
||||
'BackCompat' , '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//en">',
|
||||
'BackCompat' , '<!DOCTYPEz HTML PUBLIC "-//IETF//DTD HTML 3.2//en">',
|
||||
'BackCompat' , '<!DOCTYPE HTMLz PUBLIC "DTD HTML 3.2">',
|
||||
'BackCompat' , '<!DOCTYPE "DTD HTML 3.2">',
|
||||
"BackCompat", "<!DOCTYPE>",
|
||||
"BackCompat", "<!DOCTYPEz>",
|
||||
"BackCompat", "<! DOCTYPE>",
|
||||
"BackCompat", "<!zDOCTYPE>",
|
||||
"CSS1Compat", "<!DOCTYPEHTML>",
|
||||
"BackCompat", "<!DOCTYPEz HTML>",
|
||||
"CSS1Compat", "<!DOCTYPE HTML>",
|
||||
"BackCompat", "<!zDOCTYPE HTML>",
|
||||
"BackCompat", "<!DOCTYPE HTMLz>",
|
||||
"BackCompat", "<!DOCTYPE zHTML>",
|
||||
"BackCompat", "<!DOCTYPE XHTML>",
|
||||
"BackCompat", "<!DOCTYPE zzHTML>",
|
||||
"BackCompat", "<!DOCTYPEzHTML>",
|
||||
"BackCompat", "<!DOCTYPEzzHTML>",
|
||||
"BackCompat", '<!DOCTYPE "bla">',
|
||||
"BackCompat", '<!DOCTYPE HTML "bla">',
|
||||
"BackCompat", '<!DOCTYPE HTML "html">',
|
||||
"BackCompat", "<!DOCTYPE PUBLIC>",
|
||||
"BackCompat", '<!DOCTYPE PUBLIC "bla">',
|
||||
"BackCompat", '<!DOCTYPE PUBLIC "html">',
|
||||
"CSS1Compat", '<!DOCTYPE HTML PUBLIC "bla">',
|
||||
"BackCompat", '<!DOCTYPE HTML PUBLIC "html">',
|
||||
"BackCompat", '<!DOCTYPEz HTML PUBLIC "html">',
|
||||
"BackCompat", '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//en">',
|
||||
"BackCompat", '<!DOCTYPEz HTML PUBLIC "-//IETF//DTD HTML 3.2//en">',
|
||||
"BackCompat", '<!DOCTYPE HTMLz PUBLIC "DTD HTML 3.2">',
|
||||
"BackCompat", '<!DOCTYPE "DTD HTML 3.2">',
|
||||
/* end from bug 363883 */
|
||||
// from bug 502600
|
||||
'BackCompat' , '<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">',
|
||||
"BackCompat", '<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">',
|
||||
];
|
||||
|
||||
window.addEventListener("message", verifyResult);
|
||||
|
|
@ -58,37 +58,37 @@ function verifyResult(event) {
|
|||
let i = event.data.index;
|
||||
let curFrame = document.getElementById("test" + i);
|
||||
let mode = SpecialPowers.wrap(curFrame).contentDocument.compatMode;
|
||||
is(mode,doctypes[i],doctypes[i+1]);
|
||||
is(mode, doctypes[i], doctypes[i + 1]);
|
||||
if (i == doctypes.length - 2) {
|
||||
window.removeEventListener("message", verifyResult);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
// Insert a hidden iframe into the document, with the src
|
||||
// //
|
||||
// Insert a hidden iframe into the document, with the src
|
||||
// containing the test doctype. The iframe's onload
|
||||
// function is set to call the test's verification step.
|
||||
//
|
||||
function insert_iframe(index, doctype) {
|
||||
var elm = document.createElement('iframe');
|
||||
var elm = document.createElement("iframe");
|
||||
elm.setAttribute("id", "test" + index);
|
||||
elm.setAttribute('src', 'data:text/html,' + doctype +
|
||||
'<html><body onload="parent.postMessage({index:'+index+'},\'*\');"></body>');
|
||||
elm.setAttribute('style', 'display:none');
|
||||
document.getElementsByTagName('body')[0].appendChild(elm);
|
||||
elm.setAttribute("src", "data:text/html," + doctype +
|
||||
'<html><body onload="parent.postMessage({index:' + index + '},\'*\');"></body>');
|
||||
elm.setAttribute("style", "display:none");
|
||||
document.getElementsByTagName("body")[0].appendChild(elm);
|
||||
}
|
||||
|
||||
////
|
||||
// //
|
||||
// Iterate over the tests
|
||||
//
|
||||
function doTest() {
|
||||
for (i=0; i < doctypes.length; i+=2) {
|
||||
insert_iframe(i,doctypes[i+1]);
|
||||
for (i = 0; i < doctypes.length; i += 2) {
|
||||
insert_iframe(i, doctypes[i + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
// //
|
||||
// Run the compatbility mode tests.
|
||||
//
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1067345
|
|||
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
SpecialPowers.pushPrefEnv({'set': [ [ "dom.image.srcset.enabled", true ],
|
||||
SpecialPowers.pushPrefEnv({"set": [ [ "dom.image.srcset.enabled", true ],
|
||||
[ "dom.image.picture.enabled", true ]] },
|
||||
function() {
|
||||
// Reset the sjs helper so repeat runs work
|
||||
|
|
@ -35,7 +35,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1067345
|
|||
function resetRequests() {
|
||||
// Ask the SJS to reset requests
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('GET', "./file_img_picture_preload.sjs?reset", false);
|
||||
request.open("GET", "./file_img_picture_preload.sjs?reset", false);
|
||||
request.send(null);
|
||||
is(request.status, 200, "Sending reset to helper should succeed");
|
||||
// Script responds with pre-reset request count
|
||||
|
|
@ -64,8 +64,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1067345
|
|||
// To avoid spurious image loads being reported when the resolution changes,
|
||||
// load an intermediate iframe.
|
||||
iframe.src = "about:blank";
|
||||
iframe.addEventListener('load', function() {
|
||||
SpecialPowers.pushPrefEnv({'set': [ [ "layout.css.devPixelsPerPx", currentDPI ]] },
|
||||
iframe.addEventListener("load", function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [ [ "layout.css.devPixelsPerPx", currentDPI ]] },
|
||||
function() {
|
||||
// Clear image cache for next run (we don't try to validate cached items
|
||||
// in preload).
|
||||
|
|
|
|||
|
|
@ -4,48 +4,48 @@
|
|||
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
|
||||
<body>
|
||||
<script class="testbody">
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var declaredEncodings = [null, 'utf-8', 'uTf-8', 'UTF-8', 'utf-16', 'uTf-16', 'UTF-16'];
|
||||
var actualEncodings = ['utf-8', 'utf-16be', 'utf-16le'];
|
||||
var i = 0, j = 0
|
||||
var declaredEncodings = [null, "utf-8", "uTf-8", "UTF-8", "utf-16", "uTf-16", "UTF-16"];
|
||||
var actualEncodings = ["utf-8", "utf-16be", "utf-16le"];
|
||||
var i = 0, j = 0;
|
||||
testxhr(declaredEncodings[i], actualEncodings[j]);
|
||||
|
||||
function testxhr(declaredEncoding, actualEncoding) {
|
||||
// utf-16 XML requres the BOM
|
||||
var bom = actualEncoding.startsWith('utf-16') ? '\uFEFF' : '';
|
||||
var xmlDecl = declaredEncoding ? '<?xml version="1.0" encoding="' + declaredEncoding + '" ?>\n' : '';
|
||||
var bom = actualEncoding.startsWith("utf-16") ? "\uFEFF" : "";
|
||||
var xmlDecl = declaredEncoding ? '<?xml version="1.0" encoding="' + declaredEncoding + '" ?>\n' : "";
|
||||
// The test string need to contain U+xxD8 (bug 860180)
|
||||
var xmlString = bom + xmlDecl + '<test>testハヒフヘホ</test>';
|
||||
var xmlString = bom + xmlDecl + "<test>testハヒフヘホ</test>";
|
||||
var xml = new TextEncoder(actualEncoding).encode(xmlString);
|
||||
var description = declaredEncoding ? ' labeled with ' + declaredEncoding : ' without XML declaration';
|
||||
var description = declaredEncoding ? " labeled with " + declaredEncoding : " without XML declaration";
|
||||
if (!declaredEncoding || actualEncoding !== declaredEncoding.toLowerCase()) {
|
||||
description += ' but actually encoded with ' + actualEncoding;
|
||||
description += " but actually encoded with " + actualEncoding;
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
var url = URL.createObjectURL(new Blob([xml], {type: 'text/xml'}));
|
||||
xhr.open('GET', url);
|
||||
var url = URL.createObjectURL(new Blob([xml], {type: "text/xml"}));
|
||||
xhr.open("GET", url);
|
||||
xhr.send();
|
||||
xhr.onload = xhr.onerror = function(e) {
|
||||
URL.revokeObjectURL(url);
|
||||
is(e.type, 'load', 'xhr loading should succeed for XML' + description);
|
||||
is(xhr.responseXML.documentElement.textContent, 'testハヒフヘホ',
|
||||
'response should be available for XML' + description);
|
||||
is(e.type, "load", "xhr loading should succeed for XML" + description);
|
||||
is(xhr.responseXML.documentElement.textContent, "testハヒフヘホ",
|
||||
"response should be available for XML" + description);
|
||||
testiframe(description, xml);
|
||||
};
|
||||
}
|
||||
|
||||
function testiframe(description, xml) {
|
||||
var iframe = document.createElement('iframe');
|
||||
var url = URL.createObjectURL(new Blob([xml], {type: 'text/xml'}))
|
||||
var iframe = document.createElement("iframe");
|
||||
var url = URL.createObjectURL(new Blob([xml], {type: "text/xml"}));
|
||||
iframe.src = url;
|
||||
iframe.onload = iframe.onerror = function(e) {
|
||||
URL.revokeObjectURL(url);
|
||||
is(e.type, 'load', 'iframe loading should succeed for XML' + description);
|
||||
is(iframe.contentDocument.documentElement.textContent, 'testハヒフヘホ',
|
||||
'iframe content should be available for XML' + description);
|
||||
is(e.type, "load", "iframe loading should succeed for XML" + description);
|
||||
is(iframe.contentDocument.documentElement.textContent, "testハヒフヘホ",
|
||||
"iframe content should be available for XML" + description);
|
||||
if (++i >= declaredEncodings.length) {
|
||||
i = 0;
|
||||
if (++j >= actualEncodings.length) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -7,8 +7,7 @@ function updateDocumentSourceMaps(src) {
|
|||
try {
|
||||
saxReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
|
||||
saxReader.setFeature("http://xml.org/sax/features/namespace", true);
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
// do nothing, we'll accept it as it is.
|
||||
}
|
||||
var parseErrorLog = [];
|
||||
|
|
@ -56,7 +55,7 @@ function updateDocumentSourceMaps(src) {
|
|||
|
||||
processingInstruction: function processingInstruction(aTarget, aData) {
|
||||
do_parse_check(aTarget, "Missing processing instruction target");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var errorHandler = {
|
||||
|
|
@ -70,7 +69,7 @@ function updateDocumentSourceMaps(src) {
|
|||
|
||||
ignorableWarning: function ignorableWarning(aError) {
|
||||
do_parse_check(!aError, "XML ignorable warning");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
saxReader.contentHandler = contentHandler;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
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
|
||||
load("results.js"); // gives us a `vectors' array
|
||||
load("results.js"); // gives us a `vectors' array
|
||||
|
||||
var ParserUtils = Cc["@mozilla.org/parserutils;1"].getService(Ci.nsIParserUtils);
|
||||
var sanitizeFlags = ParserUtils.SanitizerCidEmbedsOnly|ParserUtils.SanitizerDropForms|ParserUtils.SanitizerDropNonCSSPresentation;
|
||||
// flags according to
|
||||
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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue