author | Wes Kocher <wkocher@mozilla.com> |
Thu, 23 Mar 2017 16:15:37 -0700 | |
changeset 349327 | 01d1dedf400d4be413b1a0d48090dca7acf29637 |
parent 349326 | 65a83a84898ec3486aa36065d0f62f16c9a5b25d (current diff) |
parent 349181 | 2ac80695f9bc8dcafc0b1e9fe2e68b87d58df15f (diff) |
child 349328 | dfe3771711d17a8668a1243f73d5e037a3abe65b |
child 349426 | 3f905f200fd193c3b52837dab8a3b6c3065bf037 |
child 349439 | 3eda8d604532ab726aecbeb54e99c1d6cde61615 |
push id | 88400 |
push user | kwierso@gmail.com |
push date | Thu, 23 Mar 2017 23:56:15 +0000 |
treeherder | mozilla-inbound@dfe3771711d1 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | merge |
milestone | 55.0a1 |
first release with | nightly mac
01d1dedf400d
/
55.0a1
/
20170324030205
/
files
nightly win32
01d1dedf400d
/
55.0a1
/
20170324030205
/
files
nightly win64
01d1dedf400d
/
55.0a1
/
20170324030205
/
files
nightly linux32
nightly linux64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly mac
55.0a1
/
20170324030205
/
pushlog to previous
nightly win32
55.0a1
/
20170324030205
/
pushlog to previous
nightly win64
55.0a1
/
20170324030205
/
pushlog to previous
|
--- a/.cron.yml +++ b/.cron.yml @@ -54,19 +54,8 @@ jobs: job: type: decision-task treeherder-symbol: Nc target-tasks-method: nightly_code_coverage run-on-projects: - mozilla-central when: - {hour: 18, minute: 0} - - - name: nightly-stylo-talos - job: - type: decision-task - treeherder-symbol: T - target-tasks-method: stylo_talos - run-on-projects: - - mozilla-central - when: - - {hour: 4, minute: 0} -
--- a/.eslintignore +++ b/.eslintignore @@ -126,17 +126,17 @@ devtools/client/webide/** devtools/server/actors/webconsole.js devtools/server/actors/object.js devtools/server/actors/script.js devtools/server/actors/styleeditor.js devtools/server/actors/stylesheets.js devtools/server/tests/browser/storage-*.html !devtools/server/tests/browser/storage-unsecured-iframe.html devtools/server/tests/browser/stylesheets-nested-iframes.html -devtools/server/tests/unit/** +devtools/server/tests/unit/xpcshell_debugging_script.js devtools/shared/platform/content/test/test_clipboard.html devtools/shared/qrcode/tests/mochitest/test_decode.html devtools/shared/tests/mochitest/*.html devtools/shared/webconsole/test/test_*.html # Ignore devtools pre-processed files devtools/client/framework/toolbox-process-window.js devtools/client/performance/system.js @@ -169,16 +169,17 @@ devtools/server/actors/utils/automation- devtools/client/debugger/test/mochitest/code_binary_search.js devtools/client/debugger/test/mochitest/code_math.min.js devtools/client/debugger/test/mochitest/code_math_bogus_map.js devtools/client/debugger/test/mochitest/code_ugly* devtools/client/debugger/test/mochitest/code_worker-source-map.js devtools/client/framework/test/code_ugly* devtools/server/tests/unit/babel_and_browserify_script_with_source_map.js devtools/server/tests/unit/setBreakpoint* +devtools/server/tests/unit/sourcemapped.js # dom/ exclusions dom/animation/** dom/archivereader/** dom/asmjscache/** dom/audiochannel/** dom/base/** dom/battery/**
--- a/accessible/base/NotificationController.cpp +++ b/accessible/base/NotificationController.cpp @@ -750,18 +750,21 @@ NotificationController::WillRefresh(mozi outerDocAcc->RemoveChild(childDoc); } // Failed to bind the child document, destroy it. childDoc->Shutdown(); } } - mHangingChildDocuments.Clear(); + MOZ_ASSERT(mDocument, "Illicit document shutdown"); + if (!mDocument) { + return; + } // If the document is ready and all its subdocuments are completely loaded // then process the document load. if (mDocument->HasLoadState(DocAccessible::eReady) && !mDocument->HasLoadState(DocAccessible::eCompletelyLoaded) && hangingDocCnt == 0) { uint32_t childDocCnt = mDocument->ChildDocumentCount(), childDocIdx = 0; for (; childDocIdx < childDocCnt; childDocIdx++) {
--- a/browser/base/content/browser-ctrlTab.js +++ b/browser/base/content/browser-ctrlTab.js @@ -199,26 +199,27 @@ var ctrlTab = { tabPreviews.init(); this._initRecentlyUsedTabs(); this._init(true); } }, uninit: function ctrlTab_uninit() { - this._recentlyUsedTabs = null; - this._init(false); + if (this._recentlyUsedTabs) { + this._recentlyUsedTabs = null; + this._init(false); + } }, prefName: "browser.ctrlTab.previews", readPref: function ctrlTab_readPref() { var enable = gPrefService.getBoolPref(this.prefName) && - (!gPrefService.prefHasUserValue("browser.ctrlTab.disallowForScreenReaders") || - !gPrefService.getBoolPref("browser.ctrlTab.disallowForScreenReaders")); + !gPrefService.getBoolPref("browser.ctrlTab.disallowForScreenReaders", false); if (enable) this.init(); else this.uninit(); }, observe(aSubject, aTopic, aPrefName) { this.readPref(); @@ -530,25 +531,25 @@ var ctrlTab = { this._recentlyUsedTabs = Array.filter(gBrowser.tabs, tab => !tab.closing) .sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed); }, _init: function ctrlTab__init(enable) { var toggleEventListener = enable ? "addEventListener" : "removeEventListener"; - window[toggleEventListener]("SSWindowRestored", this, false); + window[toggleEventListener]("SSWindowRestored", this); var tabContainer = gBrowser.tabContainer; - tabContainer[toggleEventListener]("TabOpen", this, false); - tabContainer[toggleEventListener]("TabAttrModified", this, false); - tabContainer[toggleEventListener]("TabSelect", this, false); - tabContainer[toggleEventListener]("TabClose", this, false); + tabContainer[toggleEventListener]("TabOpen", this); + tabContainer[toggleEventListener]("TabAttrModified", this); + tabContainer[toggleEventListener]("TabSelect", this); + tabContainer[toggleEventListener]("TabClose", this); - document[toggleEventListener]("keypress", this, false); + document[toggleEventListener]("keypress", this); gBrowser.mTabBox.handleCtrlTab = !enable; if (enable) PageThumbs.addExpirationFilter(this); else PageThumbs.removeExpirationFilter(this); // If we're not running, hide the "Show All Tabs" menu item,
--- a/browser/base/content/browser-sets.inc +++ b/browser/base/content/browser-sets.inc @@ -333,17 +333,17 @@ <key id="key_fullZoomReduce" key="&fullZoomReduceCmd.commandkey;" command="cmd_fullZoomReduce" modifiers="accel"/> <key key="&fullZoomReduceCmd.commandkey2;" command="cmd_fullZoomReduce" modifiers="accel"/> <key id="key_fullZoomEnlarge" key="&fullZoomEnlargeCmd.commandkey;" command="cmd_fullZoomEnlarge" modifiers="accel"/> <key key="&fullZoomEnlargeCmd.commandkey2;" command="cmd_fullZoomEnlarge" modifiers="accel"/> <key key="&fullZoomEnlargeCmd.commandkey3;" command="cmd_fullZoomEnlarge" modifiers="accel"/> <key id="key_fullZoomReset" key="&fullZoomResetCmd.commandkey;" command="cmd_fullZoomReset" modifiers="accel"/> <key key="&fullZoomResetCmd.commandkey2;" command="cmd_fullZoomReset" modifiers="accel"/> - <key id="key_showAllTabs" command="Browser:ShowAllTabs" keycode="VK_TAB" modifiers="control,shift"/> + <key id="key_showAllTabs" command="Browser:ShowAllTabs" keycode="VK_TAB" modifiers="control,shift" disabled="true"/> <key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" /> <key id="key_privatebrowsing" command="Tools:PrivateBrowsing" key="&privateBrowsingCmd.commandkey;" modifiers="accel,shift" reserved="true"/> <key id="key_sanitize" command="Tools:Sanitize" keycode="VK_DELETE" modifiers="accel,shift"/> #ifdef XP_MACOSX <key id="key_sanitize_mac" command="Tools:Sanitize" keycode="VK_BACK" modifiers="accel,shift"/>
--- a/devtools/server/tests/unit/.eslintrc.js +++ b/devtools/server/tests/unit/.eslintrc.js @@ -1,6 +1,9 @@ "use strict"; module.exports = { // Extend from the common devtools xpcshell eslintrc config. - "extends": "../../../.eslintrc.xpcshell.js" + "extends": "../../../.eslintrc.xpcshell.js", + "rules": { + "no-debugger": 0, + } };
--- a/devtools/server/tests/unit/head_dbg.js +++ b/devtools/server/tests/unit/head_dbg.js @@ -1,10 +1,12 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint no-unused-vars: ["error", {"vars": "local"}] */ +/* eslint-disable no-shadow */ "use strict"; var Cc = Components.classes; var Ci = Components.interfaces; var Cu = Components.utils; var Cr = Components.results; var CC = Components.Constructor; @@ -37,21 +39,21 @@ Services.prefs.setBoolPref("devtools.deb const DevToolsUtils = require("devtools/shared/DevToolsUtils"); const { DebuggerServer } = require("devtools/server/main"); const { DebuggerServer: WorkerDebuggerServer } = worker.require("devtools/server/main"); const { DebuggerClient, ObjectClient } = require("devtools/shared/client/main"); const { MemoryFront } = require("devtools/shared/fronts/memory"); const { addDebuggerToGlobal } = Cu.import("resource://gre/modules/jsdebugger.jsm", {}); -const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal); +const systemPrincipal = Cc["@mozilla.org/systemprincipal;1"] + .createInstance(Ci.nsIPrincipal); -var loadSubScript = Cc[ - "@mozilla.org/moz/jssubscript-loader;1" -].getService(Ci.mozIJSSubScriptLoader).loadSubScript; +var { loadSubScript } = Cc["@mozilla.org/moz/jssubscript-loader;1"] + .getService(Ci.mozIJSSubScriptLoader); /** * Initializes any test that needs to work with add-ons. */ function startupAddonsManager() { // Create a directory for extensions. const profileDir = do_get_profile().clone(); profileDir.append("extensions"); @@ -145,19 +147,18 @@ function makeFullRuntimeMemoryActorTest( finishClient(client); }); }); }); }; } function createTestGlobal(name) { - let sandbox = Cu.Sandbox( - Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal) - ); + let sandbox = Cu.Sandbox(Cc["@mozilla.org/systemprincipal;1"] + .createInstance(Ci.nsIPrincipal)); sandbox.__name = name; return sandbox; } function connect(client) { dump("Connecting client.\n"); return client.connect(); } @@ -231,60 +232,64 @@ function setBreakpoint(sourceClient, loc function dumpn(msg) { dump("DBG-TEST: " + msg + "\n"); } function testExceptionHook(ex) { try { do_report_unexpected_exception(ex); - } catch (ex) { - return {throw: ex}; + } catch (e) { + return {throw: e}; } return undefined; } -// Convert an nsIScriptError 'aFlags' value into an appropriate string. -function scriptErrorFlagsToKind(aFlags) { - var kind; - if (aFlags & Ci.nsIScriptError.warningFlag) +// Convert an nsIScriptError 'flags' value into an appropriate string. +function scriptErrorFlagsToKind(flags) { + let kind; + if (flags & Ci.nsIScriptError.warningFlag) { kind = "warning"; - if (aFlags & Ci.nsIScriptError.exceptionFlag) + } + if (flags & Ci.nsIScriptError.exceptionFlag) { kind = "exception"; - else + } else { kind = "error"; + } - if (aFlags & Ci.nsIScriptError.strictFlag) + if (flags & Ci.nsIScriptError.strictFlag) { kind = "strict " + kind; + } return kind; } // Register a console listener, so console messages don't just disappear // into the ether. var errorCount = 0; var listener = { - observe: function (aMessage) { + observe: function (message) { try { + let string; errorCount++; try { // If we've been given an nsIScriptError, then we can print out // something nicely formatted, for tools like Emacs to pick up. - var scriptError = aMessage.QueryInterface(Ci.nsIScriptError); - dumpn(aMessage.sourceName + ":" + aMessage.lineNumber + ": " + - scriptErrorFlagsToKind(aMessage.flags) + ": " + - aMessage.errorMessage); - var string = aMessage.errorMessage; - } catch (x) { + message.QueryInterface(Ci.nsIScriptError); + dumpn(message.sourceName + ":" + message.lineNumber + ": " + + scriptErrorFlagsToKind(message.flags) + ": " + + message.errorMessage); + string = message.errorMessage; + } catch (e1) { // Be a little paranoid with message, as the whole goal here is to lose // no information. try { - var string = "" + aMessage.message; - } catch (x) { - var string = "<error converting error message to string>"; + string = "" + message.message; + } catch (e2) { + string = "<error converting error message to string>"; } } // Make sure we exit all nested event loops so that the test can finish. while (DebuggerServer && DebuggerServer.xpcInspector && DebuggerServer.xpcInspector.eventLoopNestLevel > 0) { DebuggerServer.xpcInspector.exitNestedEventLoop(); @@ -305,133 +310,128 @@ var listener = { // to log above, but apparently that didn't cut it. } } }; var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService); consoleService.registerListener(listener); -function check_except(func) -{ +function check_except(func) { try { func(); } catch (e) { do_check_true(true); return; } dumpn("Should have thrown an exception: " + func.toString()); do_check_true(false); } -function testGlobal(aName) { - let systemPrincipal = Cc["@mozilla.org/systemprincipal;1"] - .createInstance(Ci.nsIPrincipal); - - let sandbox = Cu.Sandbox(systemPrincipal); - sandbox.__name = aName; +function testGlobal(name) { + let sandbox = Cu.Sandbox(Cc["@mozilla.org/systemprincipal;1"] + .createInstance(Ci.nsIPrincipal)); + sandbox.__name = name; return sandbox; } -function addTestGlobal(aName, aServer = DebuggerServer) -{ - let global = testGlobal(aName); - aServer.addTestGlobal(global); +function addTestGlobal(name, server = DebuggerServer) { + let global = testGlobal(name); + server.addTestGlobal(global); return global; } -// List the DebuggerClient |aClient|'s tabs, look for one whose title is -// |aTitle|, and apply |aCallback| to the packet's entry for that tab. -function getTestTab(aClient, aTitle, aCallback) { - aClient.listTabs(function (aResponse) { - for (let tab of aResponse.tabs) { - if (tab.title === aTitle) { - aCallback(tab, aResponse); +// List the DebuggerClient |client|'s tabs, look for one whose title is +// |title|, and apply |callback| to the packet's entry for that tab. +function getTestTab(client, title, callback) { + client.listTabs(function (response) { + for (let tab of response.tabs) { + if (tab.title === title) { + callback(tab, response); return; } } - aCallback(null); + callback(null); }); } -// Attach to |aClient|'s tab whose title is |aTitle|; pass |aCallback| the +// Attach to |client|'s tab whose title is |title|; pass |callback| the // response packet and a TabClient instance referring to that tab. -function attachTestTab(aClient, aTitle, aCallback) { - getTestTab(aClient, aTitle, function (aTab) { - aClient.attachTab(aTab.actor, aCallback); +function attachTestTab(client, title, callback) { + getTestTab(client, title, function (tab) { + client.attachTab(tab.actor, callback); }); } -// Attach to |aClient|'s tab whose title is |aTitle|, and then attach to -// that tab's thread. Pass |aCallback| the thread attach response packet, a +// Attach to |client|'s tab whose title is |title|, and then attach to +// that tab's thread. Pass |callback| the thread attach response packet, a // TabClient referring to the tab, and a ThreadClient referring to the // thread. -function attachTestThread(aClient, aTitle, aCallback) { - attachTestTab(aClient, aTitle, function (aTabResponse, aTabClient) { - function onAttach(aResponse, aThreadClient) { - aCallback(aResponse, aTabClient, aThreadClient, aTabResponse); +function attachTestThread(client, title, callback) { + attachTestTab(client, title, function (tabResponse, tabClient) { + function onAttach(response, threadClient) { + callback(response, tabClient, threadClient, tabResponse); } - aTabClient.attachThread({ + tabClient.attachThread({ useSourceMaps: true, autoBlackBox: true }, onAttach); }); } -// Attach to |aClient|'s tab whose title is |aTitle|, attach to the tab's -// thread, and then resume it. Pass |aCallback| the thread's response to +// Attach to |client|'s tab whose title is |title|, attach to the tab's +// thread, and then resume it. Pass |callback| the thread's response to // the 'resume' packet, a TabClient for the tab, and a ThreadClient for the // thread. -function attachTestTabAndResume(aClient, aTitle, aCallback = () => {}) { - return new Promise((resolve, reject) => { - attachTestThread(aClient, aTitle, function (aResponse, aTabClient, aThreadClient) { - aThreadClient.resume(function (aResponse) { - aCallback(aResponse, aTabClient, aThreadClient); - resolve([aResponse, aTabClient, aThreadClient]); +function attachTestTabAndResume(client, title, callback = () => {}) { + return new Promise((resolve) => { + attachTestThread(client, title, function (response, tabClient, threadClient) { + threadClient.resume(function (response) { + callback(response, tabClient, threadClient); + resolve([response, tabClient, threadClient]); }); }); }); } /** * Initialize the testing debugger server. */ -function initTestDebuggerServer(aServer = DebuggerServer) -{ - aServer.registerModule("xpcshell-test/testactors"); +function initTestDebuggerServer(server = DebuggerServer) { + server.registerModule("xpcshell-test/testactors"); // Allow incoming connections. - aServer.init(function () { return true; }); + server.init(function () { + return true; + }); } /** * Initialize the testing debugger server with a tab whose title is |title|. */ function startTestDebuggerServer(title, server = DebuggerServer) { initTestDebuggerServer(server); addTestGlobal(title); DebuggerServer.addTabActors(); let transport = DebuggerServer.connectPipe(); let client = new DebuggerClient(transport); return connect(client).then(() => client); } -function finishClient(aClient) -{ - aClient.close(function () { +function finishClient(client) { + client.close(function () { DebuggerServer.destroy(); do_test_finished(); }); } // Create a server, connect to it and fetch tab actors for the parent process; -// pass |aCallback| the debugger client and tab actor form with all actor IDs. -function get_chrome_actors(callback) -{ +// pass |callback| the debugger client and tab actor form with all actor IDs. +function get_chrome_actors(callback) { if (!DebuggerServer.initialized) { DebuggerServer.init(); DebuggerServer.addBrowserActors(); } DebuggerServer.allowChromeProcess = true; let client = new DebuggerClient(DebuggerServer.connectPipe()); client.connect() @@ -444,69 +444,68 @@ function get_chrome_actors(callback) function getChromeActors(client, server = DebuggerServer) { server.allowChromeProcess = true; return client.getProcess().then(response => response.form); } /** * Takes a relative file path and returns the absolute file url for it. */ -function getFileUrl(aName, aAllowMissing = false) { - let file = do_get_file(aName, aAllowMissing); +function getFileUrl(name, allowMissing = false) { + let file = do_get_file(name, allowMissing); return Services.io.newFileURI(file).spec; } /** * Returns the full path of the file with the specified name in a * platform-independent and URL-like form. */ -function getFilePath(aName, aAllowMissing = false, aUsePlatformPathSeparator = false) -{ - let file = do_get_file(aName, aAllowMissing); +function getFilePath(name, allowMissing = false, usePlatformPathSeparator = false) { + let file = do_get_file(name, allowMissing); let path = Services.io.newFileURI(file).spec; let filePrePath = "file://"; if ("nsILocalFileWin" in Ci && file instanceof Ci.nsILocalFileWin) { filePrePath += "/"; } path = path.slice(filePrePath.length); - if (aUsePlatformPathSeparator && path.match(/^\w:/)) { + if (usePlatformPathSeparator && path.match(/^\w:/)) { path = path.replace(/\//g, "\\"); } return path; } /** * Returns the full text contents of the given file. */ -function readFile(aFileName) { - let f = do_get_file(aFileName); +function readFile(fileName) { + let f = do_get_file(fileName); let s = Cc["@mozilla.org/network/file-input-stream;1"] .createInstance(Ci.nsIFileInputStream); s.init(f, -1, -1, false); try { return NetUtil.readInputStreamToString(s, s.available()); } finally { s.close(); } } -function writeFile(aFileName, aContent) { - let file = do_get_file(aFileName, true); +function writeFile(fileName, content) { + let file = do_get_file(fileName, true); let stream = Cc["@mozilla.org/network/file-output-stream;1"] .createInstance(Ci.nsIFileOutputStream); stream.init(file, -1, -1, 0); try { do { - let numWritten = stream.write(aContent, aContent.length); - aContent = aContent.slice(numWritten); - } while (aContent.length > 0); + let numWritten = stream.write(content, content.length); + content = content.slice(numWritten); + } while (content.length > 0); } finally { stream.close(); } } function connectPipeTracing() { return new TracingTransport(DebuggerServer.connectPipe()); } @@ -580,19 +579,19 @@ TracingTransport.prototype = { } }; function StubTransport() { } StubTransport.prototype.ready = function () {}; StubTransport.prototype.send = function () {}; StubTransport.prototype.close = function () {}; -function executeSoon(aFunc) { +function executeSoon(func) { Services.tm.mainThread.dispatch({ - run: DevToolsUtils.makeInfallible(aFunc) + run: DevToolsUtils.makeInfallible(func) }, Ci.nsIThread.DISPATCH_NORMAL); } // The do_check_* family of functions expect their last argument to be an // optional stack object. Unfortunately, most tests actually pass a in a string // containing an error message instead, which causes error reporting to break if // strict warnings as errors is turned on. To avoid this, we wrap these // functions here below to ensure the correct number of arguments is passed. @@ -805,18 +804,17 @@ function getSourceContent(sourceClient) function getSource(threadClient, url) { let deferred = promise.defer(); threadClient.getSources((res) => { let source = res.sources.filter(function (s) { return s.url === url; }); if (source.length) { deferred.resolve(threadClient.source(source[0])); - } - else { + } else { deferred.reject(new Error("source not found")); } }); return deferred.promise; } /** * Do a fake reload which clears the thread debugger
--- a/devtools/server/tests/unit/hello-actor.js +++ b/devtools/server/tests/unit/hello-actor.js @@ -1,18 +1,19 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint no-unused-vars: ["error", {"vars": "local"}] */ + +"use strict"; const protocol = require("devtools/shared/protocol"); const helloSpec = protocol.generateActorSpec({ typeName: "helloActor", methods: { hello: {} } }); var HelloActor = protocol.ActorClassWithSpec(helloSpec, { - hello: function () { - return; - } + hello: function () {} });
--- a/devtools/server/tests/unit/post_init_global_actors.js +++ b/devtools/server/tests/unit/post_init_global_actors.js @@ -1,16 +1,18 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -function PostInitGlobalActor(aConnection) {} +"use strict"; + +function PostInitGlobalActor(connection) {} PostInitGlobalActor.prototype = { actorPrefix: "postInitGlobal", - onPing: function onPing(aRequest) { + onPing(request) { return { message: "pong" }; }, }; PostInitGlobalActor.prototype.requestTypes = { "ping": PostInitGlobalActor.prototype.onPing, };
--- a/devtools/server/tests/unit/post_init_tab_actors.js +++ b/devtools/server/tests/unit/post_init_tab_actors.js @@ -1,16 +1,18 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -function PostInitTabActor(aConnection) {} +"use strict"; + +function PostInitTabActor(connection) {} PostInitTabActor.prototype = { actorPostfix: "postInitTab", - onPing: function onPing(aRequest) { + onPing(request) { return { message: "pong" }; }, }; PostInitTabActor.prototype.requestTypes = { "ping": PostInitTabActor.prototype.onPing, };
--- a/devtools/server/tests/unit/pre_init_global_actors.js +++ b/devtools/server/tests/unit/pre_init_global_actors.js @@ -1,16 +1,18 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -function PreInitGlobalActor(aConnection) {} +"use strict"; + +function PreInitGlobalActor(connection) {} PreInitGlobalActor.prototype = { actorPrefix: "preInitGlobal", - onPing: function onPing(aRequest) { + onPing(request) { return { message: "pong" }; }, }; PreInitGlobalActor.prototype.requestTypes = { "ping": PreInitGlobalActor.prototype.onPing, };
--- a/devtools/server/tests/unit/pre_init_tab_actors.js +++ b/devtools/server/tests/unit/pre_init_tab_actors.js @@ -1,16 +1,18 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -function PreInitTabActor(aConnection) {} +"use strict"; + +function PreInitTabActor(connection) {} PreInitTabActor.prototype = { actorPrefix: "preInitTab", - onPing: function onPing(aRequest) { + onPing(request) { return { message: "pong" }; }, }; PreInitTabActor.prototype.requestTypes = { "ping": PreInitTabActor.prototype.onPing, };
--- a/devtools/server/tests/unit/registertestactors-01.js +++ b/devtools/server/tests/unit/registertestactors-01.js @@ -1,11 +1,13 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + function Actor() {} exports.register = function (handle) { handle.addTabActor(Actor, "registeredActor1"); handle.addGlobalActor(Actor, "registeredActor1"); }; exports.unregister = function (handle) {
--- a/devtools/server/tests/unit/registertestactors-02.js +++ b/devtools/server/tests/unit/registertestactors-02.js @@ -1,11 +1,13 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + function Actor() {} exports.register = function (handle) { handle.addGlobalActor(Actor, "registeredActor2"); handle.addTabActor(Actor, "registeredActor2"); }; exports.unregister = function (handle) {
--- a/devtools/server/tests/unit/registertestactors-03.js +++ b/devtools/server/tests/unit/registertestactors-03.js @@ -1,12 +1,14 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -var {method, RetVal, Actor, ActorClassWithSpec, Front, FrontClassWithSpec, +"use strict"; + +var {RetVal, Actor, ActorClassWithSpec, Front, FrontClassWithSpec, generateActorSpec} = require("devtools/shared/protocol"); var Services = require("Services"); const lazySpec = generateActorSpec({ typeName: "lazy", methods: { hello: {
--- a/devtools/server/tests/unit/test_actor-registry-actor.js +++ b/devtools/server/tests/unit/test_actor-registry-actor.js @@ -1,24 +1,25 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check that you can register new actors via the ActorRegistrationActor. */ var gClient; var gRegistryFront; var gActorFront; var gOldPref; const { ActorRegistryFront } = require("devtools/shared/fronts/actor-registry"); -function run_test() -{ +function run_test() { gOldPref = Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps"); Services.prefs.setBoolPref("devtools.debugger.forbid-certified-apps", false); initTestDebuggerServer(); DebuggerServer.addBrowserActors(); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(getRegistry); do_test_pending(); } @@ -34,17 +35,17 @@ function registerNewActor() { let options = { prefix: "helloActor", constructor: "HelloActor", type: { global: true } }; gRegistryFront .registerActor("resource://test/hello-actor.js", options) - .then(actorFront => gActorFront = actorFront) + .then(actorFront => (gActorFront = actorFront)) .then(talkToNewActor) .then(null, e => { DevToolsUtils.reportException("registerNewActor", e); do_check_true(false); }); } function talkToNewActor() {
--- a/devtools/server/tests/unit/test_add_actors.js +++ b/devtools/server/tests/unit/test_add_actors.js @@ -1,23 +1,24 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gClient; var gActors; /** * The purpose of these tests is to verify that it's possible to add actors * both before and after the DebuggerServer has been initialized, so addons * that add actors don't have to poll the object for its initialization state * in order to add actors after initialization but rather can add actors anytime * regardless of the object's state. */ -function run_test() -{ +function run_test() { DebuggerServer.addActors("resource://test/pre_init_global_actors.js"); DebuggerServer.addActors("resource://test/pre_init_tab_actors.js"); DebuggerServer.init(); DebuggerServer.addBrowserActors(); DebuggerServer.addActors("resource://test/post_init_global_actors.js"); DebuggerServer.addActors("resource://test/post_init_tab_actors.js"); @@ -27,81 +28,77 @@ function run_test() add_test(test_pre_init_tab_actor); add_test(test_post_init_global_actor); add_test(test_post_init_tab_actor); add_test(test_stable_global_actor_instances); add_test(close_client); run_next_test(); } -function init() -{ +function init() { gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect() .then(() => gClient.listTabs()) - .then(aResponse => { - gActors = aResponse; + .then(response => { + gActors = response; run_next_test(); }); } -function test_pre_init_global_actor() -{ +function test_pre_init_global_actor() { gClient.request({ to: gActors.preInitGlobalActor, type: "ping" }, - function onResponse(aResponse) { - do_check_eq(aResponse.message, "pong"); + function onResponse(response) { + do_check_eq(response.message, "pong"); run_next_test(); } ); } -function test_pre_init_tab_actor() -{ +function test_pre_init_tab_actor() { gClient.request({ to: gActors.preInitTabActor, type: "ping" }, - function onResponse(aResponse) { - do_check_eq(aResponse.message, "pong"); + function onResponse(response) { + do_check_eq(response.message, "pong"); run_next_test(); } ); } -function test_post_init_global_actor() -{ +function test_post_init_global_actor() { gClient.request({ to: gActors.postInitGlobalActor, type: "ping" }, - function onResponse(aResponse) { - do_check_eq(aResponse.message, "pong"); + function onResponse(response) { + do_check_eq(response.message, "pong"); run_next_test(); } ); } -function test_post_init_tab_actor() -{ +function test_post_init_tab_actor() { gClient.request({ to: gActors.postInitTabActor, type: "ping" }, - function onResponse(aResponse) { - do_check_eq(aResponse.message, "pong"); + function onResponse(response) { + do_check_eq(response.message, "pong"); run_next_test(); } ); } // Get the object object, from the server side, for a given actor ID function getActorInstance(connID, actorID) { return DebuggerServer._connections[connID].getActor(actorID); } -function test_stable_global_actor_instances() -{ +function test_stable_global_actor_instances() { // Consider that there is only one connection, // and the first one is ours let connID = Object.keys(DebuggerServer._connections)[0]; let postInitGlobalActor = getActorInstance(connID, gActors.postInitGlobalActor); let preInitGlobalActor = getActorInstance(connID, gActors.preInitGlobalActor); - gClient.listTabs(function onListTabs(aResponse) { - do_check_eq(postInitGlobalActor, getActorInstance(connID, aResponse.postInitGlobalActor)); - do_check_eq(preInitGlobalActor, getActorInstance(connID, aResponse.preInitGlobalActor)); + gClient.listTabs(function onListTabs(response) { + do_check_eq(postInitGlobalActor, + getActorInstance(connID, response.postInitGlobalActor)); + do_check_eq(preInitGlobalActor, + getActorInstance(connID, response.preInitGlobalActor)); run_next_test(); }); } function close_client() { gClient.close().then(() => run_next_test()); }
--- a/devtools/server/tests/unit/test_addon_reload.js +++ b/devtools/server/tests/unit/test_addon_reload.js @@ -1,12 +1,14 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ -const protocol = require("devtools/shared/protocol"); +"use strict"; + const {AddonManager} = require("resource://gre/modules/AddonManager.jsm"); startupAddonsManager(); function promiseAddonEvent(event) { return new Promise(resolve => { let listener = { [event]: function (...args) { @@ -75,17 +77,17 @@ add_task(function* testReloadExitedAddon yield Promise.all([ reloadAddon(client, addonActor), promiseWebExtensionStartup(), ]); // Uninstall the decoy add-on, which should cause its actor to exit. const onUninstalled = promiseAddonEvent("onUninstalled"); installedAddon2.uninstall(); - const [uninstalledAddon] = yield onUninstalled; + yield onUninstalled; // Try to re-list all add-ons after a reload. // This was throwing an exception because of the exited actor. const newAddonActor = yield findAddonInRootList(client, installedAddon.id); equal(newAddonActor.id, addonActor.id); // The actor id should be the same after the reload equal(newAddonActor.actor, addonActor.actor);
--- a/devtools/server/tests/unit/test_addons_actor.js +++ b/devtools/server/tests/unit/test_addons_actor.js @@ -1,13 +1,14 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ -const protocol = require("devtools/shared/protocol"); -const {AddonsActor} = require("devtools/server/actors/addons"); +"use strict"; + const {AddonsFront} = require("devtools/shared/fronts/addons"); startupAddonsManager(); function* connect() { const client = yield new Promise(resolve => { get_chrome_actors(client => resolve(client)); });
--- a/devtools/server/tests/unit/test_animation_name.js +++ b/devtools/server/tests/unit/test_animation_name.js @@ -1,87 +1,87 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ -"use strict"; - -// Test that AnimationPlayerActor.getName returns the right name depending on -// the type of an animation and the various properties available on it. - -const { AnimationPlayerActor } = require("devtools/server/actors/animation"); - -function run_test() { - // Mock a window with just the properties the AnimationPlayerActor uses. - let window = { - MutationObserver: function () { - this.observe = () => {}; - }, - Animation: function () { - this.effect = {target: getMockNode()}; - }, - CSSAnimation: function () { - this.effect = {target: getMockNode()}; - }, - CSSTransition: function () { - this.effect = {target: getMockNode()}; - } - }; - - window.CSSAnimation.prototype = Object.create(window.Animation.prototype); - window.CSSTransition.prototype = Object.create(window.Animation.prototype); - - // Helper to get a mock DOM node. - function getMockNode() { - return { - ownerDocument: { - defaultView: window - } - }; - } - - // Objects in this array should contain the following properties: - // - desc {String} For logging - // - animation {Object} An animation object instantiated from one of the mock - // window animation constructors. - // - props {Objet} Properties of this object will be added to the animation - // object. - // - expectedName {String} The expected name returned by - // AnimationPlayerActor.getName. - const TEST_DATA = [{ - desc: "Animation with an id", - animation: new window.Animation(), - props: { id: "animation-id" }, - expectedName: "animation-id" - }, { - desc: "Animation without an id", - animation: new window.Animation(), - props: {}, - expectedName: "" - }, { - desc: "CSSTransition with an id", - animation: new window.CSSTransition(), - props: { id: "transition-with-id", transitionProperty: "width" }, - expectedName: "transition-with-id" - }, { - desc: "CSSAnimation with an id", - animation: new window.CSSAnimation(), - props: { id: "animation-with-id", animationName: "move" }, - expectedName: "animation-with-id" - }, { - desc: "CSSTransition without an id", - animation: new window.CSSTransition(), - props: { transitionProperty: "width" }, - expectedName: "width" - }, { - desc: "CSSAnimation without an id", - animation: new window.CSSAnimation(), - props: { animationName: "move" }, - expectedName: "move" - }]; - - for (let { desc, animation, props, expectedName } of TEST_DATA) { - do_print(desc); - for (let key in props) { - animation[key] = props[key]; - } - let actor = AnimationPlayerActor({}, animation); - do_check_eq(actor.getName(), expectedName); - } -} +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +// Test that AnimationPlayerActor.getName returns the right name depending on +// the type of an animation and the various properties available on it. + +const { AnimationPlayerActor } = require("devtools/server/actors/animation"); + +function run_test() { + // Mock a window with just the properties the AnimationPlayerActor uses. + let window = { + MutationObserver: function () { + this.observe = () => {}; + }, + Animation: function () { + this.effect = {target: getMockNode()}; + }, + CSSAnimation: function () { + this.effect = {target: getMockNode()}; + }, + CSSTransition: function () { + this.effect = {target: getMockNode()}; + } + }; + + window.CSSAnimation.prototype = Object.create(window.Animation.prototype); + window.CSSTransition.prototype = Object.create(window.Animation.prototype); + + // Helper to get a mock DOM node. + function getMockNode() { + return { + ownerDocument: { + defaultView: window + } + }; + } + + // Objects in this array should contain the following properties: + // - desc {String} For logging + // - animation {Object} An animation object instantiated from one of the mock + // window animation constructors. + // - props {Objet} Properties of this object will be added to the animation + // object. + // - expectedName {String} The expected name returned by + // AnimationPlayerActor.getName. + const TEST_DATA = [{ + desc: "Animation with an id", + animation: new window.Animation(), + props: { id: "animation-id" }, + expectedName: "animation-id" + }, { + desc: "Animation without an id", + animation: new window.Animation(), + props: {}, + expectedName: "" + }, { + desc: "CSSTransition with an id", + animation: new window.CSSTransition(), + props: { id: "transition-with-id", transitionProperty: "width" }, + expectedName: "transition-with-id" + }, { + desc: "CSSAnimation with an id", + animation: new window.CSSAnimation(), + props: { id: "animation-with-id", animationName: "move" }, + expectedName: "animation-with-id" + }, { + desc: "CSSTransition without an id", + animation: new window.CSSTransition(), + props: { transitionProperty: "width" }, + expectedName: "width" + }, { + desc: "CSSAnimation without an id", + animation: new window.CSSAnimation(), + props: { animationName: "move" }, + expectedName: "move" + }]; + + for (let { desc, animation, props, expectedName } of TEST_DATA) { + do_print(desc); + for (let key in props) { + animation[key] = props[key]; + } + let actor = AnimationPlayerActor({}, animation); + do_check_eq(actor.getName(), expectedName); + } +}
--- a/devtools/server/tests/unit/test_animation_type.js +++ b/devtools/server/tests/unit/test_animation_type.js @@ -1,68 +1,68 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ -"use strict"; - -// Test the output of AnimationPlayerActor.getType(). - -const { ANIMATION_TYPES, AnimationPlayerActor } = - require("devtools/server/actors/animation"); - -function run_test() { - // Mock a window with just the properties the AnimationPlayerActor uses. - let window = { - MutationObserver: function () { - this.observe = () => {}; - }, - Animation: function () { - this.effect = {target: getMockNode()}; - }, - CSSAnimation: function () { - this.effect = {target: getMockNode()}; - }, - CSSTransition: function () { - this.effect = {target: getMockNode()}; - } - }; - - window.CSSAnimation.prototype = Object.create(window.Animation.prototype); - window.CSSTransition.prototype = Object.create(window.Animation.prototype); - - // Helper to get a mock DOM node. - function getMockNode() { - return { - ownerDocument: { - defaultView: window - } - }; - } - - // Objects in this array should contain the following properties: - // - desc {String} For logging - // - animation {Object} An animation object instantiated from one of the mock - // window animation constructors. - // - expectedType {String} The expected type returned by - // AnimationPlayerActor.getType. - const TEST_DATA = [{ - desc: "Test CSSAnimation type", - animation: new window.CSSAnimation(), - expectedType: ANIMATION_TYPES.CSS_ANIMATION - }, { - desc: "Test CSSTransition type", - animation: new window.CSSTransition(), - expectedType: ANIMATION_TYPES.CSS_TRANSITION - }, { - desc: "Test ScriptAnimation type", - animation: new window.Animation(), - expectedType: ANIMATION_TYPES.SCRIPT_ANIMATION - }, { - desc: "Test unknown type", - animation: {effect: {target: getMockNode()}}, - expectedType: ANIMATION_TYPES.UNKNOWN - }]; - - for (let { desc, animation, expectedType } of TEST_DATA) { - do_print(desc); - let actor = AnimationPlayerActor({}, animation); - do_check_eq(actor.getType(), expectedType); - } -} +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +// Test the output of AnimationPlayerActor.getType(). + +const { ANIMATION_TYPES, AnimationPlayerActor } = + require("devtools/server/actors/animation"); + +function run_test() { + // Mock a window with just the properties the AnimationPlayerActor uses. + let window = { + MutationObserver: function () { + this.observe = () => {}; + }, + Animation: function () { + this.effect = {target: getMockNode()}; + }, + CSSAnimation: function () { + this.effect = {target: getMockNode()}; + }, + CSSTransition: function () { + this.effect = {target: getMockNode()}; + } + }; + + window.CSSAnimation.prototype = Object.create(window.Animation.prototype); + window.CSSTransition.prototype = Object.create(window.Animation.prototype); + + // Helper to get a mock DOM node. + function getMockNode() { + return { + ownerDocument: { + defaultView: window + } + }; + } + + // Objects in this array should contain the following properties: + // - desc {String} For logging + // - animation {Object} An animation object instantiated from one of the mock + // window animation constructors. + // - expectedType {String} The expected type returned by + // AnimationPlayerActor.getType. + const TEST_DATA = [{ + desc: "Test CSSAnimation type", + animation: new window.CSSAnimation(), + expectedType: ANIMATION_TYPES.CSS_ANIMATION + }, { + desc: "Test CSSTransition type", + animation: new window.CSSTransition(), + expectedType: ANIMATION_TYPES.CSS_TRANSITION + }, { + desc: "Test ScriptAnimation type", + animation: new window.Animation(), + expectedType: ANIMATION_TYPES.SCRIPT_ANIMATION + }, { + desc: "Test unknown type", + animation: {effect: {target: getMockNode()}}, + expectedType: ANIMATION_TYPES.UNKNOWN + }]; + + for (let { desc, animation, expectedType } of TEST_DATA) { + do_print(desc); + let actor = AnimationPlayerActor({}, animation); + do_check_eq(actor.getType(), expectedType); + } +}
--- a/devtools/server/tests/unit/test_attach.js +++ b/devtools/server/tests/unit/test_attach.js @@ -1,37 +1,36 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gClient; var gDebuggee; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = testGlobal("test-1"); DebuggerServer.addTestGlobal(gDebuggee); let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect().then(function ([aType, aTraits]) { - attachTestTab(gClient, "test-1", function (aReply, aTabClient) { - test_attach(aTabClient); + gClient.connect().then(function ([type, traits]) { + attachTestTab(gClient, "test-1", function (reply, tabClient) { + test_attach(tabClient); }); }); do_test_pending(); } -function test_attach(aTabClient) -{ - aTabClient.attachThread({}, function (aResponse, aThreadClient) { - do_check_eq(aThreadClient.state, "paused"); - aThreadClient.resume(cleanup); +function test_attach(tabClient) { + tabClient.attachThread({}, function (response, threadClient) { + do_check_eq(threadClient.state, "paused"); + threadClient.resume(cleanup); }); } -function cleanup() -{ - gClient.addListener("closed", function (aEvent) { +function cleanup() { + gClient.addListener("closed", function (event) { do_test_finished(); }); gClient.close(); }
--- a/devtools/server/tests/unit/test_blackboxing-01.js +++ b/devtools/server/tests/unit/test_blackboxing-01.js @@ -1,29 +1,31 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Test basic black boxing. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - testBlackBox(); - }); + attachTestTabAndResume(gClient, "test-black-box", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + testBlackBox(); + }); }); do_test_pending(); } const BLACK_BOXED_URL = "http://example.com/blackboxme.js"; const SOURCE_URL = "http://example.com/source.js"; const testBlackBox = Task.async(function* () { @@ -38,64 +40,65 @@ const testBlackBox = Task.async(function const { sources } = yield getSources(gThreadClient); let sourceClient = gThreadClient.source( sources.filter(s => s.url == BLACK_BOXED_URL)[0]); do_check_true(!sourceClient.isBlackBoxed, "By default the source is not black boxed."); // Test that we can step into `doStuff` when we are not black boxed. yield runTest( - function onSteppedLocation(aLocation) { - do_check_eq(aLocation.source.url, BLACK_BOXED_URL); - do_check_eq(aLocation.line, 2); + function onSteppedLocation(location) { + do_check_eq(location.source.url, BLACK_BOXED_URL); + do_check_eq(location.line, 2); }, - function onDebuggerStatementFrames(aFrames) { - do_check_true(!aFrames.some(f => f.where.source.isBlackBoxed)); + function onDebuggerStatementFrames(frames) { + do_check_true(!frames.some(f => f.where.source.isBlackBoxed)); } ); - let blackBoxResponse = yield blackBox(sourceClient); + yield blackBox(sourceClient); do_check_true(sourceClient.isBlackBoxed); // Test that we step through `doStuff` when we are black boxed and its frame // doesn't show up. yield runTest( - function onSteppedLocation(aLocation) { - do_check_eq(aLocation.source.url, SOURCE_URL); - do_check_eq(aLocation.line, 4); + function onSteppedLocation(location) { + do_check_eq(location.source.url, SOURCE_URL); + do_check_eq(location.line, 4); }, - function onDebuggerStatementFrames(aFrames) { - for (let f of aFrames) { + function onDebuggerStatementFrames(frames) { + for (let f of frames) { if (f.where.source.url == BLACK_BOXED_URL) { do_check_true(f.where.source.isBlackBoxed); } else { do_check_true(!f.where.source.isBlackBoxed); } } } ); - let unBlackBoxResponse = yield unBlackBox(sourceClient); + yield unBlackBox(sourceClient); do_check_true(!sourceClient.isBlackBoxed); // Test that we can step into `doStuff` again. yield runTest( - function onSteppedLocation(aLocation) { - do_check_eq(aLocation.source.url, BLACK_BOXED_URL); - do_check_eq(aLocation.line, 2); + function onSteppedLocation(location) { + do_check_eq(location.source.url, BLACK_BOXED_URL); + do_check_eq(location.line, 2); }, - function onDebuggerStatementFrames(aFrames) { - do_check_true(!aFrames.some(f => f.where.source.isBlackBoxed)); + function onDebuggerStatementFrames(frames) { + do_check_true(!frames.some(f => f.where.source.isBlackBoxed)); } ); finishClient(gClient); }); function evalCode() { + /* eslint-disable */ Components.utils.evalInSandbox( "" + function doStuff(k) { // line 1 let arg = 15; // line 2 - Step in here k(arg); // line 3 }, // line 4 gDebuggee, "1.8", BLACK_BOXED_URL, @@ -111,16 +114,17 @@ function evalCode() { ); // line 6 } + "\n" // line 7 + "debugger;", // line 8 gDebuggee, "1.8", SOURCE_URL, 1 ); + /* eslint-enable */ } const runTest = Task.async(function* (onSteppedLocation, onDebuggerStatementFrames) { let packet = yield executeOnNextTickAndWaitForPause(gDebuggee.runTest, gClient); do_check_eq(packet.why.type, "breakpoint"); yield stepIn(gClient, gThreadClient);
--- a/devtools/server/tests/unit/test_blackboxing-02.js +++ b/devtools/server/tests/unit/test_blackboxing-02.js @@ -1,59 +1,62 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Test that we don't hit breakpoints in black boxed sources, and that when we * unblack box the source again, the breakpoint hasn't disappeared and we will * hit it again. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_black_box(); - }); + attachTestTabAndResume(gClient, "test-black-box", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_black_box(); + }); }); do_test_pending(); } const BLACK_BOXED_URL = "http://example.com/blackboxme.js"; const SOURCE_URL = "http://example.com/source.js"; -function test_black_box() -{ - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.eval(aPacket.frame.actor, "doStuff", function (aResponse) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let obj = gThreadClient.pauseGrip(aPacket.why.frameFinished.return); +function test_black_box() { + gClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.eval(packet.frame.actor, "doStuff", function (response) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let obj = gThreadClient.pauseGrip(packet.why.frameFinished.return); obj.getDefinitionSite(runWithSource); }); }); - function runWithSource(aPacket) { - let source = gThreadClient.source(aPacket.source); + function runWithSource(packet) { + let source = gThreadClient.source(packet.source); source.setBreakpoint({ line: 2 - }, function (aResponse) { - do_check_true(!aResponse.error, "Should be able to set breakpoint."); + }, function (response) { + do_check_true(!response.error, "Should be able to set breakpoint."); gThreadClient.resume(test_black_box_breakpoint); }); } }); + /* eslint-disable */ Components.utils.evalInSandbox( "" + function doStuff(k) { // line 1 let arg = 15; // line 2 - Break here k(arg); // line 3 }, // line 4 gDebuggee, "1.8", BLACK_BOXED_URL, @@ -69,43 +72,48 @@ function test_black_box() ); // line 7 } // line 8 + "\n debugger;", // line 9 gDebuggee, "1.8", SOURCE_URL, 1 ); + /* eslint-enable */ } function test_black_box_breakpoint() { gThreadClient.getSources(function ({error, sources}) { do_check_true(!error, "Should not get an error: " + error); - let sourceClient = gThreadClient.source(sources.filter(s => s.url == BLACK_BOXED_URL)[0]); + let sourceClient = gThreadClient.source( + sources.filter(s => s.url == BLACK_BOXED_URL)[0] + ); sourceClient.blackBox(function ({error}) { do_check_true(!error, "Should not get an error: " + error); - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "debuggerStatement", - "We should pass over the breakpoint since the source is black boxed."); + gClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq( + packet.why.type, "debuggerStatement", + "We should pass over the breakpoint since the source is black boxed."); gThreadClient.resume(test_unblack_box_breakpoint.bind(null, sourceClient)); }); gDebuggee.runTest(); }); }); } -function test_unblack_box_breakpoint(aSourceClient) { - aSourceClient.unblackBox(function ({error}) { +function test_unblack_box_breakpoint(sourceClient) { + sourceClient.unblackBox(function ({error}) { do_check_true(!error, "Should not get an error: " + error); - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "breakpoint", + gClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.why.type, "breakpoint", "We should hit the breakpoint again"); - // We will hit the debugger statement on resume, so do this nastiness to skip over it. + // We will hit the debugger statement on resume, so do this + // nastiness to skip over it. gClient.addOneTimeListener( "paused", gThreadClient.resume.bind( gThreadClient, finishClient.bind(null, gClient))); gThreadClient.resume(); }); gDebuggee.runTest();
--- a/devtools/server/tests/unit/test_blackboxing-03.js +++ b/devtools/server/tests/unit/test_blackboxing-03.js @@ -1,50 +1,53 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Test that we don't stop at debugger statements inside black boxed sources. */ var gDebuggee; var gClient; var gThreadClient; var gBpClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_black_box(); - }); + attachTestTabAndResume(gClient, "test-black-box", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_black_box(); + }); }); do_test_pending(); } const BLACK_BOXED_URL = "http://example.com/blackboxme.js"; const SOURCE_URL = "http://example.com/source.js"; -function test_black_box() -{ - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_black_box() { + gClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); source.setBreakpoint({ line: 4 }, function ({error}, bpClient) { gBpClient = bpClient; do_check_true(!error, "Should not get an error: " + error); gThreadClient.resume(test_black_box_dbg_statement); }); }); + /* eslint-disable */ Components.utils.evalInSandbox( "" + function doStuff(k) { // line 1 debugger; // line 2 - Break here k(100); // line 3 }, // line 4 gDebuggee, "1.8", BLACK_BOXED_URL, @@ -60,43 +63,46 @@ function test_black_box() ); // line 6 } // line 7 + "\n debugger;", // line 8 gDebuggee, "1.8", SOURCE_URL, 1 ); + /* eslint-enable */ } function test_black_box_dbg_statement() { gThreadClient.getSources(function ({error, sources}) { do_check_true(!error, "Should not get an error: " + error); - let sourceClient = gThreadClient.source(sources.filter(s => s.url == BLACK_BOXED_URL)[0]); + let sourceClient = gThreadClient.source( + sources.filter(s => s.url == BLACK_BOXED_URL)[0] + ); sourceClient.blackBox(function ({error}) { do_check_true(!error, "Should not get an error: " + error); - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "breakpoint", + gClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.why.type, "breakpoint", "We should pass over the debugger statement."); gBpClient.remove(function ({error}) { do_check_true(!error, "Should not get an error: " + error); gThreadClient.resume(test_unblack_box_dbg_statement.bind(null, sourceClient)); }); }); gDebuggee.runTest(); }); }); } -function test_unblack_box_dbg_statement(aSourceClient) { - aSourceClient.unblackBox(function ({error}) { +function test_unblack_box_dbg_statement(sourceClient) { + sourceClient.unblackBox(function ({error}) { do_check_true(!error, "Should not get an error: " + error); - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "debuggerStatement", + gClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.why.type, "debuggerStatement", "We should stop at the debugger statement again"); finishClient(gClient); }); gDebuggee.runTest(); }); }
--- a/devtools/server/tests/unit/test_blackboxing-04.js +++ b/devtools/server/tests/unit/test_blackboxing-04.js @@ -1,57 +1,60 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Test behavior of blackboxing sources we are currently paused in. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_black_box(); - }); + attachTestTabAndResume(gClient, "test-black-box", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_black_box(); + }); }); do_test_pending(); } const BLACK_BOXED_URL = "http://example.com/blackboxme.js"; const SOURCE_URL = "http://example.com/source.js"; -function test_black_box() -{ - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.eval(aPacket.frame.actor, "doStuff", function (aResponse) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let obj = gThreadClient.pauseGrip(aPacket.why.frameFinished.return); +function test_black_box() { + gClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.eval(packet.frame.actor, "doStuff", function (response) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let obj = gThreadClient.pauseGrip(packet.why.frameFinished.return); obj.getDefinitionSite(runWithSource); }); }); - function runWithSource(aPacket) { - let source = gThreadClient.source(aPacket.source); + function runWithSource(packet) { + let source = gThreadClient.source(packet.source); source.setBreakpoint({ line: 2 - }, function (aResponse) { - do_check_true(!aResponse.error, "Should be able to set breakpoint."); + }, function (response) { + do_check_true(!response.error, "Should be able to set breakpoint."); test_black_box_paused(); }); } }); + /* eslint-disable */ Components.utils.evalInSandbox( "" + function doStuff(k) { // line 1 debugger; // line 2 k(100); // line 3 }, // line 4 gDebuggee, "1.8", BLACK_BOXED_URL, @@ -67,22 +70,26 @@ function test_black_box() ); // line 6 } // line 7 + "\n runTest();", // line 8 gDebuggee, "1.8", SOURCE_URL, 1 ); + /* eslint-enable */ } function test_black_box_paused() { gThreadClient.getSources(function ({error, sources}) { do_check_true(!error, "Should not get an error: " + error); - let sourceClient = gThreadClient.source(sources.filter(s => s.url == BLACK_BOXED_URL)[0]); + let sourceClient = gThreadClient.source( + sources.filter(s => s.url == BLACK_BOXED_URL)[0] + ); sourceClient.blackBox(function ({error, pausedInSource}) { do_check_true(!error, "Should not get an error: " + error); - do_check_true(pausedInSource, "We should be notified that we are currently paused in this source"); + do_check_true(pausedInSource, + "We should be notified that we are currently paused in this source"); finishClient(gClient); }); }); }
--- a/devtools/server/tests/unit/test_blackboxing-05.js +++ b/devtools/server/tests/unit/test_blackboxing-05.js @@ -1,45 +1,49 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Test exceptions inside black boxed sources. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - // XXX: We have to do an executeSoon so that the error isn't caught and - // reported by DebuggerClient.requester (because we are using the local - // transport and share a stack) which causes the test to fail. - Services.tm.mainThread.dispatch({ - run: test_black_box - }, Ci.nsIThread.DISPATCH_NORMAL); - }); + attachTestTabAndResume( + gClient, "test-black-box", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + // XXX: We have to do an executeSoon so that the error isn't caught and + // reported by DebuggerClient.requester (because we are using the local + // transport and share a stack) which causes the test to fail. + Services.tm.mainThread.dispatch({ + run: test_black_box + }, Ci.nsIThread.DISPATCH_NORMAL); + }); }); do_test_pending(); } const BLACK_BOXED_URL = "http://example.com/blackboxme.js"; const SOURCE_URL = "http://example.com/source.js"; -function test_black_box() -{ +function test_black_box() { gClient.addOneTimeListener("paused", test_black_box_exception); + /* eslint-disable */ Components.utils.evalInSandbox( "" + function doStuff(k) { // line 1 throw new Error("wu tang clan ain't nuthin' ta fuck wit"); // line 2 k(100); // line 3 }, // line 4 gDebuggee, "1.8", BLACK_BOXED_URL, @@ -56,29 +60,32 @@ function test_black_box() } // line 7 + "\ndebugger;\n" // line 8 + "try { runTest() } catch (ex) { }", // line 9 gDebuggee, "1.8", SOURCE_URL, 1 ); + /* eslint-enable */ } function test_black_box_exception() { gThreadClient.getSources(function ({error, sources}) { do_check_true(!error, "Should not get an error: " + error); - let sourceClient = gThreadClient.source(sources.filter(s => s.url == BLACK_BOXED_URL)[0]); + let sourceClient = gThreadClient.source( + sources.filter(s => s.url == BLACK_BOXED_URL)[0] + ); sourceClient.blackBox(function ({error}) { do_check_true(!error, "Should not get an error: " + error); gThreadClient.pauseOnExceptions(true); - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.frame.where.source.url, SOURCE_URL, + gClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.frame.where.source.url, SOURCE_URL, "We shouldn't pause while in the black boxed source."); finishClient(gClient); }); gThreadClient.resume(); }); }); }
--- a/devtools/server/tests/unit/test_blackboxing-06.js +++ b/devtools/server/tests/unit/test_blackboxing-06.js @@ -1,46 +1,51 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Test that we can black box source mapped sources. */ var gDebuggee; var gClient; var gThreadClient; const {SourceNode} = require("source-map"); -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + attachTestTabAndResume( + gClient, "test-black-box", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; - promise.resolve(setup_code()) - .then(black_box_code) - .then(run_code) - .then(test_correct_location) - .then(null, function (error) { - do_check_true(false, "Should not get an error, got " + error); - }) - .then(function () { - finishClient(gClient); - }); - }); + promise.resolve(setup_code()) + .then(black_box_code) + .then(run_code) + .then(test_correct_location) + .then(null, function (error) { + do_check_true(false, "Should not get an error, got " + error); + }) + .then(function () { + finishClient(gClient); + }); + }); }); do_test_pending(); } function setup_code() { + /* eslint-disable */ let { code, map } = (new SourceNode(null, null, null, [ new SourceNode(1, 0, "a.js", "" + function a() { return b(); }), "\n", new SourceNode(1, 0, "b.js", "" + function b() { debugger; // Don't want to stop here. return c(); @@ -49,16 +54,17 @@ function setup_code() { new SourceNode(1, 0, "c.js", "" + function c() { debugger; // Want to stop here. }), "\n" ])).toStringWithSourceMap({ file: "abc.js", sourceRoot: "http://example.com/" }); + /* eslint-enable */ code += "//# sourceMappingURL=data:text/json," + map.toString(); Components.utils.evalInSandbox(code, gDebuggee, "1.8", "http://example.com/abc.js"); } @@ -80,23 +86,24 @@ function black_box_code() { }); return d.promise; } function run_code() { const d = promise.defer(); - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - d.resolve(aPacket); + gClient.addOneTimeListener("paused", function (event, packet) { + d.resolve(packet); gThreadClient.resume(); }); gDebuggee.a(); return d.promise; } -function test_correct_location(aPacket) { - do_check_eq(aPacket.why.type, "debuggerStatement", +function test_correct_location(packet) { + do_check_eq(packet.why.type, "debuggerStatement", "Should hit a debugger statement."); - do_check_eq(aPacket.frame.where.source.url, "http://example.com/c.js", - "Should have skipped over the debugger statement in the black boxed source"); + do_check_eq(packet.frame.where.source.url, "http://example.com/c.js", + "Should have skipped over the debugger statement in the" + + " black boxed source"); }
--- a/devtools/server/tests/unit/test_blackboxing-07.js +++ b/devtools/server/tests/unit/test_blackboxing-07.js @@ -1,30 +1,32 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Test that sources whose URL ends with ".min.js" automatically get black * boxed. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-black-box", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - testBlackBox(); - }); + attachTestTabAndResume(gClient, "test-black-box", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + testBlackBox(); + }); }); do_test_pending(); } const BLACK_BOXED_URL = "http://example.com/black-boxed.min.js"; const SOURCE_URL = "http://example.com/source.js"; const testBlackBox = Task.async(function* () {
--- a/devtools/server/tests/unit/test_breakpoint-01.js +++ b/devtools/server/tests/unit/test_breakpoint-01.js @@ -1,75 +1,77 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check basic breakpoint functionality. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_breakpoint(); + }); }); } -function test_simple_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_simple_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 3 }; - source.setBreakpoint(location, function (aResponse, bpClient) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + source.setBreakpoint(location, function (response, bpClient) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); - }); // Continue until the breakpoint is hit. gThreadClient.resume(); }); }); + /* eslint-disable */ Cu.evalInSandbox( "var line0 = Error().lineNumber;\n" + "debugger;\n" + // line0 + 1 "var a = 1;\n" + // line0 + 2 "var b = 2;\n", // line0 + 3 gDebuggee ); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-02.js +++ b/devtools/server/tests/unit/test_breakpoint-02.js @@ -1,67 +1,70 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Check that setting breakpoints when the debuggee is running works. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_breakpoint_running(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_breakpoint_running(); + }); }); } -function test_breakpoint_running() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { +function test_breakpoint_running() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { let location = { line: gDebuggee.line0 + 3 }; gThreadClient.resume(); // Setting the breakpoint later should interrupt the debuggee. - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "interrupted"); + gThreadClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "interrupted"); }); - let source = gThreadClient.source(aPacket.frame.where.source); - source.setBreakpoint(location, function (aResponse) { + let source = gThreadClient.source(packet.frame.where.source); + source.setBreakpoint(location, function (response) { // Eval scripts don't stick around long enough for the breakpoint to be set, // so just make sure we got the expected response from the actor. - do_check_neq(aResponse.error, "noScript"); + do_check_neq(response.error, "noScript"); do_execute_soon(function () { gClient.close().then(gCallback); }); }); }); + /* eslint-disable */ Cu.evalInSandbox( "var line0 = Error().lineNumber;\n" + "debugger;\n" + "var a = 1;\n" + // line0 + 2 "var b = 2;\n", // line0 + 3 gDebuggee ); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-03.js +++ b/devtools/server/tests/unit/test_breakpoint-03.js @@ -1,96 +1,99 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that setting a breakpoint on a line without code will skip * forward when we know the script isn't GCed (the debugger is connected, * so it's kept alive). */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", - function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + function (response, tabClient, threadClient) { + gThreadClient = threadClient; test_skip_breakpoint(); }); }); } -var test_no_skip_breakpoint = Task.async(function*(source, location) { - let [aResponse, bpClient] = yield source.setBreakpoint( +var test_no_skip_breakpoint = Task.async(function* (source, location) { + let [response, bpClient] = yield source.setBreakpoint( Object.assign({}, location, { noSliding: true }) ); - do_check_true(!aResponse.actualLocation); + do_check_true(!response.actualLocation); do_check_eq(bpClient.location.line, gDebuggee.line0 + 3); yield bpClient.remove(); }); -var test_skip_breakpoint = function() { - gThreadClient.addOneTimeListener("paused", Task.async(function *(aEvent, aPacket) { +var test_skip_breakpoint = function () { + gThreadClient.addOneTimeListener("paused", Task.async(function* (event, packet) { let location = { line: gDebuggee.line0 + 3 }; - let source = gThreadClient.source(aPacket.frame.where.source); + let source = gThreadClient.source(packet.frame.where.source); // First, make sure that we can disable sliding with the // `noSliding` option. yield test_no_skip_breakpoint(source, location); // Now make sure that the breakpoint properly slides forward one line. - const [aResponse, bpClient] = yield source.setBreakpoint(location); - do_check_true(!!aResponse.actualLocation); - do_check_eq(aResponse.actualLocation.source.actor, source.actor); - do_check_eq(aResponse.actualLocation.line, location.line + 1); + const [response, bpClient] = yield source.setBreakpoint(location); + do_check_true(!!response.actualLocation); + do_check_eq(response.actualLocation.source.actor, source.actor); + do_check_eq(response.actualLocation.line, location.line + 1); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line + 1); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line + 1); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); gThreadClient.resume(); })); // Use `evalInSandbox` to make the debugger treat it as normal // globally-scoped code, where breakpoint sliding rules apply. + /* eslint-disable */ Cu.evalInSandbox( "var line0 = Error().lineNumber;\n" + "debugger;\n" + // line0 + 1 "var a = 1;\n" + // line0 + 2 "// A comment.\n" + // line0 + 3 "var b = 2;", // line0 + 4 gDebuggee ); -} + /* eslint-enable */ +};
--- a/devtools/server/tests/unit/test_breakpoint-04.js +++ b/devtools/server/tests/unit/test_breakpoint-04.js @@ -1,80 +1,82 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that setting a breakpoint in a line in a child script works. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_child_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_child_breakpoint(); + }); }); } -function test_child_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_child_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 3 }; - source.setBreakpoint(location, function (aResponse, bpClient) { + source.setBreakpoint(location, function (response, bpClient) { // actualLocation is not returned when breakpoints don't skip forward. - do_check_eq(aResponse.actualLocation, undefined); + do_check_eq(response.actualLocation, undefined); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); // Continue until the breakpoint is hit. gThreadClient.resume(); }); - }); + /* eslint-disable */ Cu.evalInSandbox( "var line0 = Error().lineNumber;\n" + "function foo() {\n" + // line0 + 1 " this.a = 1;\n" + // line0 + 2 " this.b = 2;\n" + // line0 + 3 "}\n" + // line0 + 4 "debugger;\n" + // line0 + 5 "foo();\n", // line0 + 6 gDebuggee ); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-05.js +++ b/devtools/server/tests/unit/test_breakpoint-05.js @@ -1,82 +1,85 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that setting a breakpoint in a line without code in a child script * will skip forward. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_child_skip_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_child_skip_breakpoint(); + }); }); } -function test_child_skip_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_child_skip_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 3 }; - source.setBreakpoint(location, function (aResponse, bpClient) { + source.setBreakpoint(location, function (response, bpClient) { // Check that the breakpoint has properly skipped forward one line. - do_check_eq(aResponse.actualLocation.source.actor, source.actor); - do_check_eq(aResponse.actualLocation.line, location.line + 1); + do_check_eq(response.actualLocation.source.actor, source.actor); + do_check_eq(response.actualLocation.line, location.line + 1); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line + 1); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line + 1); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); // Continue until the breakpoint is hit. gThreadClient.resume(); }); }); + /* eslint-disable */ Cu.evalInSandbox( "var line0 = Error().lineNumber;\n" + "function foo() {\n" + // line0 + 1 " this.a = 1;\n" + // line0 + 2 " // A comment.\n" + // line0 + 3 " this.b = 2;\n" + // line0 + 4 "}\n" + // line0 + 5 "debugger;\n" + // line0 + 6 "foo();\n", // line0 + 7 gDebuggee ); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-06.js +++ b/devtools/server/tests/unit/test_breakpoint-06.js @@ -1,79 +1,80 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that setting a breakpoint in a line without code in a deeply-nested * child script will skip forward. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_nested_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_nested_breakpoint(); + }); }); } -function test_nested_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_nested_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 5 }; - source.setBreakpoint(location, function (aResponse, bpClient) { + source.setBreakpoint(location, function (response, bpClient) { // Check that the breakpoint has properly skipped forward one line. - do_check_eq(aResponse.actualLocation.source.actor, source.actor); - do_check_eq(aResponse.actualLocation.line, location.line + 1); + do_check_eq(response.actualLocation.source.actor, source.actor); + do_check_eq(response.actualLocation.line, location.line + 1); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line + 1); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line + 1); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); // Continue until the breakpoint is hit. gThreadClient.resume(); }); - }); + /* eslint-disable */ Cu.evalInSandbox( "var line0 = Error().lineNumber;\n" + "function foo() {\n" + // line0 + 1 " function bar() {\n" + // line0 + 2 " function baz() {\n" + // line0 + 3 " this.a = 1;\n" + // line0 + 4 " // A comment.\n" + // line0 + 5 " this.b = 2;\n" + // line0 + 6 @@ -81,9 +82,10 @@ function test_nested_breakpoint() " baz();\n" + // line0 + 8 " }\n" + // line0 + 9 " bar();\n" + // line0 + 10 "}\n" + // line0 + 11 "debugger;\n" + // line0 + 12 "foo();\n", // line0 + 13 gDebuggee ); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-07.js +++ b/devtools/server/tests/unit/test_breakpoint-07.js @@ -1,85 +1,88 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that setting a breakpoint in a line without code in the second child * script will skip forward. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_second_child_skip_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_second_child_skip_breakpoint(); + }); }); } -function test_second_child_skip_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_second_child_skip_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 6 }; - source.setBreakpoint(location, function (aResponse, bpClient) { + source.setBreakpoint(location, function (response, bpClient) { // Check that the breakpoint has properly skipped forward one line. - do_check_eq(aResponse.actualLocation.source.actor, source.actor); - do_check_eq(aResponse.actualLocation.line, location.line + 1); + do_check_eq(response.actualLocation.source.actor, source.actor); + do_check_eq(response.actualLocation.line, location.line + 1); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line + 1); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line + 1); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); // Continue until the breakpoint is hit. gThreadClient.resume(); }); }); + /* eslint-disable */ Cu.evalInSandbox( "var line0 = Error().lineNumber;\n" + "function foo() {\n" + // line0 + 1 " bar();\n" + // line0 + 2 "}\n" + // line0 + 3 "function bar() {\n" + // line0 + 4 " this.a = 1;\n" + // line0 + 5 " // A comment.\n" + // line0 + 6 " this.b = 2;\n" + // line0 + 7 "}\n" + // line0 + 8 "debugger;\n" + // line0 + 9 "foo();\n", // line0 + 10 gDebuggee ); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-08.js +++ b/devtools/server/tests/unit/test_breakpoint-08.js @@ -1,96 +1,99 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that setting a breakpoint in a line without code in a child script * will skip forward, in a file with two scripts. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_child_skip_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_child_skip_breakpoint(); + }); }); } -function test_child_skip_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.eval(aPacket.frame.actor, "foo", function (aResponse) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let obj = gThreadClient.pauseGrip(aPacket.why.frameFinished.return); +function test_child_skip_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.eval(packet.frame.actor, "foo", function (response) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let obj = gThreadClient.pauseGrip(packet.why.frameFinished.return); obj.getDefinitionSite(runWithBreakpoint); }); }); - function runWithBreakpoint(aPacket) { - let source = gThreadClient.source(aPacket.source); + function runWithBreakpoint(packet) { + let source = gThreadClient.source(packet.source); let location = { line: gDebuggee.line0 + 3 }; - source.setBreakpoint(location, function (aResponse, bpClient) { + source.setBreakpoint(location, function (response, bpClient) { // Check that the breakpoint has properly skipped forward one line. - do_check_eq(aResponse.actualLocation.source.actor, source.actor); - do_check_eq(aResponse.actualLocation.line, location.line + 1); + do_check_eq(response.actualLocation.source.actor, source.actor); + do_check_eq(response.actualLocation.line, location.line + 1); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line + 1); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line + 1); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); // Continue until the breakpoint is hit. gThreadClient.resume(); }); } }); + /* eslint-disable */ Cu.evalInSandbox("var line0 = Error().lineNumber;\n" + "function foo() {\n" + // line0 + 1 " this.a = 1;\n" + // line0 + 2 " // A comment.\n" + // line0 + 3 " this.b = 2;\n" + // line0 + 4 "}\n", // line0 + 5 gDebuggee, "1.7", "script1.js"); Cu.evalInSandbox("var line1 = Error().lineNumber;\n" + "debugger;\n" + // line1 + 1 "foo();\n", // line1 + 2 gDebuggee, "1.7", "script2.js"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-09.js +++ b/devtools/server/tests/unit/test_breakpoint-09.js @@ -1,88 +1,88 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that removing a breakpoint works. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_remove_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_remove_breakpoint(); + }); }); } -function test_remove_breakpoint() -{ +function test_remove_breakpoint() { let done = false; - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 2 }; - source.setBreakpoint(location, function (aResponse, bpClient) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + source.setBreakpoint(location, function (response, bpClient) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, undefined); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { done = true; gThreadClient.addOneTimeListener("paused", - function (aEvent, aPacket) { + function (event, packet) { // The breakpoint should not be hit again. gThreadClient.resume(function () { do_check_true(false); }); }); gThreadClient.resume(); }); - }); // Continue until the breakpoint is hit. gThreadClient.resume(); - }); - }); + /* eslint-disable */ Cu.evalInSandbox("var line0 = Error().lineNumber;\n" + "function foo(stop) {\n" + // line0 + 1 " this.a = 1;\n" + // line0 + 2 " if (stop) return;\n" + // line0 + 3 " delete this.a;\n" + // line0 + 4 " foo(true);\n" + // line0 + 5 "}\n" + // line0 + 6 "debugger;\n" + // line1 + 7 "foo();\n", // line1 + 8 gDebuggee); + /* eslint-enable */ if (!done) { do_check_true(false); } gClient.close().then(gCallback); }
--- a/devtools/server/tests/unit/test_breakpoint-10.js +++ b/devtools/server/tests/unit/test_breakpoint-10.js @@ -1,89 +1,88 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that setting a breakpoint in a line with multiple entry points * triggers no matter which entry point we reach. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_child_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_child_breakpoint(); + }); }); } -function test_child_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_child_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 3 }; - source.setBreakpoint(location, function (aResponse, bpClient) { + source.setBreakpoint(location, function (response, bpClient) { // actualLocation is not returned when breakpoints don't skip forward. - do_check_eq(aResponse.actualLocation, undefined); + do_check_eq(response.actualLocation, undefined); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.i, 0); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.i, 1); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); // Continue until the breakpoint is hit again. gThreadClient.resume(); - }); // Continue until the breakpoint is hit. gThreadClient.resume(); - }); - }); - + /* eslint-disable */ Cu.evalInSandbox("var line0 = Error().lineNumber;\n" + "debugger;\n" + // line0 + 1 "var a, i = 0;\n" + // line0 + 2 "for (i = 1; i <= 2; i++) {\n" + // line0 + 3 " a = i;\n" + // line0 + 4 "}\n", // line0 + 5 gDebuggee); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-11.js +++ b/devtools/server/tests/unit/test_breakpoint-11.js @@ -1,88 +1,87 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Make sure that setting a breakpoint in a line with bytecodes in multiple * scripts, sets the breakpoint in all of them (bug 793214). */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_child_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_child_breakpoint(); + }); }); } -function test_child_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_child_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 2 }; - source.setBreakpoint(location, function (aResponse, bpClient) { + source.setBreakpoint(location, function (response, bpClient) { // actualLocation is not returned when breakpoints don't skip forward. - do_check_eq(aResponse.actualLocation, undefined); + do_check_eq(response.actualLocation, undefined); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, undefined); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a.b, 1); do_check_eq(gDebuggee.res, undefined); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); // Continue until the breakpoint is hit again. gThreadClient.resume(); - }); // Continue until the breakpoint is hit. gThreadClient.resume(); - }); - }); - + /* eslint-disable */ Cu.evalInSandbox("var line0 = Error().lineNumber;\n" + "debugger;\n" + // line0 + 1 "var a = { b: 1, f: function() { return 2; } };\n" + // line0+2 "var res = a.f();\n", // line0 + 3 gDebuggee); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-12.js +++ b/devtools/server/tests/unit/test_breakpoint-12.js @@ -1,113 +1,113 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Make sure that setting a breakpoint twice in a line without bytecodes works * as expected. */ const NUM_BREAKPOINTS = 10; var gDebuggee; var gClient; var gThreadClient; var gBpActor; var gCount; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; +function run_test_with_server(server, callback) { + gCallback = callback; gCount = 1; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_child_skip_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_child_skip_breakpoint(); + }); }); } -function test_child_skip_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_child_skip_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 3}; - source.setBreakpoint(location, function (aResponse, bpClient) { + source.setBreakpoint(location, function (response, bpClient) { // Check that the breakpoint has properly skipped forward one line. - do_check_eq(aResponse.actualLocation.source.actor, source.actor); - do_check_eq(aResponse.actualLocation.line, location.line + 1); - gBpActor = aResponse.actor; + do_check_eq(response.actualLocation.source.actor, source.actor); + do_check_eq(response.actualLocation.line, location.line + 1); + gBpActor = response.actor; // Set more breakpoints at the same location. set_breakpoints(source, location); }); - }); + /* eslint-disable */ Cu.evalInSandbox("var line0 = Error().lineNumber;\n" + "function foo() {\n" + // line0 + 1 " this.a = 1;\n" + // line0 + 2 " // A comment.\n" + // line0 + 3 " this.b = 2;\n" + // line0 + 4 "}\n" + // line0 + 5 "debugger;\n" + // line0 + 6 "foo();\n", // line0 + 7 gDebuggee); + /* eslint-enable */ } // Set many breakpoints at the same location. function set_breakpoints(source, location) { do_check_neq(gCount, NUM_BREAKPOINTS); - source.setBreakpoint(location, function (aResponse, bpClient) { + source.setBreakpoint(location, function (response, bpClient) { // Check that the breakpoint has properly skipped forward one line. - do_check_eq(aResponse.actualLocation.source.actor, source.actor); - do_check_eq(aResponse.actualLocation.line, location.line + 1); + do_check_eq(response.actualLocation.source.actor, source.actor); + do_check_eq(response.actualLocation.line, location.line + 1); // Check that the same breakpoint actor was returned. - do_check_eq(aResponse.actor, gBpActor); + do_check_eq(response.actor, gBpActor); if (++gCount < NUM_BREAKPOINTS) { set_breakpoints(source, location); return; } // After setting all the breakpoints, check that only one has effectively // remained. - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line + 1); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line + 1); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); // Check that the breakpoint worked. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // We don't expect any more pauses after the breakpoint was hit once. do_check_true(false); }); gThreadClient.resume(function () { // Give any remaining breakpoints a chance to trigger. do_timeout(1000, function () { gClient.close().then(gCallback); }); }); - }); // Continue until the breakpoint is hit. gThreadClient.resume(); }); - }
--- a/devtools/server/tests/unit/test_breakpoint-13.js +++ b/devtools/server/tests/unit/test_breakpoint-13.js @@ -1,95 +1,96 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Check that execution doesn't pause twice while stepping, when encountering * either a breakpoint or a debugger statement. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_breakpoint(); + }); }); } -function test_simple_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_simple_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 2 }; - source.setBreakpoint(location, Task.async(function* (aResponse, bpClient) { + source.setBreakpoint(location, Task.async(function* (response, bpClient) { const testCallbacks = [ - function (aPacket) { + function (packet) { // Check that the stepping worked. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5); - do_check_eq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5); + do_check_eq(packet.why.type, "resumeLimit"); }, - function (aPacket) { + function (packet) { // Entered the foo function call frame. - do_check_eq(aPacket.frame.where.line, location.line); - do_check_neq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, location.line); + do_check_neq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.type, "resumeLimit"); }, - function (aPacket) { + function (packet) { // At the end of the foo function call frame. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3); - do_check_neq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3); + do_check_neq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.type, "resumeLimit"); }, - function (aPacket) { + function (packet) { // Check that the breakpoint wasn't the reason for this pause, but // that the frame is about to be popped while stepping. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3); - do_check_neq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.type, "resumeLimit"); - do_check_eq(aPacket.why.frameFinished.return.type, "undefined"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3); + do_check_neq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.type, "resumeLimit"); + do_check_eq(packet.why.frameFinished.return.type, "undefined"); }, - function (aPacket) { + function (packet) { // The foo function call frame was just popped from the stack. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5); - do_check_eq(aPacket.why.type, "resumeLimit"); - do_check_eq(aPacket.poppedFrames.length, 1); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5); + do_check_eq(packet.why.type, "resumeLimit"); + do_check_eq(packet.poppedFrames.length, 1); }, - function (aPacket) { + function (packet) { // Check that the debugger statement wasn't the reason for this pause. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 6); - do_check_neq(aPacket.why.type, "debuggerStatement"); - do_check_eq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 6); + do_check_neq(packet.why.type, "debuggerStatement"); + do_check_eq(packet.why.type, "resumeLimit"); }, - function (aPacket) { + function (packet) { // Check that the debugger statement wasn't the reason for this pause. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 7); - do_check_neq(aPacket.why.type, "debuggerStatement"); - do_check_eq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 7); + do_check_neq(packet.why.type, "debuggerStatement"); + do_check_eq(packet.why.type, "resumeLimit"); }, ]; for (let callback of testCallbacks) { let waiter = waitForPause(gThreadClient); gThreadClient.stepIn(); let packet = yield waiter; callback(packet); @@ -98,18 +99,20 @@ function test_simple_breakpoint() // Remove the breakpoint and finish. let waiter = waitForPause(gThreadClient); gThreadClient.stepIn(); yield waiter; bpClient.remove(() => gThreadClient.resume(() => gClient.close().then(gCallback))); })); }); + /* eslint-disable */ Cu.evalInSandbox("var line0 = Error().lineNumber;\n" + "function foo() {\n" + // line0 + 1 " this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here. "}\n" + // line0 + 3 "debugger;\n" + // line0 + 4 "foo();\n" + // line0 + 5 "debugger;\n" + // line0 + 6 "var b = 2;\n", // line0 + 7 gDebuggee); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-14.js +++ b/devtools/server/tests/unit/test_breakpoint-14.js @@ -1,93 +1,94 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Check that a breakpoint or a debugger statement cause execution to pause even * in a stepped-over function. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-stack", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-stack", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_breakpoint(); + }); }); } -function test_simple_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_simple_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 2 }; - source.setBreakpoint(location, Task.async(function* (aResponse, bpClient) { + source.setBreakpoint(location, Task.async(function* (response, bpClient) { const testCallbacks = [ - function (aPacket) { + function (packet) { // Check that the stepping worked. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5); - do_check_eq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5); + do_check_eq(packet.why.type, "resumeLimit"); }, - function (aPacket) { + function (packet) { // Reached the breakpoint. - do_check_eq(aPacket.frame.where.line, location.line); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_neq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, location.line); + do_check_eq(packet.why.type, "breakpoint"); + do_check_neq(packet.why.type, "resumeLimit"); }, - function (aPacket) { + function (packet) { // Stepped to the closing brace of the function. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3); - do_check_eq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3); + do_check_eq(packet.why.type, "resumeLimit"); }, - function (aPacket) { + function (packet) { // The frame is about to be popped while stepping. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 3); - do_check_neq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.type, "resumeLimit"); - do_check_eq(aPacket.why.frameFinished.return.type, "undefined"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 3); + do_check_neq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.type, "resumeLimit"); + do_check_eq(packet.why.frameFinished.return.type, "undefined"); }, - function (aPacket) { + function (packet) { // The foo function call frame was just popped from the stack. do_check_eq(gDebuggee.a, 1); do_check_eq(gDebuggee.b, undefined); - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 5); - do_check_eq(aPacket.why.type, "resumeLimit"); - do_check_eq(aPacket.poppedFrames.length, 1); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 5); + do_check_eq(packet.why.type, "resumeLimit"); + do_check_eq(packet.poppedFrames.length, 1); }, - function (aPacket) { + function (packet) { // Check that the debugger statement wasn't the reason for this pause. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 6); - do_check_neq(aPacket.why.type, "debuggerStatement"); - do_check_eq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 6); + do_check_neq(packet.why.type, "debuggerStatement"); + do_check_eq(packet.why.type, "resumeLimit"); }, - function (aPacket) { + function (packet) { // Check that the debugger statement wasn't the reason for this pause. - do_check_eq(aPacket.frame.where.line, gDebuggee.line0 + 7); - do_check_neq(aPacket.why.type, "debuggerStatement"); - do_check_eq(aPacket.why.type, "resumeLimit"); + do_check_eq(packet.frame.where.line, gDebuggee.line0 + 7); + do_check_neq(packet.why.type, "debuggerStatement"); + do_check_eq(packet.why.type, "resumeLimit"); }, ]; for (let callback of testCallbacks) { let waiter = waitForPause(gThreadClient); gThreadClient.stepOver(); let packet = yield waiter; callback(packet); @@ -96,18 +97,20 @@ function test_simple_breakpoint() // Remove the breakpoint and finish. let waiter = waitForPause(gThreadClient); gThreadClient.stepOver(); yield waiter; bpClient.remove(() => gThreadClient.resume(() => gClient.close().then(gCallback))); })); }); + /* eslint-disable */ Cu.evalInSandbox("var line0 = Error().lineNumber;\n" + "function foo() {\n" + // line0 + 1 " this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here. "}\n" + // line0 + 3 "debugger;\n" + // line0 + 4 "foo();\n" + // line0 + 5 "debugger;\n" + // line0 + 6 "var b = 2;\n", // line0 + 7 gDebuggee); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-15.js +++ b/devtools/server/tests/unit/test_breakpoint-15.js @@ -1,69 +1,75 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check that adding a breakpoint in the same place returns the same actor. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - testSameBreakpoint(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + testSameBreakpoint(); + }); }); do_test_pending(); } const SOURCE_URL = "http://example.com/source.js"; const testSameBreakpoint = Task.async(function* () { let packet = yield executeOnNextTickAndWaitForPause(evalCode, gClient); let source = gThreadClient.source(packet.frame.where.source); // Whole line let wholeLineLocation = { line: 2 }; - let [firstResponse, firstBpClient] = yield setBreakpoint(source, wholeLineLocation); - let [secondResponse, secondBpClient] = yield setBreakpoint(source, wholeLineLocation); + let [, firstBpClient] = yield setBreakpoint(source, wholeLineLocation); + let [, secondBpClient] = yield setBreakpoint(source, wholeLineLocation); - do_check_eq(firstBpClient.actor, secondBpClient.actor, "Should get the same actor w/ whole line breakpoints"); + do_check_eq(firstBpClient.actor, secondBpClient.actor, + "Should get the same actor w/ whole line breakpoints"); // Specific column let columnLocation = { line: 2, column: 6 }; - [firstResponse, firstBpClient] = yield setBreakpoint(source, columnLocation); - [secondResponse, secondBpClient] = yield setBreakpoint(source, columnLocation); + [, firstBpClient] = yield setBreakpoint(source, columnLocation); + [, secondBpClient] = yield setBreakpoint(source, columnLocation); - do_check_eq(secondBpClient.actor, secondBpClient.actor, "Should get the same actor column breakpoints"); + do_check_eq(secondBpClient.actor, secondBpClient.actor, + "Should get the same actor column breakpoints"); finishClient(gClient); }); function evalCode() { + /* eslint-disable */ Components.utils.evalInSandbox( "" + function doStuff(k) { // line 1 let arg = 15; // line 2 - Step in here k(arg); // line 3 } + "\n" // line 4 + "debugger;", // line 5 gDebuggee, "1.8", SOURCE_URL, 1 ); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-16.js +++ b/devtools/server/tests/unit/test_breakpoint-16.js @@ -1,83 +1,83 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that we can set breakpoints in columns, not just lines. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-breakpoints", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-breakpoints", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-breakpoints", - function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + function (response, tabClient, threadClient) { + gThreadClient = threadClient; test_column_breakpoint(); }); }); } -function test_column_breakpoint() -{ +function test_column_breakpoint() { // Debugger statement - gClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); + gClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 1, column: 55 }; let timesBreakpointHit = 0; - source.setBreakpoint(location, function (aResponse, bpClient) { - gThreadClient.addListener("paused", function onPaused(aEvent, aPacket) { - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.why.actors[0], bpClient.actor); - do_check_eq(aPacket.frame.where.source.actor, source.actor); - do_check_eq(aPacket.frame.where.line, location.line); - do_check_eq(aPacket.frame.where.column, location.column); + source.setBreakpoint(location, function (response, bpClient) { + gThreadClient.addListener("paused", function onPaused(event, packet) { + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.why.actors[0], bpClient.actor); + do_check_eq(packet.frame.where.source.actor, source.actor); + do_check_eq(packet.frame.where.line, location.line); + do_check_eq(packet.frame.where.column, location.column); do_check_eq(gDebuggee.acc, timesBreakpointHit); - do_check_eq(aPacket.frame.environment.bindings.variables.i.value, + do_check_eq(packet.frame.environment.bindings.variables.i.value, timesBreakpointHit); if (++timesBreakpointHit === 3) { gThreadClient.removeListener("paused", onPaused); - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(() => gClient.close().then(gCallback)); }); } else { gThreadClient.resume(); } }); // Continue until the breakpoint is hit. gThreadClient.resume(); }); - }); - + /* eslint-disable */ Components.utils.evalInSandbox( "var line0 = Error().lineNumber;\n" + "(function () { debugger; this.acc = 0; for (var i = 0; i < 3; i++) this.acc++; }());", gDebuggee ); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_breakpoint-17.js +++ b/devtools/server/tests/unit/test_breakpoint-17.js @@ -1,38 +1,40 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Test that when we add 2 breakpoints to the same line at different columns and * then remove one of them, we don't remove them both. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, do_test_finished); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-breakpoints", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-breakpoints", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-breakpoints", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_breakpoints_columns(); - }); + attachTestTabAndResume(gClient, "test-breakpoints", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_breakpoints_columns(); + }); }); } const code = "(" + function (global) { global.foo = function () { Math.abs(-1); Math.log(0.5); debugger; @@ -51,54 +53,54 @@ const secondLocation = { }; function test_breakpoints_columns() { gClient.addOneTimeListener("paused", set_breakpoints); Components.utils.evalInSandbox(code, gDebuggee, "1.8", "http://example.com/", 1); } -function set_breakpoints(aEvent, aPacket) { +function set_breakpoints(event, packet) { let first, second; - let source = gThreadClient.source(aPacket.frame.where.source); + let source = gThreadClient.source(packet.frame.where.source); source.setBreakpoint(firstLocation, function ({ error, actualLocation }, - aBreakpointClient) { + breakpointClient) { do_check_true(!error, "Should not get an error setting the breakpoint"); do_check_true(!actualLocation, "Should not get an actualLocation"); - first = aBreakpointClient; + first = breakpointClient; source.setBreakpoint(secondLocation, function ({ error, actualLocation }, - aBreakpointClient) { + breakpointClient) { do_check_true(!error, "Should not get an error setting the breakpoint"); do_check_true(!actualLocation, "Should not get an actualLocation"); - second = aBreakpointClient; + second = breakpointClient; test_different_actors(first, second); }); }); } -function test_different_actors(aFirst, aSecond) { - do_check_neq(aFirst.actor, aSecond.actor, +function test_different_actors(first, second) { + do_check_neq(first.actor, second.actor, "Each breakpoint should have a different actor"); - test_remove_one(aFirst, aSecond); + test_remove_one(first, second); } -function test_remove_one(aFirst, aSecond) { - aFirst.remove(function ({error}) { +function test_remove_one(first, second) { + first.remove(function ({error}) { do_check_true(!error, "Should not get an error removing a breakpoint"); let hitSecond; - gClient.addListener("paused", function _onPaused(aEvent, {why, frame}) { + gClient.addListener("paused", function _onPaused(event, {why, frame}) { if (why.type == "breakpoint") { hitSecond = true; do_check_eq(why.actors.length, 1, "Should only be paused because of one breakpoint actor"); - do_check_eq(why.actors[0], aSecond.actor, + do_check_eq(why.actors[0], second.actor, "Should be paused because of the correct breakpoint actor"); do_check_eq(frame.where.line, secondLocation.line, "Should be at the right line"); do_check_eq(frame.where.column, secondLocation.column, "Should be at the right column"); gThreadClient.resume(); return; }
--- a/devtools/server/tests/unit/test_breakpoint-18.js +++ b/devtools/server/tests/unit/test_breakpoint-18.js @@ -1,41 +1,41 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check that we only break on offsets that are entry points for the line we are * breaking on. Bug 907278. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-breakpoints", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-breakpoints", server); gDebuggee.console = { log: x => void x }; - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-breakpoints", - function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + function (response, tabClient, threadClient) { + gThreadClient = threadClient; setUpCode(); }); }); } function setUpCode() { gClient.addOneTimeListener("paused", setBreakpoint); Cu.evalInSandbox( @@ -46,18 +46,18 @@ function setUpCode() { }, gDebuggee, "1.8", "http://example.com/", 1 ); } -function setBreakpoint(aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function setBreakpoint(event, packet) { + let source = gThreadClient.source(packet.frame.where.source); gClient.addOneTimeListener("resumed", runCode); source.setBreakpoint({ line: 2 }, ({ error }) => { do_check_true(!error); gThreadClient.resume(); }); }
--- a/devtools/server/tests/unit/test_breakpoint-19.js +++ b/devtools/server/tests/unit/test_breakpoint-19.js @@ -1,64 +1,64 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Make sure that setting a breakpoint in a not-yet-existing script doesn't throw * an error (see bug 897567). Also make sure that this breakpoint works. */ var gDebuggee; var gClient; var gThreadClient; -var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-breakpoints", aServer); +function run_test_with_server(server, callback) { + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-breakpoints", server); gDebuggee.console = { log: x => void x }; - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-breakpoints", - function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + function (response, tabClient, threadClient) { + gThreadClient = threadClient; testBreakpoint(); }); }); } const URL = "test.js"; function setUpCode() { + /* eslint-disable */ Cu.evalInSandbox( "" + function test() { // 1 var a = 1; // 2 debugger; // 3 } + // 4 "\ndebugger;", // 5 gDebuggee, "1.8", URL ); + /* eslint-enable */ } const testBreakpoint = Task.async(function* () { let source = yield getSource(gThreadClient, URL); - let [response, bpClient] = yield setBreakpoint(source, {line: 2}); + let [response, ] = yield setBreakpoint(source, {line: 2}); ok(!response.error); let actor = response.actor; ok(actor); yield executeOnNextTickAndWaitForPause(setUpCode, gClient); yield resume(gThreadClient);
--- a/devtools/server/tests/unit/test_breakpoint-20.js +++ b/devtools/server/tests/unit/test_breakpoint-20.js @@ -1,45 +1,45 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Verify that when two of the "same" source are loaded concurrently (like e10s * frame scripts), breakpoints get hit in scripts defined by all sources. */ var gDebuggee; var gClient; -var gTraceClient; -var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-breakpoints"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { attachTestThread(gClient, "test-breakpoints", testBreakpoint); }); do_test_pending(); } -const testBreakpoint = Task.async(function* (threadResponse, tabClient, threadClient, tabResponse) { +const testBreakpoint = Task.async(function* (threadResponse, tabClient, + threadClient, tabResponse) { evalSetupCode(); // Load the test source once. evalTestCode(); equal(gDebuggee.functions.length, 1, "The test code should have added a function."); // Set a breakpoint in the test source. const source = yield getSource(threadClient, "test.js"); - const [response, bpClient] = yield setBreakpoint(source, { + const [response, ] = yield setBreakpoint(source, { line: 3 }); ok(!response.error, "Shouldn't get an error setting the BP."); ok(!response.actualLocation, "Shouldn't get an actualLocation, the location we provided was good."); const bpActor = response.actor; yield resume(threadClient);
--- a/devtools/server/tests/unit/test_breakpoint-21.js +++ b/devtools/server/tests/unit/test_breakpoint-21.js @@ -1,41 +1,39 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Bug 1122064 - make sure that scripts introduced via onNewScripts * properly populate the `ScriptStore` with all there nested child * scripts, so you can set breakpoints on deeply nested scripts */ var gDebuggee; var gClient; var gThreadClient; -var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-breakpoints", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-breakpoints", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-breakpoints", - function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + function (response, tabClient, threadClient) { + gThreadClient = threadClient; test(); }); }); } const test = Task.async(function* () { // Populate the `ScriptStore` so that we only test that the script // is added through `onNewScript` @@ -57,16 +55,17 @@ const test = Task.async(function* () { do_check_eq(packet.why.actors[0], bpClient.actor); do_check_eq(packet.frame.where.source.actor, source.actor); do_check_eq(packet.frame.where.line, location.line); yield resume(gThreadClient); finishClient(gClient); }); +/* eslint-disable */ function evalCode() { // Start a new script Components.utils.evalInSandbox( "var line0 = Error().lineNumber;\n(" + function () { debugger; var a = (function () { return (function () { return (function () {
--- a/devtools/server/tests/unit/test_breakpoint-22.js +++ b/devtools/server/tests/unit/test_breakpoint-22.js @@ -1,57 +1,55 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Bug 1333219 - make that setBreakpoint fails when script is not found * at the specified line. */ var gDebuggee; var gClient; var gThreadClient; -var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-breakpoints", aServer); - gClient = new DebuggerClient(aServer.connectPipe()); +function run_test_with_server(server, callback) { + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-breakpoints", server); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-breakpoints", - function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + function (response, tabClient, threadClient) { + gThreadClient = threadClient; test(); }); }); } const test = Task.async(function* () { // Populate the `ScriptStore` so that we only test that the script // is added through `onNewScript` yield getSources(gThreadClient); let packet = yield executeOnNextTickAndWaitForPause(evalCode, gClient); let source = gThreadClient.source(packet.frame.where.source); let location = { line: gDebuggee.line0 + 2 }; - let [res, bpClient] = yield setBreakpoint(source, location); + let [res, ] = yield setBreakpoint(source, location); ok(!res.error); let location2 = { line: gDebuggee.line0 + 5 }; yield source.setBreakpoint(location2).then(_ => { do_throw("no code shall not be found the specified line or below it");
--- a/devtools/server/tests/unit/test_breakpoint-actor-map.js +++ b/devtools/server/tests/unit/test_breakpoint-actor-map.js @@ -123,28 +123,33 @@ function test_find_actors() { for (let bp of bpStore.findActors()) { bpSet.delete(bp); } do_check_eq(bpSet.size, 0, "Should be able to iterate over all breakpoints"); // Breakpoints by URL - bpSet = new Set(bps.filter(bp => { return bp.originalSourceActor.actorID === "actor1"; })); + bpSet = new Set(bps.filter(bp => { + return bp.originalSourceActor.actorID === "actor1"; + })); for (let bp of bpStore.findActors({ originalSourceActor: { actorID: "actor1" } })) { bpSet.delete(bp); } do_check_eq(bpSet.size, 0, "Should be able to filter the iteration by url"); // Breakpoints by URL and line - bpSet = new Set(bps.filter(bp => { return bp.originalSourceActor.actorID === "actor1" && bp.originalLine === 10; })); + bpSet = new Set(bps.filter(bp => { + return bp.originalSourceActor.actorID === "actor1" && bp.originalLine === 10; + })); let first = true; - for (let bp of bpStore.findActors({ originalSourceActor: { actorID: "actor1" }, originalLine: 10 })) { + for (let bp of bpStore.findActors({ originalSourceActor: { actorID: "actor1" }, + originalLine: 10 })) { if (first) { do_check_eq(bp.originalColumn, undefined, "Should always get the whole line breakpoint first"); first = false; } else { do_check_neq(bp.originalColumn, undefined, "Should not get the whole line breakpoint any time other than first."); }
--- a/devtools/server/tests/unit/test_client_close.js +++ b/devtools/server/tests/unit/test_client_close.js @@ -1,39 +1,39 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gClient; var gDebuggee; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = testGlobal("test-1"); DebuggerServer.addTestGlobal(gDebuggee); let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect().then(function (aType, aTraits) { - attachTestTab(gClient, "test-1", function (aReply, aTabClient) { + gClient.connect().then(function (type, traits) { + attachTestTab(gClient, "test-1", function (reply, tabClient) { test_close(transport); }); }); do_test_pending(); } -function test_close(aTransport) -{ +function test_close(transport) { // Check that, if we fake a transport shutdown // (like if a device is unplugged) // the client is automatically closed, // and we can still call client.close. let onClosed = function () { gClient.removeListener("closed", onClosed); ok(true, "Client emitted 'closed' event"); gClient.close().then(function () { ok(true, "client.close() successfully called its callback"); do_test_finished(); }); }; gClient.addListener("closed", onClosed); - aTransport.close(); + transport.close(); }
--- a/devtools/server/tests/unit/test_client_request.js +++ b/devtools/server/tests/unit/test_client_request.js @@ -1,11 +1,13 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + // Test the DebuggerClient.request API. var gClient, gActorId; function TestActor(conn) { this.conn = conn; } TestActor.prototype = { @@ -19,41 +21,39 @@ TestActor.prototype = { return {error: "code", message: "human message"}; } }; TestActor.prototype.requestTypes = { "hello": TestActor.prototype.hello, "error": TestActor.prototype.error }; -function run_test() -{ +function run_test() { DebuggerServer.addGlobalActor(TestActor); DebuggerServer.init(); DebuggerServer.addBrowserActors(); add_test(init); add_test(test_client_request_callback); add_test(test_client_request_promise); add_test(test_client_request_promise_error); add_test(test_client_request_event_emitter); add_test(test_close_client_while_sending_requests); add_test(test_client_request_after_close); add_test(test_client_request_after_close_callback); run_next_test(); } -function init() -{ +function init() { gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect() .then(() => gClient.listTabs()) - .then(aResponse => { - gActorId = aResponse.test; + .then(response => { + gActorId = response.test; run_next_test(); }); } function checkStack(expectedName) { if (!Services.prefs.getBoolPref("javascript.options.asyncstack")) { do_print("Async stacks are disabled."); return; @@ -67,48 +67,45 @@ function checkStack(expectedName) { ok(true, "Complete stack"); return; } stack = stack.asyncCaller || stack.caller; } ok(false, "Incomplete stack"); } -function test_client_request_callback() -{ +function test_client_request_callback() { // Test that DebuggerClient.request accepts a `onResponse` callback as 2nd argument gClient.request({ to: gActorId, type: "hello" }, response => { do_check_eq(response.from, gActorId); do_check_eq(response.hello, "world"); checkStack("test_client_request_callback"); run_next_test(); }); } -function test_client_request_promise() -{ +function test_client_request_promise() { // Test that DebuggerClient.request returns a promise that resolves on response let request = gClient.request({ to: gActorId, type: "hello" }); request.then(response => { do_check_eq(response.from, gActorId); do_check_eq(response.hello, "world"); checkStack("test_client_request_promise"); run_next_test(); }); } -function test_client_request_promise_error() -{ +function test_client_request_promise_error() { // Test that DebuggerClient.request returns a promise that reject when server // returns an explicit error message let request = gClient.request({ to: gActorId, type: "error" }); request.then(() => { @@ -117,18 +114,17 @@ function test_client_request_promise_err do_check_eq(response.from, gActorId); do_check_eq(response.error, "code"); do_check_eq(response.message, "human message"); checkStack("test_client_request_promise_error"); run_next_test(); }); } -function test_client_request_event_emitter() -{ +function test_client_request_event_emitter() { // Test that DebuggerClient.request returns also an EventEmitter object let request = gClient.request({ to: gActorId, type: "hello" }); request.on("json-reply", reply => { do_check_eq(reply.from, gActorId); do_check_eq(reply.hello, "world"); @@ -151,64 +147,67 @@ function test_close_client_while_sending let pendingRequest = gClient.request({ to: gActorId, type: "hello" }); let expectReply = promise.defer(); gClient.expectReply("root", function (response) { do_check_eq(response.error, "connectionClosed"); - do_check_eq(response.message, "server side packet can't be received as the connection just closed."); + do_check_eq(response.message, + "server side packet can't be received as the connection just closed."); expectReply.resolve(); }); gClient.close().then(() => { activeRequest.then(() => { ok(false, "First request unexpectedly succeed while closing the connection"); }, response => { do_check_eq(response.error, "connectionClosed"); - do_check_eq(response.message, "'hello' active request packet to '" + gActorId + "' can't be sent as the connection just closed."); + do_check_eq(response.message, "'hello' active request packet to '" + + gActorId + "' can't be sent as the connection just closed."); }) .then(() => pendingRequest) .then(() => { ok(false, "Second request unexpectedly succeed while closing the connection"); }, response => { do_check_eq(response.error, "connectionClosed"); - do_check_eq(response.message, "'hello' pending request packet to '" + gActorId + "' can't be sent as the connection just closed."); + do_check_eq(response.message, "'hello' pending request packet to '" + + gActorId + "' can't be sent as the connection just closed."); }) .then(() => expectReply.promise) .then(run_next_test); }); } -function test_client_request_after_close() -{ +function test_client_request_after_close() { // Test that DebuggerClient.request fails after we called client.close() // (with promise API) let request = gClient.request({ to: gActorId, type: "hello" }); request.then(response => { ok(false, "Request succeed even after client.close"); }, response => { ok(true, "Request failed after client.close"); do_check_eq(response.error, "connectionClosed"); - ok(response.message.match(/'hello' request packet to '.*' can't be sent as the connection is closed./)); + ok(response.message.match( + /'hello' request packet to '.*' can't be sent as the connection is closed./)); run_next_test(); }); } -function test_client_request_after_close_callback() -{ +function test_client_request_after_close_callback() { // Test that DebuggerClient.request fails after we called client.close() // (with callback API) - let request = gClient.request({ + gClient.request({ to: gActorId, type: "hello" }, response => { ok(true, "Request failed after client.close"); do_check_eq(response.error, "connectionClosed"); - ok(response.message.match(/'hello' request packet to '.*' can't be sent as the connection is closed./)); + ok(response.message.match( + /'hello' request packet to '.*' can't be sent as the connection is closed./)); run_next_test(); }); }
--- a/devtools/server/tests/unit/test_conditional_breakpoint-01.js +++ b/devtools/server/tests/unit/test_conditional_breakpoint-01.js @@ -1,61 +1,62 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check conditional breakpoint when condition evaluates to true. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-conditional-breakpoint"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-conditional-breakpoint", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-conditional-breakpoint", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_breakpoint(); + }); }); do_test_pending(); } -function test_simple_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_simple_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); source.setBreakpoint({ line: 3, condition: "a === 1" - }, function (aResponse, bpClient) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + }, function (response, bpClient) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.why.type, "breakpoint"); - do_check_eq(aPacket.frame.where.line, 3); + do_check_eq(packet.why.type, "breakpoint"); + do_check_eq(packet.frame.where.line, 3); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { finishClient(gClient); }); }); - }); // Continue until the breakpoint is hit. gThreadClient.resume(); - }); - }); + /* eslint-disable */ Components.utils.evalInSandbox("debugger;\n" + // 1 "var a = 1;\n" + // 2 "var b = 2;\n", // 3 gDebuggee, "1.8", "test.js", 1); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_conditional_breakpoint-02.js +++ b/devtools/server/tests/unit/test_conditional_breakpoint-02.js @@ -1,60 +1,63 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check conditional breakpoint when condition evaluates to false. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-conditional-breakpoint"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-conditional-breakpoint", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-conditional-breakpoint", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_breakpoint(); + }); }); do_test_pending(); } -function test_simple_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_simple_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); source.setBreakpoint({ line: 3, condition: "a === 2" - }, function (aResponse, bpClient) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + }, function (response, bpClient) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.why.type, "debuggerStatement"); - do_check_eq(aPacket.frame.where.line, 4); + do_check_eq(packet.why.type, "debuggerStatement"); + do_check_eq(packet.frame.where.line, 4); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { finishClient(gClient); }); }); - }); // Continue until the breakpoint is hit. gThreadClient.resume(); }); }); + /* eslint-disable */ Components.utils.evalInSandbox("debugger;\n" + // 1 "var a = 1;\n" + // 2 "var b = 2;\n" + // 3 "debugger;", // 4 gDebuggee, "1.8", "test.js", 1); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_conditional_breakpoint-03.js +++ b/devtools/server/tests/unit/test_conditional_breakpoint-03.js @@ -1,61 +1,62 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check conditional breakpoint when condition throws and make sure it pauses */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-conditional-breakpoint"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-conditional-breakpoint", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_breakpoint(); - }); + attachTestTabAndResume(gClient, "test-conditional-breakpoint", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_breakpoint(); + }); }); do_test_pending(); } -function test_simple_breakpoint() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let source = gThreadClient.source(aPacket.frame.where.source); +function test_simple_breakpoint() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let source = gThreadClient.source(packet.frame.where.source); source.setBreakpoint({ line: 3, condition: "throw new Error()" - }, function (aResponse, bpClient) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + }, function (response, bpClient) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value. - do_check_eq(aPacket.why.type, "breakpointConditionThrown"); - do_check_eq(aPacket.frame.where.line, 3); + do_check_eq(packet.why.type, "breakpointConditionThrown"); + do_check_eq(packet.frame.where.line, 3); // Remove the breakpoint. - bpClient.remove(function (aResponse) { + bpClient.remove(function (response) { gThreadClient.resume(function () { finishClient(gClient); }); }); - }); // Continue until the breakpoint is hit. gThreadClient.resume(); - }); - }); + /* eslint-disable */ Components.utils.evalInSandbox("debugger;\n" + // 1 "var a = 1;\n" + // 2 "var b = 2;\n", // 3 gDebuggee, "1.8", "test.js", 1); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_dbgactor.js +++ b/devtools/server/tests/unit/test_dbgactor.js @@ -1,116 +1,114 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gClient; var gDebuggee; const xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = testGlobal("test-1"); DebuggerServer.addTestGlobal(gDebuggee); let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.addListener("connected", function (aEvent, aType, aTraits) { - gClient.listTabs((aResponse) => { - do_check_true("tabs" in aResponse); - for (let tab of aResponse.tabs) { + gClient.addListener("connected", function (event, type, traits) { + gClient.listTabs((response) => { + do_check_true("tabs" in response); + for (let tab of response.tabs) { if (tab.title == "test-1") { test_attach_tab(tab.actor); return false; } } - do_check_true(false); // We should have found our tab in the list. + // We should have found our tab in the list. + do_check_true(false); return undefined; }); }); gClient.connect(); do_test_pending(); } -// Attach to |aTabActor|, and check the response. -function test_attach_tab(aTabActor) -{ - gClient.request({ to: aTabActor, type: "attach" }, function (aResponse) { - do_check_false("error" in aResponse); - do_check_eq(aResponse.from, aTabActor); - do_check_eq(aResponse.type, "tabAttached"); - do_check_true(typeof aResponse.threadActor === "string"); +// Attach to |tabActor|, and check the response. +function test_attach_tab(tabActor) { + gClient.request({ to: tabActor, type: "attach" }, function (response) { + do_check_false("error" in response); + do_check_eq(response.from, tabActor); + do_check_eq(response.type, "tabAttached"); + do_check_true(typeof response.threadActor === "string"); - test_attach_thread(aResponse.threadActor); + test_attach_thread(response.threadActor); }); } -// Attach to |aThreadActor|, check the response, and resume it. -function test_attach_thread(aThreadActor) -{ - gClient.request({ to: aThreadActor, type: "attach" }, function (aResponse) { - do_check_false("error" in aResponse); - do_check_eq(aResponse.from, aThreadActor); - do_check_eq(aResponse.type, "paused"); - do_check_true("why" in aResponse); - do_check_eq(aResponse.why.type, "attached"); +// Attach to |threadActor|, check the response, and resume it. +function test_attach_thread(threadActor) { + gClient.request({ to: threadActor, type: "attach" }, function (response) { + do_check_false("error" in response); + do_check_eq(response.from, threadActor); + do_check_eq(response.type, "paused"); + do_check_true("why" in response); + do_check_eq(response.why.type, "attached"); - test_resume_thread(aThreadActor); + test_resume_thread(threadActor); }); } -// Resume |aThreadActor|, and see that it stops at the 'debugger' +// Resume |threadActor|, and see that it stops at the 'debugger' // statement. -function test_resume_thread(aThreadActor) -{ +function test_resume_thread(threadActor) { // Allow the client to resume execution. - gClient.request({ to: aThreadActor, type: "resume" }, function (aResponse) { - do_check_false("error" in aResponse); - do_check_eq(aResponse.from, aThreadActor); - do_check_eq(aResponse.type, "resumed"); + gClient.request({ to: threadActor, type: "resume" }, function (response) { + do_check_false("error" in response); + do_check_eq(response.from, threadActor); + do_check_eq(response.type, "resumed"); do_check_eq(xpcInspector.eventLoopNestLevel, 0); // Now that we know we're resumed, we can make the debuggee do something. Cu.evalInSandbox("var a = true; var b = false; debugger; var b = true;", gDebuggee); // Now make sure that we've run the code after the debugger statement... do_check_true(gDebuggee.b); }); - gClient.addListener("paused", function (aName, aPacket) { - do_check_eq(aName, "paused"); - do_check_false("error" in aPacket); - do_check_eq(aPacket.from, aThreadActor); - do_check_eq(aPacket.type, "paused"); - do_check_true("actor" in aPacket); - do_check_true("why" in aPacket); - do_check_eq(aPacket.why.type, "debuggerStatement"); + gClient.addListener("paused", function (name, packet) { + do_check_eq(name, "paused"); + do_check_false("error" in packet); + do_check_eq(packet.from, threadActor); + do_check_eq(packet.type, "paused"); + do_check_true("actor" in packet); + do_check_true("why" in packet); + do_check_eq(packet.why.type, "debuggerStatement"); // Reach around the protocol to check that the debuggee is in the state // we expect. do_check_true(gDebuggee.a); do_check_false(gDebuggee.b); do_check_eq(xpcInspector.eventLoopNestLevel, 1); // Let the debuggee continue execution. - gClient.request({ to: aThreadActor, type: "resume" }, cleanup); + gClient.request({ to: threadActor, type: "resume" }, cleanup); }); } -function cleanup() -{ - gClient.addListener("closed", function (aEvent, aResult) { +function cleanup() { + gClient.addListener("closed", function (event, result) { do_test_finished(); }); try { - let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); - do_check_eq(xpcInspector.eventLoopNestLevel, 0); + let inspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); + do_check_eq(inspector.eventLoopNestLevel, 0); } catch (e) { dump(e); } gClient.close(); }
--- a/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js +++ b/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js @@ -1,69 +1,67 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gClient; var gTabClient; var gDebuggee; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = testGlobal("test-1"); DebuggerServer.addTestGlobal(gDebuggee); let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect().then(function ([aType, aTraits]) { - attachTestTab(gClient, "test-1", function (aReply, aTabClient) { - gTabClient = aTabClient; - test_threadAttach(aReply.threadActor); + gClient.connect().then(function ([type, traits]) { + attachTestTab(gClient, "test-1", function (reply, tabClient) { + gTabClient = tabClient; + test_threadAttach(reply.threadActor); }); }); do_test_pending(); } -function test_threadAttach(aThreadActorID) -{ - do_print("Trying to attach to thread " + aThreadActorID); - gTabClient.attachThread({}, function (aResponse, aThreadClient) { - do_check_eq(aThreadClient.state, "paused"); - do_check_eq(aThreadClient.actor, aThreadActorID); - aThreadClient.resume(function () { - do_check_eq(aThreadClient.state, "attached"); - test_debugger_statement(aThreadClient); +function test_threadAttach(threadActorID) { + do_print("Trying to attach to thread " + threadActorID); + gTabClient.attachThread({}, function (response, threadClient) { + do_check_eq(threadClient.state, "paused"); + do_check_eq(threadClient.actor, threadActorID); + threadClient.resume(function () { + do_check_eq(threadClient.state, "attached"); + test_debugger_statement(threadClient); }); }); } -function test_debugger_statement(aThreadClient) -{ - aThreadClient.addListener("paused", function (aEvent, aPacket) { - do_check_eq(aThreadClient.state, "paused"); +function test_debugger_statement(threadClient) { + threadClient.addListener("paused", function (event, packet) { + do_check_eq(threadClient.state, "paused"); // Reach around the protocol to check that the debuggee is in the state // we expect. do_check_true(gDebuggee.a); do_check_false(gDebuggee.b); let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); do_check_eq(xpcInspector.eventLoopNestLevel, 1); - aThreadClient.resume(cleanup); + threadClient.resume(cleanup); }); Cu.evalInSandbox("var a = true; var b = false; debugger; var b = true;", gDebuggee); // Now make sure that we've run the code after the debugger statement... do_check_true(gDebuggee.b); } -function cleanup() -{ - gClient.addListener("closed", function (aEvent) { +function cleanup() { + gClient.addListener("closed", function (event) { do_test_finished(); }); try { let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); do_check_eq(xpcInspector.eventLoopNestLevel, 0); } catch (e) { dump(e);
--- a/devtools/server/tests/unit/test_dbgglobal.js +++ b/devtools/server/tests/unit/test_dbgglobal.js @@ -1,13 +1,14 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -function run_test() -{ +"use strict"; + +function run_test() { // Should get an exception if we try to interact with DebuggerServer // before we initialize it... check_except(function () { DebuggerServer.createListener(); }); check_except(DebuggerServer.closeAllListeners); check_except(DebuggerServer.connectPipe); @@ -23,37 +24,37 @@ function run_test() // Now they should work. DebuggerServer.createListener(); DebuggerServer.closeAllListeners(); // Make sure we got the test's root actor all set up. let client1 = DebuggerServer.connectPipe(); client1.hooks = { - onPacket: function (aPacket1) { - do_check_eq(aPacket1.from, "root"); - do_check_eq(aPacket1.applicationType, "xpcshell-tests"); + onPacket: function (packet1) { + do_check_eq(packet1.from, "root"); + do_check_eq(packet1.applicationType, "xpcshell-tests"); // Spin up a second connection, make sure it has its own root // actor. let client2 = DebuggerServer.connectPipe(); client2.hooks = { - onPacket: function (aPacket2) { - do_check_eq(aPacket2.from, "root"); - do_check_neq(aPacket1.testConnectionPrefix, - aPacket2.testConnectionPrefix); + onPacket: function (packet2) { + do_check_eq(packet2.from, "root"); + do_check_neq(packet1.testConnectionPrefix, + packet2.testConnectionPrefix); client2.close(); }, - onClosed: function (aResult) { + onClosed: function (result) { client1.close(); }, }; client2.ready(); }, - onClosed: function (aResult) { + onClosed: function (result) { do_test_finished(); }, }; client1.ready(); do_test_pending(); }
--- a/devtools/server/tests/unit/test_eval-01.js +++ b/devtools/server/tests/unit/test_eval-01.js @@ -1,58 +1,59 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check basic eval resume/re-pause */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_eval(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_eval(); + }); }); do_test_pending(); } -function test_simple_eval() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let arg1Actor = aPacket.frame.arguments[0].actor; - gThreadClient.eval(null, "({ obj: true })", function (aResponse) { - do_check_eq(aResponse.type, "resumed"); +function test_simple_eval() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let arg1Actor = packet.frame.arguments[0].actor; + gThreadClient.eval(null, "({ obj: true })", function (response) { + do_check_eq(response.type, "resumed"); // Expect a pause notification immediately. - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value... - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "clientEvaluated"); - do_check_eq(aPacket.why.frameFinished.return.type, "object"); - do_check_eq(aPacket.why.frameFinished.return.class, "Object"); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "clientEvaluated"); + do_check_eq(packet.why.frameFinished.return.type, "object"); + do_check_eq(packet.why.frameFinished.return.class, "Object"); // Make sure the previous pause lifetime was correctly dropped. - gClient.request({ to: arg1Actor, type: "bogusRequest" }, function (aResponse) { - do_check_eq(aResponse.error, "noSuchActor"); + gClient.request({ to: arg1Actor, type: "bogusRequest" }, function (response) { + do_check_eq(response.error, "noSuchActor"); gThreadClient.resume(function () { finishClient(gClient); }); }); - }); - }); - }); + /* eslint-disable */ gDebuggee.eval("(" + function () { function stopMe(arg1) { debugger; } stopMe({obj: true}); } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_eval-02.js +++ b/devtools/server/tests/unit/test_eval-02.js @@ -1,48 +1,52 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check eval resume/re-pause with a throw. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_throw_eval(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_throw_eval(); + }); }); do_test_pending(); } -function test_throw_eval() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.eval(null, "throw 'failure'", function (aResponse) { - do_check_eq(aResponse.type, "resumed"); +function test_throw_eval() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.eval(null, "throw 'failure'", function (response) { + do_check_eq(response.type, "resumed"); // Expect a pause notification immediately. - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value... - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "clientEvaluated"); - do_check_eq(aPacket.why.frameFinished.throw, "failure"); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "clientEvaluated"); + do_check_eq(packet.why.frameFinished.throw, "failure"); gThreadClient.resume(function () { finishClient(gClient); }); }); }); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { function stopMe(arg1) { debugger; } stopMe({obj: true}); } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_eval-03.js +++ b/devtools/server/tests/unit/test_eval-03.js @@ -1,50 +1,54 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check syntax errors in an eval. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_syntax_error_eval(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_syntax_error_eval(); + }); }); do_test_pending(); } -function test_syntax_error_eval() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.eval(null, "%$@!@#", function (aResponse) { - do_check_eq(aResponse.type, "resumed"); +function test_syntax_error_eval() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.eval(null, "%$@!@#", function (response) { + do_check_eq(response.type, "resumed"); // Expect a pause notification immediately. - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Check the return value... - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "clientEvaluated"); - do_check_eq(aPacket.why.frameFinished.throw.type, "object"); - do_check_eq(aPacket.why.frameFinished.throw.class, "Error"); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "clientEvaluated"); + do_check_eq(packet.why.frameFinished.throw.type, "object"); + do_check_eq(packet.why.frameFinished.throw.class, "Error"); gThreadClient.resume(function () { finishClient(gClient); }); }); }); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { function stopMe(arg1) { debugger; } stopMe({obj: true}); } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_eval-04.js +++ b/devtools/server/tests/unit/test_eval-04.js @@ -1,56 +1,57 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check evals against different frames. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_syntax_error_eval(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_different_frames_eval(); + }); }); do_test_pending(); } -function test_syntax_error_eval() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - - gThreadClient.getFrames(0, 2, function (aResponse) { - let frame0 = aResponse.frames[0]; - let frame1 = aResponse.frames[1]; +function test_different_frames_eval() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.getFrames(0, 2, function (response) { + let frame0 = response.frames[0]; + let frame1 = response.frames[1]; // Eval against the top frame... - gThreadClient.eval(frame0.actor, "arg", function (aResponse) { - do_check_eq(aResponse.type, "resumed"); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.eval(frame0.actor, "arg", function (response) { + do_check_eq(response.type, "resumed"); + gThreadClient.addOneTimeListener("paused", function (event, packet) { // 'arg' should have been evaluated in frame0 - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.type, "clientEvaluated"); - do_check_eq(aPacket.why.frameFinished.return, "arg0"); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.type, "clientEvaluated"); + do_check_eq(packet.why.frameFinished.return, "arg0"); // Now eval against the second frame. - gThreadClient.eval(frame1.actor, "arg", function (aResponse) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.eval(frame1.actor, "arg", function (response) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // 'arg' should have been evaluated in frame1 - do_check_eq(aPacket.type, "paused"); - do_check_eq(aPacket.why.frameFinished.return, "arg1"); + do_check_eq(packet.type, "paused"); + do_check_eq(packet.why.frameFinished.return, "arg1"); gThreadClient.resume(function () { finishClient(gClient); }); }); }); }); });
--- a/devtools/server/tests/unit/test_eval-05.js +++ b/devtools/server/tests/unit/test_eval-05.js @@ -1,47 +1,49 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check pauses within evals. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_syntax_error_eval(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pauses_eval(); + }); }); do_test_pending(); } -function test_syntax_error_eval() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.eval(null, "debugger", function (aResponse) { +function test_pauses_eval() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.eval(null, "debugger", function (response) { // Expect a resume then a debuggerStatement pause. - do_check_eq(aResponse.type, "resumed"); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "debuggerStatement"); + do_check_eq(response.type, "resumed"); + gThreadClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.why.type, "debuggerStatement"); // Resume from the debugger statement should immediately re-pause // with a clientEvaluated reason. - gThreadClient.resume(function (aPacket) { - do_check_eq(aPacket.type, "resumed"); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "clientEvaluated"); + gThreadClient.resume(function (packet) { + do_check_eq(packet.type, "resumed"); + gThreadClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.why.type, "clientEvaluated"); gThreadClient.resume(function () { finishClient(gClient); }); }); }); }); }); });
--- a/devtools/server/tests/unit/test_eventlooplag_actor.js +++ b/devtools/server/tests/unit/test_eventlooplag_actor.js @@ -2,28 +2,26 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Test the eventLoopLag actor. */ "use strict"; -function run_test() -{ +function run_test() { let {EventLoopLagFront} = require("devtools/shared/fronts/eventlooplag"); DebuggerServer.init(); DebuggerServer.addBrowserActors(); // As seen in EventTracer.cpp let threshold = 20; let interval = 10; - let front; let client = new DebuggerClient(DebuggerServer.connectPipe()); // Start tracking event loop lags. client.connect().then(function () { client.listTabs(function (resp) { front = new EventLoopLagFront(client, resp); front.start().then(success => {
--- a/devtools/server/tests/unit/test_forwardingprefix.js +++ b/devtools/server/tests/unit/test_forwardingprefix.js @@ -1,21 +1,22 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /* Exercise prefix-based forwarding of packets to other transports. */ const { RootActor } = require("devtools/server/actors/root"); var gMainConnection, gMainTransport; var gSubconnection1, gSubconnection2; var gClient; -function run_test() -{ +function run_test() { DebuggerServer.init(); add_test(createMainConnection); add_test(TestNoForwardingYet); add_test(createSubconnection1); add_test(TestForwardPrefix1OnlyRoot); add_test(createSubconnection2); add_test(TestForwardPrefix12OnlyRoot); @@ -26,171 +27,172 @@ function run_test() /* * Create a pipe connection, and return an object |{ conn, transport }|, * where |conn| is the new DebuggerServerConnection instance, and * |transport| is the client side of the transport on which it communicates * (that is, packets sent on |transport| go to the new connection, and * |transport|'s hooks receive replies). * - * |aPrefix| is optional; if present, it's the prefix (minus the '/') for + * |prefix| is optional; if present, it's the prefix (minus the '/') for * actors in the new connection. */ -function newConnection(aPrefix) -{ - var conn; - DebuggerServer.createRootActor = function (aConn) { - conn = aConn; - return new RootActor(aConn, {}); +function newConnection(prefix) { + let conn; + DebuggerServer.createRootActor = function (connection) { + conn = connection; + return new RootActor(connection, {}); }; - var transport = DebuggerServer.connectPipe(aPrefix); + let transport = DebuggerServer.connectPipe(prefix); return { conn: conn, transport: transport }; } /* Create the main connection for these tests. */ -function createMainConnection() -{ +function createMainConnection() { ({ conn: gMainConnection, transport: gMainTransport } = newConnection()); gClient = new DebuggerClient(gMainTransport); - gClient.connect().then(([aType, aTraits]) => run_next_test()); + gClient.connect().then(([type, traits]) => run_next_test()); } /* * Exchange 'echo' messages with five actors: * - root * - prefix1/root * - prefix1/actor * - prefix2/root * - prefix2/actor * - * Expect proper echos from those named in |aReachables|, and 'noSuchActor' + * Expect proper echos from those named in |reachables|, and 'noSuchActor' * errors from the others. When we've gotten all our replies (errors or - * otherwise), call |aCompleted|. + * otherwise), call |completed|. * - * To avoid deep stacks, we call aCompleted from the next tick. + * To avoid deep stacks, we call completed from the next tick. */ -function tryActors(aReachables, aCompleted) { +function tryActors(reachables, completed) { let count = 0; let outerActor; for (outerActor of [ "root", "prefix1/root", "prefix1/actor", "prefix2/root", "prefix2/actor" ]) { /* * Let each callback capture its own iteration's value; outerActor is * local to the whole loop, not to a single iteration. */ let actor = outerActor; count++; - gClient.request({ to: actor, type: "echo", value: "tango"}, // phone home - (aResponse) => { - if (aReachables.has(actor)) - do_check_matches({ from: actor, to: actor, type: "echo", value: "tango" }, aResponse); - else - do_check_matches({ from: actor, error: "noSuchActor", message: "No such actor for ID: " + actor }, aResponse); + // phone home + gClient.request( + { to: actor, type: "echo", value: "tango"}, + (response) => { + if (reachables.has(actor)) { + do_check_matches({ from: actor, to: actor, + type: "echo", value: "tango" }, response); + } else { + do_check_matches({ from: actor, error: "noSuchActor", + message: "No such actor for ID: " + actor }, response); + } - if (--count == 0) - do_execute_soon(aCompleted, "tryActors callback " + aCompleted.name); - }); + if (--count == 0) { + do_execute_soon(completed, "tryActors callback " + completed.name); + } + }); } } /* * With no forwarding established, sending messages to root should work, * but sending messages to prefixed actor names, or anyone else, should get * an error. */ -function TestNoForwardingYet() -{ +function TestNoForwardingYet() { tryActors(new Set(["root"]), run_next_test); } /* * Create a new pipe connection which forwards its reply packets to * gMainConnection's client, and to which gMainConnection forwards packets - * directed to actors whose names begin with |aPrefix + '/'|, and. + * directed to actors whose names begin with |prefix + '/'|, and. * * Return an object { conn, transport }, as for newConnection. */ -function newSubconnection(aPrefix) -{ - let { conn, transport } = newConnection(aPrefix); +function newSubconnection(prefix) { + let { conn, transport } = newConnection(prefix); transport.hooks = { - onPacket: (aPacket) => gMainConnection.send(aPacket), + onPacket: (packet) => gMainConnection.send(packet), onClosed: () => {} }; - gMainConnection.setForwarding(aPrefix, transport); + gMainConnection.setForwarding(prefix, transport); return { conn: conn, transport: transport }; } /* Create a second root actor, to which we can forward things. */ -function createSubconnection1() -{ +function createSubconnection1() { let { conn, transport } = newSubconnection("prefix1"); gSubconnection1 = conn; transport.ready(); - gClient.expectReply("prefix1/root", (aReply) => run_next_test()); + gClient.expectReply("prefix1/root", (reply) => run_next_test()); } // Establish forwarding, but don't put any actors in that server. -function TestForwardPrefix1OnlyRoot() -{ +function TestForwardPrefix1OnlyRoot() { tryActors(new Set(["root", "prefix1/root"]), run_next_test); } /* Create a third root actor, to which we can forward things. */ -function createSubconnection2() -{ +function createSubconnection2() { let { conn, transport } = newSubconnection("prefix2"); gSubconnection2 = conn; transport.ready(); - gClient.expectReply("prefix2/root", (aReply) => run_next_test()); + gClient.expectReply("prefix2/root", (reply) => run_next_test()); } -function TestForwardPrefix12OnlyRoot() -{ +function TestForwardPrefix12OnlyRoot() { tryActors(new Set(["root", "prefix1/root", "prefix2/root"]), run_next_test); } // A dumb actor that implements 'echo'. // // It's okay that both subconnections' actors behave identically, because // the reply-sending code attaches the replying actor's name to the packet, // so simply matching the 'from' field in the reply ensures that we heard // from the right actor. -function EchoActor(aConnection) -{ - this.conn = aConnection; +function EchoActor(connection) { + this.conn = connection; } EchoActor.prototype.actorPrefix = "EchoActor"; -EchoActor.prototype.onEcho = function (aRequest) { +EchoActor.prototype.onEcho = function (request) { /* - * Request packets are frozen. Copy aRequest, so that + * Request packets are frozen. Copy request, so that * DebuggerServerConnection.onPacket can attach a 'from' property. */ - return JSON.parse(JSON.stringify(aRequest)); + return JSON.parse(JSON.stringify(request)); }; EchoActor.prototype.requestTypes = { "echo": EchoActor.prototype.onEcho }; -function TestForwardPrefix12WithActor1() -{ +function TestForwardPrefix12WithActor1() { let actor = new EchoActor(gSubconnection1); actor.actorID = "prefix1/actor"; gSubconnection1.addActor(actor); - tryActors(new Set(["root", "prefix1/root", "prefix1/actor", "prefix2/root"]), run_next_test); + tryActors( + new Set(["root", "prefix1/root", "prefix1/actor", "prefix2/root"]), + run_next_test + ); } -function TestForwardPrefix12WithActor12() -{ +function TestForwardPrefix12WithActor12() { let actor = new EchoActor(gSubconnection2); actor.actorID = "prefix2/actor"; gSubconnection2.addActor(actor); - tryActors(new Set(["root", "prefix1/root", "prefix1/actor", "prefix2/root", "prefix2/actor"]), run_next_test); + tryActors( + new Set(["root", "prefix1/root", "prefix1/actor", "prefix2/root", "prefix2/actor"]), + run_next_test + ); }
--- a/devtools/server/tests/unit/test_frameactor-01.js +++ b/devtools/server/tests/unit/test_frameactor-01.js @@ -1,39 +1,40 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Verify that we get a frame actor along with a debugger statement. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_true(!!aPacket.frame); - do_check_true(!!aPacket.frame.actor); - do_check_eq(aPacket.frame.callee.name, "stopMe"); +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + do_check_true(!!packet.frame); + do_check_true(!!packet.frame.actor); + do_check_eq(packet.frame.callee.name, "stopMe"); gThreadClient.resume(function () { finishClient(gClient); }); }); gDebuggee.eval("(" + function () { function stopMe() { debugger;
--- a/devtools/server/tests/unit/test_frameactor-02.js +++ b/devtools/server/tests/unit/test_frameactor-02.js @@ -1,38 +1,40 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Verify that two pauses in a row will keep the same frame actor. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket2) { - do_check_eq(aPacket1.frame.actor, aPacket2.frame.actor); +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet1) { + gThreadClient.addOneTimeListener("paused", function (event, packet2) { + do_check_eq(packet1.frame.actor, packet2.frame.actor); gThreadClient.resume(function () { finishClient(gClient); }); }); gThreadClient.resume(); }); gDebuggee.eval("(" + function () {
--- a/devtools/server/tests/unit/test_frameactor-03.js +++ b/devtools/server/tests/unit/test_frameactor-03.js @@ -1,40 +1,42 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Verify that a frame actor is properly expired when the frame goes away. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket2) { - let poppedFrames = aPacket2.poppedFrames; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet1) { + gThreadClient.addOneTimeListener("paused", function (event, packet2) { + let poppedFrames = packet2.poppedFrames; do_check_eq(typeof (poppedFrames), typeof ([])); - do_check_true(poppedFrames.indexOf(aPacket1.frame.actor) >= 0); + do_check_true(poppedFrames.indexOf(packet1.frame.actor) >= 0); gThreadClient.resume(function () { finishClient(gClient); }); }); gThreadClient.resume(); }); gDebuggee.eval("(" + function () {
--- a/devtools/server/tests/unit/test_frameactor-04.js +++ b/devtools/server/tests/unit/test_frameactor-04.js @@ -1,29 +1,31 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Verify the "frames" request on the thread. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } var gFrames = [ // Function calls... { type: "call", callee: { name: "depth3" } }, { type: "call", callee: { name: "depth2" } }, @@ -41,43 +43,43 @@ var gSliceTests = [ { start: 0, count: 1 }, { start: 2, count: 2 }, { start: 1, count: 15 }, { start: 15, count: undefined }, ]; function test_frame_slice() { if (gSliceTests.length == 0) { - gThreadClient.resume(function () { finishClient(gClient); }); + gThreadClient.resume(() => finishClient(gClient)); return; } let test = gSliceTests.shift(); - gThreadClient.getFrames(test.start, test.count, function (aResponse) { - var testFrames = gFrames.slice(test.start, test.count ? test.start + test.count : undefined); - do_check_eq(testFrames.length, aResponse.frames.length); - for (var i = 0; i < testFrames.length; i++) { + gThreadClient.getFrames(test.start, test.count, function (response) { + let testFrames = gFrames.slice(test.start, + test.count ? test.start + test.count : undefined); + do_check_eq(testFrames.length, response.frames.length); + for (let i = 0; i < testFrames.length; i++) { let expected = testFrames[i]; - let actual = aResponse.frames[i]; + let actual = response.frames[i]; if (test.resetActors) { expected.actor = actual.actor; } for (let key of ["type", "callee-name"]) { do_check_eq(expected[key] || undefined, actual[key]); } } test_frame_slice(); }); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) { +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { test_frame_slice(); }); gDebuggee.eval("(" + function () { function depth3() { debugger; } function depth2() {
--- a/devtools/server/tests/unit/test_frameactor-05.js +++ b/devtools/server/tests/unit/test_frameactor-05.js @@ -1,78 +1,54 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Verify that frame actors retrieved with the frames request * are included in the pause packet's popped-frames property. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_frame_slice() { - if (gSliceTests.length == 0) { - gThreadClient.resume(function () { finishClient(gClient); }); - return; - } - - let test = gSliceTests.shift(); - gThreadClient.getFrames(test.start, test.count, function (aResponse) { - var testFrames = gFrames.slice(test.start, test.count ? test.start + test.count : undefined); - do_check_eq(testFrames.length, aResponse.frames.length); - for (var i = 0; i < testFrames.length; i++) { - let expected = testFrames[i]; - let actual = aResponse.frames[i]; - - if (test.resetActors) { - expected.actor = actual.actor; - } - - for (var key in expected) { - do_check_eq(expected[key], actual[key]); - } - } - test_frame_slice(); - }); -} - -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) { - gThreadClient.getFrames(0, null, function (aFrameResponse) { - do_check_eq(aFrameResponse.frames.length, 5); +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.getFrames(0, null, function (frameResponse) { + do_check_eq(frameResponse.frames.length, 5); // Now wait for the next pause, after which the three // youngest actors should be popped.. - let expectPopped = aFrameResponse.frames.slice(0, 3).map(frame => frame.actor); + let expectPopped = frameResponse.frames.slice(0, 3).map(frame => frame.actor); expectPopped.sort(); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPausePacket) { - let popped = aPausePacket.poppedFrames.sort(); + gThreadClient.addOneTimeListener("paused", function (event, pausePacket) { + let popped = pausePacket.poppedFrames.sort(); do_check_eq(popped.length, 3); for (let i = 0; i < 3; i++) { do_check_eq(expectPopped[i], popped[i]); } - gThreadClient.resume(function () { finishClient(gClient); }); + gThreadClient.resume(() => finishClient(gClient)); }); gThreadClient.resume(); }); }); gDebuggee.eval("(" + function () { function depth3() { debugger;
--- a/devtools/server/tests/unit/test_frameactor_wasm-01.js +++ b/devtools/server/tests/unit/test_frameactor_wasm-01.js @@ -1,65 +1,70 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Verify that wasm frame(s) can be requested from the client. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { if (typeof WebAssembly == "undefined") { - return; // wasm is not enabled for this platform + // wasm is not enabled for this platform + return; } initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - gThreadClient.reconfigure({ observeAsmJS: true }, function (aResponse) { - do_check_eq(!!aResponse.error, false); - test_pause_frame(); + attachTestTabAndResume( + gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + gThreadClient.reconfigure({ observeAsmJS: true }, function (response) { + do_check_eq(!!response.error, false); + test_pause_frame(); + }); }); - }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket1) { - gThreadClient.getFrames(0, null, function (aFrameResponse) { - do_check_eq(aFrameResponse.frames.length, 4); +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.getFrames(0, null, function (frameResponse) { + do_check_eq(frameResponse.frames.length, 4); - let wasmFrame = aFrameResponse.frames[1]; + let wasmFrame = frameResponse.frames[1]; do_check_eq(wasmFrame.type, "wasmcall"); do_check_eq(wasmFrame.this, undefined); let location = wasmFrame.where; do_check_eq(location.line > 0, true); do_check_eq(location.column > 0, true); do_check_eq(location.source.url.endsWith(" > wasm"), true); finishClient(gClient); }); }); + /* eslint-disable comma-spacing, max-len */ gDebuggee.eval("(" + function () { // WebAssembly bytecode was generated by running: // js -e 'print(wasmTextToBinary("(module(import \"a\" \"b\")(func(export \"c\")call 0))"))' - var m = new WebAssembly.Module(new Uint8Array([ + let m = new WebAssembly.Module(new Uint8Array([ 0,97,115,109,1,0,0,0,1,132,128,128,128,0,1,96,0,0,2,135,128,128,128,0,1,1,97,1, 98,0,0,3,130,128,128,128,0,1,0,6,129,128,128,128,0,0,7,133,128,128,128,0,1,1,99, 0,1,10,138,128,128,128,0,1,132,128,128,128,0,0,16,0,11 ])); - var i = new WebAssembly.Instance(m, {a: {b: () => { + let i = new WebAssembly.Instance(m, {a: {b: () => { debugger; }}}); i.exports.c(); } + ")()"); }
--- a/devtools/server/tests/unit/test_framearguments-01.js +++ b/devtools/server/tests/unit/test_framearguments-01.js @@ -1,51 +1,52 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check a frame actor's arguments property. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame["arguments"]; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args.length, 6); do_check_eq(args[0], 42); do_check_eq(args[1], true); do_check_eq(args[2], "nasu"); do_check_eq(args[3].type, "null"); do_check_eq(args[4].type, "undefined"); do_check_eq(args[5].type, "object"); do_check_eq(args[5].class, "Object"); do_check_true(!!args[5].actor); gThreadClient.resume(function () { finishClient(gClient); }); }); gDebuggee.eval("(" + function () { - function stopMe(aNumber, aBool, aString, aNull, aUndefined, aObject) { + function stopMe(number, bool, string, null_, undef, object) { debugger; } stopMe(42, true, "nasu", null, undefined, { foo: "bar" }); } + ")()"); }
--- a/devtools/server/tests/unit/test_framebindings-01.js +++ b/devtools/server/tests/unit/test_framebindings-01.js @@ -1,77 +1,80 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check a frame actor's bindings property. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let bindings = aPacket.frame.environment.bindings; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let bindings = packet.frame.environment.bindings; let args = bindings.arguments; let vars = bindings.variables; do_check_eq(args.length, 6); - do_check_eq(args[0].aNumber.value, 42); - do_check_eq(args[1].aBool.value, true); - do_check_eq(args[2].aString.value, "nasu"); - do_check_eq(args[3].aNull.value.type, "null"); - do_check_eq(args[4].aUndefined.value.type, "undefined"); - do_check_eq(args[5].aObject.value.type, "object"); - do_check_eq(args[5].aObject.value.class, "Object"); - do_check_true(!!args[5].aObject.value.actor); + do_check_eq(args[0].number.value, 42); + do_check_eq(args[1].bool.value, true); + do_check_eq(args[2].string.value, "nasu"); + do_check_eq(args[3].null_.value.type, "null"); + do_check_eq(args[4].undef.value.type, "undefined"); + do_check_eq(args[5].object.value.type, "object"); + do_check_eq(args[5].object.value.class, "Object"); + do_check_true(!!args[5].object.value.actor); do_check_eq(vars.a.value, 1); do_check_eq(vars.b.value, true); do_check_eq(vars.c.value.type, "object"); do_check_eq(vars.c.value.class, "Object"); do_check_true(!!vars.c.value.actor); let objClient = gThreadClient.pauseGrip(vars.c.value); - objClient.getPrototypeAndProperties(function (aResponse) { - do_check_eq(aResponse.ownProperties.a.configurable, true); - do_check_eq(aResponse.ownProperties.a.enumerable, true); - do_check_eq(aResponse.ownProperties.a.writable, true); - do_check_eq(aResponse.ownProperties.a.value, "a"); + objClient.getPrototypeAndProperties(function (response) { + do_check_eq(response.ownProperties.a.configurable, true); + do_check_eq(response.ownProperties.a.enumerable, true); + do_check_eq(response.ownProperties.a.writable, true); + do_check_eq(response.ownProperties.a.value, "a"); - do_check_eq(aResponse.ownProperties.b.configurable, true); - do_check_eq(aResponse.ownProperties.b.enumerable, true); - do_check_eq(aResponse.ownProperties.b.writable, true); - do_check_eq(aResponse.ownProperties.b.value.type, "undefined"); - do_check_false("class" in aResponse.ownProperties.b.value); + do_check_eq(response.ownProperties.b.configurable, true); + do_check_eq(response.ownProperties.b.enumerable, true); + do_check_eq(response.ownProperties.b.writable, true); + do_check_eq(response.ownProperties.b.value.type, "undefined"); + do_check_false("class" in response.ownProperties.b.value); gThreadClient.resume(function () { finishClient(gClient); }); }); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { - function stopMe(aNumber, aBool, aString, aNull, aUndefined, aObject) { + function stopMe(number, bool, string, null_, undef, object) { var a = 1; var b = true; var c = { a: "a", b: undefined }; debugger; } stopMe(42, true, "nasu", null, undefined, { foo: "bar" }); } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_framebindings-02.js +++ b/devtools/server/tests/unit/test_framebindings-02.js @@ -1,63 +1,65 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check a frame actor's parent bindings. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let parentEnv = aPacket.frame.environment.parent; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let parentEnv = packet.frame.environment.parent; let bindings = parentEnv.bindings; let args = bindings.arguments; let vars = bindings.variables; do_check_neq(parentEnv, undefined); do_check_eq(args.length, 0); do_check_eq(vars.stopMe.value.type, "object"); do_check_eq(vars.stopMe.value.class, "Function"); do_check_true(!!vars.stopMe.value.actor); // Skip the global lexical scope. parentEnv = parentEnv.parent.parent; do_check_neq(parentEnv, undefined); let objClient = gThreadClient.pauseGrip(parentEnv.object); - objClient.getPrototypeAndProperties(function (aResponse) { - do_check_eq(aResponse.ownProperties.Object.value.type, "object"); - do_check_eq(aResponse.ownProperties.Object.value.class, "Function"); - do_check_true(!!aResponse.ownProperties.Object.value.actor); + objClient.getPrototypeAndProperties(function (response) { + do_check_eq(response.ownProperties.Object.value.type, "object"); + do_check_eq(response.ownProperties.Object.value.class, "Function"); + do_check_true(!!response.ownProperties.Object.value.actor); gThreadClient.resume(function () { finishClient(gClient); }); }); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { - function stopMe(aNumber, aBool, aString, aNull, aUndefined, aObject) { + function stopMe(number, bool, string, null_, undef, object) { var a = 1; var b = true; var c = { a: "a" }; debugger; } stopMe(42, true, "nasu", null, undefined, { foo: "bar" }); } + ")()"); }
--- a/devtools/server/tests/unit/test_framebindings-03.js +++ b/devtools/server/tests/unit/test_framebindings-03.js @@ -1,69 +1,73 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* strict mode code may not contain 'with' statements */ +/* eslint-disable strict */ + /** * Check a |with| frame actor's bindings. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let env = aPacket.frame.environment; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let env = packet.frame.environment; do_check_neq(env, undefined); let parentEnv = env.parent; do_check_neq(parentEnv, undefined); let bindings = parentEnv.bindings; let args = bindings.arguments; let vars = bindings.variables; do_check_eq(args.length, 1); - do_check_eq(args[0].aNumber.value, 10); + do_check_eq(args[0].number.value, 10); do_check_eq(vars.r.value, 10); do_check_eq(vars.a.value, Math.PI * 100); do_check_eq(vars.arguments.value.class, "Arguments"); do_check_true(!!vars.arguments.value.actor); let objClient = gThreadClient.pauseGrip(env.object); - objClient.getPrototypeAndProperties(function (aResponse) { - do_check_eq(aResponse.ownProperties.PI.value, Math.PI); - do_check_eq(aResponse.ownProperties.cos.value.type, "object"); - do_check_eq(aResponse.ownProperties.cos.value.class, "Function"); - do_check_true(!!aResponse.ownProperties.cos.value.actor); + objClient.getPrototypeAndProperties(function (response) { + do_check_eq(response.ownProperties.PI.value, Math.PI); + do_check_eq(response.ownProperties.cos.value.type, "object"); + do_check_eq(response.ownProperties.cos.value.class, "Function"); + do_check_true(!!response.ownProperties.cos.value.actor); gThreadClient.resume(function () { finishClient(gClient); }); }); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { - function stopMe(aNumber) { + function stopMe(number) { var a; - var r = aNumber; + var r = number; with (Math) { a = PI * r * r; debugger; } } stopMe(10); } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_framebindings-04.js +++ b/devtools/server/tests/unit/test_framebindings-04.js @@ -1,84 +1,88 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +/* strict mode code may not contain 'with' statements */ +/* eslint-disable strict */ /** - * Check the environment bindongs of a |with| within a |with|. + * Check the environment bindings of a |with| within a |with|. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let env = aPacket.frame.environment; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let env = packet.frame.environment; do_check_neq(env, undefined); let objClient = gThreadClient.pauseGrip(env.object); - objClient.getPrototypeAndProperties(function (aResponse) { - do_check_eq(aResponse.ownProperties.one.value, 1); - do_check_eq(aResponse.ownProperties.two.value, 2); - do_check_eq(aResponse.ownProperties.foo, undefined); + objClient.getPrototypeAndProperties(function (response) { + do_check_eq(response.ownProperties.one.value, 1); + do_check_eq(response.ownProperties.two.value, 2); + do_check_eq(response.ownProperties.foo, undefined); let parentEnv = env.parent; do_check_neq(parentEnv, undefined); let parentClient = gThreadClient.pauseGrip(parentEnv.object); - parentClient.getPrototypeAndProperties(function (aResponse) { - do_check_eq(aResponse.ownProperties.PI.value, Math.PI); - do_check_eq(aResponse.ownProperties.cos.value.type, "object"); - do_check_eq(aResponse.ownProperties.cos.value.class, "Function"); - do_check_true(!!aResponse.ownProperties.cos.value.actor); + parentClient.getPrototypeAndProperties(function (response) { + do_check_eq(response.ownProperties.PI.value, Math.PI); + do_check_eq(response.ownProperties.cos.value.type, "object"); + do_check_eq(response.ownProperties.cos.value.class, "Function"); + do_check_true(!!response.ownProperties.cos.value.actor); parentEnv = parentEnv.parent; do_check_neq(parentEnv, undefined); let bindings = parentEnv.bindings; let args = bindings.arguments; let vars = bindings.variables; do_check_eq(args.length, 1); - do_check_eq(args[0].aNumber.value, 10); + do_check_eq(args[0].number.value, 10); do_check_eq(vars.r.value, 10); do_check_eq(vars.a.value, Math.PI * 100); do_check_eq(vars.arguments.value.class, "Arguments"); do_check_true(!!vars.arguments.value.actor); do_check_eq(vars.foo.value, 2 * Math.PI); gThreadClient.resume(function () { finishClient(gClient); }); }); }); - }); + /* eslint-disable */ gDebuggee.eval("(" + function () { - function stopMe(aNumber) { + function stopMe(number) { var a, obj = { one: 1, two: 2 }; - var r = aNumber; + var r = number; with (Math) { a = PI * r * r; with (obj) { var foo = two * PI; debugger; } } } stopMe(10); } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_framebindings-05.js +++ b/devtools/server/tests/unit/test_framebindings-05.js @@ -1,57 +1,59 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check the environment bindings of a |with| in global scope. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let env = aPacket.frame.environment; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let env = packet.frame.environment; do_check_neq(env, undefined); let objClient = gThreadClient.pauseGrip(env.object); - objClient.getPrototypeAndProperties(function (aResponse) { - do_check_eq(aResponse.ownProperties.PI.value, Math.PI); - do_check_eq(aResponse.ownProperties.cos.value.type, "object"); - do_check_eq(aResponse.ownProperties.cos.value.class, "Function"); - do_check_true(!!aResponse.ownProperties.cos.value.actor); + objClient.getPrototypeAndProperties(function (response) { + do_check_eq(response.ownProperties.PI.value, Math.PI); + do_check_eq(response.ownProperties.cos.value.type, "object"); + do_check_eq(response.ownProperties.cos.value.class, "Function"); + do_check_true(!!response.ownProperties.cos.value.actor); // Skip the global lexical scope. let parentEnv = env.parent.parent; do_check_neq(parentEnv, undefined); let parentClient = gThreadClient.pauseGrip(parentEnv.object); - parentClient.getPrototypeAndProperties(function (aResponse) { - do_check_eq(aResponse.ownProperties.a.value, Math.PI * 100); - do_check_eq(aResponse.ownProperties.r.value, 10); - do_check_eq(aResponse.ownProperties.Object.value.type, "object"); - do_check_eq(aResponse.ownProperties.Object.value.class, "Function"); - do_check_true(!!aResponse.ownProperties.Object.value.actor); + parentClient.getPrototypeAndProperties(function (response) { + do_check_eq(response.ownProperties.a.value, Math.PI * 100); + do_check_eq(response.ownProperties.r.value, 10); + do_check_eq(response.ownProperties.Object.value.type, "object"); + do_check_eq(response.ownProperties.Object.value.class, "Function"); + do_check_true(!!response.ownProperties.Object.value.actor); gThreadClient.resume(function () { finishClient(gClient); }); }); }); });
--- a/devtools/server/tests/unit/test_framebindings-06.js +++ b/devtools/server/tests/unit/test_framebindings-06.js @@ -1,37 +1,37 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_banana_environment(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_banana_environment(); + }); }); do_test_pending(); } -function test_banana_environment() -{ - +function test_banana_environment() { gThreadClient.addOneTimeListener("paused", - function (aEvent, aPacket) { - equal(aPacket.type, "paused"); - let env = aPacket.frame.environment; + function (event, packet) { + equal(packet.type, "paused"); + let env = packet.frame.environment; equal(env.type, "function"); equal(env.function.name, "banana3"); let parent = env.parent; equal(parent.type, "block"); ok("banana3" in parent.bindings.variables); parent = parent.parent; equal(parent.type, "function"); equal(parent.function.name, "banana2"); @@ -42,19 +42,17 @@ function test_banana_environment() equal(parent.type, "function"); equal(parent.function.name, "banana"); gThreadClient.resume(function () { finishClient(gClient); }); }); - gDebuggee.eval("\ - function banana(x) { \n\ - return function banana2(y) { \n\ - return function banana3(z) { \n\ - debugger; \n\ - }; \n\ - }; \n\ - } \n\ - banana('x')('y')('z'); \n\ - "); + gDebuggee.eval("function banana(x) {\n" + + " return function banana2(y) {\n" + + " return function banana3(z) {\n" + + " debugger;\n" + + " };\n" + + " };\n" + + "}\n" + + "banana('x')('y')('z');\n"); }
--- a/devtools/server/tests/unit/test_framebindings-07.js +++ b/devtools/server/tests/unit/test_framebindings-07.js @@ -1,64 +1,63 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; var gDebuggee; var gClient; var gThreadClient; // Test that the EnvironmentClient's getBindings() method works as expected. -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-bindings"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-bindings", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_banana_environment(); - }); + attachTestTabAndResume(gClient, "test-bindings", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_banana_environment(); + }); }); do_test_pending(); } -function test_banana_environment() -{ - - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let environment = aPacket.frame.environment; +function test_banana_environment() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let environment = packet.frame.environment; do_check_eq(environment.type, "function"); let parent = environment.parent; do_check_eq(parent.type, "block"); let grandpa = parent.parent; do_check_eq(grandpa.type, "function"); let envClient = gThreadClient.environment(environment); - envClient.getBindings(aResponse => { - do_check_eq(aResponse.bindings.arguments[0].z.value, "z"); + envClient.getBindings(response => { + do_check_eq(response.bindings.arguments[0].z.value, "z"); let parentClient = gThreadClient.environment(parent); - parentClient.getBindings(aResponse => { - do_check_eq(aResponse.bindings.variables.banana3.value.class, "Function"); + parentClient.getBindings(response => { + do_check_eq(response.bindings.variables.banana3.value.class, "Function"); let grandpaClient = gThreadClient.environment(grandpa); - grandpaClient.getBindings(aResponse => { - do_check_eq(aResponse.bindings.arguments[0].y.value, "y"); + grandpaClient.getBindings(response => { + do_check_eq(response.bindings.arguments[0].y.value, "y"); gThreadClient.resume(() => finishClient(gClient)); }); }); }); }); - gDebuggee.eval("\ - function banana(x) { \n\ - return function banana2(y) { \n\ - return function banana3(z) { \n\ - debugger; \n\ - }; \n\ - }; \n\ - } \n\ - banana('x')('y')('z'); \n\ - "); + gDebuggee.eval("function banana(x) {\n" + + " return function banana2(y) {\n" + + " return function banana3(z) {\n" + + " debugger;\n" + + " };\n" + + " };\n" + + "}\n" + + "banana('x')('y')('z');\n"); }
--- a/devtools/server/tests/unit/test_frameclient-01.js +++ b/devtools/server/tests/unit/test_frameclient-01.js @@ -1,32 +1,34 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable max-nested-callbacks */ + +"use strict"; var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { gThreadClient.addOneTimeListener("framesadded", function () { do_check_eq(gThreadClient.cachedFrames.length, 3); do_check_true(gThreadClient.moreFrames); do_check_false(gThreadClient.fillFrames(3)); do_check_true(gThreadClient.fillFrames(30)); gThreadClient.addOneTimeListener("framesadded", function () { do_check_false(gThreadClient.moreFrames); @@ -34,20 +36,22 @@ function test_pause_frame() gThreadClient.resume(function () { finishClient(gClient); }); }); }); do_check_true(gThreadClient.fillFrames(3)); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { var recurseLeft = 5; function recurse() { if (--recurseLeft == 0) { debugger; return; } recurse(); } recurse(); } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_frameclient-02.js +++ b/devtools/server/tests/unit/test_frameclient-02.js @@ -1,46 +1,49 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { // Ask for exactly the number of frames we expect. gThreadClient.addOneTimeListener("framesadded", function () { do_check_false(gThreadClient.moreFrames); gThreadClient.resume(function () { finishClient(gClient); }); }); do_check_true(gThreadClient.fillFrames(3)); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { var recurseLeft = 1; function recurse() { if (--recurseLeft == 0) { debugger; return; } recurse(); } recurse(); } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_functiongrips-01.js +++ b/devtools/server/tests/unit/test_functiongrips-01.js @@ -1,93 +1,93 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_named_function(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_named_function(); + }); }); do_test_pending(); } -function test_named_function() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_named_function() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args[0].class, "Function"); do_check_eq(args[0].name, "stopMe"); do_check_eq(args[0].displayName, "stopMe"); let objClient = gThreadClient.pauseGrip(args[0]); - objClient.getParameterNames(function (aResponse) { - do_check_eq(aResponse.parameterNames.length, 1); - do_check_eq(aResponse.parameterNames[0], "arg1"); + objClient.getParameterNames(function (response) { + do_check_eq(response.parameterNames.length, 1); + do_check_eq(response.parameterNames[0], "arg1"); gThreadClient.resume(test_inferred_name_function); }); - }); gDebuggee.eval("stopMe(stopMe)"); } function test_inferred_name_function() { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args[0].class, "Function"); // No name for an anonymous function, but it should have an inferred name. do_check_eq(args[0].name, undefined); do_check_eq(args[0].displayName, "m"); let objClient = gThreadClient.pauseGrip(args[0]); - objClient.getParameterNames(function (aResponse) { - do_check_eq(aResponse.parameterNames.length, 3); - do_check_eq(aResponse.parameterNames[0], "foo"); - do_check_eq(aResponse.parameterNames[1], "bar"); - do_check_eq(aResponse.parameterNames[2], "baz"); + objClient.getParameterNames(function (response) { + do_check_eq(response.parameterNames.length, 3); + do_check_eq(response.parameterNames[0], "foo"); + do_check_eq(response.parameterNames[1], "bar"); + do_check_eq(response.parameterNames[2], "baz"); gThreadClient.resume(test_anonymous_function); }); }); gDebuggee.eval("var o = { m: function(foo, bar, baz) { } }; stopMe(o.m)"); } function test_anonymous_function() { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args[0].class, "Function"); // No name for an anonymous function, and no inferred name, either. do_check_eq(args[0].name, undefined); do_check_eq(args[0].displayName, undefined); let objClient = gThreadClient.pauseGrip(args[0]); - objClient.getParameterNames(function (aResponse) { - do_check_eq(aResponse.parameterNames.length, 3); - do_check_eq(aResponse.parameterNames[0], "foo"); - do_check_eq(aResponse.parameterNames[1], "bar"); - do_check_eq(aResponse.parameterNames[2], "baz"); + objClient.getParameterNames(function (response) { + do_check_eq(response.parameterNames.length, 3); + do_check_eq(response.parameterNames[0], "foo"); + do_check_eq(response.parameterNames[1], "bar"); + do_check_eq(response.parameterNames[2], "baz"); gThreadClient.resume(function () { finishClient(gClient); }); }); }); gDebuggee.eval("stopMe(function(foo, bar, baz) { })");
--- a/devtools/server/tests/unit/test_get-executable-lines-source-map.js +++ b/devtools/server/tests/unit/test_get-executable-lines-source-map.js @@ -1,12 +1,14 @@ /* 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/. */ +"use strict"; + /** * Test if getExecutableLines return correct information */ var gDebuggee; var gClient; var gThreadClient; @@ -15,18 +17,18 @@ const SOURCE_MAPPED_FILE = getFileUrl("s function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-get-executable-lines"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function _onConnect() { attachTestTabAndResume( gClient, "test-get-executable-lines", - function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + function (response, tabClient, threadClient) { + gThreadClient = threadClient; test_executable_lines(); } ); }); do_test_pending(); }
--- a/devtools/server/tests/unit/test_get-executable-lines.js +++ b/devtools/server/tests/unit/test_get-executable-lines.js @@ -1,12 +1,14 @@ /* 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/. */ +"use strict"; + /** * Test if getExecutableLines return correct information */ var gDebuggee; var gClient; var gThreadClient; @@ -15,18 +17,18 @@ const SOURCE_MAPPED_FILE = getFileUrl("s function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-get-executable-lines"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function _onConnect() { attachTestTabAndResume( gClient, "test-get-executable-lines", - function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + function (response, tabClient, threadClient) { + gThreadClient = threadClient; test_executable_lines(); } ); }); do_test_pending(); }
--- a/devtools/server/tests/unit/test_getRuleText.js +++ b/devtools/server/tests/unit/test_getRuleText.js @@ -19,17 +19,18 @@ const TEST_DATA = [ desc: "Simplest test case", input: "#id{color:red;background:yellow;}", line: 1, column: 1, expected: {offset: 4, text: "color:red;background:yellow;"} }, { desc: "Multiple rules test case", - input: "#id{color:red;background:yellow;}.class-one .class-two { position:absolute; line-height: 45px}", + input: "#id{color:red;background:yellow;}.class-one .class-two " + + "{ position:absolute; line-height: 45px}", line: 1, column: 34, expected: {offset: 56, text: " position:absolute; line-height: 45px"} }, { desc: "Unclosed rule", input: "#id{color:red;background:yellow;", line: 1,
--- a/devtools/server/tests/unit/test_getyoungestframe.js +++ b/devtools/server/tests/unit/test_getyoungestframe.js @@ -1,27 +1,27 @@ -function run_test() -{ +/* eslint-disable strict */ +function run_test() { Components.utils.import("resource://gre/modules/jsdebugger.jsm"); addDebuggerToGlobal(this); - var xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); - var g = testGlobal("test1"); + let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); + let g = testGlobal("test1"); - var dbg = new Debugger(); + let dbg = new Debugger(); dbg.uncaughtExceptionHook = testExceptionHook; dbg.addDebuggee(g); - dbg.onDebuggerStatement = function (aFrame) { - do_check_true(aFrame === dbg.getNewestFrame()); + dbg.onDebuggerStatement = function (frame) { + do_check_true(frame === dbg.getNewestFrame()); // Execute from the nested event loop, dbg.getNewestFrame() won't // be working anymore. do_execute_soon(function () { try { - do_check_true(aFrame === dbg.getNewestFrame()); + do_check_true(frame === dbg.getNewestFrame()); } finally { xpcInspector.exitNestedEventLoop("test"); } }); xpcInspector.enterNestedEventLoop("test"); }; g.eval("function debuggerStatement() { debugger; }; debuggerStatement();");
--- a/devtools/server/tests/unit/test_ignore_caught_exceptions.js +++ b/devtools/server/tests/unit/test_ignore_caught_exceptions.js @@ -1,50 +1,56 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Test that setting ignoreCaughtExceptions will cause the debugger to ignore * caught exceptions, but not uncaught ones. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "exception"); - do_check_eq(aPacket.why.exception, "bar"); +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.why.type, "exception"); + do_check_eq(packet.why.exception, "bar"); gThreadClient.resume(function () { finishClient(gClient); }); }); gThreadClient.pauseOnExceptions(true, true); gThreadClient.resume(); }); try { + /* eslint-disable */ gDebuggee.eval("(" + function () { debugger; try { throw "foo"; } catch (e) {} throw "bar"; } + ")()"); - } catch (e) {} + /* eslint-enable */ + } catch (e) { + /* Empty */ + } }
--- a/devtools/server/tests/unit/test_ignore_no_interface_exceptions.js +++ b/devtools/server/tests/unit/test_ignore_no_interface_exceptions.js @@ -1,54 +1,56 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Test that the debugger automatically ignores NS_ERROR_NO_INTERFACE * exceptions, but not normal ones. */ - var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-no-interface"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-no-interface", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-no-interface", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ +function test_pause_frame() { gThreadClient.pauseOnExceptions(true, false, function () { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "exception"); - do_check_eq(aPacket.why.exception, 42); + gThreadClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.why.type, "exception"); + do_check_eq(packet.why.exception, 42); gThreadClient.resume(function () { finishClient(gClient); }); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { function QueryInterface() { throw Components.results.NS_ERROR_NO_INTERFACE; } function stopMe() { throw 42; } try { QueryInterface(); } catch (e) {} try { stopMe(); } catch (e) {} } + ")()"); + /* eslint-enable */ }); }
--- a/devtools/server/tests/unit/test_interrupt.js +++ b/devtools/server/tests/unit/test_interrupt.js @@ -1,50 +1,49 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; var gClient; var gDebuggee; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = testGlobal("test-1"); DebuggerServer.addTestGlobal(gDebuggee); let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect().then(function (aType, aTraits) { + gClient.connect().then(function (type, traits) { attachTestTab(gClient, "test-1", test_attach); }); do_test_pending(); } -function test_attach(aResponse, aTabClient) -{ - aTabClient.attachThread({}, function (aResponse, aThreadClient) { - do_check_eq(aThreadClient.paused, true); - aThreadClient.resume(function () { - test_interrupt(aThreadClient); +function test_attach(response, tabClient) { + tabClient.attachThread({}, function (response, threadClient) { + do_check_eq(threadClient.paused, true); + threadClient.resume(function () { + test_interrupt(threadClient); }); }); } -function test_interrupt(aThreadClient) -{ - do_check_eq(aThreadClient.paused, false); - aThreadClient.interrupt(function (aResponse) { - do_check_eq(aThreadClient.paused, true); - aThreadClient.resume(function () { - do_check_eq(aThreadClient.paused, false); +function test_interrupt(threadClient) { + do_check_eq(threadClient.paused, false); + threadClient.interrupt(function (response) { + do_check_eq(threadClient.paused, true); + threadClient.resume(function () { + do_check_eq(threadClient.paused, false); cleanup(); }); }); } -function cleanup() -{ - gClient.addListener("closed", function (aEvent) { +function cleanup() { + gClient.addListener("closed", function (event) { do_test_finished(); }); gClient.close(); }
--- a/devtools/server/tests/unit/test_layout-reflows-observer.js +++ b/devtools/server/tests/unit/test_layout-reflows-observer.js @@ -1,11 +1,13 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + // Test the LayoutChangesObserver var { getLayoutChangesObserver, releaseLayoutChangesObserver, LayoutChangesObserver } = require("devtools/server/actors/reflow");
--- a/devtools/server/tests/unit/test_listsources-01.js +++ b/devtools/server/tests/unit/test_listsources-01.js @@ -1,59 +1,62 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check basic getSources functionality. */ var gDebuggee; var gClient; var gThreadClient; var gNumTimesSourcesSent = 0; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.request = (function (request) { - return function (aRequest, aOnResponse) { - if (aRequest.type === "sources") { + gClient.request = (function (origRequest) { + return function (request, onResponse) { + if (request.type === "sources") { ++gNumTimesSourcesSent; } - return request.call(this, aRequest, aOnResponse); + return origRequest.call(this, request, onResponse); }; }(gClient.request)); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_listsources(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_listsources(); + }); }); do_test_pending(); } -function test_simple_listsources() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.getSources(function (aResponse) { - do_check_true(aResponse.sources.some(function (s) { +function test_simple_listsources() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.getSources(function (response) { + do_check_true(response.sources.some(function (s) { return s.url && s.url.match(/test_listsources-01.js/); })); do_check_true(gNumTimesSourcesSent <= 1, "Should only send one sources request at most, even though we" + " might have had to send one to determine feature support."); gThreadClient.resume(function () { finishClient(gClient); }); }); }); + /* eslint-disable */ Components.utils.evalInSandbox("var line0 = Error().lineNumber;\n" + "debugger;\n" + // line0 + 1 "var a = 1;\n" + // line0 + 2 "var b = 2;\n", // line0 + 3 gDebuggee); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_listsources-02.js +++ b/devtools/server/tests/unit/test_listsources-02.js @@ -1,49 +1,49 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check getting sources before there are any. */ -var gDebuggee; var gClient; var gThreadClient; var gNumTimesSourcesSent = 0; -function run_test() -{ +function run_test() { initTestDebuggerServer(); - gDebuggee = addTestGlobal("test-stack"); + addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.request = (function (request) { - return function (aRequest, aOnResponse) { - if (aRequest.type === "sources") { + gClient.request = (function (origRequest) { + return function (request, onResponse) { + if (request.type === "sources") { ++gNumTimesSourcesSent; } - return request.call(this, aRequest, aOnResponse); + return origRequest.call(this, request, onResponse); }; }(gClient.request)); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_listing_zero_sources(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_listing_zero_sources(); + }); }); do_test_pending(); } -function test_listing_zero_sources() -{ - gThreadClient.getSources(function (aPacket) { - do_check_true(!aPacket.error); - do_check_true(!!aPacket.sources); - do_check_eq(aPacket.sources.length, 0); +function test_listing_zero_sources() { + gThreadClient.getSources(function (packet) { + do_check_true(!packet.error); + do_check_true(!!packet.sources); + do_check_eq(packet.sources.length, 0); do_check_true(gNumTimesSourcesSent <= 1, "Should only send one sources request at most, even though we" + " might have had to send one to determine feature support."); finishClient(gClient); }); }
--- a/devtools/server/tests/unit/test_listsources-03.js +++ b/devtools/server/tests/unit/test_listsources-03.js @@ -1,42 +1,43 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check getSources functionality when there are lots of sources. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-sources"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-sources", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_listsources(); - }); + attachTestTabAndResume(gClient, "test-sources", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_listsources(); + }); }); do_test_pending(); } -function test_simple_listsources() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.getSources(function (aResponse) { +function test_simple_listsources() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.getSources(function (response) { do_check_true( - !aResponse.error, + !response.error, "There shouldn't be an error fetching large amounts of sources."); - do_check_true(aResponse.sources.some(function (s) { + do_check_true(response.sources.some(function (s) { return s.url.match(/foo-999.js$/); })); gThreadClient.resume(function () { finishClient(gClient); }); }); });
--- a/devtools/server/tests/unit/test_listsources-04.js +++ b/devtools/server/tests/unit/test_listsources-04.js @@ -1,10 +1,13 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Check getSources functionality with sourcemaps. */ const {SourceNode} = require("source-map"); function run_test() { @@ -13,32 +16,32 @@ function run_test() { // `rpc` method which talks to the main thread does not work. // run_test_with_server(WorkerDebuggerServer, do_test_finished); do_test_finished(); }); do_test_pending(); } function run_test_with_server(server, cb) { - Task.spawn(function*() { + Task.spawn(function* () { initTestDebuggerServer(server); const debuggee = addTestGlobal("test-sources", server); const client = new DebuggerClient(server.connectPipe()); yield client.connect(); - const [,,threadClient] = yield attachTestTabAndResume(client, "test-sources"); + const [,, threadClient] = yield attachTestTabAndResume(client, "test-sources"); yield threadClient.reconfigure({ useSourceMaps: true }); addSources(debuggee); threadClient.getSources(Task.async(function* (res) { do_check_eq(res.sources.length, 3, "3 sources exist"); yield threadClient.reconfigure({ useSourceMaps: false }); - threadClient.getSources(function(res) { + threadClient.getSources(function (res) { do_check_eq(res.sources.length, 1, "1 source exist"); client.close().then(cb); }); })); }); } function addSources(debuggee) {
--- a/devtools/server/tests/unit/test_longstringactor.js +++ b/devtools/server/tests/unit/test_longstringactor.js @@ -9,59 +9,48 @@ const { LongStringActor } = require("dev function run_test() { test_LSA_destroy(); test_LSA_grip(); test_LSA_onSubstring(); } const TEST_STRING = "This is a very long string!"; -function makeMockLongStringActor() -{ +function makeMockLongStringActor() { let string = TEST_STRING; let actor = new LongStringActor(string); actor.actorID = "longString1"; actor.registeredPool = { longStringActors: { [string]: actor } }; return actor; } -function test_LSA_destroy() -{ +function test_LSA_destroy() { let actor = makeMockLongStringActor(); do_check_eq(actor.registeredPool.longStringActors[TEST_STRING], actor); actor.destroy(); do_check_eq(actor.registeredPool.longStringActors[TEST_STRING], void 0); } -function test_LSA_substring() -{ - let actor = makeMockLongStringActor(); - do_check_eq(actor._substring(0, 4), TEST_STRING.substring(0, 4)); - do_check_eq(actor._substring(6, 9), TEST_STRING.substring(6, 9)); - do_check_eq(actor._substring(0, TEST_STRING.length), TEST_STRING); -} - -function test_LSA_grip() -{ +function test_LSA_grip() { let actor = makeMockLongStringActor(); let grip = actor.grip(); do_check_eq(grip.type, "longString"); - do_check_eq(grip.initial, TEST_STRING.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH)); + do_check_eq(grip.initial, + TEST_STRING.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH)); do_check_eq(grip.length, TEST_STRING.length); do_check_eq(grip.actor, actor.actorID); } -function test_LSA_onSubstring() -{ +function test_LSA_onSubstring() { let actor = makeMockLongStringActor(); let response; // From the start response = actor.onSubstring({ start: 0, end: 4 });
--- a/devtools/server/tests/unit/test_longstringgrips-01.js +++ b/devtools/server/tests/unit/test_longstringgrips-01.js @@ -1,62 +1,64 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_longstring_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_longstring_grip(); + }); }); do_test_pending(); } -function test_longstring_grip() -{ +function test_longstring_grip() { let longString = "All I want is to be a monkey of moderate intelligence who" + " wears a suit... that's why I'm transferring to business school! Maybe I" + " love you so much, I love you no matter who you are pretending to be." + " Enough about your promiscuous mother, Hermes! We have bigger problems." + " For example, if you killed your grandfather, you'd cease to exist! What" + " kind of a father would I be if I said no? Yep, I remember. They came in" + " last at the Olympics, then retired to promote alcoholic beverages! And" + " remember, don't do anything that affects anything, unless it turns out" + " you were supposed to, in which case, for the love of God, don't not do" + " it!"; DebuggerServer.LONG_STRING_LENGTH = 200; - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args.length, 1); let grip = args[0]; try { do_check_eq(grip.type, "longString"); do_check_eq(grip.length, longString.length); - do_check_eq(grip.initial, longString.substr(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH)); + do_check_eq(grip.initial, + longString.substr(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH)); let longStringClient = gThreadClient.pauseLongString(grip); - longStringClient.substring(22, 28, function (aResponse) { + longStringClient.substring(22, 28, function (response) { try { - do_check_eq(aResponse.substring, "monkey"); + do_check_eq(response.substring, "monkey"); } finally { gThreadClient.resume(function () { finishClient(gClient); }); } }); } catch (error) { gThreadClient.resume(function () {
--- a/devtools/server/tests/unit/test_longstringgrips-02.js +++ b/devtools/server/tests/unit/test_longstringgrips-02.js @@ -1,50 +1,50 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { attachTestTabAndResume( - gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; + gClient, "test-grips", function (response, tabClient, threadClient) { + gThreadClient = threadClient; test_longstring_grip(); }); }); do_test_pending(); } -function test_longstring_grip() -{ +function test_longstring_grip() { DebuggerServer.LONG_STRING_LENGTH = 200; - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { try { let fakeLongStringGrip = { type: "longString", length: 1000000, actor: "123fakeActor123", initial: "" }; let longStringClient = gThreadClient.pauseLongString(fakeLongStringGrip); - longStringClient.substring(22, 28, function (aResponse) { + longStringClient.substring(22, 28, function (response) { try { - do_check_true(!!aResponse.error, + do_check_true(!!response.error, "We should not get a response, but an error."); } finally { gThreadClient.resume(function () { finishClient(gClient); }); } }); } catch (error) {
--- a/devtools/server/tests/unit/test_monitor_actor.js +++ b/devtools/server/tests/unit/test_monitor_actor.js @@ -2,18 +2,17 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Test the monitor actor. */ "use strict"; -function run_test() -{ +function run_test() { let EventEmitter = require("devtools/shared/event-emitter"); function MonitorClient(client, form) { this.client = client; this.actor = form.monitorActor; this.events = ["update"]; EventEmitter.decorate(this); @@ -59,17 +58,17 @@ function run_test() function gotUpdate(type, packet) { packet.data.forEach(function (event) { // Ignore updates that were not sent by this test. if (event.graph === "Test") { do_check_eq(event.curve, "test"); do_check_eq(event.value, 42); do_check_eq(event.time, time); - monitor.stop(function (aResponse) { + monitor.stop(function (response) { monitor.destroy(); finishClient(client); }); } }); } do_test_pending();
--- a/devtools/server/tests/unit/test_nativewrappers.js +++ b/devtools/server/tests/unit/test_nativewrappers.js @@ -1,30 +1,31 @@ -function run_test() -{ +/* eslint-disable strict */ +function run_test() { Components.utils.import("resource://gre/modules/jsdebugger.jsm"); addDebuggerToGlobal(this); - var g = testGlobal("test1"); + let g = testGlobal("test1"); - var dbg = new Debugger(); + let dbg = new Debugger(); dbg.addDebuggee(g); - dbg.onDebuggerStatement = function (aFrame) { - let args = aFrame.arguments; + dbg.onDebuggerStatement = function (frame) { + let args = frame.arguments; try { args[0]; do_check_true(true); } catch (ex) { do_check_true(false); } }; g.eval("function stopMe(arg) {debugger;}"); g2 = testGlobal("test2"); g2.g = g; g2.eval("(" + function createBadEvent() { - let parser = Components.classes["@mozilla.org/xmlextras/domparser;1"].createInstance(Components.interfaces.nsIDOMParser); + let parser = Components.classes["@mozilla.org/xmlextras/domparser;1"] + .createInstance(Components.interfaces.nsIDOMParser); let doc = parser.parseFromString("<foo></foo>", "text/xml"); g.stopMe(doc.createEvent("MouseEvent")); } + ")()"); dbg.enabled = false; }
--- a/devtools/server/tests/unit/test_nesting-01.js +++ b/devtools/server/tests/unit/test_nesting-01.js @@ -1,36 +1,41 @@ /* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + // Test that we can nest event loops when needed in // ThreadActor.prototype.unsafeSynchronize. var gClient; var gThreadActor; function run_test() { initTestDebuggerServer(); - let gDebuggee = addTestGlobal("test-nesting"); + addTestGlobal("test-nesting"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-nesting", function (aResponse, aTabClient, aThreadClient) { - // Reach over the protocol connection and get a reference to the thread actor. - gThreadActor = aThreadClient._transport._serverConnection.getActor(aThreadClient._actor); + attachTestTabAndResume( + gClient, "test-nesting", + function (response, tabClient, threadClient) { + // Reach over the protocol connection and get a reference to the thread actor. + gThreadActor = + threadClient._transport._serverConnection.getActor(threadClient._actor); - test_nesting(); - }); + test_nesting(); + }); }); do_test_pending(); } function test_nesting() { const thread = gThreadActor; - const { resolve, reject, promise: p } = promise.defer(); + const { resolve, promise: p } = promise.defer(); let currentStep = 0; executeSoon(function () { // Should be on the first step do_check_eq(++currentStep, 1); // We should have one nested event loop from unsfeSynchronize do_check_eq(thread._nestedEventLoops.size, 1);
--- a/devtools/server/tests/unit/test_nesting-02.js +++ b/devtools/server/tests/unit/test_nesting-02.js @@ -1,37 +1,42 @@ /* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + // Test that we can nest event loops and then automatically exit nested event // loops when requested. var gClient; var gThreadActor; function run_test() { initTestDebuggerServer(); - let gDebuggee = addTestGlobal("test-nesting"); + addTestGlobal("test-nesting"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-nesting", function (aResponse, aTabClient, aThreadClient) { - // Reach over the protocol connection and get a reference to the thread - // actor. - gThreadActor = aThreadClient._transport._serverConnection.getActor(aThreadClient._actor); + attachTestTabAndResume( + gClient, "test-nesting", + function (response, tabClient, threadClient) { + // Reach over the protocol connection and get a reference to the thread + // actor. + gThreadActor = + threadClient._transport._serverConnection.getActor(threadClient._actor); - test_nesting(); - }); + test_nesting(); + }); }); do_test_pending(); } function test_nesting() { const thread = gThreadActor; - const { resolve, reject, promise: p } = promise.defer(); + const { resolve, promise: p } = promise.defer(); // The following things should happen (in order): // 1. In the new event loop (created by unsafeSynchronize) // 2. Resolve the promise (shouldn't exit any event loops) // 3. Exit the event loop (should also then exit unsafeSynchronize's event loop) // 4. Be after the unsafeSynchronize call let currentStep = 0;
--- a/devtools/server/tests/unit/test_nesting-03.js +++ b/devtools/server/tests/unit/test_nesting-03.js @@ -1,51 +1,54 @@ /* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; // Test that we can detect nested event loops in tabs with the same URL. var gClient1, gClient2, gThreadClient1, gThreadClient2; function run_test() { initTestDebuggerServer(); addTestGlobal("test-nesting1"); addTestGlobal("test-nesting1"); // Conect the first client to the first debuggee. gClient1 = new DebuggerClient(DebuggerServer.connectPipe()); gClient1.connect(function () { - attachTestThread(gClient1, "test-nesting1", function (aResponse, aTabClient, aThreadClient) { - gThreadClient1 = aThreadClient; - start_second_connection(); - }); + attachTestThread(gClient1, "test-nesting1", + function (response, tabClient, threadClient) { + gThreadClient1 = threadClient; + start_second_connection(); + }); }); do_test_pending(); } function start_second_connection() { gClient2 = new DebuggerClient(DebuggerServer.connectPipe()); gClient2.connect(function () { - attachTestThread(gClient2, "test-nesting1", function (aResponse, aTabClient, aThreadClient) { - gThreadClient2 = aThreadClient; - test_nesting(); - }); + attachTestThread(gClient2, "test-nesting1", + function (response, tabClient, threadClient) { + gThreadClient2 = threadClient; + test_nesting(); + }); }); } function test_nesting() { - const { resolve, reject, promise: p } = promise.defer(); + gThreadClient1.resume(response => { + do_check_eq(response.error, "wrongOrder"); + gThreadClient2.resume(response => { + do_check_true(!response.error); + do_check_eq(response.from, gThreadClient2.actor); - gThreadClient1.resume(aResponse => { - do_check_eq(aResponse.error, "wrongOrder"); - gThreadClient2.resume(aResponse => { - do_check_true(!aResponse.error); - do_check_eq(aResponse.from, gThreadClient2.actor); - - gThreadClient1.resume(aResponse => { - do_check_true(!aResponse.error); - do_check_eq(aResponse.from, gThreadClient1.actor); + gThreadClient1.resume(response => { + do_check_true(!response.error); + do_check_eq(response.from, gThreadClient1.actor); gClient1.close(() => finishClient(gClient2)); }); }); }); }
--- a/devtools/server/tests/unit/test_new_source-01.js +++ b/devtools/server/tests/unit/test_new_source-01.js @@ -1,40 +1,41 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Check basic newSource packet sent from server. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_simple_new_source(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_simple_new_source(); + }); }); do_test_pending(); } -function test_simple_new_source() -{ - gThreadClient.addOneTimeListener("newSource", function (aEvent, aPacket) { - do_check_eq(aEvent, "newSource"); - do_check_eq(aPacket.type, "newSource"); - do_check_true(!!aPacket.source); - do_check_true(!!aPacket.source.url.match(/test_new_source-01.js$/)); +function test_simple_new_source() { + gThreadClient.addOneTimeListener("newSource", function (event, packet) { + do_check_eq(event, "newSource"); + do_check_eq(packet.type, "newSource"); + do_check_true(!!packet.source); + do_check_true(!!packet.source.url.match(/test_new_source-01.js$/)); finishClient(gClient); }); Components.utils.evalInSandbox(function inc(n) { return n + 1; }.toString(), gDebuggee); }
--- a/devtools/server/tests/unit/test_nsjsinspector.js +++ b/devtools/server/tests/unit/test_nsjsinspector.js @@ -1,44 +1,44 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + // Test the basic functionality of the nsIJSInspector component. var gCount = 0; const MAX = 10; var inspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector); var tm = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager); // Emulate 10 simultaneously-debugged windows from 3 separate client connections. var requestor = (count) => ({ - url:"http://foo/bar/" + count, + url: "http://foo/bar/" + count, connection: "conn" + (count % 3) }); -function run_test() -{ +function run_test() { test_nesting(); } -function test_nesting() -{ +function test_nesting() { do_check_eq(inspector.eventLoopNestLevel, 0); tm.currentThread.dispatch({ run: enterEventLoop}, 0); do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), 0); do_check_eq(inspector.eventLoopNestLevel, 0); do_check_eq(inspector.lastNestRequestor, null); } function enterEventLoop() { if (gCount++ < MAX) { tm.currentThread.dispatch({ run: enterEventLoop}, 0); - let r = Object.create(requestor(gCount)); + Object.create(requestor(gCount)); do_check_eq(inspector.eventLoopNestLevel, gCount); do_check_eq(inspector.lastNestRequestor.url, requestor(gCount - 1).url); do_check_eq(inspector.lastNestRequestor.connection, requestor(gCount - 1).connection); do_check_eq(inspector.enterNestedEventLoop(requestor(gCount)), gCount); } else { do_check_eq(gCount, MAX + 1); tm.currentThread.dispatch({ run: exitEventLoop}, 0);
--- a/devtools/server/tests/unit/test_objectgrips-01.js +++ b/devtools/server/tests/unit/test_objectgrips-01.js @@ -1,58 +1,57 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-grips", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-grips", server); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args[0].class, "Object"); let objClient = gThreadClient.pauseGrip(args[0]); - objClient.getOwnPropertyNames(function (aResponse) { - do_check_eq(aResponse.ownPropertyNames.length, 3); - do_check_eq(aResponse.ownPropertyNames[0], "a"); - do_check_eq(aResponse.ownPropertyNames[1], "b"); - do_check_eq(aResponse.ownPropertyNames[2], "c"); + objClient.getOwnPropertyNames(function (response) { + do_check_eq(response.ownPropertyNames.length, 3); + do_check_eq(response.ownPropertyNames[0], "a"); + do_check_eq(response.ownPropertyNames[1], "b"); + do_check_eq(response.ownPropertyNames[2], "c"); gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); - }); gDebuggee.eval("stopMe({ a: 1, b: true, c: 'foo' })"); }
--- a/devtools/server/tests/unit/test_objectgrips-02.js +++ b/devtools/server/tests/unit/test_objectgrips-02.js @@ -1,65 +1,66 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-grips", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-grips", server); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args[0].class, "Object"); let objClient = gThreadClient.pauseGrip(args[0]); - objClient.getPrototype(function (aResponse) { - do_check_true(aResponse.prototype != undefined); + objClient.getPrototype(function (response) { + do_check_true(response.prototype != undefined); - let protoClient = gThreadClient.pauseGrip(aResponse.prototype); - protoClient.getOwnPropertyNames(function (aResponse) { - do_check_eq(aResponse.ownPropertyNames.length, 2); - do_check_eq(aResponse.ownPropertyNames[0], "b"); - do_check_eq(aResponse.ownPropertyNames[1], "c"); + let protoClient = gThreadClient.pauseGrip(response.prototype); + protoClient.getOwnPropertyNames(function (response) { + do_check_eq(response.ownPropertyNames.length, 2); + do_check_eq(response.ownPropertyNames[0], "b"); + do_check_eq(response.ownPropertyNames[1], "c"); gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); - }); gDebuggee.eval(function Constr() { this.a = 1; }.toString()); - gDebuggee.eval("Constr.prototype = { b: true, c: 'foo' }; var o = new Constr(); stopMe(o)"); + gDebuggee.eval( + "Constr.prototype = { b: true, c: 'foo' }; var o = new Constr(); stopMe(o)"); }
--- a/devtools/server/tests/unit/test_objectgrips-03.js +++ b/devtools/server/tests/unit/test_objectgrips-03.js @@ -1,73 +1,73 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-grips", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-grips", server); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args[0].class, "Object"); let objClient = gThreadClient.pauseGrip(args[0]); - objClient.getProperty("x", function (aResponse) { - do_check_eq(aResponse.descriptor.configurable, true); - do_check_eq(aResponse.descriptor.enumerable, true); - do_check_eq(aResponse.descriptor.writable, true); - do_check_eq(aResponse.descriptor.value, 10); + objClient.getProperty("x", function (response) { + do_check_eq(response.descriptor.configurable, true); + do_check_eq(response.descriptor.enumerable, true); + do_check_eq(response.descriptor.writable, true); + do_check_eq(response.descriptor.value, 10); - objClient.getProperty("y", function (aResponse) { - do_check_eq(aResponse.descriptor.configurable, true); - do_check_eq(aResponse.descriptor.enumerable, true); - do_check_eq(aResponse.descriptor.writable, true); - do_check_eq(aResponse.descriptor.value, "kaiju"); + objClient.getProperty("y", function (response) { + do_check_eq(response.descriptor.configurable, true); + do_check_eq(response.descriptor.enumerable, true); + do_check_eq(response.descriptor.writable, true); + do_check_eq(response.descriptor.value, "kaiju"); - objClient.getProperty("a", function (aResponse) { - do_check_eq(aResponse.descriptor.configurable, true); - do_check_eq(aResponse.descriptor.enumerable, true); - do_check_eq(aResponse.descriptor.get.type, "object"); - do_check_eq(aResponse.descriptor.get.class, "Function"); - do_check_eq(aResponse.descriptor.set.type, "undefined"); + objClient.getProperty("a", function (response) { + do_check_eq(response.descriptor.configurable, true); + do_check_eq(response.descriptor.enumerable, true); + do_check_eq(response.descriptor.get.type, "object"); + do_check_eq(response.descriptor.get.class, "Function"); + do_check_eq(response.descriptor.set.type, "undefined"); gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); }); - }); gDebuggee.eval("stopMe({ x: 10, y: 'kaiju', get a() { return 42; } })"); }
--- a/devtools/server/tests/unit/test_objectgrips-04.js +++ b/devtools/server/tests/unit/test_objectgrips-04.js @@ -1,76 +1,76 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-grips", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-grips", server); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args[0].class, "Object"); let objClient = gThreadClient.pauseGrip(args[0]); - objClient.getPrototypeAndProperties(function (aResponse) { - do_check_eq(aResponse.ownProperties.x.configurable, true); - do_check_eq(aResponse.ownProperties.x.enumerable, true); - do_check_eq(aResponse.ownProperties.x.writable, true); - do_check_eq(aResponse.ownProperties.x.value, 10); + objClient.getPrototypeAndProperties(function (response) { + do_check_eq(response.ownProperties.x.configurable, true); + do_check_eq(response.ownProperties.x.enumerable, true); + do_check_eq(response.ownProperties.x.writable, true); + do_check_eq(response.ownProperties.x.value, 10); - do_check_eq(aResponse.ownProperties.y.configurable, true); - do_check_eq(aResponse.ownProperties.y.enumerable, true); - do_check_eq(aResponse.ownProperties.y.writable, true); - do_check_eq(aResponse.ownProperties.y.value, "kaiju"); + do_check_eq(response.ownProperties.y.configurable, true); + do_check_eq(response.ownProperties.y.enumerable, true); + do_check_eq(response.ownProperties.y.writable, true); + do_check_eq(response.ownProperties.y.value, "kaiju"); - do_check_eq(aResponse.ownProperties.a.configurable, true); - do_check_eq(aResponse.ownProperties.a.enumerable, true); - do_check_eq(aResponse.ownProperties.a.get.type, "object"); - do_check_eq(aResponse.ownProperties.a.get.class, "Function"); - do_check_eq(aResponse.ownProperties.a.set.type, "undefined"); + do_check_eq(response.ownProperties.a.configurable, true); + do_check_eq(response.ownProperties.a.enumerable, true); + do_check_eq(response.ownProperties.a.get.type, "object"); + do_check_eq(response.ownProperties.a.get.class, "Function"); + do_check_eq(response.ownProperties.a.set.type, "undefined"); - do_check_true(aResponse.prototype != undefined); + do_check_true(response.prototype != undefined); - let protoClient = gThreadClient.pauseGrip(aResponse.prototype); - protoClient.getOwnPropertyNames(function (aResponse) { - do_check_true(aResponse.ownPropertyNames.toString != undefined); + let protoClient = gThreadClient.pauseGrip(response.prototype); + protoClient.getOwnPropertyNames(function (response) { + do_check_true(response.ownPropertyNames.toString != undefined); gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); - }); gDebuggee.eval("stopMe({ x: 10, y: 'kaiju', get a() { return 42; } })"); }
--- a/devtools/server/tests/unit/test_objectgrips-05.js +++ b/devtools/server/tests/unit/test_objectgrips-05.js @@ -1,57 +1,57 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * This test checks that frozen objects report themselves as frozen in their * grip. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-grips", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-grips", server); gDebuggee.eval(function stopMe(arg1, arg2) { debugger; }.toString()); - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let obj1 = aPacket.frame.arguments[0]; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let obj1 = packet.frame.arguments[0]; do_check_true(obj1.frozen); let obj1Client = gThreadClient.pauseGrip(obj1); do_check_true(obj1Client.isFrozen); - let obj2 = aPacket.frame.arguments[1]; + let obj2 = packet.frame.arguments[1]; do_check_false(obj2.frozen); let obj2Client = gThreadClient.pauseGrip(obj2); do_check_false(obj2Client.isFrozen); gThreadClient.resume(_ => { gClient.close().then(gCallback); });
--- a/devtools/server/tests/unit/test_objectgrips-06.js +++ b/devtools/server/tests/unit/test_objectgrips-06.js @@ -1,57 +1,57 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * This test checks that sealed objects report themselves as sealed in their * grip. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-grips", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-grips", server); gDebuggee.eval(function stopMe(arg1, arg2) { debugger; }.toString()); - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let obj1 = aPacket.frame.arguments[0]; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let obj1 = packet.frame.arguments[0]; do_check_true(obj1.sealed); let obj1Client = gThreadClient.pauseGrip(obj1); do_check_true(obj1Client.isSealed); - let obj2 = aPacket.frame.arguments[1]; + let obj2 = packet.frame.arguments[1]; do_check_false(obj2.sealed); let obj2Client = gThreadClient.pauseGrip(obj2); do_check_false(obj2Client.isSealed); gThreadClient.resume(_ => { gClient.close().then(gCallback); });
--- a/devtools/server/tests/unit/test_objectgrips-07.js +++ b/devtools/server/tests/unit/test_objectgrips-07.js @@ -1,52 +1,52 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * This test checks that objects which are not extensible report themselves as * such. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-grips", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-grips", server); gDebuggee.eval(function stopMe(arg1, arg2, arg3, arg4) { debugger; }.toString()); - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let [f, s, ne, e] = aPacket.frame.arguments; - let [fClient, sClient, neClient, eClient] = aPacket.frame.arguments.map( +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let [f, s, ne, e] = packet.frame.arguments; + let [fClient, sClient, neClient, eClient] = packet.frame.arguments.map( a => gThreadClient.pauseGrip(a)); do_check_false(f.extensible); do_check_false(fClient.isExtensible); do_check_false(s.extensible); do_check_false(sClient.isExtensible);
--- a/devtools/server/tests/unit/test_objectgrips-08.js +++ b/devtools/server/tests/unit/test_objectgrips-08.js @@ -1,70 +1,70 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-grips", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-grips", server); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; do_check_eq(args[0].class, "Object"); let objClient = gThreadClient.pauseGrip(args[0]); - objClient.getPrototypeAndProperties(function (aResponse) { - do_check_eq(aResponse.ownProperties.a.configurable, true); - do_check_eq(aResponse.ownProperties.a.enumerable, true); - do_check_eq(aResponse.ownProperties.a.writable, true); - do_check_eq(aResponse.ownProperties.a.value.type, "Infinity"); + objClient.getPrototypeAndProperties(function (response) { + do_check_eq(response.ownProperties.a.configurable, true); + do_check_eq(response.ownProperties.a.enumerable, true); + do_check_eq(response.ownProperties.a.writable, true); + do_check_eq(response.ownProperties.a.value.type, "Infinity"); - do_check_eq(aResponse.ownProperties.b.configurable, true); - do_check_eq(aResponse.ownProperties.b.enumerable, true); - do_check_eq(aResponse.ownProperties.b.writable, true); - do_check_eq(aResponse.ownProperties.b.value.type, "-Infinity"); + do_check_eq(response.ownProperties.b.configurable, true); + do_check_eq(response.ownProperties.b.enumerable, true); + do_check_eq(response.ownProperties.b.writable, true); + do_check_eq(response.ownProperties.b.value.type, "-Infinity"); - do_check_eq(aResponse.ownProperties.c.configurable, true); - do_check_eq(aResponse.ownProperties.c.enumerable, true); - do_check_eq(aResponse.ownProperties.c.writable, true); - do_check_eq(aResponse.ownProperties.c.value.type, "NaN"); + do_check_eq(response.ownProperties.c.configurable, true); + do_check_eq(response.ownProperties.c.enumerable, true); + do_check_eq(response.ownProperties.c.writable, true); + do_check_eq(response.ownProperties.c.value.type, "NaN"); - do_check_eq(aResponse.ownProperties.d.configurable, true); - do_check_eq(aResponse.ownProperties.d.enumerable, true); - do_check_eq(aResponse.ownProperties.d.writable, true); - do_check_eq(aResponse.ownProperties.d.value.type, "-0"); + do_check_eq(response.ownProperties.d.configurable, true); + do_check_eq(response.ownProperties.d.enumerable, true); + do_check_eq(response.ownProperties.d.writable, true); + do_check_eq(response.ownProperties.d.value.type, "-0"); gThreadClient.resume(function () { gClient.close().then(gCallback); }); }); }); gDebuggee.eval("stopMe({ a: Infinity, b: -Infinity, c: NaN, d: -0 })");
--- a/devtools/server/tests/unit/test_objectgrips-09.js +++ b/devtools/server/tests/unit/test_objectgrips-09.js @@ -1,74 +1,75 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + /** * This tests exercises getProtypesAndProperties message accepted * by a thread actor. */ var gDebuggee; var gClient; var gThreadClient; var gCallback; -function run_test() -{ +function run_test() { run_test_with_server(DebuggerServer, function () { run_test_with_server(WorkerDebuggerServer, do_test_finished); }); do_test_pending(); } -function run_test_with_server(aServer, aCallback) -{ - gCallback = aCallback; - initTestDebuggerServer(aServer); - gDebuggee = addTestGlobal("test-grips", aServer); +function run_test_with_server(server, callback) { + gCallback = callback; + initTestDebuggerServer(server); + gDebuggee = addTestGlobal("test-grips", server); gDebuggee.eval(function stopMe(arg1, arg2) { debugger; }.toString()); - gClient = new DebuggerClient(aServer.connectPipe()); + gClient = new DebuggerClient(server.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; - gThreadClient.getPrototypesAndProperties([args[0].actor, args[1].actor], function (aResponse) { - let obj1 = aResponse.actors[args[0].actor]; - let obj2 = aResponse.actors[args[1].actor]; - do_check_eq(obj1.ownProperties.x.configurable, true); - do_check_eq(obj1.ownProperties.x.enumerable, true); - do_check_eq(obj1.ownProperties.x.writable, true); - do_check_eq(obj1.ownProperties.x.value, 10); + gThreadClient.getPrototypesAndProperties( + [args[0].actor, args[1].actor], function (response) { + let obj1 = response.actors[args[0].actor]; + let obj2 = response.actors[args[1].actor]; + do_check_eq(obj1.ownProperties.x.configurable, true); + do_check_eq(obj1.ownProperties.x.enumerable, true); + do_check_eq(obj1.ownProperties.x.writable, true); + do_check_eq(obj1.ownProperties.x.value, 10); - do_check_eq(obj1.ownProperties.y.configurable, true); - do_check_eq(obj1.ownProperties.y.enumerable, true); - do_check_eq(obj1.ownProperties.y.writable, true); - do_check_eq(obj1.ownProperties.y.value, "kaiju"); + do_check_eq(obj1.ownProperties.y.configurable, true); + do_check_eq(obj1.ownProperties.y.enumerable, true); + do_check_eq(obj1.ownProperties.y.writable, true); + do_check_eq(obj1.ownProperties.y.value, "kaiju"); - do_check_eq(obj2.ownProperties.z.configurable, true); - do_check_eq(obj2.ownProperties.z.enumerable, true); - do_check_eq(obj2.ownProperties.z.writable, true); - do_check_eq(obj2.ownProperties.z.value, 123); + do_check_eq(obj2.ownProperties.z.configurable, true); + do_check_eq(obj2.ownProperties.z.enumerable, true); + do_check_eq(obj2.ownProperties.z.writable, true); + do_check_eq(obj2.ownProperties.z.value, 123); - do_check_true(obj1.prototype != undefined); - do_check_true(obj2.prototype != undefined); + do_check_true(obj1.prototype != undefined); + do_check_true(obj2.prototype != undefined); - gThreadClient.resume(function () { - gClient.close().then(gCallback); + gThreadClient.resume(function () { + gClient.close().then(gCallback); + }); }); - }); - }); gDebuggee.eval("stopMe({ x: 10, y: 'kaiju'}, { z: 123 })"); }
--- a/devtools/server/tests/unit/test_objectgrips-10.js +++ b/devtools/server/tests/unit/test_objectgrips-10.js @@ -1,72 +1,75 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; var gDebuggee; var gClient; var gThreadClient; // Test that closures can be inspected. -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-closures"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-closures", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-closures", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); do_test_pending(); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let person = aPacket.frame.environment.bindings.variables.person; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let person = packet.frame.environment.bindings.variables.person; do_check_eq(person.value.class, "Object"); let personClient = gThreadClient.pauseGrip(person.value); - personClient.getPrototypeAndProperties(aResponse => { - do_check_eq(aResponse.ownProperties.getName.value.class, "Function"); + personClient.getPrototypeAndProperties(response => { + do_check_eq(response.ownProperties.getName.value.class, "Function"); - do_check_eq(aResponse.ownProperties.getAge.value.class, "Function"); + do_check_eq(response.ownProperties.getAge.value.class, "Function"); - do_check_eq(aResponse.ownProperties.getFoo.value.class, "Function"); + do_check_eq(response.ownProperties.getFoo.value.class, "Function"); - let getNameClient = gThreadClient.pauseGrip(aResponse.ownProperties.getName.value); - let getAgeClient = gThreadClient.pauseGrip(aResponse.ownProperties.getAge.value); - let getFooClient = gThreadClient.pauseGrip(aResponse.ownProperties.getFoo.value); - getNameClient.getScope(aResponse => { - do_check_eq(aResponse.scope.bindings.arguments[0].name.value, "Bob"); + let getNameClient = gThreadClient.pauseGrip(response.ownProperties.getName.value); + let getAgeClient = gThreadClient.pauseGrip(response.ownProperties.getAge.value); + let getFooClient = gThreadClient.pauseGrip(response.ownProperties.getFoo.value); + getNameClient.getScope(response => { + do_check_eq(response.scope.bindings.arguments[0].name.value, "Bob"); - getAgeClient.getScope(aResponse => { - do_check_eq(aResponse.scope.bindings.arguments[1].age.value, 58); + getAgeClient.getScope(response => { + do_check_eq(response.scope.bindings.arguments[1].age.value, 58); - getFooClient.getScope(aResponse => { - do_check_eq(aResponse.scope.bindings.variables.foo.value, 10); + getFooClient.getScope(response => { + do_check_eq(response.scope.bindings.variables.foo.value, 10); gThreadClient.resume(() => finishClient(gClient)); }); }); }); }); - }); + /* eslint-disable */ gDebuggee.eval("(" + function () { var PersonFactory = function (name, age) { var foo = 10; return { getName: function () { return name; }, getAge: function () { return age; }, getFoo: function () { foo = Date.now(); return foo; } }; }; var person = new PersonFactory("Bob", 58); debugger; } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_objectgrips-11.js +++ b/devtools/server/tests/unit/test_objectgrips-11.js @@ -1,52 +1,52 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + // Test that we get the magic properties on Error objects. var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_object_grip(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_object_grip(); + }); }); do_test_pending(); } -function test_object_grip() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_object_grip() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; let objClient = gThreadClient.pauseGrip(args[0]); - objClient.getOwnPropertyNames(function (aResponse) { - var opn = aResponse.ownPropertyNames; + objClient.getOwnPropertyNames(function (response) { + let opn = response.ownPropertyNames; do_check_eq(opn.length, 4); opn.sort(); do_check_eq(opn[0], "columnNumber"); do_check_eq(opn[1], "fileName"); do_check_eq(opn[2], "lineNumber"); do_check_eq(opn[3], "message"); gThreadClient.resume(function () { finishClient(gClient); }); }); - }); gDebuggee.eval("stopMe(new TypeError('error message text'))"); }
--- a/devtools/server/tests/unit/test_objectgrips-12.js +++ b/devtools/server/tests/unit/test_objectgrips-12.js @@ -1,39 +1,41 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable max-nested-callbacks */ + +"use strict"; // Test getDisplayString. Cu.import("resource://testing-common/PromiseTestUtils.jsm", this); var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gDebuggee.eval(function stopMe(arg1) { debugger; }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_display_string(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_display_string(); + }); }); do_test_pending(); } -function test_display_string() -{ +function test_display_string() { const testCases = [ { input: "new Boolean(true)", output: "true" }, { input: "new Number(5)", output: "5" @@ -134,18 +136,18 @@ function test_display_string() { input: "new Promise(function () {})", output: "Promise (pending)" } ]; PromiseTestUtils.expectUncaughtRejection(/Error/); - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - const args = aPacket.frame.arguments; + gThreadClient.addOneTimeListener("paused", function (event, packet) { + const args = packet.frame.arguments; (function loop() { const objClient = gThreadClient.pauseGrip(args.pop()); objClient.getDisplayString(function ({ displayString }) { do_check_eq(displayString, testCases.pop().output); if (args.length) { loop(); } else {
--- a/devtools/server/tests/unit/test_objectgrips-13.js +++ b/devtools/server/tests/unit/test_objectgrips-13.js @@ -1,40 +1,41 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + // Test that ObjectClient.prototype.getDefinitionSite and the "definitionSite" // request work properly. var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); Components.utils.evalInSandbox(function stopMe() { debugger; }.toString(), gDebuggee); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - add_pause_listener(); - }); + attachTestTabAndResume(gClient, "test-grips", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + add_pause_listener(); + }); }); do_test_pending(); } -function add_pause_listener() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - const [funcGrip, objGrip] = aPacket.frame.arguments; +function add_pause_listener() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + const [funcGrip, objGrip] = packet.frame.arguments; const func = gThreadClient.pauseGrip(funcGrip); const obj = gThreadClient.pauseGrip(objGrip); test_definition_site(func, obj); }); eval_code(); }
--- a/devtools/server/tests/unit/test_pause_exceptions-01.js +++ b/devtools/server/tests/unit/test_pause_exceptions-01.js @@ -1,50 +1,54 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ + +"use strict"; /** * Test that setting pauseOnExceptions to true will cause the debuggee to pause * when an exceptions is thrown. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "exception"); - do_check_eq(aPacket.why.exception, 42); +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.why.type, "exception"); + do_check_eq(packet.why.exception, 42); gThreadClient.resume(function () { finishClient(gClient); }); }); gThreadClient.pauseOnExceptions(true); gThreadClient.resume(); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { function stopMe() { debugger; throw 42; } try { stopMe(); } catch (e) {} } + ")()"); + /* eslint-enable */ }
--- a/devtools/server/tests/unit/test_pause_exceptions-02.js +++ b/devtools/server/tests/unit/test_pause_exceptions-02.js @@ -1,47 +1,50 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Test that setting pauseOnExceptions to true when the debugger isn't in a * paused state will cause the debuggee to pause when an exceptions is thrown. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ +function test_pause_frame() { gThreadClient.pauseOnExceptions(true, false, function () { - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - do_check_eq(aPacket.why.type, "exception"); - do_check_eq(aPacket.why.exception, 42); + gThreadClient.addOneTimeListener("paused", function (event, packet) { + do_check_eq(packet.why.type, "exception"); + do_check_eq(packet.why.exception, 42); gThreadClient.resume(function () { finishClient(gClient); }); }); + /* eslint-disable */ gDebuggee.eval("(" + function () { function stopMe() { throw 42; } try { stopMe(); } catch (e) {} } + ")()"); + /* eslint-enable */ }); }
--- a/devtools/server/tests/unit/test_pauselifetime-01.js +++ b/devtools/server/tests/unit/test_pauselifetime-01.js @@ -1,52 +1,53 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that pause-lifetime grips go away correctly after a resume. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let pauseActor = aPacket.actor; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let pauseActor = packet.actor; - // Make a bogus request to the pause-liftime actor. Should get + // Make a bogus request to the pause-lifetime actor. Should get // unrecognized-packet-type (and not no-such-actor). - gClient.request({ to: pauseActor, type: "bogusRequest" }, function (aResponse) { - do_check_eq(aResponse.error, "unrecognizedPacketType"); + gClient.request({ to: pauseActor, type: "bogusRequest" }, function (response) { + do_check_eq(response.error, "unrecognizedPacketType"); gThreadClient.resume(function () { // Now that we've resumed, should get no-such-actor for the // same request. - gClient.request({ to: pauseActor, type: "bogusRequest" }, function (aResponse) { - do_check_eq(aResponse.error, "noSuchActor"); + gClient.request({ to: pauseActor, type: "bogusRequest" }, function (response) { + do_check_eq(response.error, "noSuchActor"); finishClient(gClient); }); }); - }); }); gDebuggee.eval("(" + function () { function stopMe() { debugger; } stopMe();
--- a/devtools/server/tests/unit/test_pauselifetime-02.js +++ b/devtools/server/tests/unit/test_pauselifetime-02.js @@ -1,56 +1,58 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that pause-lifetime grips go away correctly after a resume. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; let objActor = args[0].actor; do_check_eq(args[0].class, "Object"); do_check_true(!!objActor); // Make a bogus request to the grip actor. Should get // unrecognized-packet-type (and not no-such-actor). - gClient.request({ to: objActor, type: "bogusRequest" }, function (aResponse) { - do_check_eq(aResponse.error, "unrecognizedPacketType"); + gClient.request({ to: objActor, type: "bogusRequest" }, function (response) { + do_check_eq(response.error, "unrecognizedPacketType"); gThreadClient.resume(function () { // Now that we've resumed, should get no-such-actor for the // same request. - gClient.request({ to: objActor, type: "bogusRequest" }, function (aResponse) { - do_check_eq(aResponse.error, "noSuchActor"); + gClient.request({ to: objActor, type: "bogusRequest" }, function (response) { + do_check_eq(response.error, "noSuchActor"); finishClient(gClient); }); }); }); }); gDebuggee.eval("(" + function () { - function stopMe(aObject) { + function stopMe(obj) { debugger; } stopMe({ foo: "bar" }); } + ")()"); }
--- a/devtools/server/tests/unit/test_pauselifetime-03.js +++ b/devtools/server/tests/unit/test_pauselifetime-03.js @@ -1,61 +1,63 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ + +"use strict"; /** * Check that pause-lifetime grip clients are marked invalid after a resume. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; let objActor = args[0].actor; do_check_eq(args[0].class, "Object"); do_check_true(!!objActor); let objClient = gThreadClient.pauseGrip(args[0]); do_check_true(objClient.valid); // Make a bogus request to the grip actor. Should get // unrecognized-packet-type (and not no-such-actor). - gClient.request({ to: objActor, type: "bogusRequest" }, function (aResponse) { - do_check_eq(aResponse.error, "unrecognizedPacketType"); + gClient.request({ to: objActor, type: "bogusRequest" }, function (response) { + do_check_eq(response.error, "unrecognizedPacketType"); do_check_true(objClient.valid); gThreadClient.resume(function () { // Now that we've resumed, should get no-such-actor for the // same request. - gClient.request({ to: objActor, type: "bogusRequest" }, function (aResponse) { + gClient.request({ to: objActor, type: "bogusRequest" }, function (response) { do_check_false(objClient.valid); - do_check_eq(aResponse.error, "noSuchActor"); + do_check_eq(response.error, "noSuchActor"); finishClient(gClient); }); }); }); }); gDebuggee.eval("(" + function () { - function stopMe(aObject) { + function stopMe(obj) { debugger; } stopMe({ foo: "bar" }); } + ")()"); }
--- a/devtools/server/tests/unit/test_pauselifetime-04.js +++ b/devtools/server/tests/unit/test_pauselifetime-04.js @@ -1,48 +1,49 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + /** * Test that requesting a pause actor for the same value multiple * times returns the same actor. */ var gDebuggee; var gClient; var gThreadClient; -function run_test() -{ +function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); gClient.connect().then(function () { - attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { - gThreadClient = aThreadClient; - test_pause_frame(); - }); + attachTestTabAndResume(gClient, "test-stack", + function (response, tabClient, threadClient) { + gThreadClient = threadClient; + test_pause_frame(); + }); }); do_test_pending(); } -function test_pause_frame() -{ - gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { - let args = aPacket.frame.arguments; +function test_pause_frame() { + gThreadClient.addOneTimeListener("paused", function (event, packet) { + let args = packet.frame.arguments; let objActor1 = args[0].actor; - gThreadClient.getFrames(0, 1, function (aResponse) { - let frame = aResponse.frames[0]; + gThreadClient.getFrames(0, 1, function (response) { + let frame = response.frames[0]; do_check_eq(objActor1, frame.arguments[0].actor); gThreadClient.resume(function () { finishClient(gClient); }); }); }); gDebuggee.eval("(" + function () { - function stopMe(aObject) { + function stopMe(obj) { debugger; } stopMe({ foo: "bar" }); } + ")()"); }
--- a/devtools/server/tests/unit/test_profiler_activation-01.js +++ b/devtools/server/tests/unit/test_profiler_activation-01.js @@ -1,23 +1,23 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow */ "use strict"; /** * Tests whether the profiler module and actor have the correct state on * initialization, activation, and when a clients' connection closes. */ const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler); const MAX_PROFILER_ENTRIES = 10000000; -function run_test() -{ +function run_test() { // Ensure the profiler is not running when the test starts (it could // happen if the MOZ_PROFILER_STARTUP environment variable is set). Profiler.StopProfiler(); get_chrome_actors((client1, form1) => { let actor1 = form1.profilerActor; get_chrome_actors((client2, form2) => { let actor2 = form2.profilerActor; @@ -36,54 +36,55 @@ function test_activate(client1, actor1, do_check_false(Profiler.IsActive()); do_check_false(response.isActive); do_check_eq(response.currentTime, undefined); do_check_true(typeof response.position === "number"); do_check_true(typeof response.totalSize === "number"); do_check_true(typeof response.generation === "number"); // Start the profiler on the first connection.... - client1.request({ to: actor1, type: "startProfiler", entries: MAX_PROFILER_ENTRIES }, response => { - do_check_true(Profiler.IsActive()); - do_check_true(response.started); - do_check_true(typeof response.position === "number"); - do_check_true(typeof response.totalSize === "number"); - do_check_true(typeof response.generation === "number"); - do_check_true(response.position >= 0 && response.position < response.totalSize); - do_check_true(response.totalSize === MAX_PROFILER_ENTRIES); - - // On the next connection just make sure the actor has been instantiated. - client2.request({ to: actor2, type: "isActive" }, response => { + client1.request( + { to: actor1, type: "startProfiler", entries: MAX_PROFILER_ENTRIES }, response => { do_check_true(Profiler.IsActive()); - do_check_true(response.isActive); - do_check_true(response.currentTime > 0); + do_check_true(response.started); do_check_true(typeof response.position === "number"); do_check_true(typeof response.totalSize === "number"); do_check_true(typeof response.generation === "number"); do_check_true(response.position >= 0 && response.position < response.totalSize); do_check_true(response.totalSize === MAX_PROFILER_ENTRIES); - let origConnectionClosed = DebuggerServer._connectionClosed; - - DebuggerServer._connectionClosed = function (conn) { - origConnectionClosed.call(this, conn); + // On the next connection just make sure the actor has been instantiated. + client2.request({ to: actor2, type: "isActive" }, response => { + do_check_true(Profiler.IsActive()); + do_check_true(response.isActive); + do_check_true(response.currentTime > 0); + do_check_true(typeof response.position === "number"); + do_check_true(typeof response.totalSize === "number"); + do_check_true(typeof response.generation === "number"); + do_check_true(response.position >= 0 && response.position < response.totalSize); + do_check_true(response.totalSize === MAX_PROFILER_ENTRIES); - // The first client is the only actor that started the profiler, - // however the second client can request the accumulated profile data - // at any moment, so the profiler module shouldn't have deactivated. - do_check_true(Profiler.IsActive()); + let origConnectionClosed = DebuggerServer._connectionClosed; DebuggerServer._connectionClosed = function (conn) { origConnectionClosed.call(this, conn); - // Now there are no open clients at all, it should *definitely* - // be deactivated by now. - do_check_false(Profiler.IsActive()); + // The first client is the only actor that started the profiler, + // however the second client can request the accumulated profile data + // at any moment, so the profiler module shouldn't have deactivated. + do_check_true(Profiler.IsActive()); + + DebuggerServer._connectionClosed = function (conn) { + origConnectionClosed.call(this, conn); - callback(); + // Now there are no open clients at all, it should *definitely* + // be deactivated by now. + do_check_false(Profiler.IsActive()); + + callback(); + }; + client2.close(); }; - client2.close(); - }; - client1.close(); + client1.close(); + }); }); - }); }); }
--- a/devtools/server/tests/unit/test_profiler_activation-02.js +++ b/devtools/server/tests/unit/test_profiler_activation-02.js @@ -6,23 +6,21 @@ /** * Tests whether the profiler actor correctly handles the case where the * built-in module was already started. */ const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler); const WAIT_TIME = 1000; // ms -function run_test() -{ +function run_test() { // Ensure the profiler is already running when the test starts. Profiler.StartProfiler(1000000, 1, ["js"], 1); DevToolsUtils.waitForTime(WAIT_TIME).then(() => { - get_chrome_actors((client, form) => { let actor = form.profilerActor; test_start_time(client, actor, () => { client.close().then(do_test_finished); }); }); });
--- a/devtools/server/tests/unit/test_profiler_bufferstatus.js +++ b/devtools/server/tests/unit/test_profiler_bufferstatus.js @@ -1,24 +1,24 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ "use strict"; /** * Tests if the profiler actor returns its buffer status via getBufferInfo. */ const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler); const INITIAL_WAIT_TIME = 100; // ms const MAX_WAIT_TIME = 20000; // ms const MAX_PROFILER_ENTRIES = 10000000; -function run_test() -{ +function run_test() { // Ensure the profiler is not running when the test starts (it could // happen if the MOZ_PROFILER_STARTUP environment variable is set). Profiler.StopProfiler(); get_chrome_actors((client, form) => { let actor = form.profilerActor; check_empty_buffer(client, actor, () => { activate_profiler(client, actor, startTime => { @@ -31,97 +31,91 @@ function run_test() }); }); }); }); do_test_pending(); } -function check_buffer(client, actor, callback) -{ +function check_buffer(client, actor, callback) { client.request({ to: actor, type: "isActive" }, response => { do_check_true(typeof response.position === "number"); do_check_true(typeof response.totalSize === "number"); do_check_true(typeof response.generation === "number"); do_check_true(response.position > 0 && response.position < response.totalSize); do_check_true(response.totalSize === MAX_PROFILER_ENTRIES); // There's no way we'll fill the buffer in this test. do_check_true(response.generation === 0); callback(); }); } -function check_empty_buffer(client, actor, callback) -{ +function check_empty_buffer(client, actor, callback) { client.request({ to: actor, type: "isActive" }, response => { do_check_false(Profiler.IsActive()); do_check_false(response.isActive); do_check_true(response.position === void 0); do_check_true(response.totalSize === void 0); do_check_true(response.generation === void 0); do_check_false(response.isActive); do_check_eq(response.currentTime, undefined); calback(); }); } -function activate_profiler(client, actor, callback) -{ - client.request({ to: actor, type: "startProfiler", entries: MAX_PROFILER_ENTRIES }, response => { - do_check_true(response.started); - client.request({ to: actor, type: "isActive" }, response => { - do_check_true(response.isActive); - callback(response.currentTime); +function activate_profiler(client, actor, callback) { + client.request( + { to: actor, type: "startProfiler", entries: MAX_PROFILER_ENTRIES }, response => { + do_check_true(response.started); + client.request({ to: actor, type: "isActive" }, response => { + do_check_true(response.isActive); + callback(response.currentTime); + }); }); - }); } -function deactivate_profiler(client, actor, callback) -{ +function deactivate_profiler(client, actor, callback) { client.request({ to: actor, type: "stopProfiler" }, response => { do_check_false(response.started); client.request({ to: actor, type: "isActive" }, response => { do_check_false(response.isActive); callback(); }); }); } -function wait_for_samples(client, actor, callback) -{ - function attempt(delay) - { - // No idea why, but Components.stack.sourceLine returns null. - let funcLine = Components.stack.lineNumber - 3; - +function wait_for_samples(client, actor, callback) { + function attempt(delay) { // Spin for the requested time, then take a sample. let start = Date.now(); - let stack; + do_print("Attempt: delay = " + delay); - while (Date.now() - start < delay) { stack = Components.stack; } + while (Date.now() - start < delay) { + /* Empty */ + } do_print("Attempt: finished waiting."); client.request({ to: actor, type: "getProfile" }, response => { // At this point, we may or may not have samples, depending on // whether the spin loop above has given the profiler enough time // to get started. if (response.profile.threads[0].samples.length == 0) { if (delay < MAX_WAIT_TIME) { // Double the spin-wait time and try again. do_print("Attempt: no samples, going around again."); - return attempt(delay * 2); + attempt(delay * 2); } else { // We've waited long enough, so just fail. do_print("Attempt: waited a long time, but no samples were collected."); do_print("Giving up."); do_check_true(false); - return; } + return; } callback(); }); } // Start off with a 100 millisecond delay. attempt(INITIAL_WAIT_TIME); }
--- a/devtools/server/tests/unit/test_profiler_close.js +++ b/devtools/server/tests/unit/test_profiler_close.js @@ -1,22 +1,22 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +/* eslint-disable no-shadow, max-nested-callbacks */ "use strict"; /** * Tests whether the profiler module is kept active when there are multiple * client consumers and one requests deactivation. */ const Profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler); -function run_test() -{ +function run_test() { get_chrome_actors((client1, form1) => { let actor1 = form1.profilerActor; get_chrome_actors((client2, form2) => { let actor2 = form2.profilerActor; test_close(client1, actor1, client2, actor2, () => { client1.close(() => { client2.close(() => { do_test_finished(); @@ -24,44 +24,41 @@ function run_test() }); }); }); }); do_test_pending(); } -function activate_profiler(client, actor, callback) -{ +function activate_profiler(client, actor, callback) { client.request({ to: actor, type: "startProfiler" }, response => { do_check_true(response.started); do_check_true(Profiler.IsActive()); client.request({ to: actor, type: "isActive" }, response => { do_check_true(response.isActive); callback(); }); }); } -function deactivate_profiler(client, actor, callback) -{ +function deactivate_profiler(client, actor, callback) { client.request({ to: actor, type: "stopProfiler" }, response => { do_check_false(response.started); do_check_true(Profiler.IsActive()); client.request({ to: actor, type: "isActive" }, response => { do_check_true(response.isActive);