зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1572409 - TargetList in debugger: Split global and target specific setup in commands and events modules r=jlast
Depends on D55669 Differential Revision: https://phabricator.services.mozilla.com/D55670 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f1dedb91ec
Коммит
6e863a5ae6
|
@ -4,27 +4,31 @@
|
|||
|
||||
// @flow
|
||||
|
||||
import { setupCommands, clientCommands } from "./firefox/commands";
|
||||
import { setupEvents, clientEvents } from "./firefox/events";
|
||||
import {
|
||||
setupCommands,
|
||||
setupCommandsTopTarget,
|
||||
clientCommands,
|
||||
} from "./firefox/commands";
|
||||
import {
|
||||
setupEvents,
|
||||
setupEventsTopTarget,
|
||||
clientEvents,
|
||||
} from "./firefox/events";
|
||||
import { features, prefs } from "../utils/prefs";
|
||||
|
||||
export async function onConnect(connection: any, actions: Object) {
|
||||
const { debuggerClient, targetList } = connection;
|
||||
setupCommands({ debuggerClient });
|
||||
setupEvents({ actions, debuggerClient });
|
||||
|
||||
const currentTarget = targetList.targetFront;
|
||||
const threadFront = currentTarget.threadFront;
|
||||
|
||||
if (!currentTarget || !threadFront || !debuggerClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
setupCommands({
|
||||
threadFront,
|
||||
currentTarget,
|
||||
debuggerClient,
|
||||
});
|
||||
|
||||
setupEvents({ threadFront, currentTarget, actions, debuggerClient });
|
||||
|
||||
setupCommandsTopTarget(currentTarget);
|
||||
setupEventsTopTarget(currentTarget);
|
||||
currentTarget.on("will-navigate", actions.willNavigate);
|
||||
currentTarget.on("navigate", actions.navigated);
|
||||
|
||||
|
|
|
@ -52,20 +52,21 @@ let eventBreakpoints: ?EventListenerActiveList;
|
|||
const CALL_STACK_PAGE_SIZE = 1000;
|
||||
|
||||
type Dependencies = {
|
||||
threadFront: ThreadFront,
|
||||
currentTarget: Target,
|
||||
debuggerClient: DebuggerClient,
|
||||
};
|
||||
|
||||
function setupCommands(dependencies: Dependencies) {
|
||||
currentThreadFront = dependencies.threadFront;
|
||||
currentTarget = dependencies.currentTarget;
|
||||
debuggerClient = dependencies.debuggerClient;
|
||||
targets = {};
|
||||
sourceActors = {};
|
||||
breakpoints = {};
|
||||
}
|
||||
|
||||
function setupCommandsTopTarget(targetFront: Target) {
|
||||
currentTarget = targetFront;
|
||||
currentThreadFront = targetFront.threadFront;
|
||||
}
|
||||
|
||||
function createObjectFront(grip: Grip): ObjectFront {
|
||||
if (!grip.actor) {
|
||||
throw new Error("Actor is missing");
|
||||
|
@ -598,4 +599,4 @@ const clientCommands = {
|
|||
fetchAncestorFramePositions,
|
||||
};
|
||||
|
||||
export { setupCommands, clientCommands };
|
||||
export { setupCommands, setupCommandsTopTarget, clientCommands };
|
||||
|
|
|
@ -25,14 +25,13 @@ const {
|
|||
} = require("devtools/client/shared/workers-listener.js");
|
||||
|
||||
type Dependencies = {
|
||||
threadFront: ThreadFront,
|
||||
currentTarget: Target,
|
||||
actions: typeof Actions,
|
||||
debuggerClient: DebuggerClient,
|
||||
};
|
||||
|
||||
let actions: typeof Actions;
|
||||
let isInterrupted: boolean;
|
||||
let workersListener: Object;
|
||||
|
||||
function addThreadEventListeners(thread: ThreadFront) {
|
||||
Object.keys(clientEvents).forEach(eventName => {
|
||||
|
@ -45,16 +44,21 @@ function attachAllTargets(currentTarget: Target) {
|
|||
}
|
||||
|
||||
function setupEvents(dependencies: Dependencies) {
|
||||
const { currentTarget, threadFront, debuggerClient } = dependencies;
|
||||
const { debuggerClient } = dependencies;
|
||||
actions = dependencies.actions;
|
||||
sourceQueue.initialize(actions);
|
||||
|
||||
addThreadEventListeners(threadFront);
|
||||
currentTarget.on("workerListChanged", () => threadListChanged());
|
||||
debuggerClient.mainRoot.on("processListChanged", () => threadListChanged());
|
||||
|
||||
if (features.windowlessServiceWorkers || attachAllTargets(currentTarget)) {
|
||||
const workersListener = new WorkersListener(debuggerClient.mainRoot);
|
||||
workersListener = new WorkersListener(debuggerClient.mainRoot);
|
||||
}
|
||||
|
||||
function setupEventsTopTarget(targetFront: Target) {
|
||||
targetFront.on("workerListChanged", () => threadListChanged());
|
||||
addThreadEventListeners(targetFront.threadFront);
|
||||
|
||||
workersListener.removeListener();
|
||||
if (features.windowlessServiceWorkers || attachAllTargets(targetFront)) {
|
||||
workersListener.addListener(() => threadListChanged());
|
||||
}
|
||||
}
|
||||
|
@ -130,4 +134,10 @@ const clientEvents = {
|
|||
replayFramePositions,
|
||||
};
|
||||
|
||||
export { setupEvents, clientEvents, addThreadEventListeners, attachAllTargets };
|
||||
export {
|
||||
setupEvents,
|
||||
setupEventsTopTarget,
|
||||
clientEvents,
|
||||
addThreadEventListeners,
|
||||
attachAllTargets,
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче