Skip to content

Commit

Permalink
Bug 1622219 - Return only the thread front from Target.attachThread. …
Browse files Browse the repository at this point in the history
…r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D65124

--HG--
extra : moz-landing-system : lando
  • Loading branch information
ochameau committed Mar 16, 2020
1 parent f409f12 commit 69614d0
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion devtools/client/debugger/src/client/firefox/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function attachTargets(targetLists, args) {
// But workers targets are still only managed by the debugger codebase
// and so we have to attach their thread actor
if (!threadFront) {
[, threadFront] = await targetFront.attachThread({
threadFront = await targetFront.attachThread({
...defaultThreadOptions(),
...args.options,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ add_task(async function() {
const descriptorFront = await gClient.mainRoot.getMainProcess();
const front = await descriptorFront.getTarget();
await front.attach();
const [, threadFront] = await front.attachThread();
const threadFront = await front.attachThread();
gThreadFront = threadFront;
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:mozilla");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function testChromeTab() {
const target = await TargetFactory.forTab(tab);
await target.attach();

const [, threadFront] = await target.attachThread();
const threadFront = await target.attachThread();
await threadFront.resume();

const { sources } = await threadFront.getSources();
Expand Down Expand Up @@ -108,7 +108,7 @@ async function testMainProcess() {
const target = await targetDescriptor.getTarget();
await target.attach();

const [, threadFront] = await target.attachThread();
const threadFront = await target.attachThread();
await threadFront.resume();
const { sources } = await threadFront.getSources();
ok(
Expand Down
2 changes: 1 addition & 1 deletion devtools/client/framework/toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ Toolbox.prototype = {

_attachAndResumeThread: async function(target) {
const options = defaultThreadOptions();
const [, threadFront] = await target.attachThread(options);
const threadFront = await target.attachThread(options);

try {
await threadFront.resume();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function testEarlyDebuggerStatement(client, tab, targetFront) {
client.off("paused", onPaused);

// Now attach and resume...
const [, threadFront] = await targetFront.attachThread();
const threadFront = await targetFront.attachThread();
await threadFront.resume();
ok(true, "Pause wasn't called before we've attached.");

Expand Down
2 changes: 1 addition & 1 deletion devtools/client/shared/test/helper_workers.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ this.removeTab = function removeTab(tab, win) {
async function attachThreadActorForTab(tab) {
const target = await TargetFactory.forTab(tab);
await target.attach();
const [, threadFront] = await target.attachThread();
const threadFront = await target.attachThread();
await threadFront.resume();
return { client: target.client, threadFront };
}
Expand Down
4 changes: 2 additions & 2 deletions devtools/docs/backend/client-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Once the application is attached to a tab, it can attach to its thread in order
// Assuming the application is already attached to the tab, and response is the first
// argument of the attachTarget callback.

client.attachThread(response.threadActor).then(function([response, threadFront]) {
client.attachThread(response.threadActor).then(function(threadFront) {
if (!threadFront) {
return;
}
Expand Down Expand Up @@ -178,7 +178,7 @@ function debugTab() {
// Attach to the tab.
targetFront.attach().then(() => {
// Attach to the thread (context).
targetFront.attachThread().then(([response, threadFront]) => {
targetFront.attachThread().then((threadFront) => {
// Attach listeners for thread events.
threadFront.on("paused", onPause);
threadFront.on("resumed", fooListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

// When running in oop mode we can explicitly attach the thread without locking
// the main process.
const [, threadFront] = await addonTarget.attachThread();
const threadFront = await addonTarget.attachThread();

ok(threadFront, "Got a threadFront for the target addon");
is(threadFront.paused, true, "The addon threadActor is paused");
Expand Down
2 changes: 1 addition & 1 deletion devtools/server/tests/xpcshell/head_dbg.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ async function setupTestFromUrl(url) {
const targetFront = findTab(tabs, "test");
await targetFront.attach();

const [, threadFront] = await attachThread(targetFront);
const threadFront = await attachThread(targetFront);
await resume(threadFront);

const sourceUrl = getFileUrl(url);
Expand Down
2 changes: 1 addition & 1 deletion devtools/server/tests/xpcshell/test_reattach-thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_task(
threadFrontTest(async ({ threadFront, debuggee, client, targetFront }) => {
await threadFront.detach();
Assert.equal(threadFront.state, "detached");
const [, newThreadFront] = await targetFront.attachThread({});
const newThreadFront = await targetFront.attachThread({});
Assert.notEqual(threadFront, newThreadFront);
Assert.equal(newThreadFront.state, "paused");
Assert.equal(targetFront.threadFront, newThreadFront);
Expand Down
2 changes: 1 addition & 1 deletion devtools/server/tests/xpcshell/test_xpcshell_debugging.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ add_task(async function() {
// Even though we have no tabs, getMainProcess gives us the chrome debugger.
const targetDescriptor = await client.mainRoot.getMainProcess();
const front = await targetDescriptor.getTarget();
const [, threadFront] = await front.attachThread();
const threadFront = await front.attachThread();

// tell the thread to do the initial resume. This would cause the
// xpcshell test harness to resume and load the file under test.
Expand Down
4 changes: 2 additions & 2 deletions devtools/shared/fronts/targets/target-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ function TargetMixin(parentClass) {
);
}
this.threadFront = await this.getFront("thread");
const result = await this.threadFront.attach(options);
await this.threadFront.attach(options);

this.threadFront.on("newSource", this._onNewSource);

// Resolve the onThreadAttached promise so that consumers that need to
// wait for the thread to be attached can resume.
this._resolveOnThreadAttached();

return [result, this.threadFront];
return this.threadFront;
}

// Listener for "newSource" event fired by the thread actor
Expand Down
2 changes: 1 addition & 1 deletion devtools/shared/webconsole/test/chrome/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var _attachConsole = async function(listeners, attachToTab, attachToWorker) {

// Attach the Target and the target thread in order to instantiate the console client.
await target.attach();
const [, threadFront] = await target.attachThread();
const threadFront = await target.attachThread();
await threadFront.resume();

const webConsoleFront = await target.getFront("console");
Expand Down

0 comments on commit 69614d0

Please sign in to comment.