forked from mirrors/gecko-dev
Bug 1561085 - Enable some ESLint rules for the rest of dom/base/test/**. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D35711 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6e6e460616
commit
e11ca34a3a
34 changed files with 216 additions and 199 deletions
|
|
@ -13,8 +13,6 @@ obj*/**
|
|||
|
||||
# dom/ exclusions which should be removed (aka ESLint enabled)
|
||||
dom/base/*.*
|
||||
dom/base/test/*.*
|
||||
dom/base/test/jsmodules/**
|
||||
dom/media/test/**
|
||||
!dom/media/test/marionette/yttest/*.js
|
||||
dom/promise/**
|
||||
|
|
@ -169,6 +167,7 @@ dom/svg/test/test_nonAnimStrings.xhtml
|
|||
dom/svg/test/test_SVG_namespace_ids.html
|
||||
|
||||
# Strange encodings
|
||||
dom/base/test/file_bug687859-16.js
|
||||
dom/encoding/test/test_utf16_files.html
|
||||
dom/encoding/test/file_utf16_be_bom.js
|
||||
dom/encoding/test/file_utf16_le_bom.js
|
||||
|
|
@ -179,6 +178,12 @@ dom/html/test/test_bug677658.html
|
|||
|
||||
# Intentional broken files
|
||||
dom/base/test/file_js_cache_syntax_error.js
|
||||
dom/base/test/jsmodules/test_syntaxError.html
|
||||
dom/base/test/jsmodules/test_syntaxErrorAsync.html
|
||||
dom/base/test/jsmodules/module_badSyntax.js
|
||||
dom/base/test/jsmodules/test_syntaxErrorInline.html
|
||||
dom/base/test/jsmodules/test_syntaxErrorInlineAsync.html
|
||||
dom/base/test/test_bug687859.html
|
||||
dom/media/tests/mochitest/identity/idp-bad.js
|
||||
dom/serviceworkers/test/file_js_cache_syntax_error.js
|
||||
dom/serviceworkers/test/parse_error_worker.js
|
||||
|
|
|
|||
|
|
@ -62,10 +62,12 @@ add_task(async function(){
|
|||
|
||||
// Navigate to a content page from the child side.
|
||||
await BrowserTestUtils.switchTab(gBrowser, tab1);
|
||||
/* eslint-disable no-shadow */
|
||||
await ContentTask.spawn(tab1.linkedBrowser, null, async function() {
|
||||
const TEST_URL = "http://www.example.com/browser/dom/base/test/dummy.html";
|
||||
content.location.href = TEST_URL;
|
||||
});
|
||||
/* eslint-enable no-shadow */
|
||||
await BrowserTestUtils.browserLoaded(tab1.linkedBrowser, false, TEST_URL);
|
||||
is(ppmm.childCount, originalChildCount + 2,
|
||||
"Navigating away from the preloaded browser (child side) should create a new content process.")
|
||||
|
|
@ -106,4 +108,3 @@ add_task(async function preloaded_state_attribute() {
|
|||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
NewTabPagePreloading.removePreloadedBrowser(window);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ async function spawnNewAndTest(recur, pids) {
|
|||
};
|
||||
Services.obs.addObserver(observer, CONTENT_CREATED);
|
||||
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, function(browser) {
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, function() {
|
||||
// If this new tab caused us to create a new process, the ok(false)
|
||||
// should have already happened. Therefore, if we get here, we've
|
||||
// passed. Simply remove the observer.
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ async function runTest(input, url) {
|
|||
|
||||
is(data.inputStream.available(), input.length, "The length of the inputStream matches: " + input.length);
|
||||
|
||||
/* eslint-disable no-shadow */
|
||||
let dataBack = await ContentTask.spawn(browser, data, function(data) {
|
||||
let dataBack = {
|
||||
inputStream: data.inputStream,
|
||||
|
|
@ -34,6 +35,8 @@ async function runTest(input, url) {
|
|||
|
||||
return dataBack;
|
||||
});
|
||||
/* eslint-enable no-shadow */
|
||||
|
||||
|
||||
ok(dataBack.check, "The inputStream is a nsIInputStream also on content.");
|
||||
ok(data.inputStream instanceof Ci.nsIInputStream, "The original object was an inputStream");
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ const receive = (topic, p, syncCallback) => {
|
|||
}
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
const id = setTimeout(timeout, 90000);
|
||||
addObserver(observer, topic, false);
|
||||
queue.push(topic, resolve);
|
||||
|
|
@ -59,6 +60,7 @@ receive.queue = [];
|
|||
|
||||
const openTab = uri => gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, uri);
|
||||
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
||||
const isData = document => document.URL.startsWith("data:");
|
||||
|
|
|
|||
|
|
@ -226,6 +226,8 @@
|
|||
.bar. { background: red; color: yellow; }
|
||||
</span>
|
||||
<script><![CDATA[
|
||||
/* eslint-disable no-shadow */
|
||||
|
||||
window.onload = function() {
|
||||
doTest();
|
||||
}
|
||||
|
|
@ -242,13 +244,13 @@
|
|||
var cache = {};
|
||||
|
||||
var css = document.getElementById("test").firstChild.nodeValue.split("\n");
|
||||
for ( var i = 0; i < css.length; i++ ) {
|
||||
for ( let i = 0; i < css.length; i++ ) {
|
||||
css[i] = css[i].replace(/\/\*.*?\*\//g, "")
|
||||
.replace(/^\s*|\s*$/g, "").split(/\s*{/);
|
||||
}
|
||||
|
||||
var ecss = document.getElementById("error").firstChild.nodeValue.split("\n");
|
||||
for ( var i = 0; i < ecss.length; i++ ) {
|
||||
for ( let i = 0; i < ecss.length; i++ ) {
|
||||
ecss[i] = ecss[i].replace(/\/\*.*?\*\//g, "")
|
||||
.replace(/^\s*|\s*$/g, "").split(/\s*{/);
|
||||
}
|
||||
|
|
@ -290,14 +292,14 @@
|
|||
cacheCheck( "Fragment", fragment );
|
||||
|
||||
root.remove( );
|
||||
|
||||
|
||||
interfaceCheck(document, "Document");
|
||||
runTest( css, "Document", document, true );
|
||||
check( "Document", document, true, false );
|
||||
runTest( ecss, "SyntaxError: Document", document, false );
|
||||
jqTests("Document", document, "querySelectorAll");
|
||||
cacheCheck( "Document", document );
|
||||
|
||||
|
||||
done();
|
||||
|
||||
function interfaceCheck(obj, type){
|
||||
|
|
@ -320,7 +322,7 @@
|
|||
li.appendChild( document.createTextNode( ": " + passed + " passed, " + (tests - passed) + " failed" ) );
|
||||
r.appendChild( li );
|
||||
|
||||
for ( var i = 0; i < results.length; i++ ) {
|
||||
for ( let i = 0; i < results.length; i++ ) {
|
||||
var li = document.createElement("li");
|
||||
var span = document.createElement("span");
|
||||
span.style.color = (results[i][0] === "FAIL" ? "red" : "green");
|
||||
|
|
@ -404,14 +406,14 @@
|
|||
} catch(e){ pass = true; }
|
||||
assert( pass, type + ".querySelector no value" );
|
||||
|
||||
for ( var i = 0; i < css.length; i++ ) {
|
||||
for ( let i = 0; i < css.length; i++ ) {
|
||||
var test = css[i];
|
||||
if ( test.length == 2 ) {
|
||||
var query = test[0], color = test[1].match(/: ([^\s;]+)/)[1];
|
||||
|
||||
|
||||
try {
|
||||
var found = root.querySelectorAll(query);
|
||||
|
||||
|
||||
for ( var f = 0; f < found.length; f++ ) {
|
||||
found[f].style.backgroundColor = color;
|
||||
}
|
||||
|
|
@ -563,7 +565,7 @@
|
|||
(e.name == "SyntaxError" && e.code == DOMException.SYNTAX_ERR));
|
||||
}
|
||||
|
||||
assert( pass, type + ": " + name + " Bad Resolver #" + (i+1) + " (" + nq + ")" +
|
||||
assert( pass, type + ": " + name + " Bad Resolver #" + (i+1) + " (" + nq + ")" +
|
||||
(pass ? "" : " Expected: " + extra(ids) + " Received: " + extra(results)) );
|
||||
}
|
||||
} else {
|
||||
|
|
@ -575,7 +577,7 @@
|
|||
} catch(e) {
|
||||
pass = e.name == "SyntaxError" && e.code == DOMException.SYNTAX_ERR;
|
||||
}
|
||||
|
||||
|
||||
assert( pass, type + ": " + name + " (" + nq + ")" +
|
||||
(pass ? "" : " Expected: " + extra(ids) + " Received: " + extra(results)) );
|
||||
|
||||
|
|
@ -588,7 +590,7 @@
|
|||
|
||||
function hasPassed(results, ids){
|
||||
var pass = (results && results.length == ids.length) || (!results && !ids);
|
||||
|
||||
|
||||
if ( ids && results ) {
|
||||
for ( var i = 0; ids && i < ids.length; i++ ) {
|
||||
if ( ids[i] !== results[i].getAttribute("id") ) {
|
||||
|
|
@ -609,7 +611,7 @@
|
|||
extra += (extra.length > 2 ? "," : "") + "'" + (results[i].id || results[i]) + "'";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extra += "]";
|
||||
return extra;
|
||||
}
|
||||
|
|
@ -672,7 +674,7 @@
|
|||
var param = query("#object1 param");
|
||||
assert( param && param.length == 2, type + ": Object/param as context" );
|
||||
|
||||
var l = query("#length");
|
||||
var l = query("#length");
|
||||
assert( l && l.length, type + ': <input name="length"> cannot be found under IE' );
|
||||
var lin = query("#lengthtest input");
|
||||
assert( lin && lin.length, type + ': <input name="length"> cannot be found under IE' );
|
||||
|
|
@ -695,18 +697,18 @@
|
|||
t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", ["台北Táiběi","台北"] );
|
||||
t( "Descendant ID selector using UTF8", "div #台北", ["台北"] );
|
||||
t( "Child ID selector using UTF8", "form > #台北", ["台北"] );
|
||||
|
||||
|
||||
t( "Escaped ID", "#foo\\:bar", ["foo:bar"] );
|
||||
t( "Escaped ID", "#test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
|
||||
t( "Descendant escaped ID", "div #foo\\:bar", ["foo:bar"] );
|
||||
t( "Descendant escaped ID", "div #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
|
||||
t( "Child escaped ID", "form > #foo\\:bar", ["foo:bar"] );
|
||||
t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
|
||||
|
||||
|
||||
t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267
|
||||
t( "ID Selector, not an ancestor ID", "#form #first", [] );
|
||||
t( "ID Selector, not a child ID", "#form > #option1a", [] );
|
||||
|
||||
|
||||
t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] );
|
||||
t( "All Children of ID with no children", "#firstUL > *", [] );
|
||||
|
||||
|
|
@ -718,14 +720,14 @@
|
|||
t( "Class Selector", ".blog.link", ["simon"] );
|
||||
t( "Class Selector w/ Element", "a.blog", ["mark","simon"] );
|
||||
t( "Parent Class Selector", "p .blog", ["mark","simon"] );
|
||||
|
||||
|
||||
t( "Class selector using UTF8", ".台北Táiběi", ["utf8class1"] );
|
||||
t( "Class selector using UTF8", ".台北", ["utf8class1","utf8class2"] );
|
||||
t( "Class selector using UTF8", ".台北Táiběi.台北", ["utf8class1"] );
|
||||
t( "Class selector using UTF8", ".台北Táiběi, .台北", ["utf8class1","utf8class2"] );
|
||||
t( "Descendant class selector using UTF8", "div .台北Táiběi", ["utf8class1"] );
|
||||
t( "Child class selector using UTF8", "form > .台北Táiběi", ["utf8class1"] );
|
||||
|
||||
|
||||
t( "Escaped Class", ".foo\\:bar", ["foo:bar"] );
|
||||
t( "Escaped Class", ".test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
|
||||
t( "Descendant scaped Class", "div .foo\\:bar", ["foo:bar"] );
|
||||
|
|
@ -756,13 +758,13 @@
|
|||
t( "Adjacent", "a+a", ["groups"] );
|
||||
t( "Adjacent", "p + p", ["ap","en","sap"] );
|
||||
t( "Comma, Child, and Adjacent", "a + a, code > a", ["groups","anchor1","anchor2"] );
|
||||
|
||||
|
||||
t( "First Child", "p:first-child", ["firstp","sndp"] );
|
||||
t( "Nth Child", "p:nth-child(1)", ["firstp","sndp"] );
|
||||
|
||||
|
||||
t( "Last Child", "p:last-child", ["sap"] );
|
||||
t( "Last Child", "a:last-child", ["simon1","anchor1","mark","yahoo","anchor2","simon"] );
|
||||
|
||||
|
||||
t( "Nth-child", "#main form#form > *:nth-child(2)", ["text2"] );
|
||||
t( "Nth-child", "#main form#form > :nth-child(2)", ["text2"] );
|
||||
|
||||
|
|
@ -788,27 +790,27 @@
|
|||
t( "Attribute Exists", "a[title]", ["google"] );
|
||||
t( "Attribute Exists", "*[title]", ["google"] );
|
||||
t( "Attribute Exists", "[title]", ["google"] );
|
||||
|
||||
|
||||
t( "Attribute Equals", "a[rel='bookmark']", ["simon1"] );
|
||||
t( "Attribute Equals", 'a[rel="bookmark"]', ["simon1"] );
|
||||
t( "Attribute Equals", "a[rel=bookmark]", ["simon1"] );
|
||||
t( "Multiple Attribute Equals", "#form input[type='hidden'],#form input[type='radio']", ['radio1','radio2','hidden1'] );
|
||||
t( "Multiple Attribute Equals", "#form input[type=\"hidden\"],#form input[type='radio']", ['radio1','radio2','hidden1'] );
|
||||
t( "Multiple Attribute Equals", "#form input[type=hidden],#form input[type=radio]", ['radio1','radio2','hidden1'] );
|
||||
|
||||
|
||||
t( "Attribute selector using UTF8", "span[lang=中文]", ["台北"] );
|
||||
|
||||
|
||||
t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] );
|
||||
t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] );
|
||||
t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
|
||||
|
||||
|
||||
// t("Select options via [selected]", "#select1 option[selected]", ["option1a"] );
|
||||
t("Select options via [selected]", "#select1 option[selected]", [] );
|
||||
t("Select options via [selected]", "#select2 option[selected]", ["option2d"] );
|
||||
t("Select options via [selected]", "#select3 option[selected]", ["option3b", "option3c"] );
|
||||
|
||||
|
||||
t( "Grouped Form Elements", "input[name='foo[bar]']", ["hidden2"] );
|
||||
|
||||
|
||||
t( ":not() Existing attribute", "#form select:not([multiple])", ["select1", "select2"]);
|
||||
t( ":not() Equals attribute", "#form select:not([name=select1])", ["select2", "select3"]);
|
||||
t( ":not() Equals quoted attribute", "#form select:not([name='select1'])", ["select2", "select3"]);
|
||||
|
|
@ -1276,7 +1278,7 @@
|
|||
<h1 id="header">jQuery Test Suite</h1>
|
||||
<h2 id="banner"></h2>
|
||||
<h2 id="userAgent"></h2>
|
||||
|
||||
|
||||
<!-- Test HTML -->
|
||||
<div id="nothiddendiv" style="height:1px;background:white;">
|
||||
|
||||
|
|
@ -1293,9 +1295,9 @@
|
|||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||
|
||||
<p id="ap">
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/">Google Groups</a>.
|
||||
This link has <code><a href="http://smin" id="anchor1">class="blog"</a></code>:
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/">Google Groups</a>.
|
||||
This link has <code><a href="http://smin" id="anchor1">class="blog"</a></code>:
|
||||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
|
||||
|
||||
</p>
|
||||
|
|
@ -1322,14 +1324,14 @@
|
|||
|
||||
<input type="hidden" name="hidden" id="hidden1"/>
|
||||
<input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>
|
||||
|
||||
|
||||
<input type="text" id="name" name="name" value="name" />
|
||||
|
||||
|
||||
<button id="button" name="button">Button</button>
|
||||
|
||||
|
||||
<textarea id="area1" maxlength="30">foobar</textarea>
|
||||
|
||||
|
||||
|
||||
<select name="select1" id="select1">
|
||||
<option id="option1a" class="emptyopt" value="">Nothing</option>
|
||||
<option id="option1b" value="1">1</option>
|
||||
|
|
@ -1350,20 +1352,20 @@
|
|||
<option id="option3c" selected="selected" value="2">2</option>
|
||||
<option id="option3d" value="3">3</option>
|
||||
</select>
|
||||
|
||||
|
||||
<object id="object1" codebase="stupid">
|
||||
<param name="p1" value="x1" />
|
||||
<param name="p2" value="x2" />
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
<span id="台北Táiběi"></span>
|
||||
<span id="台北" lang="中文"></span>
|
||||
<span id="utf8class1" class="台北Táiběi 台北"></span>
|
||||
<span id="utf8class2" class="台北"></span>
|
||||
<span id="foo:bar" class="foo:bar"></span>
|
||||
<span id="test.foo[5]bar" class="test.foo[5]bar"></span>
|
||||
|
||||
|
||||
<foo_bar id="foobar">test element</foo_bar>
|
||||
|
||||
</form>
|
||||
|
|
@ -1375,27 +1377,27 @@
|
|||
</form>
|
||||
<table id="table"></table>
|
||||
|
||||
|
||||
|
||||
<div id="fx-queue">
|
||||
<div id="fadein" class='chain test'>fadeIn<div>fadeIn</div></div>
|
||||
<div id="fadeout" class='chain test out'>fadeOut<div>fadeOut</div></div>
|
||||
|
||||
|
||||
<div id="show" class='chain test'>show<div>show</div></div>
|
||||
<div id="hide" class='chain test out'>hide<div>hide</div></div>
|
||||
|
||||
|
||||
|
||||
<div id="togglein" class='chain test'>togglein<div>togglein</div></div>
|
||||
<div id="toggleout" class='chain test out'>toggleout<div>toggleout</div></div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="slideup" class='chain test'>slideUp<div>slideUp</div></div>
|
||||
<div id="slidedown" class='chain test out'>slideDown<div>slideDown</div></div>
|
||||
|
||||
|
||||
<div id="slidetogglein" class='chain test'>slideToggleIn<div>slideToggleIn</div></div>
|
||||
|
||||
<div id="slidetoggleout" class='chain test out'>slideToggleOut<div>slideToggleOut</div></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="fx-tests"></div>
|
||||
|
||||
<form id="testForm" action="#" method="get">
|
||||
|
|
@ -1462,7 +1464,7 @@ Z</textarea>
|
|||
</div>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
|
||||
<ol id="tests"></ol>
|
||||
</div>
|
||||
<ol id="results"></ol>
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<script>function f() { history.length; } window.onload = function() { var f = window.f; document.open(); document.close(); parent.continueTest(f); }</script>
|
||||
<script>function f() { history.length; } window.onload = function() { var func = window.f; document.open(); document.close(); parent.continueTest(func); }</script>
|
||||
|
|
|
|||
7
dom/base/test/jsmodules/.eslintrc.js
Normal file
7
dom/base/test/jsmodules/.eslintrc.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
}
|
||||
};
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// This helper expects these globals to be defined.
|
||||
/* global PARAMS, SJS, testCases */
|
||||
|
||||
/*
|
||||
* common functionality for iframe, anchor, and area referrer attribute tests
|
||||
*/
|
||||
|
|
@ -80,22 +83,22 @@ var tests = (function*() {
|
|||
}
|
||||
|
||||
var actions = testCases[j].ACTION;
|
||||
var tests = testCases[j].TESTS;
|
||||
var subTests = testCases[j].TESTS;
|
||||
for (var k = 0; k < actions.length; k++) {
|
||||
var actionString = actions[k];
|
||||
for (var i = 0; i < tests.length; i++) {
|
||||
for (var i = 0; i < subTests.length; i++) {
|
||||
yield resetState();
|
||||
var searchParams = new URLSearchParams();
|
||||
searchParams.append("ACTION", actionString);
|
||||
searchParams.append("NAME", tests[i].NAME);
|
||||
searchParams.append("NAME", subTests[i].NAME);
|
||||
for (var l of PARAMS) {
|
||||
if (tests[i][l]) {
|
||||
searchParams.append(l, tests[i][l]);
|
||||
if (subTests[i][l]) {
|
||||
searchParams.append(l, subTests[i][l]);
|
||||
}
|
||||
}
|
||||
var schemeFrom = tests[i].SCHEME_FROM || "http";
|
||||
var schemeFrom = subTests[i].SCHEME_FROM || "http";
|
||||
yield iframe.src = schemeFrom + SJS + searchParams.toString();
|
||||
yield checkIndividualResults(tests[i].DESC, tests[i].RESULT, tests[i].NAME);
|
||||
yield checkIndividualResults(subTests[i].DESC, subTests[i].RESULT, subTests[i].NAME);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
function compare_arrays(e, f, label) {
|
||||
var length = (e.length > f.length) ? e.length : f.length;
|
||||
for (var i = 0; i < length; i += 1) {
|
||||
if (e[i] > 0)
|
||||
if (e[i] > 0)
|
||||
is(f[i], e[i], label + " - index " + i + ": ");
|
||||
else
|
||||
todo_is(f[i], -e[i], label + " - index " + i + ": ");
|
||||
|
|
@ -110,17 +110,17 @@
|
|||
compare_arrays(expect_f, found, 'filtered backward');
|
||||
|
||||
function checkBadFilter(method, n) {
|
||||
var iterator =
|
||||
var iter =
|
||||
document.createNodeIterator(document, NodeFilter.SHOW_ALL,
|
||||
function() {
|
||||
if (n < 0)
|
||||
iterator.detach();
|
||||
iter.detach();
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
});
|
||||
while (--n >= 0)
|
||||
iterator.nextNode();
|
||||
iter.nextNode();
|
||||
try {
|
||||
iterator[method]();
|
||||
iter[method]();
|
||||
ok(true, "Able to call " + method + " on a NodeIterator after calling no-op detach()");
|
||||
} catch (x) { ok(false, x) }
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
// Implementing the scenario outlined in
|
||||
// http://bugzilla.mozilla.org/show_bug.cgi?id=552110#c4
|
||||
|
||||
var iterator = (function(filter) {
|
||||
var iter = (function(filt) {
|
||||
var grandparent = document.createElement("div"),
|
||||
parent = document.createElement("span");
|
||||
|
||||
|
|
@ -141,12 +141,12 @@
|
|||
|
||||
return document.createNodeIterator(grandparent,
|
||||
NodeFilter.SHOW_ALL,
|
||||
filter);
|
||||
})(function filter(n) {
|
||||
filt);
|
||||
})(function(n) {
|
||||
if (n.nodeName != "img")
|
||||
return NodeFilter.FILTER_ACCEPT;
|
||||
|
||||
iterator.detach();
|
||||
iter.detach();
|
||||
|
||||
n.parentNode.remove();
|
||||
// Drop any node references passed into this function.
|
||||
|
|
@ -162,16 +162,16 @@
|
|||
return NodeFilter.FILTER_SKIP;
|
||||
});
|
||||
|
||||
is(iterator.nextNode().nodeName, "div",
|
||||
"iterator.nextNode() returned the wrong node");
|
||||
is(iterator.nextNode().nodeName, "span",
|
||||
"iterator.nextNode() returned the wrong node");
|
||||
is(iter.nextNode().nodeName, "div",
|
||||
"iter.nextNode() returned the wrong node");
|
||||
is(iter.nextNode().nodeName, "span",
|
||||
"iter.nextNode() returned the wrong node");
|
||||
try {
|
||||
var p = iterator.nextNode();
|
||||
ok(false, "iterator.nextNode() should have thrown, but instead it returned <" + p.nodeName + ">");
|
||||
var p = iter.nextNode();
|
||||
ok(false, "iter.nextNode() should have thrown, but instead it returned <" + p.nodeName + ">");
|
||||
} catch (x) { ok(true, x) }
|
||||
})();
|
||||
|
||||
|
||||
]]></script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
var is = window.parent.is;
|
||||
|
||||
var host;
|
||||
var sr;
|
||||
var embed;
|
||||
var object;
|
||||
var iframe;
|
||||
|
|
@ -34,7 +33,7 @@
|
|||
|
||||
function test() {
|
||||
host = document.getElementById("host");
|
||||
sr = host.attachShadow({mode: 'open'});
|
||||
let sr = host.attachShadow({mode: 'open'});
|
||||
embed = createResource(sr, "embed");
|
||||
object = createResource(sr, "object");
|
||||
iframe = createResource(sr, "iframe");
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ function getTargetOrigin(i) {
|
|||
}
|
||||
|
||||
// Create the frames, and tell them which subframes to load.
|
||||
for (var i = 0; i < numTests; i++) {
|
||||
for (let i = 0; i < numTests; i++) {
|
||||
var frame = document.createElement("iframe");
|
||||
frame.src = getFrameOrigin(i) +
|
||||
"/tests/dom/base/test/file_bug1091883_frame.html#" +
|
||||
|
|
@ -53,7 +53,7 @@ for (var i = 0; i < numTests; i++) {
|
|||
|
||||
// Navigate all subframes to the target.
|
||||
window.onload = function() {
|
||||
for (var i = 0; i < numTests; i++) {
|
||||
for (let i = 0; i < numTests; i++) {
|
||||
frames[i].frames[0].location = getTargetOrigin(i) +
|
||||
"/tests/dom/base/test/file_bug1091883_target.html#" + i;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,14 +58,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
|||
doTest5, doTest5_b, doTest5_c, doTest5_e, doTest6, doTest7
|
||||
];
|
||||
|
||||
for (var test_id=0; test_id < all_tests.length; ++test_id) {
|
||||
for (let test_id=0; test_id < all_tests.length; ++test_id) {
|
||||
gTestsHaveFinished[test_id] = false;
|
||||
var fn = all_tests[test_id];
|
||||
fn(test_id);
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
for (var test_id=0; test_id < all_tests.length; ++test_id) {
|
||||
for (let test_id=0; test_id < all_tests.length; ++test_id) {
|
||||
if (!gTestsHaveFinished[test_id]) {
|
||||
ok(false, "Test " + test_id + " took too long");
|
||||
setTestHasFinished(test_id);
|
||||
|
|
@ -181,7 +181,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
|||
|
||||
function doTest1_f(test_id) {
|
||||
var called_on_error = false;
|
||||
|
||||
|
||||
gEventSourceObj1_f = new EventSource("file_bug869432.eventsource");
|
||||
gEventSourceObj1_f.onopen = function(e) {
|
||||
ok(false, "Test 1.f failed: onopen was called");
|
||||
|
|
@ -429,8 +429,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
|||
// b) invalid access-control xsite request
|
||||
// c) valid access-control xsite request on a restricted page with credentials
|
||||
// d) valid access-control xsite request on a restricted page without credentials
|
||||
// e) valid access-control xsite request on a restricted page when the parameter withCredentials is a getter
|
||||
// f) valid access-control xsite request on a restricted page when the parameter withCredentials is missing
|
||||
// e) valid access-control xsite request on a restricted page when the parameter withCredentials is a getter
|
||||
// f) valid access-control xsite request on a restricted page when the parameter withCredentials is missing
|
||||
|
||||
function doTest5(test_id)
|
||||
{
|
||||
|
|
@ -498,17 +498,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
|||
xhr.send();
|
||||
xhr.onloadend = function() {
|
||||
ok(xhr.status == 200, "Failed to set credentials in test 5.d");
|
||||
|
||||
|
||||
gEventSourceObj5_d = new EventSource("https://example.com/tests/dom/base/test/file_restrictedEventSource.sjs?test=user2_evtsrc");
|
||||
ok(!gEventSourceObj5_d.withCredentials, "Wrong withCredentials in test 5.d");
|
||||
|
||||
|
||||
gEventSourceObj5_d.onmessage = function(e) {
|
||||
ok(e.origin == "https://example.com", "Wrong Origin in test 5.d");
|
||||
fn_onmessage(e);
|
||||
};
|
||||
gEventSourceObj5_d.hits = [];
|
||||
gEventSourceObj5_d.hits['fn_onmessage'] = 0;
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
ok(gEventSourceObj5_d.hits['fn_onmessage'] == 0, "Test 5.d failed");
|
||||
gEventSourceObj5_d.close();
|
||||
|
|
@ -605,10 +605,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
|||
{
|
||||
e.target.msg_received.push(e.data);
|
||||
}
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
gEventSourceObj7.close();
|
||||
|
||||
|
||||
ok(gEventSourceObj7.msg_received[0] == "" &&
|
||||
gEventSourceObj7.msg_received[1] == "delayed1" &&
|
||||
gEventSourceObj7.msg_received[2] == "delayed2", "Test 7 failed");
|
||||
|
|
@ -663,4 +663,3 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
|||
<span id=waitSpan>Wait please...</span>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,13 +12,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409380
|
|||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=409380">Mozilla Bug 409380</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 409380 **/
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function runRangeTest()
|
||||
{
|
||||
// Bug 336381
|
||||
|
|
@ -363,7 +364,7 @@ function runRangeTest()
|
|||
hadException = true;
|
||||
}
|
||||
ok(!hadException, "Shouldn't have got an exception!");
|
||||
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
@ -375,4 +376,3 @@ addLoadEvent(runRangeTest);
|
|||
<div id="connectedDiv">zz</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ var docSources = [
|
|||
"iframe7_bug431701.xml",
|
||||
];
|
||||
|
||||
for (var i = 0; i < docSources.length; ++i) {
|
||||
for (let i = 0; i < docSources.length; ++i) {
|
||||
document.getElementsByTagName("iframe")[i].src = docSources[i];
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ function startTest() {
|
|||
// sanity check
|
||||
isnot("", null, "Shouldn't be equal!");
|
||||
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
for (let i = 0; i < tests.length; ++i) {
|
||||
doTest(i);
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ function startTest() {
|
|||
.getRequestHeader("Content-Type"),
|
||||
"application/xml;charset=UTF-8", "Testing correct type on the wire");
|
||||
xhr.abort();
|
||||
|
||||
|
||||
SimpleTest.finish();
|
||||
};
|
||||
|
||||
|
|
@ -117,4 +117,3 @@ function startTest() {
|
|||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,14 +12,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=435425
|
|||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=435425">Mozilla Bug 435425</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 435425 **/
|
||||
|
||||
var xhr = null;
|
||||
var upload = null;
|
||||
var currentEvents = null;
|
||||
var expectedResponseText = null;
|
||||
|
|
@ -69,7 +68,7 @@ function logEvent(evt) {
|
|||
ok(evt.target instanceof currentEvents[i].target,
|
||||
"Wrong event target [" + evt.target + "," + evt.type + "]!");
|
||||
|
||||
// If we handled non-optional event, remove all optional events before the
|
||||
// If we handled non-optional event, remove all optional events before the
|
||||
// handled event and then the non-optional event from the list.
|
||||
if (!currentEvents[i].optional) {
|
||||
for (;i != -1; --i) {
|
||||
|
|
@ -102,7 +101,7 @@ function openXHR(xhr, method, url, privileged) {
|
|||
}
|
||||
|
||||
function start(obj) {
|
||||
xhr = new XMLHttpRequest();
|
||||
let xhr = new XMLHttpRequest();
|
||||
upload = xhr.upload;
|
||||
currentEvents = obj.expectedEvents;
|
||||
expectedResponseText = obj.withUpload;
|
||||
|
|
@ -208,7 +207,7 @@ for (var largeLength = 0; largeLength < (0x0000FFFF + 2); ++largeLength) {
|
|||
const XHR = XMLHttpRequest;
|
||||
const UPLOAD = XMLHttpRequestUpload;
|
||||
|
||||
var tests =
|
||||
var tests =
|
||||
[
|
||||
{ method: "GET", withUpload: none, testAbort: false, testRedirectError: false, testNetworkError: false,
|
||||
expectedEvents: [{target: XHR, type: "loadstart", optional: false},
|
||||
|
|
@ -429,4 +428,3 @@ addLoadEvent(runTest);
|
|||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=444546
|
|||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=444546">Mozilla Bug 444546</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
|
@ -60,9 +60,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=444546
|
|||
evt.target.log.textContent = diff + "ms";
|
||||
evt.target.prevTime = time;
|
||||
if (evt.lengthComputable) {
|
||||
var loaded = (evt.loaded / evt.total);
|
||||
if (loaded < 1) {
|
||||
evt.target.log.style.width = (loaded * 400) + "px";
|
||||
var fractionLoaded = (evt.loaded / evt.total);
|
||||
if (fractionLoaded < 1) {
|
||||
evt.target.log.style.width = (fractionLoaded * 400) + "px";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ function testCancelInPhase4() {
|
|||
|
||||
// First request - should be loaded from server
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("readystatechange", function(e) {
|
||||
xhr.addEventListener("readystatechange", function() {
|
||||
if (xhr.readyState < xhr.DONE) return;
|
||||
is(xhr.readyState, xhr.DONE, "wrong readyState");
|
||||
xhr.abort();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
/**
|
||||
* Test for Bug 493881: Changes to legacy HTML color properties before the BODY is loaded
|
||||
* should be ignored. Additionally, after BODY loads, setting any of these properties to undefined
|
||||
* should be ignored. Additionally, after BODY loads, setting any of these properties to undefined
|
||||
* should cause them to be returned as the string "undefined".
|
||||
*/
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ function setAndTestProperty(prop, color) {
|
|||
* Attempt to set legacy color properties before BODY exists, and verify that such
|
||||
* attempts are ignored.
|
||||
*/
|
||||
for (var i = 0; i < legacyProps.length; i++) {
|
||||
for (let i = 0; i < legacyProps.length; i++) {
|
||||
initialValues[i] = setAndTestProperty(legacyProps[i], testColors[i]);
|
||||
}
|
||||
|
||||
|
|
@ -35,13 +35,13 @@ for (var i = 0; i < legacyProps.length; i++) {
|
|||
*/
|
||||
addLoadEvent( function() {
|
||||
// Verify that the legacy color properties still have their original values.
|
||||
for (var i = 0; i < legacyProps.length; i++) {
|
||||
for (let i = 0; i < legacyProps.length; i++) {
|
||||
is(document[legacyProps[i]], initialValues[i], "document[" + legacyProps[i] + "] altered after body load");
|
||||
}
|
||||
|
||||
|
||||
// Verify that legacy color properties applied before BODY are really ignored when rendering.
|
||||
// Save current computed style colors for later use.
|
||||
for (i = 0; i < idPropList.length; i++) {
|
||||
for (let i = 0; i < idPropList.length; i++) {
|
||||
var style = window.getComputedStyle(document.getElementById(idPropList[i].id));
|
||||
var color = style.getPropertyValue(idPropList[i].prop);
|
||||
idPropList[i].initialComputedColor = color;
|
||||
|
|
@ -49,21 +49,21 @@ addLoadEvent( function() {
|
|||
}
|
||||
// XXX: Can't get links to visually activate via script events, so can't verify
|
||||
// that the alinkColor property was not applied.
|
||||
|
||||
|
||||
// Verify that setting legacy color props to undefined after BODY loads will cause them
|
||||
// to be read as the string "undefined".
|
||||
for (var i = 0; i < legacyProps.length; i++) {
|
||||
for (let i = 0; i < legacyProps.length; i++) {
|
||||
document[legacyProps[i]] = undefined;
|
||||
is(document[legacyProps[i]], "undefined",
|
||||
is(document[legacyProps[i]], "undefined",
|
||||
"Unexpected value of " + legacyProps[i] + " after setting to undefined");
|
||||
}
|
||||
|
||||
|
||||
// Verify that setting legacy color props to undefined led to result
|
||||
// of parsing undefined as a color.
|
||||
for (i = 0; i < idPropList.length; i++) {
|
||||
for (let i = 0; i < idPropList.length; i++) {
|
||||
var style = window.getComputedStyle(document.getElementById(idPropList[i].id));
|
||||
var color = style.getPropertyValue(idPropList[i].prop);
|
||||
is(color, "rgb(0, 239, 14)",
|
||||
is(color, "rgb(0, 239, 14)",
|
||||
"element's style should get result of parsing undefined as a color");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=682463
|
|||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=682463">Mozilla Bug 682463</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
|
@ -23,10 +23,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=682463
|
|||
return document.createTextNode(s);
|
||||
}
|
||||
function div(l,r) {
|
||||
var div = document.createElement("DIV");
|
||||
if (l) div.appendChild(l);
|
||||
if (r) div.appendChild(r);
|
||||
return div;
|
||||
var d = document.createElement("DIV");
|
||||
if (l) d.appendChild(l);
|
||||
if (r) d.appendChild(r);
|
||||
return d;
|
||||
}
|
||||
function createRange(sn,so,en,eo) {
|
||||
var r = document.createRange();
|
||||
|
|
|
|||
|
|
@ -53,18 +53,18 @@ SimpleTest.requestLongerTimeout(4);
|
|||
* This is the main test routine -- serialized by use of a generator.
|
||||
* It performs all tests in sequence using four iframes.
|
||||
*/
|
||||
function startTests(testName, testIframeUrls) {
|
||||
function startTests(testName, iframeUrls) {
|
||||
testsGenerator[testName] = (function*() {
|
||||
var testframe = document.getElementById(testName);
|
||||
testframe.onload = function() {
|
||||
advance(testName);
|
||||
}
|
||||
|
||||
// load the test frame from testIframeUrls[url]
|
||||
// load the test frame from iframeUrls[url]
|
||||
// it will call back into this function via postMessage when it finishes
|
||||
// loading and continue beyond the yield.
|
||||
for(url in testIframeUrls) {
|
||||
yield testframe.src = testIframeUrls[url];
|
||||
for(url in iframeUrls) {
|
||||
yield testframe.src = iframeUrls[url];
|
||||
// run test and check result for loaded test URL
|
||||
yield checkExpectedGlobalResults(testName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,18 +53,18 @@ SimpleTest.requestLongerTimeout(4);
|
|||
* This is the main test routine -- serialized by use of a generator.
|
||||
* It performs all tests in sequence using four iframes.
|
||||
*/
|
||||
function startTests(testName, testIframeUrls) {
|
||||
function startTests(testName, iframeUrls) {
|
||||
testsGenerator[testName] = (function*() {
|
||||
var testframe = document.getElementById(testName);
|
||||
testframe.onload = function() {
|
||||
advance(testName);
|
||||
}
|
||||
|
||||
// load the test frame from testIframeUrls[url]
|
||||
// load the test frame from iframeUrls[url]
|
||||
// it will call back into this function via postMessage when it finishes
|
||||
// loading and continue beyond the yield.
|
||||
for(url in testIframeUrls) {
|
||||
yield testframe.src = testIframeUrls[url];
|
||||
for(url in iframeUrls) {
|
||||
yield testframe.src = iframeUrls[url];
|
||||
// run test and check result for loaded test URL
|
||||
yield checkExpectedGlobalResults(testName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ var xhr = new XMLHttpRequest();
|
|||
xhr.open("GET", url, true);
|
||||
xhr.responseType = "blob";
|
||||
|
||||
function checkHeaders(xhr) {
|
||||
var headers = xhr.getAllResponseHeaders();
|
||||
function checkHeaders(xhrInner) {
|
||||
var headers = xhrInner.getAllResponseHeaders();
|
||||
dump(headers + "\n");
|
||||
var p = headers.split("\n");
|
||||
|
||||
|
|
@ -44,9 +44,9 @@ function checkHeaders(xhr) {
|
|||
ok(contentLength == true, "Content-length is part of the headers!");
|
||||
ok(contentType == true, "Content-type is part of the headers!");
|
||||
|
||||
var ct = xhr.getResponseHeader('content-type');
|
||||
var ct = xhrInner.getResponseHeader('content-type');
|
||||
ok(ct.length > 0, 'Get Response Header - content type: ' + ct);
|
||||
var cl = xhr.getResponseHeader('content-length');
|
||||
var cl = xhrInner.getResponseHeader('content-length');
|
||||
ok(cl.length > 0, 'Get Response Header - content length: ' + cl);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=913761
|
|||
transportChannel.port1.onmessage = function (event) {
|
||||
ok(true, 'Port Returned.');
|
||||
var portToService = event.data.port;
|
||||
portToService.onmessage = function (event) {
|
||||
portToService.onmessage = function () {
|
||||
ok(true, "message received");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -76,11 +76,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=922681
|
|||
testInnerHTML(c, "<body>", "");
|
||||
|
||||
function testTableBody(tag) {
|
||||
var c = document.createElement(tag);
|
||||
testInnerHTML(c, "abc", "abc");
|
||||
testInnerHTML(c, "<td>", "<tr><td></td></tr>");
|
||||
testInnerHTML(c, "</body>", "");
|
||||
testInnerHTML(c, "<input>", "<input>");
|
||||
var e = document.createElement(tag);
|
||||
testInnerHTML(e, "abc", "abc");
|
||||
testInnerHTML(e, "<td>", "<tr><td></td></tr>");
|
||||
testInnerHTML(e, "</body>", "");
|
||||
testInnerHTML(e, "<input>", "<input>");
|
||||
}
|
||||
testTableBody("thead");
|
||||
testTableBody("tbody");
|
||||
|
|
|
|||
|
|
@ -52,23 +52,23 @@ function testSetFocus(aEventType, aCallback)
|
|||
|
||||
var movingFocus = false;
|
||||
button.addEventListener(aEventType,
|
||||
function (aEvent) {
|
||||
function (event) {
|
||||
movingFocus = true;
|
||||
input.focus();
|
||||
aEvent.preventDefault();
|
||||
event.preventDefault();
|
||||
button.removeEventListener(aEventType, arguments.callee, true);
|
||||
}, true);
|
||||
|
||||
synthesizeMouseAtCenter(button, {});
|
||||
|
||||
window.addEventListener("message", function (aEvent) {
|
||||
window.addEventListener("message", function (event) {
|
||||
if (movingFocus) {
|
||||
is(aEvent.data, "input-value: blur",
|
||||
is(event.data, "input-value: blur",
|
||||
description + "<input> in the iframe should get blur");
|
||||
is(input.value, "focus",
|
||||
description + "<input> in the parent should get focus");
|
||||
} else {
|
||||
is(aEvent.data, "input-value: focus",
|
||||
is(event.data, "input-value: focus",
|
||||
description + "<input> in the iframe should keep having focus");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ limitations under the License.
|
|||
<p id="display"></p>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/* eslint "no-shadow": ["error", {"allow": ["done", "next"]}] */
|
||||
var tests = [];
|
||||
var curDescribeMsg = '';
|
||||
var curItMsg = '';
|
||||
|
|
@ -149,18 +150,18 @@ limitations under the License.
|
|||
|
||||
var sinon = {
|
||||
spy: function () {
|
||||
var callbacks = [];
|
||||
var cbs = [];
|
||||
var fn = function () {
|
||||
fn.callCount++;
|
||||
fn.lastCall = { args: arguments };
|
||||
if (callbacks.length) {
|
||||
callbacks.shift()();
|
||||
if (cbs.length) {
|
||||
cbs.shift()();
|
||||
}
|
||||
};
|
||||
fn.callCount = 0;
|
||||
fn.lastCall = { args: [] };
|
||||
fn.waitForNotification = (fn) => {
|
||||
callbacks.push(fn);
|
||||
fn.waitForNotification = (fn1) => {
|
||||
cbs.push(fn1);
|
||||
};
|
||||
return fn;
|
||||
}
|
||||
|
|
@ -927,7 +928,7 @@ limitations under the License.
|
|||
});
|
||||
|
||||
describe('observe subframe', function () {
|
||||
|
||||
|
||||
it('should not trigger if target and root are not in the same document',
|
||||
function(done) {
|
||||
|
||||
|
|
@ -944,7 +945,7 @@ limitations under the License.
|
|||
}
|
||||
|
||||
targetEl4.src = "intersectionobserver_iframe.html";
|
||||
|
||||
|
||||
});
|
||||
|
||||
it('boundingClientRect matches target.getBoundingClientRect() for an element inside an iframe',
|
||||
|
|
@ -977,7 +978,7 @@ limitations under the License.
|
|||
targetEl4.src = "http://example.org/tests/dom/base/test/intersectionobserver_cross_domain_iframe.html";
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
describe('takeRecords', function() {
|
||||
|
|
@ -1002,7 +1003,7 @@ limitations under the License.
|
|||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,24 +21,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=912456
|
|||
function receiveMessage(evt) {
|
||||
ok(evt.data.port, "Port has been received!");
|
||||
|
||||
var a = new MessageChannel();
|
||||
ok(a, "MessageChannel created");
|
||||
var a1 = new MessageChannel();
|
||||
ok(a1, "MessageChannel created");
|
||||
|
||||
try {
|
||||
evt.data.port.postMessage({port: a.port2});
|
||||
evt.data.port.postMessage({port: a1.port2});
|
||||
ok(false, "PostMessage should throw! - no transfered port");
|
||||
} catch(e) {
|
||||
ok(true, "PostMessage should throw! - no transfered port");
|
||||
}
|
||||
|
||||
try {
|
||||
evt.data.port.postMessage({port: a.port2}, [a.port2, a.port2]);
|
||||
evt.data.port.postMessage({port: a1.port2}, [a1.port2, a1.port2]);
|
||||
ok(false, "PostMessage should throw - no duplicate!");
|
||||
} catch(e) {
|
||||
ok(true, "PostMessage should throw - no duplicate!");
|
||||
}
|
||||
|
||||
evt.data.port.postMessage({port: a.port2}, [a.port2]);
|
||||
evt.data.port.postMessage({port: a1.port2}, [a1.port2]);
|
||||
}
|
||||
|
||||
a.port1.onmessage = function(evt) {
|
||||
|
|
@ -74,10 +74,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=912456
|
|||
ok(evt.ports, "Port is received");
|
||||
is(evt.ports.length, 1, "Ports.length is 1");
|
||||
|
||||
var a = new MessageChannel();
|
||||
ok(a, "MessageChannel created");
|
||||
var a1 = new MessageChannel();
|
||||
ok(a1, "MessageChannel created");
|
||||
|
||||
evt.ports[0].postMessage(42, [a.port2]);
|
||||
evt.ports[0].postMessage(42, [a1.port2]);
|
||||
}
|
||||
|
||||
a.port1.onmessage = function(evt) {
|
||||
|
|
@ -112,4 +112,3 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=912456
|
|||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
info("Third iframe loaded");
|
||||
let doc3 = SpecialPowers.wrap(iframe3).contentDocument;
|
||||
let target = doc3.getElementById("target");
|
||||
target.addEventListener("test-event", function onEvent(e) {
|
||||
target.addEventListener("test-event", function onEvent() {
|
||||
is(messageIndex, 2,
|
||||
"target should be the last one to receive the test event");
|
||||
messageIndex++;
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=641821
|
|||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="runTest()">
|
||||
<body onload="runTest()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=641821">Mozilla Bug 641821</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
|
@ -53,14 +53,14 @@ if (!("ok" in window)) {
|
|||
|
||||
if (!("is" in window)) {
|
||||
window.is = function(val, refVal, str) {
|
||||
log(str + (val == refVal? " PASSED " : " FAILED ") +
|
||||
log(str + (val == refVal? " PASSED " : " FAILED ") +
|
||||
(val != refVal ? "expected " + refVal + " got " + val + "\n" : "\n"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!("isnot" in window)) {
|
||||
window.isnot = function(val, refVal, str) {
|
||||
log(str + (val != refVal? " PASSED " : " FAILED ") +
|
||||
log(str + (val != refVal? " PASSED " : " FAILED ") +
|
||||
(val == refVal ? "Didn't expect " + refVal + "\n" : "\n"));
|
||||
}
|
||||
}
|
||||
|
|
@ -367,10 +367,10 @@ function testNestedMutations() {
|
|||
is(records[0].type, "characterData", "Should have got characterData");
|
||||
observer.disconnect();
|
||||
m = null;
|
||||
m3 = new M(function(records, observer) {
|
||||
m3 = new M(function(recordsInner, observerInnder) {
|
||||
ok(m2WasCalled, "m2 should have been called before m3!");
|
||||
is(records[0].type, "characterData", "Should have got characterData");
|
||||
observer.disconnect();
|
||||
is(recordsInner[0].type, "characterData", "Should have got characterData");
|
||||
observerInnder.disconnect();
|
||||
then(testAdoptNode);
|
||||
m3 = null;
|
||||
});
|
||||
|
|
@ -464,7 +464,7 @@ function testInsertAdjacentHTML() {
|
|||
is(records[2].nextSibling, null, "");
|
||||
is(records[3].target, doc.body, "");
|
||||
is(records[3].previousSibling, d4, "");
|
||||
is(records[3].nextSibling, null, "");
|
||||
is(records[3].nextSibling, null, "");
|
||||
observer.disconnect();
|
||||
then(testSyncXHR);
|
||||
m = null;
|
||||
|
|
@ -518,12 +518,12 @@ function testTakeRecords() {
|
|||
is(records[1].addedNodes.length, 2, "Should have got addedNodes");
|
||||
is(records[2].type, "attributes", "Should have got attributes");
|
||||
is(records[2].attributeName, "foo", "");
|
||||
|
||||
|
||||
is(records.length, takenRecords.length, "Should have had similar mutations");
|
||||
is(records[0].type, takenRecords[0].type, "Should have had similar mutations");
|
||||
is(records[1].type, takenRecords[1].type, "Should have had similar mutations");
|
||||
is(records[2].type, takenRecords[2].type, "Should have had similar mutations");
|
||||
|
||||
|
||||
is(records[1].removedNodes.length, takenRecords[1].removedNodes.length, "Should have had similar mutations");
|
||||
is(records[1].addedNodes.length, takenRecords[1].addedNodes.length, "Should have had similar mutations");
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ function testTakeRecords() {
|
|||
}
|
||||
|
||||
function testExpandos() {
|
||||
var m2 = new M(function(records, observer) {
|
||||
m2 = new M(function(records, observer) {
|
||||
is(observer.expandoProperty, true);
|
||||
observer.disconnect();
|
||||
then(testOutsideShadowDOM);
|
||||
|
|
@ -596,7 +596,7 @@ function testOutsideShadowDOM() {
|
|||
then(testMarquee);
|
||||
return;
|
||||
}
|
||||
var m = new M(function(records, observer) {
|
||||
m = new M(function(records, observer) {
|
||||
is(records.length, 1);
|
||||
is(records[0].type, "attributes", "Should have got attributes");
|
||||
observer.disconnect();
|
||||
|
|
@ -617,7 +617,7 @@ function testOutsideShadowDOM() {
|
|||
}
|
||||
|
||||
function testMarquee() {
|
||||
var m = new M(function(records, observer) {
|
||||
m = new M(function(records, observer) {
|
||||
is(records.length, 1);
|
||||
is(records[0].type, "attributes");
|
||||
is(records[0].attributeName, "ok");
|
||||
|
|
@ -724,7 +724,7 @@ function testStyleRemoveProperty2() {
|
|||
|
||||
function testAttributeRecordMerging1() {
|
||||
ok(true, "testAttributeRecordMerging1");
|
||||
var m = new M(function(records, observer) {
|
||||
m = new M(function(records, observer) {
|
||||
is(records.length, 2);
|
||||
is(records[0].type, "attributes");
|
||||
is(records[0].target, div);
|
||||
|
|
@ -757,7 +757,7 @@ function testAttributeRecordMerging1() {
|
|||
|
||||
function testAttributeRecordMerging2() {
|
||||
ok(true, "testAttributeRecordMerging2");
|
||||
var m = new M(function(records, observer) {
|
||||
m = new M(function(records, observer) {
|
||||
is(records.length, 2);
|
||||
is(records[0].type, "attributes");
|
||||
is(records[0].target, div);
|
||||
|
|
@ -794,7 +794,7 @@ function testAttributeRecordMerging2() {
|
|||
|
||||
function testAttributeRecordMerging3() {
|
||||
ok(true, "testAttributeRecordMerging3");
|
||||
var m = new M(function(records, observer) {
|
||||
m = new M(function(records, observer) {
|
||||
is(records.length, 4);
|
||||
is(records[0].type, "attributes");
|
||||
is(records[0].target, div);
|
||||
|
|
@ -807,7 +807,7 @@ function testAttributeRecordMerging3() {
|
|||
is(records[1].attributeName, "foo");
|
||||
is(records[1].attributeNamespace, null);
|
||||
is(records[1].oldValue, "initial");
|
||||
|
||||
|
||||
is(records[2].type, "attributes");
|
||||
is(records[2].target, div);
|
||||
is(records[2].attributeName, "foo");
|
||||
|
|
@ -845,7 +845,7 @@ function testAttributeRecordMerging3() {
|
|||
|
||||
function testAttributeRecordMerging4() {
|
||||
ok(true, "testAttributeRecordMerging4");
|
||||
var m = new M(function(records, observer) {
|
||||
m = new M(function(records, observer) {
|
||||
});
|
||||
|
||||
div.setAttribute("foo", "initial");
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=889335
|
|||
function* testEvents() {
|
||||
for (var i = 0; i < testValues.length; ++i) {
|
||||
var data = testValues[i];
|
||||
setTimeout(function(data) {
|
||||
SpecialPowers.pushPrefEnv({"set": [['intl.accept_languages', data.accept_languages]]});
|
||||
setTimeout(function(d) {
|
||||
SpecialPowers.pushPrefEnv({"set": [['intl.accept_languages', d.accept_languages]]});
|
||||
}, 0, data);
|
||||
expectedLanguageChanges++;
|
||||
yield undefined;
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ function test_workers() {
|
|||
w.onmessage = function(e) {
|
||||
is(e.data, 'ok', "Worker ready!");
|
||||
|
||||
w.onmessage = function(e) {
|
||||
w.onmessage = function(e1) {
|
||||
if (!resolve) {
|
||||
ok(false, "Unexpected message!");
|
||||
return;
|
||||
|
|
@ -411,7 +411,7 @@ function test_workers() {
|
|||
|
||||
let tmp = resolve;
|
||||
resolve = null;
|
||||
tmp({ data: e.data, ports: e.ports });
|
||||
tmp({ data: e1.data, ports: e1.ports });
|
||||
}
|
||||
|
||||
runTests({
|
||||
|
|
@ -423,7 +423,7 @@ function test_workers() {
|
|||
resolve = r;
|
||||
try {
|
||||
w.postMessage(what, ports);
|
||||
} catch(e) {
|
||||
} catch(ex) {
|
||||
resolve = null;
|
||||
rr();
|
||||
}
|
||||
|
|
@ -493,7 +493,7 @@ function test_broadcastChannel_inWorkers() {
|
|||
w.onmessage = function(e) {
|
||||
is(e.data, 'ok', "Worker ready!");
|
||||
|
||||
w.onmessage = function(e) {
|
||||
w.onmessage = function(e1) {
|
||||
if (!resolve) {
|
||||
ok(false, "Unexpected message!");
|
||||
return;
|
||||
|
|
@ -501,7 +501,7 @@ function test_broadcastChannel_inWorkers() {
|
|||
|
||||
let tmp = resolve;
|
||||
resolve = null;
|
||||
tmp({ data: e.data, ports: e.ports });
|
||||
tmp({ data: e1.data, ports: e1.ports });
|
||||
}
|
||||
|
||||
runTests({
|
||||
|
|
@ -581,7 +581,7 @@ function test_messagePort_inWorkers() {
|
|||
w.onmessage = function(e) {
|
||||
is(e.data, 'ok', "Worker ready!");
|
||||
|
||||
w.onmessage = function(e) {
|
||||
w.onmessage = function(e1) {
|
||||
if (!resolve) {
|
||||
ok(false, "Unexpected message!");
|
||||
return;
|
||||
|
|
@ -589,7 +589,7 @@ function test_messagePort_inWorkers() {
|
|||
|
||||
let tmp = resolve;
|
||||
resolve = null;
|
||||
tmp({ data: e.data, ports: e.ports });
|
||||
tmp({ data: e1.data, ports: e1.ports });
|
||||
}
|
||||
|
||||
runTests({
|
||||
|
|
@ -601,7 +601,7 @@ function test_messagePort_inWorkers() {
|
|||
resolve = r;
|
||||
try {
|
||||
mc.port1.postMessage(what, ports);
|
||||
} catch(e) {
|
||||
} catch(ex) {
|
||||
resolve = null;
|
||||
rr();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ function runATest(obj) {
|
|||
//convert RectList to a real array
|
||||
obj.rectList=Array.prototype.slice.call(obj.rectList, 0);
|
||||
}
|
||||
obj.rectList.forEach(function(rect,i) {
|
||||
is(_getRect(rectlist[i]),_getRect(rect),
|
||||
obj.rectList.forEach(function(r,i) {
|
||||
is(_getRect(rectlist[i]),_getRect(r),
|
||||
annotateName(testname+": item at "+i));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@ SimpleTest.waitForExplicitFinish();
|
|||
// nesting.
|
||||
function clearNestingLevel() {
|
||||
return new Promise(resolve => {
|
||||
window.addEventListener('message', function onMessage() {
|
||||
window.removeEventListener('message', onMessage);
|
||||
window.addEventListener('message', () => {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
postMessage('done', '*');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue