Bug 1783813 - [devtools] Unify debugger initialization and thread selection. r=bomsy

We are updating more things when selecting a thread than when opening the debugger.
Let's use a unique codepath when it comes to handle a new top level target.

Differential Revision: https://phabricator.services.mozilla.com/D151552
This commit is contained in:
Alexandre Poirot 2022-08-17 16:13:35 +00:00
Родитель 905a369a06
Коммит d27ee059ff
3 изменённых файлов: 7 добавлений и 25 удалений

Просмотреть файл

@ -5,10 +5,8 @@
import { clearDocuments } from "../utils/editor";
import sourceQueue from "../utils/source-queue";
import { evaluateExpressions } from "./expressions";
import { clearWasmStates } from "../utils/wasm";
import { getMainThread, getThreadContext } from "../selectors";
import { getMainThread } from "../selectors";
/**
* Redux actions for the navigation state
@ -35,18 +33,6 @@ export function willNavigate(event) {
};
}
export function connect(url, actor) {
return async function({ dispatch, getState }) {
dispatch({
type: "CONNECT",
mainThreadActorID: actor,
});
const cx = getThreadContext(getState());
dispatch(evaluateExpressions(cx));
};
}
/**
* @memberof actions/navigation
* @static

Просмотреть файл

@ -8,6 +8,7 @@ import { features } from "../utils/prefs";
import { recordEvent } from "../utils/telemetry";
import sourceQueue from "../utils/source-queue";
import { getContext } from "../selectors";
let actions;
let commands;
@ -60,11 +61,11 @@ export async function onConnect(_commands, _resourceCommand, _actions, store) {
};
await commands.threadConfigurationCommand.updateConfiguration(options);
// We should probably only pass descriptor informations from here
// so only pass if that's a WebExtension toolbox.
// And let actions.willNavigate/NAVIGATE pass the current/selected thread
// from onTargetAvailable
await actions.connect(targetFront.url, targetFront.threadFront.actor);
// Select the top level target by default
await actions.selectThread(
getContext(store.getState()),
targetFront.threadFront.actor
);
await targetCommand.watchTargets({
types: targetCommand.ALL_TYPES,

Просмотреть файл

@ -236,11 +236,6 @@ function update(state = initialPauseState(), action) {
case "SELECT_FRAME":
return updateThreadState({ selectedFrameId: action.frame.id });
case "CONNECT":
return {
...initialPauseState(action.mainThreadActorID),
};
case "PAUSE_ON_EXCEPTIONS": {
const { shouldPauseOnExceptions, shouldPauseOnCaughtExceptions } = action;