Skip to content

Commit

Permalink
Bug 1688231 - [devtools] Delete noPauseOnThreadActorAttach trait. r=b…
Browse files Browse the repository at this point in the history
…omsy.

This was used for pre-86 servers, and we can now assume that all servers
threads don't pause on attach.

Differential Revision: https://phabricator.services.mozilla.com/D145888
  • Loading branch information
nchevobbe committed May 10, 2022
1 parent 050d109 commit 11d67bc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 47 deletions.
21 changes: 1 addition & 20 deletions devtools/client/fronts/targets/target-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,26 +532,7 @@ function TargetMixin(parentClass) {
if (this.isDestroyedOrBeingDestroyed()) {
return;
}
const threadFront = await this.attachThread(options);

// @backward-compat { version 86 } ThreadActor.attach no longer pause the thread,
// so that we no longer have to resume.
// Once 86 is in release, we can remove the rest of this method.
if (this.getTrait("noPauseOnThreadActorAttach")) {
return;
}
try {
if (this.isDestroyedOrBeingDestroyed() || threadFront.isDestroyed()) {
return;
}
await threadFront.resume();
} catch (ex) {
if (ex.error === "wrongOrder") {
targetCommand.emit("target-thread-wrong-order-on-resume");
} else {
throw ex;
}
}
await this.attachThread(options);
}

async attachThread(options = {}) {
Expand Down
26 changes: 2 additions & 24 deletions devtools/client/fronts/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,8 @@ class ThreadFront extends FrontClassWithSpec(threadSpec) {
this._threadGrips = {};
// Note that this isn't matching ThreadActor state field.
// ThreadFront is only using two values: paused or attached.
// @backward-compat { version 86 } ThreadActor.attach no longer pauses the thread,
// so that the default state is "attached" by default.
if (this.targetFront.getTrait("noPauseOnThreadActorAttach")) {
this._state = "attached";
} else {
this._state = "paused";
}
this._state = "attached";

this._beforePaused = this._beforePaused.bind(this);
this._beforeResumed = this._beforeResumed.bind(this);
this.before("paused", this._beforePaused);
Expand Down Expand Up @@ -195,23 +190,6 @@ class ThreadFront extends FrontClassWithSpec(threadSpec) {
return { sources };
}

/**
* attach to the thread actor.
*/
async attach(options) {
const noPauseOnThreadActorAttach = this.targetFront.getTrait(
"noPauseOnThreadActorAttach"
);
const onPaused = noPauseOnThreadActorAttach ? null : this.once("paused");
await super.attach(options);
// @backward-compat { version 86 } ThreadActor.attach no longer pause the thread,
// so that we shouldn't wait for the paused event,
// since it won't be emitted anymore.
if (!noPauseOnThreadActorAttach) {
await onPaused;
}
}

/**
* Return a ObjectFront object for the given object grip.
*
Expand Down
3 changes: 0 additions & 3 deletions devtools/server/actors/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
"dom.worker.console.dispatch_events_to_main_thread"
)
: true,
// @backward-compat { version 86 } ThreadActor.attach no longer pauses the thread,
// so that we no longer have to resume.
noPauseOnThreadActorAttach: true,
};
},

Expand Down

0 comments on commit 11d67bc

Please sign in to comment.