Bug 1447944 - Enable ESLint rule no-undef for test files in devtools/server/tests/unit/. r=jdescottes

MozReview-Commit-ID: JBtDdAUraQ2

--HG--
extra : rebase_source : 544ada916f5d3fd41f57225b19897d6b21407425
This commit is contained in:
Mark Banner 2018-03-22 10:59:26 +00:00
Родитель b6a27be22a
Коммит f1ed0a2b70
18 изменённых файлов: 49 добавлений и 29 удалений

Просмотреть файл

@ -19,7 +19,6 @@ module.exports = {
"client/memory/test/**",
"server/tests/browser/**",
"server/tests/mochitest/**",
"server/tests/unit/**",
"shared/heapsnapshot/tests/unit/**",
"shared/tests/unit/**",
"shared/webconsole/test/**",

Просмотреть файл

@ -3,6 +3,9 @@
"use strict";
// Uses the same scope as test_add_actors.js
/* import-globals-from head_dbg.js */
function PostInitGlobalActor(connection) {}
PostInitGlobalActor.prototype = {

Просмотреть файл

@ -3,6 +3,9 @@
"use strict";
// Uses the same scope as test_add_actors.js
/* import-globals-from head_dbg.js */
function PostInitTabActor(connection) {}
PostInitTabActor.prototype = {

Просмотреть файл

@ -3,6 +3,9 @@
"use strict";
// Uses the same scope as test_add_actors.js
/* import-globals-from head_dbg.js */
function PreInitGlobalActor(connection) {}
PreInitGlobalActor.prototype = {

Просмотреть файл

@ -3,6 +3,9 @@
"use strict";
// Uses the same scope as test_add_actors.js
/* import-globals-from head_dbg.js */
function PreInitTabActor(connection) {}
PreInitTabActor.prototype = {

Просмотреть файл

@ -52,7 +52,7 @@ function test_black_box() {
}
});
/* eslint-disable no-multi-spaces */
/* eslint-disable no-multi-spaces, no-undef */
Cu.evalInSandbox(
"" + function doStuff(k) { // line 1
let arg = 15; // line 2 - Break here
@ -78,7 +78,7 @@ function test_black_box() {
SOURCE_URL,
1
);
/* eslint-enable no-multi-spaces */
/* eslint-enable no-multi-spaces, no-undef */
}
function test_black_box_breakpoint() {

Просмотреть файл

@ -42,7 +42,7 @@ function test_black_box() {
});
});
/* eslint-disable no-multi-spaces */
/* eslint-disable no-multi-spaces, no-undef */
Cu.evalInSandbox(
"" + function doStuff(k) { // line 1
debugger; // line 2 - Break here
@ -68,7 +68,7 @@ function test_black_box() {
SOURCE_URL,
1
);
/* eslint-enable no-multi-spaces */
/* eslint-enable no-multi-spaces, no-undef */
}
function test_black_box_dbg_statement() {

Просмотреть файл

@ -49,7 +49,7 @@ function test_black_box() {
}
});
/* eslint-disable no-multi-spaces */
/* eslint-disable no-multi-spaces, no-undef */
Cu.evalInSandbox(
"" + function doStuff(k) { // line 1
debugger; // line 2
@ -75,7 +75,7 @@ function test_black_box() {
SOURCE_URL,
1
);
/* eslint-enable no-multi-spaces */
/* eslint-enable no-multi-spaces, no-undef */
}
function test_black_box_paused() {

Просмотреть файл

@ -38,7 +38,7 @@ const SOURCE_URL = "http://example.com/source.js";
function test_black_box() {
gClient.addOneTimeListener("paused", test_black_box_exception);
/* eslint-disable no-multi-spaces, no-unreachable */
/* eslint-disable no-multi-spaces, no-unreachable, no-undef */
Cu.evalInSandbox(
"" + function doStuff(k) { // line 1
throw new Error("wu tang clan ain't nuthin' ta fuck wit"); // line 2
@ -65,7 +65,7 @@ function test_black_box() {
SOURCE_URL,
1
);
/* eslint-enable no-multi-spaces */
/* eslint-enable no-multi-spaces, no-unreachable, no-undef */
}
function test_black_box_exception() {

Просмотреть файл

@ -40,7 +40,7 @@ function run_test() {
}
function setup_code() {
/* eslint-disable no-multi-spaces */
/* eslint-disable no-multi-spaces, no-undef */
let { code, map } = (new SourceNode(null, null, null, [
new SourceNode(1, 0, "a.js", "" + function a() {
return b();
@ -59,7 +59,7 @@ function setup_code() {
file: "abc.js",
sourceRoot: "http://example.com/"
});
/* eslint-enable no-multi-spaces */
/* eslint-enable no-multi-spaces, no-undef */
code += "//# sourceMappingURL=data:text/json," + map.toString();

Просмотреть файл

@ -18,7 +18,7 @@ function run_test() {
g.eval("function stopMe(arg) {debugger;}");
g2 = testGlobal("test2");
let g2 = testGlobal("test2");
g2.g = g;
g2.eval("(" + function createBadEvent() {
let parser = Cc["@mozilla.org/xmlextras/domparser;1"]

Просмотреть файл

@ -57,10 +57,11 @@ function test_object_grip() {
});
});
/* eslint-disable no-undef */
gDebuggee.eval("(" + function() {
let obj1 = {};
Object.freeze(obj1);
stopMe(obj1, {});
} + "())");
/* eslint-enable no-undef */
}

Просмотреть файл

@ -57,10 +57,11 @@ function test_object_grip() {
});
});
/* eslint-disable no-undef */
gDebuggee.eval("(" + function() {
let obj1 = {};
Object.seal(obj1);
stopMe(obj1, {});
} + "())");
/* eslint-enable no-undef */
}

Просмотреть файл

@ -61,6 +61,7 @@ function test_object_grip() {
});
});
/* eslint-disable no-undef */
gDebuggee.eval("(" + function() {
let f = {};
Object.freeze(f);
@ -70,5 +71,5 @@ function test_object_grip() {
Object.preventExtensions(ne);
stopMe(f, s, ne, {});
} + "())");
/* eslint-enable no-undef */
}

Просмотреть файл

@ -13,20 +13,23 @@ add_task(async function() {
let response = await listTabs(client);
let targetTab = findTab(response.tabs, "promises-actor-test");
ok(targetTab, "Found our target tab.");
Assert.ok(targetTab, "Found our target tab.");
// Attach to the TabActor and check the response
client.request({ to: targetTab.actor, type: "attach" }, response => {
ok(!("error" in response), "Expect no error in response.");
ok(response.from, targetTab.actor,
"Expect the target TabActor in response form field.");
ok(response.type, "tabAttached",
"Expect tabAttached in the response type.");
is(typeof response.promisesActor === "string",
"Should have a tab context PromisesActor.");
await new Promise(resolve => {
client.request({ to: targetTab.actor, type: "attach" }, response => {
Assert.ok(!("error" in response), "Expect no error in response.");
Assert.equal(response.from, targetTab.actor,
"Expect the target TabActor in response form field.");
Assert.equal(response.type, "tabAttached",
"Expect tabAttached in the response type.");
Assert.ok(typeof response.promisesActor === "string",
"Should have a tab context PromisesActor.");
resolve();
});
});
let chromeActors = await getChromeActors(client);
ok(typeof chromeActors.promisesActor === "string",
Assert.ok(typeof chromeActors.promisesActor === "string",
"Should have a chrome context PromisesActor.");
});

Просмотреть файл

@ -181,13 +181,13 @@ function run_test() {
});
DebuggerServer.init();
check_except(() => {
let badActor = ActorClassWithSpec({}, {
missing: preEvent("missing-event", function() {
Assert.throws(() => {
let badActor = protocol.ActorClassWithSpec({}, {
missing: protocol.preEvent("missing-event", function() {
})
});
void badActor;
});
}, /Actor specification must have a typeName member/);
protocol.types.getType("array:array:array:number");
protocol.types.getType("array:array:array:number");

Просмотреть файл

@ -11,6 +11,7 @@ function run_test() {
let testFile = do_get_file("xpcshell_debugging_script.js");
// _setupDebuggerServer is from xpcshell-test's head.js
/* global _setupDebuggerServer */
let testResumed = false;
let DebuggerServer = _setupDebuggerServer([testFile.path], () => {
testResumed = true;

Просмотреть файл

@ -22,7 +22,9 @@ module.exports = {
"Cr": false,
"Cu": false,
"DOMRequest": false,
"Debugger": false,
"DedicatedWorkerGlobalScope": false,
"HeapSnapshot": false,
"IDBFileRequest": false,
"IDBLocaleAwareKeyRange": false,
"IDBMutableFile": false,