Skip to content

Instantly share code, notes, and snippets.

@juliandescottes
Created June 11, 2019 11:40
Show Gist options
  • Save juliandescottes/d7d1357672114e88f090d02951ad28c7 to your computer and use it in GitHub Desktop.
Save juliandescottes/d7d1357672114e88f090d02951ad28c7 to your computer and use it in GitHub Desktop.
diff --git a/devtools/shared/client/deprecated-thread-client.js b/devtools/shared/client/deprecated-thread-client.js
--- a/devtools/shared/client/deprecated-thread-client.js
+++ b/devtools/shared/client/deprecated-thread-client.js
@@ -28,16 +28,17 @@ loader.lazyRequireGetter(
*
* @param client DebuggerClient
* @param actor string
* The actor ID for this thread.
*/
function ThreadClient(client, actor) {
this.client = client;
this._actor = actor;
+ this.client._clients.set(actor, this);
this._pauseGrips = {};
this._threadGrips = {};
this.request = this.client.request;
}
ThreadClient.prototype = {
_state: "paused",
get state() {
@@ -48,16 +49,21 @@ ThreadClient.prototype = {
},
_actor: null,
get actor() {
return this._actor;
},
+ get actorID() {
+ return this._actor;
+ },
+
+
get _transport() {
return this.client._transport;
},
_assertPaused: function(command) {
if (!this.paused) {
throw Error(
command + " command sent while not paused. Currently " + this._state
@@ -225,16 +231,17 @@ ThreadClient.prototype = {
/**
* Detach from the thread actor.
*/
detach: DebuggerClient.requester({
type: "detach",
}),
destroy: function() {
+ this.client._clients.delete(this.actor);
return this.detach();
},
/**
* attach to the thread actor.
*/
attach: DebuggerClient.requester({
type: "attach",
@@ -345,16 +352,17 @@ ThreadClient.prototype = {
* registered listeners.
*/
_onThreadState: function(packet) {
this._state = ThreadStateTypes[packet.type];
// The debugger UI may not be initialized yet so we want to keep
// the packet around so it knows what to pause state to display
// when it's initialized
this._lastPausePacket = packet.type === "resumed" ? null : packet;
+
this._clearPauseGrips();
packet.type === ThreadStateTypes.detached && this._clearThreadGrips();
this.client._eventsEnabled && this.emit(packet.type, packet);
},
getLastPausePacket: function() {
return this._lastPausePacket;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment