Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 0d444d8

Browse files
author
Jason Laster
committed
Bug 1497393 - replace onPauseChange with native threadClient event.
Differential Revision: https://phabricator.services.mozilla.com/D26831 --HG-- extra : moz-landing-system : lando
1 parent ead0a1f commit 0d444d8

8 files changed

Lines changed: 9 additions & 22 deletions

File tree

devtools/client/debugger/src/actions/pause/paused.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ export function paused(pauseInfo: Pause) {
3535
const { thread, frames, why, loadedObjects } = pauseInfo;
3636
const topFrame = frames.length > 0 ? frames[0] : null;
3737

38-
client.onPauseChange(thread, true);
39-
4038
dispatch({
4139
type: "PAUSED",
4240
thread,

devtools/client/debugger/src/actions/pause/resumed.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ export function resumed(packet: ResumedPacket) {
2424
const wasPausedInEval = inDebuggerEval(why);
2525
const wasStepping = isStepping(getState(), thread);
2626

27-
client.onPauseChange(thread, false);
28-
2927
dispatch({ type: "RESUME", thread, wasStepping });
3028

3129
const cx = getThreadContext(getState());

devtools/client/debugger/src/actions/pause/tests/pause.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ const mockThreadClient = {
7070
}
7171
});
7272
},
73-
getBreakpointPositions: async () => ({}),
74-
onPauseChange() {}
73+
getBreakpointPositions: async () => ({})
7574
};
7675

7776
const mockFrameId = "1";

devtools/client/debugger/src/actions/tests/ast.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ const threadClient = {
3535
evaluate: async expression => ({ result: evaluationResult[expression] }),
3636
evaluateExpressions: async expressions =>
3737
expressions.map(expression => ({ result: evaluationResult[expression] })),
38-
getBreakpointPositions: async () => ({}),
39-
onPauseChange() {}
38+
getBreakpointPositions: async () => ({})
4039
};
4140

4241
const sourceMaps = {

devtools/client/debugger/src/actions/tests/expressions.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ const mockThreadClient = {
4646
matchProp: "to"
4747
});
4848
});
49-
},
50-
onPauseChange() {}
49+
}
5150
};
5251

5352
describe("expressions", () => {

devtools/client/debugger/src/actions/tests/helpers/threadClient.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,5 @@ export const sourceThreadClient = {
7878
threadClient: async () => {},
7979
getFrameScopes: async () => {},
8080
evaluateExpressions: async () => {},
81-
getBreakpointPositions: async () => ({}),
82-
onPauseChange() {}
81+
getBreakpointPositions: async () => ({})
8382
};

devtools/client/debugger/src/client/firefox/commands.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ function reload(): Promise<*> {
303303
return tabTarget.reload();
304304
}
305305

306-
function onPauseChange(thread: string, paused: boolean) {
307-
tabTarget.emit("pause-change", { thread, paused });
308-
}
309-
310306
function getProperties(thread: string, grip: Grip): Promise<*> {
311307
const objClient = lookupThreadClient(thread).pauseGrip(grip);
312308

@@ -508,7 +504,6 @@ const clientCommands = {
508504
evaluateExpressions,
509505
navigate,
510506
reload,
511-
onPauseChange,
512507
getProperties,
513508
getFrameScopes,
514509
pauseOnExceptions,

devtools/client/inspector/inspector.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ function Inspector(toolbox) {
135135
this.onSidebarSelect = this.onSidebarSelect.bind(this);
136136
this.onSidebarShown = this.onSidebarShown.bind(this);
137137
this.onSidebarToggle = this.onSidebarToggle.bind(this);
138+
this.handleThreadState = this.handleThreadState.bind(this);
138139

139140
this._target.on("will-navigate", this._onBeforeNavigate);
140141
}
@@ -155,8 +156,8 @@ Inspector.prototype = {
155156
}
156157
this._replayResumed = !dbg.isPaused();
157158

158-
this._onReplayPauseChange = this._onReplayPauseChange.bind(this);
159-
this._target.on("pause-change", this._onReplayPauseChange);
159+
this._target.threadClient.addListener("paused", this.handleThreadState);
160+
this._target.threadClient.addListener("resumed", this.handleThreadState);
160161
}
161162

162163
await Promise.all([
@@ -1124,9 +1125,8 @@ Inspector.prototype = {
11241125
/**
11251126
* When replaying, reset the inspector whenever the target paused or unpauses.
11261127
*/
1127-
_onReplayPauseChange({ paused }) {
1128-
this._replayResumed = !paused;
1129-
1128+
handleThreadState(event) {
1129+
this._replayResumed = event != "paused";
11301130
this.onNewRoot();
11311131
},
11321132

0 commit comments

Comments
 (0)