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*{/);
|
||||
}
|
||||
|
|
@ -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,7 +406,7 @@
|
|||
} 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];
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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,13 +162,13 @@
|
|||
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) }
|
||||
})();
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -663,4 +663,3 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=338583
|
|||
<span id=waitSpan>Wait please...</span>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409380
|
|||
|
||||
/** Test for Bug 409380 **/
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function runRangeTest()
|
||||
{
|
||||
// Bug 336381
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
@ -117,4 +117,3 @@ function startTest() {
|
|||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=435425
|
|||
|
||||
/** Test for Bug 435425 **/
|
||||
|
||||
var xhr = null;
|
||||
var upload = null;
|
||||
var currentEvents = null;
|
||||
var expectedResponseText = null;
|
||||
|
|
@ -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;
|
||||
|
|
@ -429,4 +428,3 @@ addLoadEvent(runTest);
|
|||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -52,7 +52,7 @@ addLoadEvent( function() {
|
|||
|
||||
// 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",
|
||||
"Unexpected value of " + legacyProps[i] + " after setting to undefined");
|
||||
|
|
@ -60,7 +60,7 @@ addLoadEvent( function() {
|
|||
|
||||
// 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)",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
});
|
||||
|
|
@ -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);
|
||||
|
|
@ -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