Bug 1841967 - [devtools] Remove leftover "cx" variable from preview and command actions. r=devtools-reviewers,bomsy

Differential Revision: https://phabricator.services.mozilla.com/D182873
This commit is contained in:
Alexandre Poirot 2023-07-11 14:36:26 +00:00
parent 082700b3e3
commit 28d1bf9e16
6 changed files with 13 additions and 22 deletions

View file

@ -57,6 +57,6 @@ export function continueToHere(cx, location) {
);
}
dispatch(resume(cx));
dispatch(resume());
};
}

View file

@ -119,8 +119,7 @@ describe("pause", () => {
await dispatch(actions.newGeneratedSource(makeSource("foo1")));
await dispatch(actions.paused(mockPauseInfo));
const cx = selectors.getThreadContext(getState());
const stepped = dispatch(actions.stepIn(cx));
const stepped = dispatch(actions.stepIn());
expect(isStepping(getState(), "FakeThread")).toBeTruthy();
if (!stepInResolve) {
throw new Error("no stepInResolve");
@ -132,9 +131,9 @@ describe("pause", () => {
it("should only step when paused", async () => {
const client = { stepIn: jest.fn() };
const { dispatch, cx } = createStore(client);
const { dispatch } = createStore(client);
dispatch(actions.stepIn(cx));
dispatch(actions.stepIn());
expect(client.stepIn.mock.calls).toHaveLength(0);
});
@ -144,8 +143,7 @@ describe("pause", () => {
await dispatch(actions.newGeneratedSource(makeSource("foo1")));
await dispatch(actions.paused(mockPauseInfo));
const cx = selectors.getThreadContext(getState());
dispatch(actions.stepIn(cx));
dispatch(actions.stepIn());
expect(isStepping(getState(), "FakeThread")).toBeTruthy();
});

View file

@ -37,7 +37,7 @@ function findExpressionMatch(state, codeMirror, tokenPos) {
return match;
}
export function getPreview(cx, target, tokenPos, codeMirror) {
export function getPreview(target, tokenPos, codeMirror) {
return async thunkArgs => {
const { getState, client } = thunkArgs;
if (
@ -125,7 +125,7 @@ export function getPreview(cx, target, tokenPos, codeMirror) {
};
}
export function getExceptionPreview(cx, target, tokenPos, codeMirror) {
export function getExceptionPreview(target, tokenPos, codeMirror) {
return async ({ dispatch, getState }) => {
const match = findExpressionMatch(getState(), codeMirror, tokenPos);
if (!match) {

View file

@ -8,7 +8,7 @@ import { connect } from "../../../utils/connect";
import Popup from "./Popup";
import { getThreadContext, getIsCurrentThreadPaused } from "../../../selectors";
import { getIsCurrentThreadPaused } from "../../../selectors";
import actions from "../../../actions";
const EXCEPTION_MARKER = "mark-text-exception";
@ -22,7 +22,6 @@ class Preview extends PureComponent {
static get propTypes() {
return {
cx: PropTypes.object.isRequired,
editor: PropTypes.object.isRequired,
editorRef: PropTypes.object.isRequired,
isPaused: PropTypes.bool.isRequired,
@ -60,22 +59,17 @@ class Preview extends PureComponent {
const tokenId = {};
this.currentTokenId = tokenId;
const { cx, editor, getPreview, getExceptionPreview } = this.props;
const { editor, getPreview, getExceptionPreview } = this.props;
const isTargetException = target.classList.contains(EXCEPTION_MARKER);
let preview;
if (isTargetException) {
preview = await getExceptionPreview(
cx,
target,
tokenPos,
editor.codeMirror
);
preview = await getExceptionPreview(target, tokenPos, editor.codeMirror);
}
if (this.props.isPaused && !this.state.selecting) {
preview = await getPreview(cx, target, tokenPos, editor.codeMirror);
preview = await getPreview(target, tokenPos, editor.codeMirror);
}
// Prevent modifying state and showing this preview if we started hovering another token
@ -126,7 +120,6 @@ class Preview extends PureComponent {
const mapStateToProps = state => {
return {
cx: getThreadContext(state),
isPaused: getIsCurrentThreadPaused(state),
};
};

View file

@ -66,7 +66,7 @@ add_task(
// We can't use the `stepIn` helper as this last step will resume
// and the helper is expecting to pause again
await dbg.actions.stepIn(getThreadContext(dbg));
await dbg.actions.stepIn();
await assertNotPaused(dbg);
}
);

View file

@ -66,7 +66,7 @@ add_task(async function () {
);
info("Resuming the thread");
dbg.actions.resume(dbg.selectors.getThreadContext());
dbg.actions.resume();
await onFirstCallMessageReceived;
ok(