diff --git a/.eslintignore b/.eslintignore index a3f5ffae1543..b1ed7dff30e9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -136,7 +136,6 @@ dom/workers/test/threadErrors_worker1.js intl/l10n/ # Exclude everything but self-hosted JS -js/ductwork/ js/examples/ js/public/ js/xpconnect/ diff --git a/.eslintrc-test-paths.js b/.eslintrc-test-paths.js index 8f2b135328be..507b25167a9b 100644 --- a/.eslintrc-test-paths.js +++ b/.eslintrc-test-paths.js @@ -54,6 +54,7 @@ const extraXpcshellTestPaths = [ "intl/benchmarks/", "intl/l10n/test/", "ipc/testshell/tests/", + "js/ductwork/debugger/tests/", "memory/replace/dmd/test/", "netwerk/test/httpserver/test/", "testing/modules/tests/xpcshell/", diff --git a/js/ductwork/debugger/JSDebugger.cpp b/js/ductwork/debugger/JSDebugger.cpp index 436ab1262e39..f0145ce19ea7 100644 --- a/js/ductwork/debugger/JSDebugger.cpp +++ b/js/ductwork/debugger/JSDebugger.cpp @@ -35,7 +35,7 @@ JSDebugger::AddClass(JS::Handle global, JSContext* cx) { return NS_ERROR_INVALID_ARG; } - JS::RootedObject obj(cx, &global.toObject()); + JS::Rooted obj(cx, &global.toObject()); obj = js::UncheckedUnwrap(obj, /* stopAtWindowProxy = */ false); if (!obj) { return NS_ERROR_FAILURE; diff --git a/js/ductwork/debugger/jsdebugger.jsm b/js/ductwork/debugger/jsdebugger.jsm index ed5e9f66f7b0..53be813286d4 100644 --- a/js/ductwork/debugger/jsdebugger.jsm +++ b/js/ductwork/debugger/jsdebugger.jsm @@ -3,7 +3,9 @@ * 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/. */ -var EXPORTED_SYMBOLS = [ "addDebuggerToGlobal", "addSandboxedDebuggerToGlobal" ]; +"use strict"; + +var EXPORTED_SYMBOLS = ["addDebuggerToGlobal", "addSandboxedDebuggerToGlobal"]; /* * This is the js module for Debugger. Import it like so: @@ -29,7 +31,7 @@ function addDebuggerToGlobal(global) { // Defines the Debugger in a sandbox global in a separate compartment. This // ensures the debugger and debuggee are in different compartments. function addSandboxedDebuggerToGlobal(global) { - var sb = Cu.Sandbox(global, {freshCompartment: true}); + const sb = Cu.Sandbox(global, { freshCompartment: true }); addDebuggerToGlobal(sb); global.Debugger = sb.Debugger; } @@ -50,7 +52,7 @@ function initPromiseDebugging(global) { global.eval(polyfillSource); } -let polyfillSource = ` +const polyfillSource = ` Object.defineProperty(Debugger.Object.prototype, "promiseState", { get() { const state = this.PromiseDebugging.getState(this.unsafeDereference()); diff --git a/js/ductwork/debugger/tests/head_dbg.js b/js/ductwork/debugger/tests/head_dbg.js index aad37f5f128c..48942bdb7a96 100644 --- a/js/ductwork/debugger/tests/head_dbg.js +++ b/js/ductwork/debugger/tests/head_dbg.js @@ -3,11 +3,12 @@ "use strict"; -function testGlobal(aName) { - let systemPrincipal = Cc["@mozilla.org/systemprincipal;1"] - .createInstance(Ci.nsIPrincipal); +function testGlobal(name) { + const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].createInstance( + Ci.nsIPrincipal + ); - let sandbox = Cu.Sandbox(systemPrincipal); - Cu.evalInSandbox("this.__name = '" + aName + "'", sandbox); + const sandbox = Cu.Sandbox(systemPrincipal); + Cu.evalInSandbox("this.__name = '" + name + "'", sandbox); return sandbox; } diff --git a/js/ductwork/debugger/tests/test_nativewrappers.js b/js/ductwork/debugger/tests/test_nativewrappers.js index 3523121164d2..69af71822b80 100644 --- a/js/ductwork/debugger/tests/test_nativewrappers.js +++ b/js/ductwork/debugger/tests/test_nativewrappers.js @@ -1,6 +1,9 @@ -function run_test() -{ - const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); +"use strict"; + +function run_test() { + const { addDebuggerToGlobal } = ChromeUtils.import( + "resource://gre/modules/jsdebugger.jsm" + ); Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true); registerCleanupFunction(() => { @@ -8,30 +11,35 @@ function run_test() }); addDebuggerToGlobal(globalThis); - var g = testGlobal("test1"); + const g = testGlobal("test1"); - var dbg = new Debugger(); + const dbg = new Debugger(); dbg.addDebuggee(g); - dbg.onDebuggerStatement = function(aFrame) { - let args = aFrame["arguments"]; + dbg.onDebuggerStatement = function(frame) { + const args = frame.arguments; try { args[0]; Assert.ok(true); - } catch(ex) { + } catch (ex) { Assert.ok(false); } }; g.eval("function stopMe(arg) {debugger;}"); - g2 = testGlobal("test2"); + const g2 = testGlobal("test2"); g2.g = g; - g2.eval("(" + function createBadEvent() { - Cu.importGlobalProperties(["DOMParser"]); - let parser = new DOMParser(); - let doc = parser.parseFromString("", "text/xml"); - g.stopMe(doc.createEvent("MouseEvent")); - } + ")()"); + g2.eval( + "(" + + function createBadEvent() { + // eslint-disable-next-line mozilla/reject-importGlobalProperties + Cu.importGlobalProperties(["DOMParser"]); + const parser = new DOMParser(); + const doc = parser.parseFromString("", "text/xml"); + g.stopMe(doc.createEvent("MouseEvent")); + } + + ")()" + ); dbg.removeAllDebuggees(); }