diff --git a/devtools/client/aboutdebugging/aboutdebugging.js b/devtools/client/aboutdebugging/aboutdebugging.js index 9e69828dcf5..a8a79fc7898 100644 --- a/devtools/client/aboutdebugging/aboutdebugging.js +++ b/devtools/client/aboutdebugging/aboutdebugging.js @@ -105,7 +105,7 @@ var AboutDebugging = { DebuggerServer.allowChromeProcess = true; this.client = new DebuggerClient(DebuggerServer.connectPipe()); - this.client.connect(() => { + this.client.connect().then(() => { // Show the first available tab. this.showTab(); window.addEventListener("hashchange", () => this.showTab()); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_addonactor.js b/devtools/client/debugger/test/mochitest/browser_dbg_addonactor.js index d35fa8f3d88..2a5e3b6a292 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_addonactor.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_addonactor.js @@ -16,7 +16,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-01.js b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-01.js index 5737d3df77e..de28962ce73 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-01.js @@ -17,7 +17,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-02.js b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-02.js index f09d858c46c..15ea48e6bd2 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-02.js @@ -18,7 +18,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-03.js b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-03.js index 38e72a80da3..a054b93c432 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_break-on-dom-event-03.js @@ -17,7 +17,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_chrome-debugging.js b/devtools/client/debugger/test/mochitest/browser_dbg_chrome-debugging.js index 6005a430263..8c02cdd9dee 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_chrome-debugging.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_chrome-debugging.js @@ -27,7 +27,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_debugger-statement.js b/devtools/client/debugger/test/mochitest/browser_dbg_debugger-statement.js index 64bba61b239..5cc7e1c435f 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_debugger-statement.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_debugger-statement.js @@ -18,7 +18,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-01.js b/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-01.js index 930165b253c..1755ac9e268 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-01.js @@ -18,7 +18,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-02.js b/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-02.js index f6b8268e2af..2b4b74fdcc9 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-02.js @@ -19,7 +19,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-03.js b/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-03.js index b44e3f9bcb2..6b58d773b95 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-03.js @@ -19,7 +19,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_globalactor.js b/devtools/client/debugger/test/mochitest/browser_dbg_globalactor.js index 9c3ad076da2..70971aa9474 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_globalactor.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_globalactor.js @@ -20,7 +20,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_listaddons.js b/devtools/client/debugger/test/mochitest/browser_dbg_listaddons.js index 212cda90eb7..fa44a1261f0 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_listaddons.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_listaddons.js @@ -17,7 +17,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-01.js b/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-01.js index 607357dcd4b..f3378f8050c 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-01.js @@ -18,7 +18,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-03.js b/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-03.js index 268557b1721..902a4358a07 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-03.js @@ -17,7 +17,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect(Task.async(function*(aType, aTraits) { + gClient.connect().then(Task.async(function*([aType, aTraits]) { is(aType, "browser", "Root actor should identify itself as a browser."); let tab = yield addTab(TAB1_URL); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_multiple-windows.js b/devtools/client/debugger/test/mochitest/browser_dbg_multiple-windows.js index 04bb6e49b6e..22cfd01e5da 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_multiple-windows.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_multiple-windows.js @@ -20,7 +20,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_navigation.js b/devtools/client/debugger/test/mochitest/browser_dbg_navigation.js index a4cbc49bfd0..44d6915d1dd 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_navigation.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_navigation.js @@ -18,7 +18,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_tabactor-01.js b/devtools/client/debugger/test/mochitest/browser_dbg_tabactor-01.js index 9fdf60942fa..9ff5cce06d8 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_tabactor-01.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_tabactor-01.js @@ -21,7 +21,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_tabactor-02.js b/devtools/client/debugger/test/mochitest/browser_dbg_tabactor-02.js index 429e813742b..9c85eeedb2c 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_tabactor-02.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_tabactor-02.js @@ -21,7 +21,7 @@ function test() { let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect((aType, aTraits) => { + gClient.connect().then(([aType, aTraits]) => { is(aType, "browser", "Root actor should identify itself as a browser."); diff --git a/devtools/client/debugger/test/mochitest/head.js b/devtools/client/debugger/test/mochitest/head.js index 8bdd0de1497..fec0673be91 100644 --- a/devtools/client/debugger/test/mochitest/head.js +++ b/devtools/client/debugger/test/mochitest/head.js @@ -564,9 +564,7 @@ AddonDebugger.prototype = { let transport = DebuggerServer.connectPipe(); this.client = new DebuggerClient(transport); - let connected = promise.defer(); - this.client.connect(connected.resolve); - yield connected.promise; + yield this.client.connect(); let addonActor = yield getAddonActorForUrl(this.client, aUrl); @@ -1005,11 +1003,7 @@ function generateMouseClickInTab(tab, path) { function connect(client) { info("Connecting client."); - return new Promise(function (resolve) { - client.connect(function () { - resolve(); - }); - }); + return client.connect(); } function close(client) { diff --git a/devtools/client/framework/connect/connect.js b/devtools/client/framework/connect/connect.js index 1825050f512..e7aa340cd09 100644 --- a/devtools/client/framework/connect/connect.js +++ b/devtools/client/framework/connect/connect.js @@ -74,20 +74,14 @@ var submit = Task.async(function*() { gClient = new DebuggerClient(transport); let delay = Services.prefs.getIntPref("devtools.debugger.remote-timeout"); gConnectionTimeout = setTimeout(handleConnectionTimeout, delay); - let response = yield clientConnect(); + let response = yield gClient.connect(); yield onConnectionReady(...response); }); -function clientConnect() { - let deferred = promise.defer(); - gClient.connect((...args) => deferred.resolve(args)); - return deferred.promise; -} - /** * Connection is ready. List actors and build buttons. */ -var onConnectionReady = Task.async(function*(aType, aTraits) { +var onConnectionReady = Task.async(function*([aType, aTraits]) { clearTimeout(gConnectionTimeout); let response = yield gClient.listAddons(); diff --git a/devtools/client/framework/gDevTools.jsm b/devtools/client/framework/gDevTools.jsm index 8014d65930f..361e24b11d5 100644 --- a/devtools/client/framework/gDevTools.jsm +++ b/devtools/client/framework/gDevTools.jsm @@ -731,7 +731,7 @@ var gDevToolsBrowser = { let client = new DebuggerClient(transport); let deferred = promise.defer(); - client.connect(() => { + client.connect().then(() => { client.mainRoot.listProcesses(response => { // Do nothing if there is only one process, the parent process. let contentProcesses = response.processes.filter(p => (!p.parent)); diff --git a/devtools/client/framework/target.js b/devtools/client/framework/target.js index ae42ebc5441..604068cd540 100644 --- a/devtools/client/framework/target.js +++ b/devtools/client/framework/target.js @@ -414,12 +414,12 @@ TabTarget.prototype = { }; if (this.isLocalTab) { - this._client.connect(() => { - this._client.getTab({ tab: this.tab }).then(response => { + this._client.connect() + .then(() => this._client.getTab({ tab: this.tab })) + .then(response => { this._form = response.tab; attachTab(); }); - }); } else if (this.isTabActor) { // In the remote debugging case, the protocol connection will have been // already initialized in the connection screen code. diff --git a/devtools/client/framework/test/browser_toolbox_tool_remote_reopen.js b/devtools/client/framework/test/browser_toolbox_tool_remote_reopen.js index eff76dd3333..14d585779de 100644 --- a/devtools/client/framework/test/browser_toolbox_tool_remote_reopen.js +++ b/devtools/client/framework/test/browser_toolbox_tool_remote_reopen.js @@ -73,11 +73,7 @@ function getClient() { let transport = DebuggerServer.connectPipe(); let client = new DebuggerClient(transport); - client.connect(() => { - deferred.resolve(client); - }); - - return deferred.promise; + return client.connect().then(() => client); } function getTarget(client) { diff --git a/devtools/client/framework/test/browser_two_tabs.js b/devtools/client/framework/test/browser_two_tabs.js index 9b9f609fbbc..41dcc721cb5 100644 --- a/devtools/client/framework/test/browser_two_tabs.js +++ b/devtools/client/framework/test/browser_two_tabs.js @@ -44,15 +44,15 @@ function openTabs() { function connect() { // Connect to debugger server to fetch the two tab actors gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(() => { - gClient.listTabs(response => { + gClient.connect() + .then(() => gClient.listTabs()) + .then(response => { // Fetch the tab actors for each tab gTabActor1 = response.tabs.filter(a => a.url === TAB_URL_1)[0]; gTabActor2 = response.tabs.filter(a => a.url === TAB_URL_2)[0]; checkGetTab(); }); - }); } function checkGetTab() { diff --git a/devtools/client/framework/test/head.js b/devtools/client/framework/test/head.js index a54275e85d4..977268197cc 100644 --- a/devtools/client/framework/test/head.js +++ b/devtools/client/framework/test/head.js @@ -29,11 +29,11 @@ function getChromeActors(callback) DebuggerServer.allowChromeProcess = true; let client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(() => { - client.getProcess().then(response => { + client.connect() + .then(() => client.getProcess()) + .then(response => { callback(client, response.form); }); - }); SimpleTest.registerCleanupFunction(() => { DebuggerServer.destroy(); diff --git a/devtools/client/framework/toolbox-process-window.js b/devtools/client/framework/toolbox-process-window.js index 21649ab79be..f50f9095dae 100644 --- a/devtools/client/framework/toolbox-process-window.js +++ b/devtools/client/framework/toolbox-process-window.js @@ -33,7 +33,7 @@ var connect = Task.async(function*() { port: Prefs.chromeDebuggingPort }); gClient = new DebuggerClient(transport); - gClient.connect(() => { + gClient.connect().then(() => { let addonID = getParameterByName("addonID"); if (addonID) { diff --git a/devtools/client/scratchpad/scratchpad.js b/devtools/client/scratchpad/scratchpad.js index ead372e941b..4dff1db53a3 100644 --- a/devtools/client/scratchpad/scratchpad.js +++ b/devtools/client/scratchpad/scratchpad.js @@ -2193,8 +2193,6 @@ ScratchpadWindow.prototype = Heritage.extend(ScratchpadTab.prototype, { */ _attach: function SW__attach() { - let deferred = promise.defer(); - if (!DebuggerServer.initialized) { DebuggerServer.init(); DebuggerServer.addBrowserActors(); @@ -2202,19 +2200,11 @@ ScratchpadWindow.prototype = Heritage.extend(ScratchpadTab.prototype, { DebuggerServer.allowChromeProcess = true; let client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(() => { - client.getProcess().then(aResponse => { - if (aResponse.error) { - reportError("listTabs", aResponse); - deferred.reject(aResponse); - } - else { - deferred.resolve({ form: aResponse.form, client: client }); - } + return client.connect() + .then(() => client.getProcess()) + .then(aResponse => { + return { form: aResponse.form, client: client }; }); - }); - - return deferred.promise; } }); diff --git a/devtools/client/shared/test/test-actor-registry.js b/devtools/client/shared/test/test-actor-registry.js index bd551d358bf..e0ead0c13d5 100644 --- a/devtools/client/shared/test/test-actor-registry.js +++ b/devtools/client/shared/test/test-actor-registry.js @@ -78,9 +78,7 @@ exports.getTestActorWithoutToolbox = Task.async(function* (tab) { } let client = new DebuggerClient(DebuggerServer.connectPipe()); - let deferred = promise.defer(); - client.connect(deferred.resolve); - yield deferred.promise; + yield client.connect(); // We also need to make sure the test actor is registered on the server. yield registerTestActor(client); diff --git a/devtools/client/webconsole/hudservice.js b/devtools/client/webconsole/hudservice.js index d3c3fa4ab21..c4373f0ede1 100644 --- a/devtools/client/webconsole/hudservice.js +++ b/devtools/client/webconsole/hudservice.js @@ -192,15 +192,13 @@ HUD_SERVICE.prototype = DebuggerServer.allowChromeProcess = true; let client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(() => { - client.getProcess().then(aResponse => { + return client.connect() + .then(() => client.getProcess()) + .then(aResponse => { // Set chrome:false in order to attach to the target // (i.e. send an `attach` request to the chrome actor) - deferred.resolve({ form: aResponse.form, client: client, chrome: false }); - }, deferred.reject); - }); - - return deferred.promise; + return { form: aResponse.form, client: client, chrome: false }; + }); } let target; diff --git a/devtools/server/tests/browser/browser_register_actor.js b/devtools/server/tests/browser/browser_register_actor.js index 0c30dc30941..567f0896b5b 100644 --- a/devtools/server/tests/browser/browser_register_actor.js +++ b/devtools/server/tests/browser/browser_register_actor.js @@ -11,8 +11,9 @@ function test() { } gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function onConnect() { - gClient.listTabs(function onListTabs(aResponse) { + gClient.connect() + .then(() => gClient.listTabs()) + .then(aResponse => { var options = { prefix: "helloActor", @@ -41,7 +42,6 @@ function test() { }); }); }); - }); } function checkActorState(helloActor, callback) { diff --git a/devtools/server/tests/browser/head.js b/devtools/server/tests/browser/head.js index 81a5249f687..db8130026aa 100644 --- a/devtools/server/tests/browser/head.js +++ b/devtools/server/tests/browser/head.js @@ -81,13 +81,11 @@ function initDebuggerServer() { * connected. */ function connectDebuggerClient(client) { - return new Promise(resolve => { - client.connect(() => { - client.listTabs(tabs => { - resolve(tabs.tabs[tabs.selected]); - }); + return client.connect() + .then(() => client.listTabs()) + .then(tabs => { + return tabs.tabs[tabs.selected]; }); - }); } /** diff --git a/devtools/server/tests/mochitest/director-helpers.js b/devtools/server/tests/mochitest/director-helpers.js index 968ff2ea3ca..effee775a12 100644 --- a/devtools/server/tests/mochitest/director-helpers.js +++ b/devtools/server/tests/mochitest/director-helpers.js @@ -13,8 +13,6 @@ SimpleTest.registerCleanupFunction(function() { Services.prefs.clearUserPref("dom.mozBrowserFramesEnabled"); }); -const {promiseInvoke} = require("devtools/shared/async-utils"); - const { DirectorRegistry, DirectorRegistryFront } = require("devtools/server/actors/director-registry"); @@ -30,7 +28,7 @@ function* newConnectedDebuggerClient(opts) { var transport = DebuggerServer.connectPipe(); var client = new DebuggerClient(transport); - yield promiseInvoke(client, client.connect); + yield client.connect(); var root = yield client.listTabs(); diff --git a/devtools/server/tests/mochitest/inspector-helpers.js b/devtools/server/tests/mochitest/inspector-helpers.js index 3b966622cb2..37f938d2cf4 100644 --- a/devtools/server/tests/mochitest/inspector-helpers.js +++ b/devtools/server/tests/mochitest/inspector-helpers.js @@ -58,7 +58,7 @@ function attachURL(url, callback) { window.addEventListener("message", function loadListener(event) { if (event.data === "ready") { client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect((applicationType, traits) => { + client.connect().then(([applicationType, traits]) => { client.listTabs(response => { for (let tab of response.tabs) { if (tab.url === url) { diff --git a/devtools/server/tests/mochitest/memory-helpers.js b/devtools/server/tests/mochitest/memory-helpers.js index 938dbca8604..df8203aa070 100644 --- a/devtools/server/tests/mochitest/memory-helpers.js +++ b/devtools/server/tests/mochitest/memory-helpers.js @@ -22,26 +22,14 @@ function startServerAndGetSelectedTabMemory() { DebuggerServer.addBrowserActors(); var client = new DebuggerClient(DebuggerServer.connectPipe()); - return new Promise((resolve, reject) => { - client.connect(response => { - if (response.error) { - reject(new Error(response.error + ": " + response.message)); - return; - } + return client.connect() + .then(() => client.listTabs()) + .then(response => { + var form = response.tabs[response.selected]; + var memory = MemoryFront(client, form, response); - client.listTabs(response => { - if (response.error) { - reject(new Error(response.error + ": " + response.message)); - return; - } - - var form = response.tabs[response.selected]; - var memory = MemoryFront(client, form, response); - - resolve({ memory, client }); - }); + return { memory, client }; }); - }); } function destroyServerAndFinish(client) { diff --git a/devtools/server/tests/mochitest/memprof-helpers.js b/devtools/server/tests/mochitest/memprof-helpers.js index e1f8fefa11e..33187e0bbe4 100644 --- a/devtools/server/tests/mochitest/memprof-helpers.js +++ b/devtools/server/tests/mochitest/memprof-helpers.js @@ -23,26 +23,14 @@ function startServerAndGetSelectedTabMemprof() { DebuggerServer.addBrowserActors(); var client = new DebuggerClient(DebuggerServer.connectPipe()); - return new Promise((resolve, reject) => { - client.connect(response => { - if (response.error) { - reject(new Error(response.error + ": " + response.message)); - return; - } + return client.connect() + .then(() => client.listTabs()) + .then(response => { + var form = response.tabs[response.selected]; + var memprof = MemprofFront(client, form); - client.listTabs(response => { - if (response.error) { - reject(new Error(response.error + ": " + response.message)); - return; - } - - var form = response.tabs[response.selected]; - var memprof = MemprofFront(client, form); - - resolve({ memprof, client }); - }); + return { memprof, client }; }); - }); } function destroyServerAndFinish(client) { diff --git a/devtools/server/tests/mochitest/test_device.html b/devtools/server/tests/mochitest/test_device.html index 96535563234..3722d5ba6eb 100644 --- a/devtools/server/tests/mochitest/test_device.html +++ b/devtools/server/tests/mochitest/test_device.html @@ -34,7 +34,7 @@ window.onload = function() { } var client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function onConnect() { + client.connect().then(function onConnect() { client.listTabs(function onListTabs(aResponse) { var d = getDeviceFront(client, aResponse); diff --git a/devtools/server/tests/mochitest/test_framerate_01.html b/devtools/server/tests/mochitest/test_framerate_01.html index ec45708de4e..1323e3a20ec 100644 --- a/devtools/server/tests/mochitest/test_framerate_01.html +++ b/devtools/server/tests/mochitest/test_framerate_01.html @@ -75,7 +75,7 @@ window.onload = function() { } var client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function onConnect() { + client.connect().then(function onConnect() { client.listTabs(function onListTabs(aResponse) { var form = aResponse.tabs[aResponse.selected]; var front = FramerateFront(client, form); diff --git a/devtools/server/tests/mochitest/test_framerate_02.html b/devtools/server/tests/mochitest/test_framerate_02.html index 3588b7ff88f..c9ea9ce5415 100644 --- a/devtools/server/tests/mochitest/test_framerate_02.html +++ b/devtools/server/tests/mochitest/test_framerate_02.html @@ -75,7 +75,7 @@ window.onload = function() { } var client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function onConnect() { + client.connect().then(function onConnect() { client.listTabs(function onListTabs(aResponse) { var form = aResponse.tabs[aResponse.selected]; var front = FramerateFront(client, form); diff --git a/devtools/server/tests/mochitest/test_framerate_03.html b/devtools/server/tests/mochitest/test_framerate_03.html index 867c5478d52..5c51fa2a39d 100644 --- a/devtools/server/tests/mochitest/test_framerate_03.html +++ b/devtools/server/tests/mochitest/test_framerate_03.html @@ -43,7 +43,7 @@ window.onload = function() { } var client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function onConnect() { + client.connect().then(function onConnect() { client.listTabs(function onListTabs(aResponse) { var form = aResponse.tabs[aResponse.selected]; var front = FramerateFront(client, form); diff --git a/devtools/server/tests/mochitest/test_framerate_05.html b/devtools/server/tests/mochitest/test_framerate_05.html index 0a28b6801ca..afa7f146137 100644 --- a/devtools/server/tests/mochitest/test_framerate_05.html +++ b/devtools/server/tests/mochitest/test_framerate_05.html @@ -38,7 +38,7 @@ window.onload = function() { DebuggerServer.addBrowserActors(); var client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function onConnect() { + client.connect().then(function onConnect() { client.listTabs(function onListTabs(aResponse) { var form = aResponse.tabs[aResponse.selected]; var front = FramerateFront(client, form); diff --git a/devtools/server/tests/mochitest/test_getProcess.html b/devtools/server/tests/mochitest/test_getProcess.html index 62d0e6d705e..130cda88a35 100644 --- a/devtools/server/tests/mochitest/test_getProcess.html +++ b/devtools/server/tests/mochitest/test_getProcess.html @@ -52,7 +52,7 @@ function runTests() { // Fake a first connection to the content process let transport = DebuggerServer.connectPipe(); client = new DebuggerClient(transport); - client.connect(listProcess); + client.connect().then(listProcess); } function listProcess() { diff --git a/devtools/server/tests/mochitest/test_preference.html b/devtools/server/tests/mochitest/test_preference.html index cf42bd794ff..cdc78e10bb5 100644 --- a/devtools/server/tests/mochitest/test_preference.html +++ b/devtools/server/tests/mochitest/test_preference.html @@ -31,7 +31,7 @@ function runTests() { DebuggerServer.addBrowserActors(); var client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function onConnect() { + client.connect().then(function onConnect() { client.listTabs(function onListTabs(aResponse) { var p = getPreferenceFront(client, aResponse); diff --git a/devtools/server/tests/mochitest/test_settings.html b/devtools/server/tests/mochitest/test_settings.html index 1e2d891d416..39479d45dd4 100644 --- a/devtools/server/tests/mochitest/test_settings.html +++ b/devtools/server/tests/mochitest/test_settings.html @@ -35,7 +35,7 @@ function runTests() { DebuggerServer.addBrowserActors(); var client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function onConnect() { + client.connect().then(function onConnect() { client.listTabs(function onListTabs(aResponse) { var s = getSettingsFront(client, aResponse); diff --git a/devtools/server/tests/unit/head_dbg.js b/devtools/server/tests/unit/head_dbg.js index e07439951a5..66ff795fa21 100644 --- a/devtools/server/tests/unit/head_dbg.js +++ b/devtools/server/tests/unit/head_dbg.js @@ -130,11 +130,7 @@ function createTestGlobal(name) { function connect(client) { dump("Connecting client.\n"); - return new Promise(function (resolve) { - client.connect(function () { - resolve(); - }); - }); + return client.connect(); } function close(client) { @@ -423,11 +419,11 @@ function get_chrome_actors(callback) DebuggerServer.allowChromeProcess = true; let client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(() => { - client.getProcess().then(response => { + client.connect() + .then(() => client.getProcess()) + .then(response => { callback(client, response.form); }); - }); } function getChromeActors(client, server = DebuggerServer) { diff --git a/devtools/server/tests/unit/test_actor-registry-actor.js b/devtools/server/tests/unit/test_actor-registry-actor.js index 7c39683e2a3..f46ebf8514d 100644 --- a/devtools/server/tests/unit/test_actor-registry-actor.js +++ b/devtools/server/tests/unit/test_actor-registry-actor.js @@ -19,7 +19,7 @@ function run_test() initTestDebuggerServer(); DebuggerServer.addBrowserActors(); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(getRegistry); + gClient.connect().then(getRegistry); do_test_pending(); } diff --git a/devtools/server/tests/unit/test_add_actors.js b/devtools/server/tests/unit/test_add_actors.js index d210076e9ea..bed40177aff 100644 --- a/devtools/server/tests/unit/test_add_actors.js +++ b/devtools/server/tests/unit/test_add_actors.js @@ -35,12 +35,12 @@ function run_test() function init() { gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function onConnect() { - gClient.listTabs(function onListTabs(aResponse) { + gClient.connect() + .then(() => gClient.listTabs()) + .then(aResponse => { gActors = aResponse; run_next_test(); }); - }); } function test_pre_init_global_actor() diff --git a/devtools/server/tests/unit/test_attach.js b/devtools/server/tests/unit/test_attach.js index 11ea6406ba9..f1bb1053119 100644 --- a/devtools/server/tests/unit/test_attach.js +++ b/devtools/server/tests/unit/test_attach.js @@ -12,7 +12,7 @@ function run_test() let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { + gClient.connect().then(function([aType, aTraits]) { attachTestTab(gClient, "test-1", function(aReply, aTabClient) { test_attach(aTabClient); }); diff --git a/devtools/server/tests/unit/test_blackboxing-01.js b/devtools/server/tests/unit/test_blackboxing-01.js index 3465f23934b..332444f57a5 100644 --- a/devtools/server/tests/unit/test_blackboxing-01.js +++ b/devtools/server/tests/unit/test_blackboxing-01.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; testBlackBox(); diff --git a/devtools/server/tests/unit/test_blackboxing-02.js b/devtools/server/tests/unit/test_blackboxing-02.js index a62daf33d83..ab125092ab9 100644 --- a/devtools/server/tests/unit/test_blackboxing-02.js +++ b/devtools/server/tests/unit/test_blackboxing-02.js @@ -16,7 +16,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_black_box(); diff --git a/devtools/server/tests/unit/test_blackboxing-03.js b/devtools/server/tests/unit/test_blackboxing-03.js index 86487153880..ce866bf2588 100644 --- a/devtools/server/tests/unit/test_blackboxing-03.js +++ b/devtools/server/tests/unit/test_blackboxing-03.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_black_box(); diff --git a/devtools/server/tests/unit/test_blackboxing-04.js b/devtools/server/tests/unit/test_blackboxing-04.js index c2004359c32..611de9afffa 100644 --- a/devtools/server/tests/unit/test_blackboxing-04.js +++ b/devtools/server/tests/unit/test_blackboxing-04.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_black_box(); diff --git a/devtools/server/tests/unit/test_blackboxing-05.js b/devtools/server/tests/unit/test_blackboxing-05.js index 15aac272624..862e14d5742 100644 --- a/devtools/server/tests/unit/test_blackboxing-05.js +++ b/devtools/server/tests/unit/test_blackboxing-05.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + 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 diff --git a/devtools/server/tests/unit/test_blackboxing-06.js b/devtools/server/tests/unit/test_blackboxing-06.js index 13760967664..23238c20f7e 100644 --- a/devtools/server/tests/unit/test_blackboxing-06.js +++ b/devtools/server/tests/unit/test_blackboxing-06.js @@ -16,7 +16,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; diff --git a/devtools/server/tests/unit/test_blackboxing-07.js b/devtools/server/tests/unit/test_blackboxing-07.js index 24a634db474..ebd541a0265 100644 --- a/devtools/server/tests/unit/test_blackboxing-07.js +++ b/devtools/server/tests/unit/test_blackboxing-07.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-black-box"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-black-box", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; testBlackBox(); diff --git a/devtools/server/tests/unit/test_breakpoint-01.js b/devtools/server/tests/unit/test_breakpoint-01.js index e75cbdd7ea8..efdc20e3562 100644 --- a/devtools/server/tests/unit/test_breakpoint-01.js +++ b/devtools/server/tests/unit/test_breakpoint-01.js @@ -23,7 +23,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-02.js b/devtools/server/tests/unit/test_breakpoint-02.js index 0bc6a2f40d3..7ec8e63960b 100644 --- a/devtools/server/tests/unit/test_breakpoint-02.js +++ b/devtools/server/tests/unit/test_breakpoint-02.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_breakpoint_running(); diff --git a/devtools/server/tests/unit/test_breakpoint-03.js b/devtools/server/tests/unit/test_breakpoint-03.js index 5db5d499460..0c472bb0744 100644 --- a/devtools/server/tests/unit/test_breakpoint-03.js +++ b/devtools/server/tests/unit/test_breakpoint-03.js @@ -26,7 +26,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { diff --git a/devtools/server/tests/unit/test_breakpoint-04.js b/devtools/server/tests/unit/test_breakpoint-04.js index ee3366c2e21..ed86a99bc5a 100644 --- a/devtools/server/tests/unit/test_breakpoint-04.js +++ b/devtools/server/tests/unit/test_breakpoint-04.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_child_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-05.js b/devtools/server/tests/unit/test_breakpoint-05.js index cf5e630e20f..a059978f660 100644 --- a/devtools/server/tests/unit/test_breakpoint-05.js +++ b/devtools/server/tests/unit/test_breakpoint-05.js @@ -25,7 +25,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_child_skip_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-06.js b/devtools/server/tests/unit/test_breakpoint-06.js index c39675d719a..5c1e2ec5e5d 100644 --- a/devtools/server/tests/unit/test_breakpoint-06.js +++ b/devtools/server/tests/unit/test_breakpoint-06.js @@ -25,7 +25,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_nested_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-07.js b/devtools/server/tests/unit/test_breakpoint-07.js index 12766ac0659..6731d88cfe5 100644 --- a/devtools/server/tests/unit/test_breakpoint-07.js +++ b/devtools/server/tests/unit/test_breakpoint-07.js @@ -25,7 +25,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_second_child_skip_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-08.js b/devtools/server/tests/unit/test_breakpoint-08.js index a1bca9c0c26..e54af0dd29f 100644 --- a/devtools/server/tests/unit/test_breakpoint-08.js +++ b/devtools/server/tests/unit/test_breakpoint-08.js @@ -25,7 +25,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_child_skip_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-09.js b/devtools/server/tests/unit/test_breakpoint-09.js index 5735af904e7..fee611da521 100644 --- a/devtools/server/tests/unit/test_breakpoint-09.js +++ b/devtools/server/tests/unit/test_breakpoint-09.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_remove_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-10.js b/devtools/server/tests/unit/test_breakpoint-10.js index 2de01c60992..65fd90018d1 100644 --- a/devtools/server/tests/unit/test_breakpoint-10.js +++ b/devtools/server/tests/unit/test_breakpoint-10.js @@ -25,7 +25,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_child_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-11.js b/devtools/server/tests/unit/test_breakpoint-11.js index ef8eb8c4be8..74e580f5f22 100644 --- a/devtools/server/tests/unit/test_breakpoint-11.js +++ b/devtools/server/tests/unit/test_breakpoint-11.js @@ -25,7 +25,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_child_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-12.js b/devtools/server/tests/unit/test_breakpoint-12.js index a184e5aeb6a..62063155af4 100644 --- a/devtools/server/tests/unit/test_breakpoint-12.js +++ b/devtools/server/tests/unit/test_breakpoint-12.js @@ -29,7 +29,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_child_skip_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-13.js b/devtools/server/tests/unit/test_breakpoint-13.js index 307b058a411..db5deaec36e 100644 --- a/devtools/server/tests/unit/test_breakpoint-13.js +++ b/devtools/server/tests/unit/test_breakpoint-13.js @@ -25,7 +25,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-14.js b/devtools/server/tests/unit/test_breakpoint-14.js index 163b357bb37..bd288e5ca7d 100644 --- a/devtools/server/tests/unit/test_breakpoint-14.js +++ b/devtools/server/tests/unit/test_breakpoint-14.js @@ -25,7 +25,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_breakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-15.js b/devtools/server/tests/unit/test_breakpoint-15.js index 1e9935a2a26..6a3ab7c6f55 100644 --- a/devtools/server/tests/unit/test_breakpoint-15.js +++ b/devtools/server/tests/unit/test_breakpoint-15.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; testSameBreakpoint(); diff --git a/devtools/server/tests/unit/test_breakpoint-16.js b/devtools/server/tests/unit/test_breakpoint-16.js index 8aaba8f6121..10408c40d0e 100644 --- a/devtools/server/tests/unit/test_breakpoint-16.js +++ b/devtools/server/tests/unit/test_breakpoint-16.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-breakpoints", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-breakpoints", function (aResponse, aTabClient, aThreadClient) { diff --git a/devtools/server/tests/unit/test_breakpoint-17.js b/devtools/server/tests/unit/test_breakpoint-17.js index 0f501f4625f..bd093a2fc12 100644 --- a/devtools/server/tests/unit/test_breakpoint-17.js +++ b/devtools/server/tests/unit/test_breakpoint-17.js @@ -23,7 +23,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-breakpoints", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-breakpoints", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_breakpoints_columns(); diff --git a/devtools/server/tests/unit/test_breakpoint-18.js b/devtools/server/tests/unit/test_breakpoint-18.js index 81909bc0375..74414adeaeb 100644 --- a/devtools/server/tests/unit/test_breakpoint-18.js +++ b/devtools/server/tests/unit/test_breakpoint-18.js @@ -26,7 +26,7 @@ function run_test_with_server(aServer, aCallback) gDebuggee = addTestGlobal("test-breakpoints", aServer); gDebuggee.console = { log: x => void x }; gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-breakpoints", function (aResponse, aTabClient, aThreadClient) { diff --git a/devtools/server/tests/unit/test_breakpoint-19.js b/devtools/server/tests/unit/test_breakpoint-19.js index b869592a73f..68784bfb9f8 100644 --- a/devtools/server/tests/unit/test_breakpoint-19.js +++ b/devtools/server/tests/unit/test_breakpoint-19.js @@ -26,7 +26,7 @@ function run_test_with_server(aServer, aCallback) gDebuggee = addTestGlobal("test-breakpoints", aServer); gDebuggee.console = { log: x => void x }; gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-breakpoints", function (aResponse, aTabClient, aThreadClient) { diff --git a/devtools/server/tests/unit/test_breakpoint-20.js b/devtools/server/tests/unit/test_breakpoint-20.js index 20e8d24949d..fb673f825e3 100644 --- a/devtools/server/tests/unit/test_breakpoint-20.js +++ b/devtools/server/tests/unit/test_breakpoint-20.js @@ -16,7 +16,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-breakpoints"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestThread(gClient, "test-breakpoints", testBreakpoint); }); do_test_pending(); diff --git a/devtools/server/tests/unit/test_breakpoint-21.js b/devtools/server/tests/unit/test_breakpoint-21.js index 9ca9cf1e945..8b7dd84c473 100644 --- a/devtools/server/tests/unit/test_breakpoint-21.js +++ b/devtools/server/tests/unit/test_breakpoint-21.js @@ -26,7 +26,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-breakpoints", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-breakpoints", function (aResponse, aTabClient, aThreadClient) { diff --git a/devtools/server/tests/unit/test_client_close.js b/devtools/server/tests/unit/test_client_close.js index 9909c4ce839..14fa66efad0 100644 --- a/devtools/server/tests/unit/test_client_close.js +++ b/devtools/server/tests/unit/test_client_close.js @@ -12,7 +12,7 @@ function run_test() let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { + gClient.connect().then(function(aType, aTraits) { attachTestTab(gClient, "test-1", function(aReply, aTabClient) { test_close(transport); }); diff --git a/devtools/server/tests/unit/test_client_request.js b/devtools/server/tests/unit/test_client_request.js index 9bd4f337964..bad82906106 100644 --- a/devtools/server/tests/unit/test_client_request.js +++ b/devtools/server/tests/unit/test_client_request.js @@ -45,12 +45,12 @@ function run_test() function init() { gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function onConnect() { - gClient.listTabs(function onListTabs(aResponse) { + gClient.connect() + .then(() => gClient.listTabs()) + .then(aResponse => { gActorId = aResponse.test; run_next_test(); }); - }); } function checkStack(expectedName) { diff --git a/devtools/server/tests/unit/test_conditional_breakpoint-01.js b/devtools/server/tests/unit/test_conditional_breakpoint-01.js index 3f68d14aaf5..4661bb0c4c2 100644 --- a/devtools/server/tests/unit/test_conditional_breakpoint-01.js +++ b/devtools/server/tests/unit/test_conditional_breakpoint-01.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-conditional-breakpoint"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-conditional-breakpoint", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_breakpoint(); diff --git a/devtools/server/tests/unit/test_conditional_breakpoint-02.js b/devtools/server/tests/unit/test_conditional_breakpoint-02.js index 266750488b8..30f511d351b 100644 --- a/devtools/server/tests/unit/test_conditional_breakpoint-02.js +++ b/devtools/server/tests/unit/test_conditional_breakpoint-02.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-conditional-breakpoint"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-conditional-breakpoint", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_breakpoint(); diff --git a/devtools/server/tests/unit/test_conditional_breakpoint-03.js b/devtools/server/tests/unit/test_conditional_breakpoint-03.js index 50e911d54ae..d9cf13e005d 100644 --- a/devtools/server/tests/unit/test_conditional_breakpoint-03.js +++ b/devtools/server/tests/unit/test_conditional_breakpoint-03.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-conditional-breakpoint"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-conditional-breakpoint", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_breakpoint(); diff --git a/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js b/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js index 35a2163f1b8..208d3d07c01 100644 --- a/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js +++ b/devtools/server/tests/unit/test_dbgclient_debuggerstatement.js @@ -13,7 +13,7 @@ function run_test() let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { + gClient.connect().then(function([aType, aTraits]) { attachTestTab(gClient, "test-1", function(aReply, aTabClient) { gTabClient = aTabClient; test_threadAttach(aReply.threadActor); diff --git a/devtools/server/tests/unit/test_eval-01.js b/devtools/server/tests/unit/test_eval-01.js index 03bbcfbf569..21e08c30cfe 100644 --- a/devtools/server/tests/unit/test_eval-01.js +++ b/devtools/server/tests/unit/test_eval-01.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_eval(); diff --git a/devtools/server/tests/unit/test_eval-02.js b/devtools/server/tests/unit/test_eval-02.js index 6dcb607e785..9dddb3bd380 100644 --- a/devtools/server/tests/unit/test_eval-02.js +++ b/devtools/server/tests/unit/test_eval-02.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_throw_eval(); diff --git a/devtools/server/tests/unit/test_eval-03.js b/devtools/server/tests/unit/test_eval-03.js index 867fe56169a..c335937f009 100644 --- a/devtools/server/tests/unit/test_eval-03.js +++ b/devtools/server/tests/unit/test_eval-03.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_syntax_error_eval(); diff --git a/devtools/server/tests/unit/test_eval-04.js b/devtools/server/tests/unit/test_eval-04.js index 302b591df77..534f505a1a6 100644 --- a/devtools/server/tests/unit/test_eval-04.js +++ b/devtools/server/tests/unit/test_eval-04.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_syntax_error_eval(); diff --git a/devtools/server/tests/unit/test_eval-05.js b/devtools/server/tests/unit/test_eval-05.js index 3f779b3233f..26d0afd64c0 100644 --- a/devtools/server/tests/unit/test_eval-05.js +++ b/devtools/server/tests/unit/test_eval-05.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_syntax_error_eval(); diff --git a/devtools/server/tests/unit/test_eventlooplag_actor.js b/devtools/server/tests/unit/test_eventlooplag_actor.js index a97c1d321d5..4dd531879b5 100644 --- a/devtools/server/tests/unit/test_eventlooplag_actor.js +++ b/devtools/server/tests/unit/test_eventlooplag_actor.js @@ -23,7 +23,7 @@ function run_test() let client = new DebuggerClient(DebuggerServer.connectPipe()); // Start tracking event loop lags. - client.connect(function () { + client.connect().then(function () { client.listTabs(function(resp) { front = new EventLoopLagFront(client, resp); front.start().then(success => { diff --git a/devtools/server/tests/unit/test_forwardingprefix.js b/devtools/server/tests/unit/test_forwardingprefix.js index ab289799bdb..4b3d7429ab6 100644 --- a/devtools/server/tests/unit/test_forwardingprefix.js +++ b/devtools/server/tests/unit/test_forwardingprefix.js @@ -52,7 +52,7 @@ function createMainConnection() { ({ conn: gMainConnection, transport: gMainTransport } = newConnection()); gClient = new DebuggerClient(gMainTransport); - gClient.connect((aType, aTraits) => run_next_test()); + gClient.connect().then(([aType, aTraits]) => run_next_test()); } /* diff --git a/devtools/server/tests/unit/test_frameactor-01.js b/devtools/server/tests/unit/test_frameactor-01.js index 52125d7cb0d..e8f7ed56c74 100644 --- a/devtools/server/tests/unit/test_frameactor-01.js +++ b/devtools/server/tests/unit/test_frameactor-01.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_frameactor-02.js b/devtools/server/tests/unit/test_frameactor-02.js index 2c6c01ccea6..5825df9a51c 100644 --- a/devtools/server/tests/unit/test_frameactor-02.js +++ b/devtools/server/tests/unit/test_frameactor-02.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_frameactor-03.js b/devtools/server/tests/unit/test_frameactor-03.js index b7c08d31a05..68e8c4572c8 100644 --- a/devtools/server/tests/unit/test_frameactor-03.js +++ b/devtools/server/tests/unit/test_frameactor-03.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_frameactor-04.js b/devtools/server/tests/unit/test_frameactor-04.js index 96c2285cbb2..d58e9ff1bb8 100644 --- a/devtools/server/tests/unit/test_frameactor-04.js +++ b/devtools/server/tests/unit/test_frameactor-04.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_frameactor-05.js b/devtools/server/tests/unit/test_frameactor-05.js index 409edb77f70..0ba1e84cc02 100644 --- a/devtools/server/tests/unit/test_frameactor-05.js +++ b/devtools/server/tests/unit/test_frameactor-05.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_framearguments-01.js b/devtools/server/tests/unit/test_framearguments-01.js index 3c5613ef113..785f618040a 100644 --- a/devtools/server/tests/unit/test_framearguments-01.js +++ b/devtools/server/tests/unit/test_framearguments-01.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_framebindings-01.js b/devtools/server/tests/unit/test_framebindings-01.js index 405f95c145c..ecf8d62fa24 100644 --- a/devtools/server/tests/unit/test_framebindings-01.js +++ b/devtools/server/tests/unit/test_framebindings-01.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_framebindings-02.js b/devtools/server/tests/unit/test_framebindings-02.js index d3f8073df82..4249c77952c 100644 --- a/devtools/server/tests/unit/test_framebindings-02.js +++ b/devtools/server/tests/unit/test_framebindings-02.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_framebindings-03.js b/devtools/server/tests/unit/test_framebindings-03.js index eed8649aa09..91138081b37 100644 --- a/devtools/server/tests/unit/test_framebindings-03.js +++ b/devtools/server/tests/unit/test_framebindings-03.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_framebindings-04.js b/devtools/server/tests/unit/test_framebindings-04.js index b2d71ffe507..ea6d3c27fff 100644 --- a/devtools/server/tests/unit/test_framebindings-04.js +++ b/devtools/server/tests/unit/test_framebindings-04.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_framebindings-05.js b/devtools/server/tests/unit/test_framebindings-05.js index 32d670750b8..060bdf7aaf8 100644 --- a/devtools/server/tests/unit/test_framebindings-05.js +++ b/devtools/server/tests/unit/test_framebindings-05.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_framebindings-06.js b/devtools/server/tests/unit/test_framebindings-06.js index 2f714f9cc31..738f19cea80 100644 --- a/devtools/server/tests/unit/test_framebindings-06.js +++ b/devtools/server/tests/unit/test_framebindings-06.js @@ -11,7 +11,7 @@ function run_test() gDebuggee = addTestGlobal("test-grips"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_banana_environment(); diff --git a/devtools/server/tests/unit/test_framebindings-07.js b/devtools/server/tests/unit/test_framebindings-07.js index 47c7e69c800..a01b96e70c9 100644 --- a/devtools/server/tests/unit/test_framebindings-07.js +++ b/devtools/server/tests/unit/test_framebindings-07.js @@ -12,7 +12,7 @@ function run_test() gDebuggee = addTestGlobal("test-bindings"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-bindings", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_banana_environment(); diff --git a/devtools/server/tests/unit/test_frameclient-01.js b/devtools/server/tests/unit/test_frameclient-01.js index b75e7eb20c7..56019dd4ff4 100644 --- a/devtools/server/tests/unit/test_frameclient-01.js +++ b/devtools/server/tests/unit/test_frameclient-01.js @@ -10,7 +10,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_frameclient-02.js b/devtools/server/tests/unit/test_frameclient-02.js index 7e12abbc861..a66deedff47 100644 --- a/devtools/server/tests/unit/test_frameclient-02.js +++ b/devtools/server/tests/unit/test_frameclient-02.js @@ -10,7 +10,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_functiongrips-01.js b/devtools/server/tests/unit/test_functiongrips-01.js index 8c3ba605c89..3fef2ff07fa 100644 --- a/devtools/server/tests/unit/test_functiongrips-01.js +++ b/devtools/server/tests/unit/test_functiongrips-01.js @@ -14,7 +14,7 @@ function run_test() }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_named_function(); diff --git a/devtools/server/tests/unit/test_get-executable-lines-source-map.js b/devtools/server/tests/unit/test_get-executable-lines-source-map.js index b32e69aab85..bc30e299115 100644 --- a/devtools/server/tests/unit/test_get-executable-lines-source-map.js +++ b/devtools/server/tests/unit/test_get-executable-lines-source-map.js @@ -16,7 +16,7 @@ function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-get-executable-lines"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function _onConnect() { + gClient.connect().then(function _onConnect() { attachTestTabAndResume( gClient, "test-get-executable-lines", diff --git a/devtools/server/tests/unit/test_get-executable-lines.js b/devtools/server/tests/unit/test_get-executable-lines.js index 2228fa5259f..447eab3e587 100644 --- a/devtools/server/tests/unit/test_get-executable-lines.js +++ b/devtools/server/tests/unit/test_get-executable-lines.js @@ -16,7 +16,7 @@ function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-get-executable-lines"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function _onConnect() { + gClient.connect().then(function _onConnect() { attachTestTabAndResume( gClient, "test-get-executable-lines", diff --git a/devtools/server/tests/unit/test_ignore_caught_exceptions.js b/devtools/server/tests/unit/test_ignore_caught_exceptions.js index 09cdb8070be..c438b95d157 100644 --- a/devtools/server/tests/unit/test_ignore_caught_exceptions.js +++ b/devtools/server/tests/unit/test_ignore_caught_exceptions.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_interrupt.js b/devtools/server/tests/unit/test_interrupt.js index 01d8cfb4835..7c0021d21ec 100644 --- a/devtools/server/tests/unit/test_interrupt.js +++ b/devtools/server/tests/unit/test_interrupt.js @@ -12,7 +12,7 @@ function run_test() let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect(function(aType, aTraits) { + gClient.connect().then(function(aType, aTraits) { attachTestTab(gClient, "test-1", test_attach); }); do_test_pending(); diff --git a/devtools/server/tests/unit/test_listsources-01.js b/devtools/server/tests/unit/test_listsources-01.js index 1d9b58f92a2..231e6a1e4fa 100644 --- a/devtools/server/tests/unit/test_listsources-01.js +++ b/devtools/server/tests/unit/test_listsources-01.js @@ -24,7 +24,7 @@ function run_test() return request.call(this, aRequest, aOnResponse); }; }(gClient.request)); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_listsources(); diff --git a/devtools/server/tests/unit/test_listsources-02.js b/devtools/server/tests/unit/test_listsources-02.js index 09ac39d843c..190a5e31bc9 100644 --- a/devtools/server/tests/unit/test_listsources-02.js +++ b/devtools/server/tests/unit/test_listsources-02.js @@ -24,7 +24,7 @@ function run_test() return request.call(this, aRequest, aOnResponse); }; }(gClient.request)); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_listing_zero_sources(); diff --git a/devtools/server/tests/unit/test_listsources-03.js b/devtools/server/tests/unit/test_listsources-03.js index a0d401dc151..72ebb5e1c28 100644 --- a/devtools/server/tests/unit/test_listsources-03.js +++ b/devtools/server/tests/unit/test_listsources-03.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-sources"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-sources", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_listsources(); diff --git a/devtools/server/tests/unit/test_longstringgrips-01.js b/devtools/server/tests/unit/test_longstringgrips-01.js index a488590d5c6..e2321833456 100644 --- a/devtools/server/tests/unit/test_longstringgrips-01.js +++ b/devtools/server/tests/unit/test_longstringgrips-01.js @@ -14,7 +14,7 @@ function run_test() }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_longstring_grip(); diff --git a/devtools/server/tests/unit/test_longstringgrips-02.js b/devtools/server/tests/unit/test_longstringgrips-02.js index 62262d3b509..5fed8389c9d 100644 --- a/devtools/server/tests/unit/test_longstringgrips-02.js +++ b/devtools/server/tests/unit/test_longstringgrips-02.js @@ -14,7 +14,7 @@ function run_test() }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume( gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; diff --git a/devtools/server/tests/unit/test_memory_footprint.js b/devtools/server/tests/unit/test_memory_footprint.js index abc1291b7cb..f7c5c677635 100644 --- a/devtools/server/tests/unit/test_memory_footprint.js +++ b/devtools/server/tests/unit/test_memory_footprint.js @@ -39,7 +39,7 @@ function add_browser_actors() { function connect_client() { gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function onConnect() { + gClient.connect().then(function onConnect() { check_footprint("DebuggerClient.connect()", 2000); }); } diff --git a/devtools/server/tests/unit/test_nesting-01.js b/devtools/server/tests/unit/test_nesting-01.js index dcfb0fe6322..e515f051ee8 100644 --- a/devtools/server/tests/unit/test_nesting-01.js +++ b/devtools/server/tests/unit/test_nesting-01.js @@ -12,7 +12,7 @@ function run_test() { initTestDebuggerServer(); let gDebuggee = addTestGlobal("test-nesting"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function () { + 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); diff --git a/devtools/server/tests/unit/test_nesting-02.js b/devtools/server/tests/unit/test_nesting-02.js index e217c2611b8..928331be569 100644 --- a/devtools/server/tests/unit/test_nesting-02.js +++ b/devtools/server/tests/unit/test_nesting-02.js @@ -12,7 +12,7 @@ function run_test() { initTestDebuggerServer(); let gDebuggee = addTestGlobal("test-nesting"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function () { + 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. diff --git a/devtools/server/tests/unit/test_new_source-01.js b/devtools/server/tests/unit/test_new_source-01.js index 533f30ce0ba..f4a430f2d60 100644 --- a/devtools/server/tests/unit/test_new_source-01.js +++ b/devtools/server/tests/unit/test_new_source-01.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_new_source(); diff --git a/devtools/server/tests/unit/test_objectgrips-01.js b/devtools/server/tests/unit/test_objectgrips-01.js index f90238a38cc..62bbccb0ca7 100644 --- a/devtools/server/tests/unit/test_objectgrips-01.js +++ b/devtools/server/tests/unit/test_objectgrips-01.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) }.toString()); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-02.js b/devtools/server/tests/unit/test_objectgrips-02.js index 0b7b12f9180..fc3da8cd62e 100644 --- a/devtools/server/tests/unit/test_objectgrips-02.js +++ b/devtools/server/tests/unit/test_objectgrips-02.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) }.toString()); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-03.js b/devtools/server/tests/unit/test_objectgrips-03.js index 6cebb7fc2fa..ea2b8ba2c57 100644 --- a/devtools/server/tests/unit/test_objectgrips-03.js +++ b/devtools/server/tests/unit/test_objectgrips-03.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) }.toString()); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-04.js b/devtools/server/tests/unit/test_objectgrips-04.js index 9e295f80f6e..aa89a03dba1 100644 --- a/devtools/server/tests/unit/test_objectgrips-04.js +++ b/devtools/server/tests/unit/test_objectgrips-04.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) }.toString()); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-05.js b/devtools/server/tests/unit/test_objectgrips-05.js index 04fde877f25..eca0a3efc19 100644 --- a/devtools/server/tests/unit/test_objectgrips-05.js +++ b/devtools/server/tests/unit/test_objectgrips-05.js @@ -29,7 +29,7 @@ function run_test_with_server(aServer, aCallback) }.toString()); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-06.js b/devtools/server/tests/unit/test_objectgrips-06.js index 7971f28fbd2..4bb77249e69 100644 --- a/devtools/server/tests/unit/test_objectgrips-06.js +++ b/devtools/server/tests/unit/test_objectgrips-06.js @@ -29,7 +29,7 @@ function run_test_with_server(aServer, aCallback) }.toString()); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-07.js b/devtools/server/tests/unit/test_objectgrips-07.js index 9ecce818ddc..7cbd6d18026 100644 --- a/devtools/server/tests/unit/test_objectgrips-07.js +++ b/devtools/server/tests/unit/test_objectgrips-07.js @@ -29,7 +29,7 @@ function run_test_with_server(aServer, aCallback) }.toString()); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-08.js b/devtools/server/tests/unit/test_objectgrips-08.js index 591278d6671..640acd909e2 100644 --- a/devtools/server/tests/unit/test_objectgrips-08.js +++ b/devtools/server/tests/unit/test_objectgrips-08.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) }.toString()); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-09.js b/devtools/server/tests/unit/test_objectgrips-09.js index c87726c688d..0392e4dfc9f 100644 --- a/devtools/server/tests/unit/test_objectgrips-09.js +++ b/devtools/server/tests/unit/test_objectgrips-09.js @@ -28,7 +28,7 @@ function run_test_with_server(aServer, aCallback) }.toString()); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-10.js b/devtools/server/tests/unit/test_objectgrips-10.js index 67451e3075a..d61d4598410 100644 --- a/devtools/server/tests/unit/test_objectgrips-10.js +++ b/devtools/server/tests/unit/test_objectgrips-10.js @@ -13,7 +13,7 @@ function run_test() gDebuggee = addTestGlobal("test-closures"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-closures", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-11.js b/devtools/server/tests/unit/test_objectgrips-11.js index 94d594577a9..a223693c7b9 100644 --- a/devtools/server/tests/unit/test_objectgrips-11.js +++ b/devtools/server/tests/unit/test_objectgrips-11.js @@ -16,7 +16,7 @@ function run_test() }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_object_grip(); diff --git a/devtools/server/tests/unit/test_objectgrips-12.js b/devtools/server/tests/unit/test_objectgrips-12.js index fdcd9070453..e0c81523fb7 100644 --- a/devtools/server/tests/unit/test_objectgrips-12.js +++ b/devtools/server/tests/unit/test_objectgrips-12.js @@ -16,7 +16,7 @@ function run_test() }.toString()); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_display_string(); diff --git a/devtools/server/tests/unit/test_objectgrips-13.js b/devtools/server/tests/unit/test_objectgrips-13.js index 13f650b69af..1523dd2ecc0 100644 --- a/devtools/server/tests/unit/test_objectgrips-13.js +++ b/devtools/server/tests/unit/test_objectgrips-13.js @@ -17,7 +17,7 @@ function run_test() }.toString(), gDebuggee); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; add_pause_listener(); diff --git a/devtools/server/tests/unit/test_pause_exceptions-01.js b/devtools/server/tests/unit/test_pause_exceptions-01.js index 0ca75e388af..92f9165587a 100644 --- a/devtools/server/tests/unit/test_pause_exceptions-01.js +++ b/devtools/server/tests/unit/test_pause_exceptions-01.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_pause_exceptions-02.js b/devtools/server/tests/unit/test_pause_exceptions-02.js index 54174ec08ea..bebf295f365 100644 --- a/devtools/server/tests/unit/test_pause_exceptions-02.js +++ b/devtools/server/tests/unit/test_pause_exceptions-02.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_pauselifetime-01.js b/devtools/server/tests/unit/test_pauselifetime-01.js index a7af929456b..3cbff5a88bb 100644 --- a/devtools/server/tests/unit/test_pauselifetime-01.js +++ b/devtools/server/tests/unit/test_pauselifetime-01.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_pauselifetime-02.js b/devtools/server/tests/unit/test_pauselifetime-02.js index bfbb18e3990..521d2082da4 100644 --- a/devtools/server/tests/unit/test_pauselifetime-02.js +++ b/devtools/server/tests/unit/test_pauselifetime-02.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_pauselifetime-03.js b/devtools/server/tests/unit/test_pauselifetime-03.js index 058ca42e64e..0d7a48c1de2 100644 --- a/devtools/server/tests/unit/test_pauselifetime-03.js +++ b/devtools/server/tests/unit/test_pauselifetime-03.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_pauselifetime-04.js b/devtools/server/tests/unit/test_pauselifetime-04.js index a9d90d0215b..f537668dbf7 100644 --- a/devtools/server/tests/unit/test_pauselifetime-04.js +++ b/devtools/server/tests/unit/test_pauselifetime-04.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-stack"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_pause_frame(); diff --git a/devtools/server/tests/unit/test_promise_state-01.js b/devtools/server/tests/unit/test_promise_state-01.js index d04321d279c..6e658ae7fbc 100644 --- a/devtools/server/tests/unit/test_promise_state-01.js +++ b/devtools/server/tests/unit/test_promise_state-01.js @@ -11,7 +11,7 @@ function run_test() initTestDebuggerServer(); const debuggee = addTestGlobal("test-promise-state"); const client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function() { + client.connect().then(function() { attachTestTabAndResume(client, "test-promise-state", function (response, tabClient, threadClient) { Task.spawn(function* () { const packet = yield executeOnNextTickAndWaitForPause(() => evalCode(debuggee), client); diff --git a/devtools/server/tests/unit/test_promise_state-02.js b/devtools/server/tests/unit/test_promise_state-02.js index 1a9cb5bb42b..83b8d9ee511 100644 --- a/devtools/server/tests/unit/test_promise_state-02.js +++ b/devtools/server/tests/unit/test_promise_state-02.js @@ -11,7 +11,7 @@ function run_test() initTestDebuggerServer(); const debuggee = addTestGlobal("test-promise-state"); const client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function() { + client.connect().then(function() { attachTestTabAndResume(client, "test-promise-state", function (response, tabClient, threadClient) { Task.spawn(function* () { const packet = yield executeOnNextTickAndWaitForPause(() => evalCode(debuggee), client); diff --git a/devtools/server/tests/unit/test_promise_state-03.js b/devtools/server/tests/unit/test_promise_state-03.js index 9f686ba2d2f..615b1217a90 100644 --- a/devtools/server/tests/unit/test_promise_state-03.js +++ b/devtools/server/tests/unit/test_promise_state-03.js @@ -11,7 +11,7 @@ function run_test() initTestDebuggerServer(); const debuggee = addTestGlobal("test-promise-state"); const client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function() { + client.connect().then(function() { attachTestTabAndResume(client, "test-promise-state", function (response, tabClient, threadClient) { Task.spawn(function* () { const packet = yield executeOnNextTickAndWaitForPause(() => evalCode(debuggee), client); diff --git a/devtools/server/tests/unit/test_protocol_abort.js b/devtools/server/tests/unit/test_protocol_abort.js index 665e4f1b37e..efa959a1ff0 100644 --- a/devtools/server/tests/unit/test_protocol_abort.js +++ b/devtools/server/tests/unit/test_protocol_abort.js @@ -54,7 +54,7 @@ function run_test() { let client = new DebuggerClient(trace); let rootClient; - client.connect((applicationType, traits) => { + client.connect().then(([applicationType, traits]) => { rootClient = RootFront(client); rootClient.simpleReturn().then(() => { diff --git a/devtools/server/tests/unit/test_protocol_async.js b/devtools/server/tests/unit/test_protocol_async.js index 65c8bfb7059..44fdd4a946f 100644 --- a/devtools/server/tests/unit/test_protocol_async.js +++ b/devtools/server/tests/unit/test_protocol_async.js @@ -97,7 +97,7 @@ function run_test() let client = new DebuggerClient(trace); let rootClient; - client.connect((applicationType, traits) => { + client.connect().then([applicationType, traits]) => { rootClient = RootFront(client); let calls = []; diff --git a/devtools/server/tests/unit/test_protocol_children.js b/devtools/server/tests/unit/test_protocol_children.js index f7b072c89a2..a61c76cb574 100644 --- a/devtools/server/tests/unit/test_protocol_children.js +++ b/devtools/server/tests/unit/test_protocol_children.js @@ -303,7 +303,7 @@ function run_test() let trace = connectPipeTracing(); let client = new DebuggerClient(trace); - client.connect((applicationType, traits) => { + client.connect().then(([applicationType, traits]) => { trace.expectReceive({"from":"","applicationType":"xpcshell-tests","traits":[]}) do_check_eq(applicationType, "xpcshell-tests"); diff --git a/devtools/server/tests/unit/test_protocol_longstring.js b/devtools/server/tests/unit/test_protocol_longstring.js index 462154810b4..99e123cf540 100644 --- a/devtools/server/tests/unit/test_protocol_longstring.js +++ b/devtools/server/tests/unit/test_protocol_longstring.js @@ -96,7 +96,7 @@ function run_test() } - client.connect((applicationType, traits) => { + client.connect().then(([applicationType, traits]) => { rootClient = RootFront(client); // Root actor has no children yet. diff --git a/devtools/server/tests/unit/test_protocol_simple.js b/devtools/server/tests/unit/test_protocol_simple.js index e6f734aeac7..05a6f3d1732 100644 --- a/devtools/server/tests/unit/test_protocol_simple.js +++ b/devtools/server/tests/unit/test_protocol_simple.js @@ -180,7 +180,7 @@ function run_test() let client = new DebuggerClient(trace); let rootClient; - client.connect((applicationType, traits) => { + client.connect().then(([applicationType, traits]) => { trace.expectReceive({"from":"","applicationType":"xpcshell-tests","traits":[]}); do_check_eq(applicationType, "xpcshell-tests"); diff --git a/devtools/server/tests/unit/test_protocol_stack.js b/devtools/server/tests/unit/test_protocol_stack.js index c4fab033871..0328e514f62 100644 --- a/devtools/server/tests/unit/test_protocol_stack.js +++ b/devtools/server/tests/unit/test_protocol_stack.js @@ -63,7 +63,7 @@ function run_test() { let client = new DebuggerClient(trace); let rootClient; - client.connect(function onConnect() { + client.connect().then(function onConnect() { rootClient = RootFront(client); rootClient.simpleReturn().then(() => { diff --git a/devtools/server/tests/unit/test_reattach-thread.js b/devtools/server/tests/unit/test_reattach-thread.js index e83100a28bf..e7ec07f6ba2 100644 --- a/devtools/server/tests/unit/test_reattach-thread.js +++ b/devtools/server/tests/unit/test_reattach-thread.js @@ -15,7 +15,7 @@ function run_test() let transport = DebuggerServer.connectPipe(); gClient = new DebuggerClient(transport); - gClient.connect(() => { + gClient.connect().then(() => { attachTestTab(gClient, "test-reattach", (aReply, aTabClient) => { gTabClient = aTabClient; test_attach(); diff --git a/devtools/server/tests/unit/test_registerClient.js b/devtools/server/tests/unit/test_registerClient.js index 1fb3a425c59..a5d961c15a0 100644 --- a/devtools/server/tests/unit/test_registerClient.js +++ b/devtools/server/tests/unit/test_registerClient.js @@ -65,13 +65,13 @@ function run_test() function init() { gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function onConnect() { - gClient.listTabs(function onListTabs(aResponse) { + gClient.connect() + .then(() => gClient.listTabs()) + .then(aResponse => { gActors = aResponse; gTestClient = new TestClient(gClient, aResponse); run_next_test(); }); - }); } function test_client_events() diff --git a/devtools/server/tests/unit/test_register_actor.js b/devtools/server/tests/unit/test_register_actor.js index 7a9f0170180..3f326270196 100644 --- a/devtools/server/tests/unit/test_register_actor.js +++ b/devtools/server/tests/unit/test_register_actor.js @@ -74,7 +74,7 @@ function test_lazy_api() { do_check_false(isActorInstanciated); let client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function onConnect() { + client.connect().then(function onConnect() { client.listTabs(onListTabs); }); function onListTabs(aResponse) { diff --git a/devtools/server/tests/unit/test_requestTypes.js b/devtools/server/tests/unit/test_requestTypes.js index 014c9920638..5695a6571aa 100644 --- a/devtools/server/tests/unit/test_requestTypes.js +++ b/devtools/server/tests/unit/test_requestTypes.js @@ -28,7 +28,7 @@ function run_test() DebuggerServer.addBrowserActors(); var client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function() { + client.connect().then(function() { test_requestTypes_request(client); }); diff --git a/devtools/server/tests/unit/test_source-01.js b/devtools/server/tests/unit/test_source-01.js index 2d605cda777..044e30c34d9 100644 --- a/devtools/server/tests/unit/test_source-01.js +++ b/devtools/server/tests/unit/test_source-01.js @@ -24,7 +24,7 @@ function run_test() ); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_source(); diff --git a/devtools/server/tests/unit/test_sourcemaps-01.js b/devtools/server/tests/unit/test_sourcemaps-01.js index 930bcd803a7..1ce6c734842 100644 --- a/devtools/server/tests/unit/test_sourcemaps-01.js +++ b/devtools/server/tests/unit/test_sourcemaps-01.js @@ -16,7 +16,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_source_map(); diff --git a/devtools/server/tests/unit/test_sourcemaps-02.js b/devtools/server/tests/unit/test_sourcemaps-02.js index d8faca53311..94604263270 100644 --- a/devtools/server/tests/unit/test_sourcemaps-02.js +++ b/devtools/server/tests/unit/test_sourcemaps-02.js @@ -16,7 +16,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_source_map(); diff --git a/devtools/server/tests/unit/test_sourcemaps-03.js b/devtools/server/tests/unit/test_sourcemaps-03.js index ba0f538859e..a9d85391143 100644 --- a/devtools/server/tests/unit/test_sourcemaps-03.js +++ b/devtools/server/tests/unit/test_sourcemaps-03.js @@ -16,7 +16,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_source_map(); diff --git a/devtools/server/tests/unit/test_sourcemaps-04.js b/devtools/server/tests/unit/test_sourcemaps-04.js index db05eee7da4..626feab5054 100644 --- a/devtools/server/tests/unit/test_sourcemaps-04.js +++ b/devtools/server/tests/unit/test_sourcemaps-04.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_absolute_source_map(); diff --git a/devtools/server/tests/unit/test_sourcemaps-05.js b/devtools/server/tests/unit/test_sourcemaps-05.js index 0ba5dc3158e..c80f6ef110e 100644 --- a/devtools/server/tests/unit/test_sourcemaps-05.js +++ b/devtools/server/tests/unit/test_sourcemaps-05.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_relative_source_map(); diff --git a/devtools/server/tests/unit/test_sourcemaps-06.js b/devtools/server/tests/unit/test_sourcemaps-06.js index eba5a862d13..ff4a394b523 100644 --- a/devtools/server/tests/unit/test_sourcemaps-06.js +++ b/devtools/server/tests/unit/test_sourcemaps-06.js @@ -17,7 +17,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_source_content(); diff --git a/devtools/server/tests/unit/test_sourcemaps-07.js b/devtools/server/tests/unit/test_sourcemaps-07.js index 82a5ef3724e..a81e17eac2e 100644 --- a/devtools/server/tests/unit/test_sourcemaps-07.js +++ b/devtools/server/tests/unit/test_sourcemaps-07.js @@ -16,7 +16,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_cached_original_sources(); diff --git a/devtools/server/tests/unit/test_sourcemaps-08.js b/devtools/server/tests/unit/test_sourcemaps-08.js index 693b790fd8c..17a35a8f335 100644 --- a/devtools/server/tests/unit/test_sourcemaps-08.js +++ b/devtools/server/tests/unit/test_sourcemaps-08.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_source_maps(); diff --git a/devtools/server/tests/unit/test_sourcemaps-09.js b/devtools/server/tests/unit/test_sourcemaps-09.js index 16d08c16b78..ee3467f51b5 100644 --- a/devtools/server/tests/unit/test_sourcemaps-09.js +++ b/devtools/server/tests/unit/test_sourcemaps-09.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_minified(); diff --git a/devtools/server/tests/unit/test_sourcemaps-10.js b/devtools/server/tests/unit/test_sourcemaps-10.js index 85730f21fbb..60dd032dd9a 100644 --- a/devtools/server/tests/unit/test_sourcemaps-10.js +++ b/devtools/server/tests/unit/test_sourcemaps-10.js @@ -15,7 +15,7 @@ function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; promise.resolve(define_code()) diff --git a/devtools/server/tests/unit/test_sourcemaps-11.js b/devtools/server/tests/unit/test_sourcemaps-11.js index 40b457f8049..781a38e2123 100644 --- a/devtools/server/tests/unit/test_sourcemaps-11.js +++ b/devtools/server/tests/unit/test_sourcemaps-11.js @@ -15,7 +15,7 @@ function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; promise.resolve(define_code()) diff --git a/devtools/server/tests/unit/test_sourcemaps-12.js b/devtools/server/tests/unit/test_sourcemaps-12.js index 465ee5b56b9..43d06f494d1 100644 --- a/devtools/server/tests/unit/test_sourcemaps-12.js +++ b/devtools/server/tests/unit/test_sourcemaps-12.js @@ -16,7 +16,7 @@ function run_test() { initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; define_code(); diff --git a/devtools/server/tests/unit/test_sourcemaps-13.js b/devtools/server/tests/unit/test_sourcemaps-13.js index 45aabeec886..8d9dd4c2d92 100644 --- a/devtools/server/tests/unit/test_sourcemaps-13.js +++ b/devtools/server/tests/unit/test_sourcemaps-13.js @@ -17,7 +17,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-source-map"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-source-map", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; gTabClient = aTabClient; diff --git a/devtools/server/tests/unit/test_sourcemaps-16.js b/devtools/server/tests/unit/test_sourcemaps-16.js index 708e4a254c2..8876a698069 100644 --- a/devtools/server/tests/unit/test_sourcemaps-16.js +++ b/devtools/server/tests/unit/test_sourcemaps-16.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-sourcemaps"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestThread(gClient, "test-sourcemaps", testSourcemap); }); do_test_pending(); diff --git a/devtools/server/tests/unit/test_stepping-01.js b/devtools/server/tests/unit/test_stepping-01.js index b292665d6dd..f9761c0b5ff 100644 --- a/devtools/server/tests/unit/test_stepping-01.js +++ b/devtools/server/tests/unit/test_stepping-01.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_stepping(); diff --git a/devtools/server/tests/unit/test_stepping-02.js b/devtools/server/tests/unit/test_stepping-02.js index c313808aaeb..74232972ee0 100644 --- a/devtools/server/tests/unit/test_stepping-02.js +++ b/devtools/server/tests/unit/test_stepping-02.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_stepping(); diff --git a/devtools/server/tests/unit/test_stepping-03.js b/devtools/server/tests/unit/test_stepping-03.js index 6bb3ce1a40b..a17f90d9c99 100644 --- a/devtools/server/tests/unit/test_stepping-03.js +++ b/devtools/server/tests/unit/test_stepping-03.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_stepping(); diff --git a/devtools/server/tests/unit/test_stepping-04.js b/devtools/server/tests/unit/test_stepping-04.js index 96dc93cb46b..637f6d5a72d 100644 --- a/devtools/server/tests/unit/test_stepping-04.js +++ b/devtools/server/tests/unit/test_stepping-04.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_simple_stepping(); diff --git a/devtools/server/tests/unit/test_stepping-05.js b/devtools/server/tests/unit/test_stepping-05.js index 08a846e1a0c..3128e899900 100644 --- a/devtools/server/tests/unit/test_stepping-05.js +++ b/devtools/server/tests/unit/test_stepping-05.js @@ -26,7 +26,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_stepping_last(); diff --git a/devtools/server/tests/unit/test_stepping-06.js b/devtools/server/tests/unit/test_stepping-06.js index e2c58bcae85..6f31392947e 100644 --- a/devtools/server/tests/unit/test_stepping-06.js +++ b/devtools/server/tests/unit/test_stepping-06.js @@ -24,7 +24,7 @@ function run_test_with_server(aServer, aCallback) initTestDebuggerServer(aServer); gDebuggee = addTestGlobal("test-stack", aServer); gClient = new DebuggerClient(aServer.connectPipe()); - gClient.connect(function () { + gClient.connect().then(function () { attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; // XXX: We have to do an executeSoon so that the error isn't caught and diff --git a/devtools/server/tests/unit/test_symbols-01.js b/devtools/server/tests/unit/test_symbols-01.js index 0976a998a73..d850779b065 100644 --- a/devtools/server/tests/unit/test_symbols-01.js +++ b/devtools/server/tests/unit/test_symbols-01.js @@ -12,7 +12,7 @@ function run_test() { const debuggee = addTestGlobal("test-symbols"); const client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function() { + client.connect().then(function() { attachTestTabAndResume(client, "test-symbols", function(response, tabClient, threadClient) { add_task(testSymbols.bind(null, client, debuggee)); run_next_test(); diff --git a/devtools/server/tests/unit/test_symbols-02.js b/devtools/server/tests/unit/test_symbols-02.js index 95753d6ddbb..61e8616ae5f 100644 --- a/devtools/server/tests/unit/test_symbols-02.js +++ b/devtools/server/tests/unit/test_symbols-02.js @@ -12,7 +12,7 @@ function run_test() { const debuggee = addTestGlobal("test-symbols"); const client = new DebuggerClient(DebuggerServer.connectPipe()); - client.connect(function() { + client.connect().then(function() { attachTestTabAndResume(client, "test-symbols", function(response, tabClient, threadClient) { add_task(testSymbols.bind(null, client, debuggee)); run_next_test(); diff --git a/devtools/server/tests/unit/test_threadlifetime-01.js b/devtools/server/tests/unit/test_threadlifetime-01.js index 3ebd93c8272..2a530dedbb3 100644 --- a/devtools/server/tests/unit/test_threadlifetime-01.js +++ b/devtools/server/tests/unit/test_threadlifetime-01.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_thread_lifetime(); diff --git a/devtools/server/tests/unit/test_threadlifetime-02.js b/devtools/server/tests/unit/test_threadlifetime-02.js index b56143cdeff..1308e3b1a2a 100644 --- a/devtools/server/tests/unit/test_threadlifetime-02.js +++ b/devtools/server/tests/unit/test_threadlifetime-02.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_thread_lifetime(); diff --git a/devtools/server/tests/unit/test_threadlifetime-03.js b/devtools/server/tests/unit/test_threadlifetime-03.js index 60fa595f02c..1ccf837946c 100644 --- a/devtools/server/tests/unit/test_threadlifetime-03.js +++ b/devtools/server/tests/unit/test_threadlifetime-03.js @@ -14,7 +14,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_thread_lifetime(); diff --git a/devtools/server/tests/unit/test_threadlifetime-04.js b/devtools/server/tests/unit/test_threadlifetime-04.js index 38cd38dd6ea..ad3e00f7b68 100644 --- a/devtools/server/tests/unit/test_threadlifetime-04.js +++ b/devtools/server/tests/unit/test_threadlifetime-04.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_thread_lifetime(); diff --git a/devtools/server/tests/unit/test_threadlifetime-05.js b/devtools/server/tests/unit/test_threadlifetime-05.js index 7795f010061..eda9ebc7640 100644 --- a/devtools/server/tests/unit/test_threadlifetime-05.js +++ b/devtools/server/tests/unit/test_threadlifetime-05.js @@ -16,7 +16,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_thread_lifetime(); diff --git a/devtools/server/tests/unit/test_threadlifetime-06.js b/devtools/server/tests/unit/test_threadlifetime-06.js index b71a48dc748..d6967b8d6db 100644 --- a/devtools/server/tests/unit/test_threadlifetime-06.js +++ b/devtools/server/tests/unit/test_threadlifetime-06.js @@ -15,7 +15,7 @@ function run_test() initTestDebuggerServer(); gDebuggee = addTestGlobal("test-grips"); gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function() { + gClient.connect().then(function() { attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { gThreadClient = aThreadClient; test_thread_lifetime(); diff --git a/devtools/server/tests/unit/test_xpcshell_debugging.js b/devtools/server/tests/unit/test_xpcshell_debugging.js index 602639a89e4..201419777d5 100644 --- a/devtools/server/tests/unit/test_xpcshell_debugging.js +++ b/devtools/server/tests/unit/test_xpcshell_debugging.js @@ -12,7 +12,7 @@ function run_test() { let DebuggerServer = _setupDebuggerServer([testFile.path], () => testResumed = true); let transport = DebuggerServer.connectPipe(); let client = new DebuggerClient(transport); - client.connect(() => { + client.connect().then(() => { // Even though we have no tabs, listTabs gives us the chromeDebugger. client.getProcess().then(response => { let actor = response.form.actor; diff --git a/devtools/shared/apps/tests/debugger-protocol-helper.js b/devtools/shared/apps/tests/debugger-protocol-helper.js index 2240dd7521c..2865c18aef8 100644 --- a/devtools/shared/apps/tests/debugger-protocol-helper.js +++ b/devtools/shared/apps/tests/debugger-protocol-helper.js @@ -49,13 +49,13 @@ function connect(onDone) { function startClient(transport, onDone) { // Setup client and actor used in all tests gClient = new DebuggerClient(transport); - gClient.connect(function onConnect() { - gClient.listTabs(function onListTabs(aResponse) { + gClient.connect() + .then(() => gClient.listTabs()) + .then(aResponse => { gActor = aResponse.webappsActor; if (gActor) webappActorRequest({type: "watchApps"}, onDone); }); - }); gClient.addListener("appInstall", function (aState, aType, aPacket) { sendAsyncMessage("installed-event", { manifestURL: aType.manifestURL }); diff --git a/devtools/shared/apps/tests/unit/head_apps.js b/devtools/shared/apps/tests/unit/head_apps.js index f24cc8bd0d5..5a72d1ed908 100644 --- a/devtools/shared/apps/tests/unit/head_apps.js +++ b/devtools/shared/apps/tests/unit/head_apps.js @@ -26,13 +26,13 @@ function connect(onDone) { // Setup client and actor used in all tests gClient = new DebuggerClient(DebuggerServer.connectPipe()); - gClient.connect(function onConnect() { - gClient.listTabs(function onListTabs(aResponse) { + gClient.connect() + .then(() => gClient.listTabs()) + .then(aResponse => { gActor = aResponse.webappsActor; gActorFront = new AppActorFront(gClient, aResponse); onDone(); }); - }); } function webappActorRequest(request, onResponse) { diff --git a/devtools/shared/client/connection-manager.js b/devtools/shared/client/connection-manager.js index c8880f8573f..ae982ab7ec7 100644 --- a/devtools/shared/client/connection-manager.js +++ b/devtools/shared/client/connection-manager.js @@ -316,7 +316,7 @@ Connection.prototype = { } this._client = new DebuggerClient(transport); this._client.addOneTimeListener("closed", this._onDisconnected); - this._client.connect(this._onConnected); + this._client.connect().then(this._onConnected); }, e => { // If we're continuously trying to connect, we expect the connection to be // rejected a couple times, so don't log these. diff --git a/devtools/shared/client/main.js b/devtools/shared/client/main.js index 425b67ced47..bad301d3805 100644 --- a/devtools/shared/client/main.js +++ b/devtools/shared/client/main.js @@ -335,8 +335,15 @@ DebuggerClient.prototype = { * @param aOnConnected function * If specified, will be called when the greeting packet is * received from the debugging server. + * + * @return Promise + * Resolves once connected with an array whose first element + * is the application type, by default "browser", and the second + * element is the traits object (help figure out the features + * and behaviors of the server we connect to. See RootActor). */ connect: function (aOnConnected) { + let deferred = promise.defer(); this.emit("connect"); // Also emit the event on the |DebuggerClient| object (not on the instance), @@ -348,9 +355,11 @@ DebuggerClient.prototype = { if (aOnConnected) { aOnConnected(aApplicationType, aTraits); } + deferred.resolve([aApplicationType, aTraits]); }); this._transport.ready(); + return deferred.promise; }, /** diff --git a/devtools/shared/security/tests/unit/test_oob_cert_auth.js b/devtools/shared/security/tests/unit/test_oob_cert_auth.js index fed389cbc1b..77a8caacbda 100644 --- a/devtools/shared/security/tests/unit/test_oob_cert_auth.js +++ b/devtools/shared/security/tests/unit/test_oob_cert_auth.js @@ -16,11 +16,9 @@ function run_test() { } function connectClient(client) { - let deferred = promise.defer(); - client.connect(() => { - client.listTabs(deferred.resolve); + return client.connect(() => { + return client.listTabs(); }); - return deferred.promise; } add_task(function*() { diff --git a/devtools/shared/transport/tests/unit/test_bulk_error.js b/devtools/shared/transport/tests/unit/test_bulk_error.js index 5b41c7c0349..212ba1be336 100644 --- a/devtools/shared/transport/tests/unit/test_bulk_error.js +++ b/devtools/shared/transport/tests/unit/test_bulk_error.js @@ -47,21 +47,18 @@ function add_test_bulk_actor() { /*** Tests ***/ var test_string_error = Task.async(function*(transportFactory, onReady) { - let deferred = promise.defer(); let transport = yield transportFactory(); let client = new DebuggerClient(transport); - client.connect((app, traits) => { - do_check_eq(traits.bulk, true); - client.listTabs(response => { - deferred.resolve(onReady(client, response).then(() => { - client.close(); - transport.close(); - })); + return client.connect().then(([app, traits]) => { + do_check_eq(traits.bulk, true); + return client.listTabs(); + }).then(response => { + return onReady(client, response); + }).then(() => { + client.close(); + transport.close(); }); - }); - - return deferred.promise; }); /*** Reply Types ***/ diff --git a/devtools/shared/transport/tests/unit/test_client_server_bulk.js b/devtools/shared/transport/tests/unit/test_client_server_bulk.js index d570cb772fc..6fe0aa41a99 100644 --- a/devtools/shared/transport/tests/unit/test_client_server_bulk.js +++ b/devtools/shared/transport/tests/unit/test_client_server_bulk.js @@ -144,7 +144,7 @@ var test_bulk_request_cs = Task.async(function*(transportFactory, actorType, rep let transport = yield transportFactory(); let client = new DebuggerClient(transport); - client.connect((app, traits) => { + client.connect().then(([app, traits]) => { do_check_eq(traits.bulk, true); client.listTabs(clientDeferred.resolve); }); diff --git a/devtools/shared/transport/tests/unit/test_no_bulk.js b/devtools/shared/transport/tests/unit/test_no_bulk.js index bdc89b732f5..bdf0c20f0d5 100644 --- a/devtools/shared/transport/tests/unit/test_no_bulk.js +++ b/devtools/shared/transport/tests/unit/test_no_bulk.js @@ -26,7 +26,7 @@ var test_bulk_send_error = Task.async(function*(transportFactory) { let transport = yield transportFactory(); let client = new DebuggerClient(transport); - client.connect((app, traits) => { + return client.connect().then(([app, traits]) => { do_check_false(traits.bulk); try { @@ -36,8 +36,5 @@ var test_bulk_send_error = Task.async(function*(transportFactory) { do_check_true(true); } - deferred.resolve(); }); - - return deferred.promise; }); diff --git a/devtools/shared/webconsole/test/common.js b/devtools/shared/webconsole/test/common.js index 45d84d90147..adde01b63a0 100644 --- a/devtools/shared/webconsole/test/common.js +++ b/devtools/shared/webconsole/test/common.js @@ -50,7 +50,7 @@ function connectToDebugger(aCallback) let client = new DebuggerClient(transport); let dbgState = { dbgClient: client }; - client.connect(aCallback.bind(null, dbgState)); + client.connect().then(response => aCallback(dbgState, response)); } function attachConsole(aListeners, aCallback) {