зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1451378 - Enable ESLint rule no-undef for more test files in devtools. r=jdescottes
MozReview-Commit-ID: 6q43u1m0hLI --HG-- extra : rebase_source : 02bf20a95994ac2fb13e3a69e3d504564fcc279d
This commit is contained in:
Родитель
b7a889c98b
Коммит
57f0cf24f4
|
@ -16,12 +16,8 @@ module.exports = {
|
||||||
// XXX Bug 1230193. We're still working on enabling no-undef for these test
|
// XXX Bug 1230193. We're still working on enabling no-undef for these test
|
||||||
// directories.
|
// directories.
|
||||||
"files": [
|
"files": [
|
||||||
"client/memory/test/**",
|
|
||||||
"server/tests/browser/**",
|
|
||||||
"server/tests/mochitest/**",
|
"server/tests/mochitest/**",
|
||||||
"shared/heapsnapshot/tests/unit/**",
|
|
||||||
"shared/tests/unit/**",
|
"shared/tests/unit/**",
|
||||||
"shared/webconsole/test/**",
|
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-undef": "off",
|
"no-undef": "off",
|
||||||
|
|
|
@ -3,14 +3,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// Extend from the shared list of defined globals for mochitests.
|
// Extend from the shared list of defined globals for mochitests.
|
||||||
"extends": "../../../../.eslintrc.mochitests.js",
|
"extends": "../../../../.eslintrc.mochitests.js",
|
||||||
"globals": {
|
|
||||||
"addTab": true,
|
|
||||||
"censusState": true,
|
|
||||||
"refreshTab": true,
|
|
||||||
"removeTab": true,
|
|
||||||
"waitForTime": true,
|
|
||||||
"waitUntilState": true
|
|
||||||
},
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-vars": ["error", { "vars": "local", "args": "none" }],
|
"no-unused-vars": ["error", { "vars": "local", "args": "none" }],
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
|
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
|
||||||
const { viewState, censusState } = require("devtools/client/memory/constants");
|
const { viewState } = require("devtools/client/memory/constants");
|
||||||
const { changeView } = require("devtools/client/memory/actions/view");
|
const { changeView } = require("devtools/client/memory/actions/view");
|
||||||
|
|
||||||
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
|
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
const {
|
const {
|
||||||
dominatorTreeState,
|
dominatorTreeState,
|
||||||
viewState,
|
viewState,
|
||||||
censusState,
|
|
||||||
} = require("devtools/client/memory/constants");
|
} = require("devtools/client/memory/constants");
|
||||||
const { changeViewAndRefresh, changeView } = require("devtools/client/memory/actions/view");
|
const { changeViewAndRefresh, changeView } = require("devtools/client/memory/actions/view");
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
const {
|
const {
|
||||||
individualsState,
|
individualsState,
|
||||||
viewState,
|
viewState,
|
||||||
censusState,
|
|
||||||
} = require("devtools/client/memory/constants");
|
} = require("devtools/client/memory/constants");
|
||||||
const { changeView } = require("devtools/client/memory/actions/view");
|
const { changeView } = require("devtools/client/memory/actions/view");
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
viewState,
|
viewState
|
||||||
censusState
|
|
||||||
} = require("devtools/client/memory/constants");
|
} = require("devtools/client/memory/constants");
|
||||||
const {
|
const {
|
||||||
takeSnapshotAndCensus
|
takeSnapshotAndCensus
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {
|
const {
|
||||||
censusState,
|
|
||||||
viewState
|
viewState
|
||||||
} = require("devtools/client/memory/constants");
|
} = require("devtools/client/memory/constants");
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
|
const TEST_URL = "http://example.com/browser/devtools/client/memory/test/browser/doc_steady_allocation.html";
|
||||||
const { viewState, censusState } = require("devtools/client/memory/constants");
|
const { viewState } = require("devtools/client/memory/constants");
|
||||||
const { changeView } = require("devtools/client/memory/actions/view");
|
const { changeView } = require("devtools/client/memory/actions/view");
|
||||||
|
|
||||||
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
|
this.test = makeMemoryTest(TEST_URL, async function({ tab, panel }) {
|
||||||
|
|
|
@ -4,16 +4,18 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// Load the shared test helpers into this compartment.
|
// Load the shared test helpers into this compartment.
|
||||||
|
/* import-globals-from ../../../shared/test/shared-head.js */
|
||||||
Services.scriptloader.loadSubScript(
|
Services.scriptloader.loadSubScript(
|
||||||
"chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js",
|
"chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js",
|
||||||
this);
|
this);
|
||||||
|
|
||||||
// Load the shared Redux helpers into this compartment.
|
// Load the shared Redux helpers into this compartment.
|
||||||
|
/* import-globals-from ../../../shared/test/shared-redux-head.js */
|
||||||
Services.scriptloader.loadSubScript(
|
Services.scriptloader.loadSubScript(
|
||||||
"chrome://mochitests/content/browser/devtools/client/shared/test/shared-redux-head.js",
|
"chrome://mochitests/content/browser/devtools/client/shared/test/shared-redux-head.js",
|
||||||
this);
|
this);
|
||||||
|
|
||||||
var { censusDisplays, snapshotState: states } = require("devtools/client/memory/constants");
|
var { censusDisplays, censusState, snapshotState: states } = require("devtools/client/memory/constants");
|
||||||
var { L10N } = require("devtools/client/memory/utils");
|
var { L10N } = require("devtools/client/memory/utils");
|
||||||
|
|
||||||
Services.prefs.setBoolPref("devtools.memory.enabled", true);
|
Services.prefs.setBoolPref("devtools.memory.enabled", true);
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// Extend from the shared list of defined globals for mochitests.
|
// Extend from the shared list of defined globals for mochitests.
|
||||||
"extends": "../../../../.eslintrc.mochitests.js",
|
"extends": "../../../../.eslintrc.mochitests.js",
|
||||||
"globals": {
|
|
||||||
"SimpleTest": true,
|
|
||||||
"ok": true,
|
|
||||||
"requestAnimationFrame": true
|
|
||||||
},
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-vars": ["error", { "vars": "local", "args": "none" }],
|
"no-unused-vars": ["error", { "vars": "local", "args": "none" }],
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ module.exports = {
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-unused-vars": ["error", {
|
"no-unused-vars": ["error", {
|
||||||
"vars": "local",
|
"vars": "local",
|
||||||
"varsIgnorePattern": "^run_test$"
|
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
// via xpcshell.ini
|
||||||
|
/* import-globals-from ../../../shared/test/shared-redux-head.js */
|
||||||
|
|
||||||
var { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
var { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
|
||||||
|
|
||||||
var Services = require("Services");
|
var Services = require("Services");
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// Extend from the common devtools mochitest eslintrc config.
|
// Extend from the common devtools mochitest eslintrc config.
|
||||||
"extends": "../../../.eslintrc.xpcshell.js"
|
"extends": "../../../.eslintrc.mochitests.js"
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,12 +26,11 @@ async function test() {
|
||||||
let { errorActor } = await gClient.listTabs();
|
let { errorActor } = await gClient.listTabs();
|
||||||
ok(errorActor, "Found the error actor.");
|
ok(errorActor, "Found the error actor.");
|
||||||
|
|
||||||
try {
|
await Assert.rejects(gClient.request({ to: errorActor, type: "error" }),
|
||||||
await gClient.request({ to: globalActor, type: "error" });
|
err => err.error == "unknownError" &&
|
||||||
ok(false, "The request is expected to fail.");
|
/error occurred while processing 'error/.test(err.message),
|
||||||
} catch (e) {
|
"The request should be rejected");
|
||||||
ok(true, "The request failed as expected, and was caught by the client");
|
|
||||||
}
|
|
||||||
await gClient.close();
|
await gClient.close();
|
||||||
|
|
||||||
finish();
|
finish();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
// name (and different paths).
|
// name (and different paths).
|
||||||
|
|
||||||
const {StorageFront} = require("devtools/shared/fronts/storage");
|
const {StorageFront} = require("devtools/shared/fronts/storage");
|
||||||
|
/* import-globals-from storage-helpers.js */
|
||||||
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/server/tests/browser/storage-helpers.js", this);
|
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/server/tests/browser/storage-helpers.js", this);
|
||||||
|
|
||||||
const TESTDATA = {
|
const TESTDATA = {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const { StorageFront } = require("devtools/shared/fronts/storage");
|
const { StorageFront } = require("devtools/shared/fronts/storage");
|
||||||
|
/* import-globals-from storage-helpers.js */
|
||||||
Services.scriptloader.loadSubScript(
|
Services.scriptloader.loadSubScript(
|
||||||
"chrome://mochitests/content/browser/devtools/server/tests/browser/storage-helpers.js",
|
"chrome://mochitests/content/browser/devtools/server/tests/browser/storage-helpers.js",
|
||||||
this);
|
this);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const {StorageFront} = require("devtools/shared/fronts/storage");
|
const {StorageFront} = require("devtools/shared/fronts/storage");
|
||||||
|
/* import-globals-from storage-helpers.js */
|
||||||
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/server/tests/browser/storage-helpers.js", this);
|
Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/server/tests/browser/storage-helpers.js", this);
|
||||||
|
|
||||||
const storeMap = {
|
const storeMap = {
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/* global test */
|
||||||
window.test = function() {
|
window.test = function() {
|
||||||
document.body.expando1 = { cycle: document.body };
|
document.body.expando1 = { cycle: document.body };
|
||||||
SpecialPowers.Cu.forceCC();
|
SpecialPowers.Cu.forceCC();
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var x = 1;
|
var x = 1;
|
||||||
|
/* global test */
|
||||||
window.test = function() {
|
window.test = function() {
|
||||||
SpecialPowers.Cu.forceGC();
|
SpecialPowers.Cu.forceGC();
|
||||||
document.body.style.borderTop = x + "px solid red";
|
document.body.style.borderTop = x + "px solid red";
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
/* global DebuggerServer */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test actor designed to check that clients are properly notified of errors when calling
|
* Test actor designed to check that clients are properly notified of errors when calling
|
||||||
* methods on old style actors.
|
* methods on old style actors.
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
// This file assumes head.js is loaded in the global scope.
|
||||||
|
/* import-globals-from head.js */
|
||||||
|
|
||||||
/* exported openTabAndSetupStorage, clearStorage */
|
/* exported openTabAndSetupStorage, clearStorage */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
|
@ -111,7 +111,7 @@ function getFilePath(name, allowMissing = false, usePlatformPathSeparator = fals
|
||||||
|
|
||||||
path = path.slice(filePrePath.length);
|
path = path.slice(filePrePath.length);
|
||||||
|
|
||||||
if (sePlatformPathSeparator && path.match(/^\w:/)) {
|
if (usePlatformPathSeparator && path.match(/^\w:/)) {
|
||||||
path = path.replace(/\//g, "\\");
|
path = path.replace(/\//g, "\\");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ function assertLabelAndShallowSize(breakdown, givenDescription,
|
||||||
dumpn("Given description: " + JSON.stringify(givenDescription, null, 4));
|
dumpn("Given description: " + JSON.stringify(givenDescription, null, 4));
|
||||||
|
|
||||||
const visitor = new LabelAndShallowSizeVisitor();
|
const visitor = new LabelAndShallowSizeVisitor();
|
||||||
CensusUtils.walk(breakdown, description, visitor);
|
CensusUtils.walk(breakdown, givenDescription, visitor);
|
||||||
|
|
||||||
dumpn("Expected shallow size: " + expectedShallowSize);
|
dumpn("Expected shallow size: " + expectedShallowSize);
|
||||||
dumpn("Actual shallow size: " + visitor.shallowSize());
|
dumpn("Actual shallow size: " + visitor.shallowSize());
|
||||||
|
@ -435,7 +435,7 @@ function assertDeduplicatedPaths({ target, paths, expectedNodes, expectedEdges }
|
||||||
}
|
}
|
||||||
equal(count, 1,
|
equal(count, 1,
|
||||||
"should have exactly one matching edge for the expected edge = "
|
"should have exactly one matching edge for the expected edge = "
|
||||||
+ JSON.stringify(edge));
|
+ JSON.stringify(expectedEdge));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ module.exports = {
|
||||||
"DOMRequest": false,
|
"DOMRequest": false,
|
||||||
"Debugger": false,
|
"Debugger": false,
|
||||||
"DedicatedWorkerGlobalScope": false,
|
"DedicatedWorkerGlobalScope": false,
|
||||||
|
"DominatorTree": false,
|
||||||
"HeapSnapshot": false,
|
"HeapSnapshot": false,
|
||||||
"IDBFileRequest": false,
|
"IDBFileRequest": false,
|
||||||
"IDBLocaleAwareKeyRange": false,
|
"IDBLocaleAwareKeyRange": false,
|
||||||
|
@ -55,6 +56,7 @@ module.exports = {
|
||||||
"console": true,
|
"console": true,
|
||||||
"dump": true,
|
"dump": true,
|
||||||
"openDialog": false,
|
"openDialog": false,
|
||||||
|
"saveStack": false,
|
||||||
"sizeToContent": false,
|
"sizeToContent": false,
|
||||||
// Specific to Firefox
|
// Specific to Firefox
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
|
|
|
@ -9,6 +9,9 @@ module.exports = {
|
||||||
"_TEST_FILE": false,
|
"_TEST_FILE": false,
|
||||||
"add_task": false,
|
"add_task": false,
|
||||||
"add_test": false,
|
"add_test": false,
|
||||||
|
// Test-only function.
|
||||||
|
"allocationMarker": false,
|
||||||
|
"byteSize": false,
|
||||||
"deepEqual": false,
|
"deepEqual": false,
|
||||||
"do_await_remote_message": false,
|
"do_await_remote_message": false,
|
||||||
"do_check_instanceof": false,
|
"do_check_instanceof": false,
|
||||||
|
@ -29,6 +32,7 @@ module.exports = {
|
||||||
"do_timeout": false,
|
"do_timeout": false,
|
||||||
"equal": false,
|
"equal": false,
|
||||||
"executeSoon": false,
|
"executeSoon": false,
|
||||||
|
"gc": false,
|
||||||
// XPCShell specific function, see XPCShellEnvironment.cpp
|
// XPCShell specific function, see XPCShellEnvironment.cpp
|
||||||
"gczeal": false,
|
"gczeal": false,
|
||||||
"greater": false,
|
"greater": false,
|
||||||
|
|
|
@ -35,7 +35,6 @@ module.exports = {
|
||||||
"DOMException": false,
|
"DOMException": false,
|
||||||
"DOMRequest": false,
|
"DOMRequest": false,
|
||||||
"DOMStringList": false,
|
"DOMStringList": false,
|
||||||
"DominatorTree": false,
|
|
||||||
"ErrorEvent": false,
|
"ErrorEvent": false,
|
||||||
"Event": false,
|
"Event": false,
|
||||||
"EventTarget": false,
|
"EventTarget": false,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче