diff options
Diffstat (limited to 'devtools/client/debugger/src/actions/pause/selectFrame.js')
-rw-r--r-- | devtools/client/debugger/src/actions/pause/selectFrame.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/devtools/client/debugger/src/actions/pause/selectFrame.js b/devtools/client/debugger/src/actions/pause/selectFrame.js new file mode 100644 index 0000000000..4344a1c00b --- /dev/null +++ b/devtools/client/debugger/src/actions/pause/selectFrame.js @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ + +// @flow + +import { selectLocation } from "../sources"; +import { evaluateExpressions } from "../expressions"; +import { fetchScopes } from "./fetchScopes"; +import assert from "../../utils/assert"; + +import type { Frame, ThreadContext } from "../../types"; +import type { ThunkArgs } from "../types"; + +/** + * @memberof actions/pause + * @static + */ +export function selectFrame(cx: ThreadContext, frame: Frame) { + return async ({ dispatch, client, getState, sourceMaps }: ThunkArgs) => { + assert(cx.thread == frame.thread, "Thread mismatch"); + + // Frames that aren't on-stack do not support evalling and may not + // have live inspectable scopes, so we do not allow selecting them. + if (frame.state !== "on-stack") { + return dispatch(selectLocation(cx, frame.location)); + } + + dispatch({ + type: "SELECT_FRAME", + cx, + thread: cx.thread, + frame, + }); + + // It's important that we wait for selectLocation to finish because + // we rely on the source being loaded and symbols fetched below. + await dispatch(selectLocation(cx, frame.location)); + + dispatch(evaluateExpressions(cx)); + dispatch(fetchScopes(cx)); + }; +} |