forked from mirrors/gecko-dev
Bug 1508819 - Enable ESLint for dom/bindings (manual changes). r=nika
Depends on D13891 Differential Revision: https://phabricator.services.mozilla.com/D13892 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
894c13cd76
commit
2dbc54f868
37 changed files with 154 additions and 132 deletions
|
|
@ -161,7 +161,6 @@ dom/base/test/*.*
|
|||
dom/base/test/unit/test_serializers_entities*.js
|
||||
dom/base/test/unit_ipc/**
|
||||
dom/base/test/jsmodules/**
|
||||
dom/bindings/**
|
||||
dom/canvas/**
|
||||
dom/encoding/**
|
||||
dom/events/**
|
||||
|
|
|
|||
|
|
@ -2,6 +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/. */
|
||||
/* global noSuchMethodExistsYo1, noSuchMethodExistsYo2, noSuchMethodExistsYo3 */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<body>
|
||||
<script>
|
||||
worker = new Worker("a");
|
||||
var worker = new Worker("a");
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796850
|
|||
|
||||
/** Test for Bug 796850 **/
|
||||
var xhr = new XMLHttpRequest();
|
||||
caught = false;
|
||||
var caught = false;
|
||||
try {
|
||||
xhr.open("\u5427", "about:mozilla", true);
|
||||
} catch (TypeError) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
/* global test, assert_array_equals */
|
||||
test(function() {
|
||||
var props = Object.getOwnPropertyNames(Object.prototype);
|
||||
// If you change this list, make sure it continues to match the list in
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1148593
|
|||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
/* global noSuchFunction */
|
||||
|
||||
/** Test for Bug 1148593 **/
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=936056
|
|||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
get = desc.get;
|
||||
var get = desc.get;
|
||||
ok(get, "Couldn't find document getter");
|
||||
Object.defineProperty(frames[0], "foo", { get, configurable: true });
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1036214
|
|||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
/* global TestInterfaceJS */
|
||||
|
||||
/** Test for subsumes-checking |any| and |object| for js-implemented WebIDL. **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
@ -84,7 +85,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1036214
|
|||
//
|
||||
|
||||
xoObjects.forEach(function(xoObj) {
|
||||
var blank = new TestInterfaceJS();
|
||||
new TestInterfaceJS();
|
||||
checkThrows(() => new TestInterfaceJS(xoObj, undefined), "any param for constructor");
|
||||
checkThrows(() => new TestInterfaceJS(undefined, xoObj), "obj param for constructor");
|
||||
checkThrows(() => new TestInterfaceJS(undefined, undefined, { anyMember: xoObj }), "any dict param for constructor");
|
||||
|
|
|
|||
|
|
@ -9,20 +9,20 @@
|
|||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="application/javascript">
|
||||
/* global TestInterfaceMaplike, TestInterfaceSetlike, TestInterfaceMaplikeObject, TestInterfaceJSMaplike */
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]}, function() {
|
||||
base_properties = [["has", "function", 1],
|
||||
["entries", "function", 0],
|
||||
["keys", "function", 0],
|
||||
["values", "function", 0],
|
||||
["forEach", "function", 1],
|
||||
["size", "number"]];
|
||||
maplike_properties = base_properties.concat([["set", "function", 2]]);
|
||||
setlike_properties = base_properties;
|
||||
rw_properties = [["clear", "function", 0],
|
||||
["delete", "function", 1]];
|
||||
setlike_rw_properties = base_properties.concat(rw_properties).concat([["add", "function", 1]]);
|
||||
maplike_rw_properties = maplike_properties.concat(rw_properties).concat([["get", "function", 1]]);
|
||||
var base_properties = [["has", "function", 1],
|
||||
["entries", "function", 0],
|
||||
["keys", "function", 0],
|
||||
["values", "function", 0],
|
||||
["forEach", "function", 1],
|
||||
["size", "number"]];
|
||||
var maplike_properties = base_properties.concat([["set", "function", 2]]);
|
||||
var rw_properties = [["clear", "function", 0],
|
||||
["delete", "function", 1]];
|
||||
var setlike_rw_properties = base_properties.concat(rw_properties).concat([["add", "function", 1]]);
|
||||
var maplike_rw_properties = maplike_properties.concat(rw_properties).concat([["get", "function", 1]]);
|
||||
var testExistence = function testExistence(prefix, obj, properties) {
|
||||
for (var [name, type, args] of properties) {
|
||||
// Properties are somewhere up the proto chain, hasOwnProperty won't work
|
||||
|
|
@ -56,6 +56,7 @@
|
|||
var m;
|
||||
var testSet;
|
||||
var testIndex;
|
||||
|
||||
// Simple map creation and functionality test
|
||||
info("SimpleMap: Testing simple map creation and functionality");
|
||||
m = new TestInterfaceMaplike();
|
||||
|
|
@ -64,12 +65,12 @@
|
|||
is(m.size, 0, "SimpleMap: size should be zero");
|
||||
ok(!m.has("test"), "SimpleMap: maplike has should return false");
|
||||
is(m.get("test"), undefined, "SimpleMap: maplike get should return undefined on bogus lookup");
|
||||
m1 = m.set("test", 1);
|
||||
var m1 = m.set("test", 1);
|
||||
is(m, m1, "SimpleMap: return from set should be map object");
|
||||
is(m.size, 1, "SimpleMap: size should be 1");
|
||||
ok(m.has("test"), "SimpleMap: maplike has should return true");
|
||||
is(m.get("test"), 1, "SimpleMap: maplike get should return value entered");
|
||||
m2 = m.set("test2", 2);
|
||||
m.set("test2", 2);
|
||||
is(m.size, 2, "SimpleMap: size should be 2");
|
||||
testSet = [["test", 1], ["test2", 2]];
|
||||
testIndex = 0;
|
||||
|
|
@ -85,8 +86,8 @@
|
|||
is(m.get("test2"), 2, "SimpleMap: maplike get should return value entered");
|
||||
is(m.delete("test2"), true, "SimpleMap: maplike deletion should return boolean");
|
||||
is(m.size, 1, "SimpleMap: size should be 1");
|
||||
iterable = false;
|
||||
for (var e of m) {
|
||||
var iterable = false;
|
||||
for (let e of m) {
|
||||
iterable = true;
|
||||
is(e[0], "test", "SimpleMap: iterable first array element should be key");
|
||||
is(e[1], 1, "SimpleMap: iterable second array element should be value");
|
||||
|
|
@ -95,13 +96,13 @@
|
|||
is(m[Symbol.iterator].name, "entries", "SimpleMap: @@iterator symbol has correct name");
|
||||
is(m[Symbol.iterator], m.entries, 'SimpleMap: @@iterator is an alias for "entries"');
|
||||
ok(iterable, "SimpleMap: @@iterator symbol resolved correctly");
|
||||
for (var k of m.keys()) {
|
||||
for (let k of m.keys()) {
|
||||
is(k, "test", "SimpleMap: first keys element should be 'test'");
|
||||
}
|
||||
for (var v of m.values()) {
|
||||
for (let v of m.values()) {
|
||||
is(v, 1, "SimpleMap: first values elements should be 1");
|
||||
}
|
||||
for (var e of m.entries()) {
|
||||
for (let e of m.entries()) {
|
||||
is(e[0], "test", "SimpleMap: entries first array element should be 'test'");
|
||||
is(e[1], 1, "SimpleMap: entries second array element should be 1");
|
||||
}
|
||||
|
|
@ -119,7 +120,7 @@
|
|||
is(m, m1, "SimpleSet: return from set should be map object");
|
||||
is(m.size, 1, "SimpleSet: size should be 1");
|
||||
ok(m.has("test"), "SimpleSet: maplike has should return true");
|
||||
m2 = m.add("test2");
|
||||
m.add("test2");
|
||||
is(m.size, 2, "SimpleSet: size should be 2");
|
||||
testSet = ["test", "test2"];
|
||||
testIndex = 0;
|
||||
|
|
@ -134,7 +135,7 @@
|
|||
is(m.delete("test2"), true, "SimpleSet: maplike deletion should return true");
|
||||
is(m.size, 1, "SimpleSet: size should be 1");
|
||||
iterable = false;
|
||||
for (var e of m) {
|
||||
for (let e of m) {
|
||||
iterable = true;
|
||||
is(e, "test", "SimpleSet: iterable first array element should be key");
|
||||
}
|
||||
|
|
@ -142,13 +143,13 @@
|
|||
is(m[Symbol.iterator].name, "values", "SimpleSet: @@iterator symbol has correct name");
|
||||
is(m[Symbol.iterator], m.values, 'SimpleSet: @@iterator is an alias for "values"');
|
||||
ok(iterable, "SimpleSet: @@iterator symbol resolved correctly");
|
||||
for (var k of m.keys()) {
|
||||
for (let k of m.keys()) {
|
||||
is(k, "test", "SimpleSet: first keys element should be 'test'");
|
||||
}
|
||||
for (var v of m.values()) {
|
||||
for (let v of m.values()) {
|
||||
is(v, "test", "SimpleSet: first values elements should be 'test'");
|
||||
}
|
||||
for (var e of m.entries()) {
|
||||
for (let e of m.entries()) {
|
||||
is(e[0], "test", "SimpleSet: Entries first array element should be 'test'");
|
||||
is(e[1], "test", "SimpleSet: Entries second array element should be 'test'");
|
||||
}
|
||||
|
|
@ -165,7 +166,7 @@
|
|||
is(m.size, 1, "MapConvenience: size should be 1");
|
||||
ok(m.hasInternal("test"), "MapConvenience: maplike hasInternal should return true");
|
||||
is(m.get("test"), 1, "MapConvenience: maplike get should return value entered");
|
||||
m2 = m.setInternal("test2", 2);
|
||||
m.setInternal("test2", 2);
|
||||
is(m.size, 2, "size should be 2");
|
||||
ok(m.hasInternal("test2"), "MapConvenience: maplike hasInternal should return true");
|
||||
is(m.get("test2"), 2, "MapConvenience: maplike get should return value entered");
|
||||
|
|
@ -187,7 +188,7 @@
|
|||
m.setInternal("test");
|
||||
is(m.size, 1, "size should be 1");
|
||||
ok(m.hasInternal("test"), "ReadOnlyMapConvenience: maplike hasInternal should return true");
|
||||
m2 = m.setInternal("test2");
|
||||
m.setInternal("test2");
|
||||
is(m.size, 2, "size should be 2");
|
||||
ok(m.hasInternal("test2"), "ReadOnlyMapConvenience: maplike hasInternal should return true");
|
||||
is(m.deleteInternal("test2"), true, "ReadOnlyMapConvenience: maplike deleteInternal should return true");
|
||||
|
|
@ -206,19 +207,19 @@
|
|||
is(m.size, 1, "JSMapConvenience: size should be 1");
|
||||
ok(m.has("test"), "JSMapConvenience: maplike has should return true");
|
||||
is(m.get("test"), 1, "JSMapConvenience: maplike get should return value entered");
|
||||
m2 = m.setInternal("test2", 2);
|
||||
m.setInternal("test2", 2);
|
||||
is(m.size, 2, "JSMapConvenience: size should be 2");
|
||||
ok(m.has("test2"), "JSMapConvenience: maplike has should return true");
|
||||
is(m.get("test2"), 2, "JSMapConvenience: maplike get should return value entered");
|
||||
is(m.deleteInternal("test2"), true, "JSMapConvenience: maplike deleteInternal should return true");
|
||||
is(m.size, 1, "JSMapConvenience: size should be 1");
|
||||
for (var k of m.keys()) {
|
||||
for (let k of m.keys()) {
|
||||
is(k, "test", "JSMapConvenience: first keys element should be 'test'");
|
||||
}
|
||||
for (var v of m.values()) {
|
||||
for (let v of m.values()) {
|
||||
is(v, 1, "JSMapConvenience: first values elements should be 1");
|
||||
}
|
||||
for (var e of m.entries()) {
|
||||
for (let e of m.entries()) {
|
||||
is(e[0], "test", "JSMapConvenience: entries first array element should be 'test'");
|
||||
is(e[1], 1, "JSMapConvenience: entries second array element should be 1");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
/* global test, assert_throws */
|
||||
test(() => {
|
||||
assert_throws(new TypeError, () => {
|
||||
"use strict";
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
/* global test */
|
||||
|
||||
test(function() {
|
||||
new Worker("data:text/javascript,new XMLHttpRequest(42)");
|
||||
}, "Should not crash");
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=775543
|
|||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=775543">Mozilla Bug 775543</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_bug775543.html" onload="test();"></iframe>
|
||||
<iframe id="t" src="http://example.org/tests/dom/bindings/test/file_bug775543.html" onload="test();"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/* global XPCNativeWrapper */
|
||||
/** Test for Bug 775543 **/
|
||||
|
||||
function test() {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
<div id="log"></div>
|
||||
<iframe srcdoc='<script>function f() { parent.callCount++; }</script>'></iframe>
|
||||
<script>
|
||||
/* global async_test, assert_equals */
|
||||
var callCount = 0;
|
||||
var t = async_test("A test of callback invocation in a no-longer-current window with a still-active document");
|
||||
window.addEventListener("load", t.step_func_done(function() {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
/* global promise_test, promise_rejects */
|
||||
|
||||
promise_test(function(t) {
|
||||
var iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL, JSON.parse);
|
||||
return promise_rejects(t, new SyntaxError,
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
<div id="log"></div>
|
||||
<iframe src="http://www1.w3c-test.org/common/blank.html"></iframe>
|
||||
<script>
|
||||
/* global async_test, assert_equals, assert_throws */
|
||||
|
||||
async_test(function(t) {
|
||||
window.addEventListener("load", t.step_func(
|
||||
function() {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ function namedSetNonStrict(obj) {
|
|||
ok(threw,
|
||||
"Should throw in non-strict mode when defining named property on " + obj);
|
||||
}
|
||||
for (var obj of [ document, document.forms ]) {
|
||||
for (let obj of [ document, document.forms ]) {
|
||||
namedSetStrict(obj);
|
||||
namedSetNonStrict(obj);
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ function indexedSetNonStrict(obj) {
|
|||
ok(threw,
|
||||
"Should throw in non-strict mode when defining indexed property on " + obj);
|
||||
}
|
||||
for (var obj of [ document.forms, document.childNodes ]) {
|
||||
for (let obj of [ document.forms, document.childNodes ]) {
|
||||
indexedSetStrict(obj);
|
||||
indexedSetNonStrict(obj);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ function test() {
|
|||
|
||||
// Object.prototype is at the end of the prototype chain.
|
||||
var obj = win;
|
||||
var proto;
|
||||
while ((proto = Object.getPrototypeOf(obj))) {
|
||||
obj = proto;
|
||||
}
|
||||
|
|
@ -191,7 +192,7 @@ function test() {
|
|||
"includes()");
|
||||
|
||||
// Check that deleters work correctly in the [OverrideBuiltins] case.
|
||||
var elem = win.document.documentElement;
|
||||
elem = win.document.documentElement;
|
||||
var dataset = elem.dataset;
|
||||
is(dataset.foo, undefined, "Should not have a 'foo' property");
|
||||
ok(!("foo" in dataset), "Really should not have a 'foo' property");
|
||||
|
|
@ -286,7 +287,7 @@ function test() {
|
|||
"Should see constant property on prototype objects");
|
||||
|
||||
// Adopting nodes should not lose expandos.
|
||||
var elem = doc.createElement("span");
|
||||
elem = doc.createElement("span");
|
||||
elem.expando = 5;
|
||||
is(elem.expando, 5, "We just set this property");
|
||||
document.adoptNode(elem);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
/* global test, assert_equals */
|
||||
test(function() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("get", "foo");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1295322
|
|||
<pre id="test">
|
||||
</pre>
|
||||
<script type="application/javascript">
|
||||
|
||||
/* global TestFunctions */
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
async function runTests() {
|
||||
await SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]});
|
||||
|
|
@ -26,29 +26,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1295322
|
|||
var t = new TestFunctions();
|
||||
|
||||
try {
|
||||
t.testThrowNsresult();
|
||||
t.testThrowNsresult();
|
||||
} catch (e) {
|
||||
try {
|
||||
is(e.name, "NS_BINDING_ABORTED",
|
||||
"Should have the right exception");
|
||||
is(e.filename, location.href,
|
||||
"Should not be seeing where the exception really came from");
|
||||
} catch (e2) {
|
||||
ok(false, "Should be able to work with the exception");
|
||||
}
|
||||
try {
|
||||
is(e.name, "NS_BINDING_ABORTED", "Should have the right exception");
|
||||
is(e.filename, location.href, "Should not be seeing where the exception really came from");
|
||||
} catch (e2) {
|
||||
ok(false, "Should be able to work with the exception");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
t.testThrowNsresultFromNative();
|
||||
t.testThrowNsresultFromNative();
|
||||
} catch (e) {
|
||||
try {
|
||||
is(e.name, "NS_ERROR_UNEXPECTED",
|
||||
"Should have the right exception");
|
||||
is(e.filename, location.href,
|
||||
"Should not be seeing where the exception really came from");
|
||||
} catch (e2) {
|
||||
ok(false, "Should be able to work with the exception");
|
||||
}
|
||||
is(e.name, "NS_ERROR_UNEXPECTED", "Should have the right exception");
|
||||
is(e.filename, location.href, "Should not be seeing where the exception really came from");
|
||||
} catch (e2) {
|
||||
ok(false, "Should be able to work with the exception");
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=847119
|
|||
var domthrows = function() { xhr.open(); };
|
||||
|
||||
var count = 20000;
|
||||
|
||||
|
||||
function f() {
|
||||
var k = 0;
|
||||
for (var j = 0; j < count; ++j) {
|
||||
|
|
@ -27,17 +27,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=847119
|
|||
function g() { return count; }
|
||||
|
||||
is(f(), count, "Should get count exceptions");
|
||||
for (var h of [f, g]) {
|
||||
for (let h of [f, g]) {
|
||||
try { is(h(), count, "Should get count exceptions here too"); } catch (e) {}
|
||||
}
|
||||
ok(true, "We should get here");
|
||||
|
||||
var domthrows = function() { xhr.withCredentials = false; };
|
||||
domthrows = function() { xhr.withCredentials = false; };
|
||||
xhr.open("GET", "");
|
||||
xhr.send();
|
||||
|
||||
is(f(), count, "Should get count exceptions from getter");
|
||||
for (var h of [f, g]) {
|
||||
for (let h of [f, g]) {
|
||||
try { is(h(), count, "Should get count exceptions from getter here too"); } catch (e) {}
|
||||
}
|
||||
ok(true, "We should get here too");
|
||||
|
|
|
|||
|
|
@ -59,8 +59,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=882653
|
|||
];
|
||||
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
msg = "Correct exception should be thrown for " + tests[i][2];
|
||||
var msg = "Correct exception should be thrown for " + tests[i][2];
|
||||
try {
|
||||
// eslint-disable-next-line no-eval
|
||||
eval(tests[i][0]);
|
||||
ok(false, msg);
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107592
|
|||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/* global TestInterfaceJS */
|
||||
/** Test for Bug 1107592 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=725907
|
|||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=725907">Mozilla Bug 725907</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
||||
</div>
|
||||
<div id="basket">
|
||||
<span id="egg0"></span>
|
||||
|
|
@ -25,23 +25,23 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=725907
|
|||
|
||||
/** Test for Bug 725907 **/
|
||||
|
||||
|
||||
function runTestsForDocument(document, msgSuffix) {
|
||||
function is(a, b, msg) { SimpleTest.is(a, b, msg + msgSuffix); }
|
||||
function isnot(a, b, msg) { SimpleTest.isnot(a, b, msg + msgSuffix); }
|
||||
|
||||
var basket = document.getElementById("basket");
|
||||
var egg3 = document.createElement("span");
|
||||
egg3.id = "egg3";
|
||||
|
||||
var log = "";
|
||||
for (var x of basket.childNodes) {
|
||||
for (let x of basket.childNodes) {
|
||||
if (x.nodeType != x.TEXT_NODE)
|
||||
log += x.id + ";";
|
||||
}
|
||||
is(log, "egg0;egg1;egg2;", "'for (x of div.childNodes)' should iterate over child nodes");
|
||||
|
||||
log = "";
|
||||
for (var x of basket.childNodes) {
|
||||
for (let x of basket.childNodes) {
|
||||
if (x.nodeType != x.TEXT_NODE) {
|
||||
log += x.id + ";";
|
||||
if (x.id == "egg1")
|
||||
|
|
@ -52,17 +52,18 @@ function runTestsForDocument(document, msgSuffix) {
|
|||
|
||||
log = "";
|
||||
basket.appendChild(document.createTextNode("some text"));
|
||||
for (var x of basket.children)
|
||||
for (let x of basket.children)
|
||||
log += x.id + ";";
|
||||
is(log, "egg0;egg1;egg2;egg3;", "'for (x of div.children)' should iterate over child elements");
|
||||
|
||||
var count = 0;
|
||||
for (var x of document.getElementsByClassName("hazardous-materials"))
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
for (let x of document.getElementsByClassName("hazardous-materials"))
|
||||
count++;
|
||||
is(count, 0, "'for (x of emptyNodeList)' loop should run zero times");
|
||||
|
||||
var log = "";
|
||||
for (var x of document.querySelectorAll("span"))
|
||||
log = "";
|
||||
for (let x of document.querySelectorAll("span"))
|
||||
log += x.id + ";";
|
||||
is(log, "egg0;egg1;duckling1;egg2;egg3;", "for-of loop should work with a querySelectorAll() NodeList");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,14 @@
|
|||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="application/javascript">
|
||||
/* global TestInterfaceIterableSingle, TestInterfaceIterableDouble, TestInterfaceIterableDoubleUnion */
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]}, function() {
|
||||
base_properties = [["entries", "function", 0],
|
||||
["keys", "function", 0],
|
||||
["values", "function", 0],
|
||||
["forEach", "function", 1]];
|
||||
var base_properties = [["entries", "function", 0],
|
||||
["keys", "function", 0],
|
||||
["values", "function", 0],
|
||||
["forEach", "function", 1]];
|
||||
var testExistence = function testExistence(prefix, obj, properties) {
|
||||
for (var [name, type, args] of properties) {
|
||||
// Properties are somewhere up the proto chain, hasOwnProperty won't work
|
||||
|
|
@ -46,7 +48,6 @@
|
|||
};
|
||||
|
||||
var itr;
|
||||
// Simple single type iterable creation and functionality test
|
||||
info("IterableSingle: Testing simple iterable creation and functionality");
|
||||
itr = new TestInterfaceIterableSingle();
|
||||
testExistence("IterableSingle: ", itr, base_properties);
|
||||
|
|
@ -66,10 +67,10 @@
|
|||
var key_itr = itr.keys();
|
||||
var value_itr = itr.values();
|
||||
var entries_itr = itr.entries();
|
||||
for (var i = 0; i < 3; ++i) {
|
||||
var key = key_itr.next();
|
||||
var value = value_itr.next();
|
||||
var entry = entries_itr.next();
|
||||
for (let i = 0; i < 3; ++i) {
|
||||
let key = key_itr.next();
|
||||
let value = value_itr.next();
|
||||
let entry = entries_itr.next();
|
||||
is(key.value, i, "IterableSingle: Key iterator value should be " + i);
|
||||
is(key.value, keys[i],
|
||||
"IterableSingle: Key iterator value should match destructuring " + i);
|
||||
|
|
@ -86,10 +87,10 @@
|
|||
|
||||
var callsToForEachCallback = 0;
|
||||
var thisArg = {};
|
||||
itr.forEach(function(value, index, obj) {
|
||||
itr.forEach(function(value1, index, obj) {
|
||||
is(index, callsToForEachCallback,
|
||||
`IterableSingle: Should have the right index at ${callsToForEachCallback} calls to forEach callback`);
|
||||
is(value, values[index],
|
||||
is(value1, values[index],
|
||||
`IterableSingle: Should have the right value at ${callsToForEachCallback} calls to forEach callback`);
|
||||
is(this, thisArg,
|
||||
"IterableSingle: Should have the right this value for forEach callback");
|
||||
|
|
@ -100,9 +101,9 @@
|
|||
is(callsToForEachCallback, 3,
|
||||
"IterableSingle: Should have right total number of calls to forEach callback");
|
||||
|
||||
var key = key_itr.next();
|
||||
var value = value_itr.next();
|
||||
var entry = entries_itr.next();
|
||||
let key = key_itr.next();
|
||||
let value = value_itr.next();
|
||||
let entry = entries_itr.next();
|
||||
is(key.value, undefined, "IterableSingle: Key iterator value should be undefined");
|
||||
is(key.done, true, "IterableSingle: Key iterator done should be true");
|
||||
is(value.value, undefined, "IterableSingle: Value iterator value should be undefined");
|
||||
|
|
@ -120,16 +121,16 @@
|
|||
is(itr.entries, itr[Symbol.iterator],
|
||||
"IterableDouble: Should be using @@iterator for 'entries'");
|
||||
var elements = [["a", "b"], ["c", "d"], ["e", "f"]];
|
||||
var keys = [...itr.keys()];
|
||||
var values = [...itr.values()];
|
||||
var entries = [...itr.entries()];
|
||||
var key_itr = itr.keys();
|
||||
var value_itr = itr.values();
|
||||
var entries_itr = itr.entries();
|
||||
for (var i = 0; i < 3; ++i) {
|
||||
var key = key_itr.next();
|
||||
var value = value_itr.next();
|
||||
var entry = entries_itr.next();
|
||||
keys = [...itr.keys()];
|
||||
values = [...itr.values()];
|
||||
entries = [...itr.entries()];
|
||||
key_itr = itr.keys();
|
||||
value_itr = itr.values();
|
||||
entries_itr = itr.entries();
|
||||
for (let i = 0; i < 3; ++i) {
|
||||
key = key_itr.next();
|
||||
value = value_itr.next();
|
||||
entry = entries_itr.next();
|
||||
is(key.value, elements[i][0], "IterableDouble: Key iterator value should be " + elements[i][0]);
|
||||
is(key.value, keys[i],
|
||||
"IterableDouble: Key iterator value should match destructuring " + i);
|
||||
|
|
@ -146,10 +147,10 @@
|
|||
|
||||
callsToForEachCallback = 0;
|
||||
thisArg = {};
|
||||
itr.forEach(function(value, key, obj) {
|
||||
is(key, keys[callsToForEachCallback],
|
||||
itr.forEach(function(value1, key1, obj) {
|
||||
is(key1, keys[callsToForEachCallback],
|
||||
`IterableDouble: Should have the right key at ${callsToForEachCallback} calls to forEach callback`);
|
||||
is(value, values[callsToForEachCallback],
|
||||
is(value1, values[callsToForEachCallback],
|
||||
`IterableDouble: Should have the right value at ${callsToForEachCallback} calls to forEach callback`);
|
||||
is(this, thisArg,
|
||||
"IterableDouble: Should have the right this value for forEach callback");
|
||||
|
|
@ -160,9 +161,9 @@
|
|||
is(callsToForEachCallback, 3,
|
||||
"IterableDouble: Should have right total number of calls to forEach callback");
|
||||
|
||||
var key = key_itr.next();
|
||||
var value = value_itr.next();
|
||||
var entry = entries_itr.next();
|
||||
key = key_itr.next();
|
||||
value = value_itr.next();
|
||||
entry = entries_itr.next();
|
||||
is(key.value, undefined, "IterableDouble: Key iterator value should be undefined");
|
||||
is(key.done, true, "IterableDouble: Key iterator done should be true");
|
||||
is(value.value, undefined, "IterableDouble: Value iterator value should be undefined");
|
||||
|
|
@ -179,17 +180,17 @@
|
|||
testExistence("IterableDoubleUnion: ", itr, base_properties);
|
||||
is(itr.entries, itr[Symbol.iterator],
|
||||
"IterableDoubleUnion: Should be using @@iterator for 'entries'");
|
||||
var elements = [["long", 1], ["string", "a"]];
|
||||
var keys = [...itr.keys()];
|
||||
var values = [...itr.values()];
|
||||
var entries = [...itr.entries()];
|
||||
var key_itr = itr.keys();
|
||||
var value_itr = itr.values();
|
||||
var entries_itr = itr.entries();
|
||||
for (var i = 0; i < elements.length; ++i) {
|
||||
var key = key_itr.next();
|
||||
var value = value_itr.next();
|
||||
var entry = entries_itr.next();
|
||||
elements = [["long", 1], ["string", "a"]];
|
||||
keys = [...itr.keys()];
|
||||
values = [...itr.values()];
|
||||
entries = [...itr.entries()];
|
||||
key_itr = itr.keys();
|
||||
value_itr = itr.values();
|
||||
entries_itr = itr.entries();
|
||||
for (let i = 0; i < elements.length; ++i) {
|
||||
key = key_itr.next();
|
||||
value = value_itr.next();
|
||||
entry = entries_itr.next();
|
||||
is(key.value, elements[i][0], "IterableDoubleUnion: Key iterator value should be " + elements[i][0]);
|
||||
is(key.value, keys[i],
|
||||
"IterableDoubleUnion: Key iterator value should match destructuring " + i);
|
||||
|
|
@ -206,10 +207,10 @@
|
|||
|
||||
callsToForEachCallback = 0;
|
||||
thisArg = {};
|
||||
itr.forEach(function(value, key, obj) {
|
||||
is(key, keys[callsToForEachCallback],
|
||||
itr.forEach(function(value1, key1, obj) {
|
||||
is(key1, keys[callsToForEachCallback],
|
||||
`IterableDoubleUnion: Should have the right key at ${callsToForEachCallback} calls to forEach callback`);
|
||||
is(value, values[callsToForEachCallback],
|
||||
is(value1, values[callsToForEachCallback],
|
||||
`IterableDoubleUnion: Should have the right value at ${callsToForEachCallback} calls to forEach callback`);
|
||||
is(this, thisArg,
|
||||
"IterableDoubleUnion: Should have the right this value for forEach callback");
|
||||
|
|
@ -220,9 +221,9 @@
|
|||
is(callsToForEachCallback, 2,
|
||||
"IterableDoubleUnion: Should have right total number of calls to forEach callback");
|
||||
|
||||
var key = key_itr.next();
|
||||
var value = value_itr.next();
|
||||
var entry = entries_itr.next();
|
||||
key = key_itr.next();
|
||||
value = value_itr.next();
|
||||
entry = entries_itr.next();
|
||||
is(key.value, undefined, "IterableDoubleUnion: Key iterator value should be undefined");
|
||||
is(key.done, true, "IterableDoubleUnion: Key iterator done should be true");
|
||||
is(value.value, undefined, "IterableDoubleUnion: Value iterator value should be undefined");
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1464374-->
|
|||
|
||||
<iframe></iframe>
|
||||
<script type="application/javascript">
|
||||
/* global TestInterfaceJS */
|
||||
/** Test for Bug 1464374 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1186696
|
|||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/* global TestInterfaceJS */
|
||||
/** Test for Bug 1186696 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
/* global test, assert_equals */
|
||||
function noop1() { }
|
||||
function noop2() { }
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
/* global test, assert_equals, assert_true, assert_false, assert_not_equals */
|
||||
test(function() {
|
||||
var list = document.getElementsByTagName("div");
|
||||
var desc = Object.getOwnPropertyDescriptor(list, "0");
|
||||
|
|
@ -16,7 +17,7 @@ test(function() {
|
|||
}, "Correct getOwnPropertyDescriptor behavior");
|
||||
test(function() {
|
||||
var list = document.getElementsByTagName("div");
|
||||
props = [];
|
||||
var props = [];
|
||||
for (var prop in list) {
|
||||
props.push(prop);
|
||||
}
|
||||
|
|
@ -25,13 +26,13 @@ test(function() {
|
|||
}, "Correct enumeration behavior");
|
||||
test(function() {
|
||||
var list = document.getElementsByTagName("div");
|
||||
props = Object.keys(list);
|
||||
var props = Object.keys(list);
|
||||
assert_not_equals(props.indexOf("0"), -1, "Keys should contain '0'");
|
||||
assert_equals(props.indexOf("log"), -1, "Keys should not contain 'log'");
|
||||
}, "Correct keys() behavior");
|
||||
test(function() {
|
||||
var list = document.getElementsByTagName("div");
|
||||
props = Object.getOwnPropertyNames(list);
|
||||
var props = Object.getOwnPropertyNames(list);
|
||||
assert_not_equals(props.indexOf("0"), -1,
|
||||
"own prop names should contain '0'");
|
||||
assert_not_equals(props.indexOf("log"), -1,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1107592
|
|||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/* global TestInterfaceJS, thereIsNoSuchContentFunction1, thereIsNoSuchContentFunction2, thereIsNoSuchContentFunction3 */
|
||||
/** Test for Bug 1107592 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
@ -93,7 +93,7 @@ doTest@${ourFile}:56:9
|
|||
checkExn.bind(null, 90, "ReferenceError",
|
||||
"thereIsNoSuchContentFunction3 is not defined",
|
||||
undefined, ourFile, 6,
|
||||
`then@${ourFile}:90:32
|
||||
`then@${ourFile}:90:22
|
||||
` + (asyncStack ? `Async*doTest@${ourFile}:89:9\n` + parentFrame : ""))),
|
||||
t.testPromiseWithDOMExceptionThrowingPromiseInit().then(
|
||||
ensurePromiseFail.bind(null, 7),
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1048659
|
|||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/* global TestInterfaceJS */
|
||||
/** Test for returning unions from JS-implemented WebIDL. **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]}, go);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1066432
|
|||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/* global TestInterfaceJS */
|
||||
/** Test for Bug 1066432 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]}, function() {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function doTest() {
|
|||
}
|
||||
var setterCalled = false;
|
||||
|
||||
extLength = gl.getSupportedExtensions().length;
|
||||
var extLength = gl.getSupportedExtensions().length;
|
||||
ok(extLength > 0,
|
||||
"This test won't work right if we have no supported extensions");
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1334537
|
|||
var asShortAString = t.getStringDataAsAString(substringLength);
|
||||
var asAString = t.getStringDataAsAString();
|
||||
|
||||
is(asShortAString, shortTestString, "Short DOMString should be short");
|
||||
is(asShortDOMString, shortTestString, "Short DOMString should be short");
|
||||
is(asFullDOMString, testString, "Full DOMString should be test string");
|
||||
is(asShortAString, shortTestString, "Short AString should be short");
|
||||
is(asAString, testString, "Full AString should be test string");
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
/* global test, assert_true */
|
||||
test(function() {
|
||||
function test(root) {
|
||||
var threw = false;
|
||||
|
|
@ -14,7 +15,9 @@ test(function() {
|
|||
// Hot loop to make sure the JIT heuristics ion-compile this function even
|
||||
// though it's throwing exceptions (which would normally make us back off
|
||||
// of ion compilation).
|
||||
for (var i = 0; i < 1500; i++) {}
|
||||
for (var i = 0; i < 1500; i++) {
|
||||
// empty
|
||||
}
|
||||
return threw;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1465602
|
|||
<pre id="test">
|
||||
</pre>
|
||||
<script type="application/javascript">
|
||||
|
||||
/* global TestFunctions */
|
||||
/** Test for Bug 1465602 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<div id="log"></div>
|
||||
<img name="location">
|
||||
<script>
|
||||
/* global test, assert_equals */
|
||||
test(function() {
|
||||
assert_equals(document.location, window.location,
|
||||
'The <img name="location"> should not override the location getter');
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="application/javascript">
|
||||
/* global TestInterfaceJS */
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]}, function() {
|
||||
var testInterfaceJS = new TestInterfaceJS();
|
||||
|
|
|
|||
Loading…
Reference in a new issue