Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jasonLaster/704ed786cce03a365adee45d985da63f to your computer and use it in GitHub Desktop.
Save jasonLaster/704ed786cce03a365adee45d985da63f to your computer and use it in GitHub Desktop.
diff --git a/devtools/client/debugger/new/src/client/firefox.js b/devtools/client/debugger/new/src/client/firefox.js
--- a/devtools/client/debugger/new/src/client/firefox.js
+++ b/devtools/client/debugger/new/src/client/firefox.js
@@ -35,9 +35,7 @@ export async function onConnect(connecti
supportsWasm
});
- if (actions) {
- setupEvents({ threadClient, actions, supportsWasm });
- }
+ setupEvents({ threadClient, tabTarget, actions, supportsWasm });
tabTarget.on("will-navigate", actions.willNavigate);
tabTarget.on("navigate", actions.navigated);
diff --git a/devtools/client/debugger/new/src/client/firefox/events.js b/devtools/client/debugger/new/src/client/firefox/events.js
--- a/devtools/client/debugger/new/src/client/firefox/events.js
+++ b/devtools/client/debugger/new/src/client/firefox/events.js
@@ -9,7 +9,8 @@ import type {
ResumedPacket,
PausedPacket,
ThreadClient,
- Actions
+ Actions,
+ TabTarget
} from "./types";
import { createPause, createSource } from "./create";
@@ -19,6 +20,7 @@ const CALL_STACK_PAGE_SIZE = 1000;
type Dependencies = {
threadClient: ThreadClient,
+ tabTarget: TabTarget,
actions: Actions,
supportsWasm: boolean
};
@@ -35,26 +37,13 @@ function addThreadEventListeners(client:
function setupEvents(dependencies: Dependencies) {
const threadClient = dependencies.threadClient;
+ const tabTarget = dependencies.tabTarget;
actions = dependencies.actions;
supportsWasm = dependencies.supportsWasm;
sourceQueue.initialize(actions);
- if (threadClient) {
- addThreadEventListeners(threadClient);
-
- if (threadClient._parent) {
- // Parent may be BrowsingContextTargetFront/WorkerTargetFront and
- // be protocol.js. Or DebuggerClient and still be old fashion actor.
- if (threadClient._parent.on) {
- threadClient._parent.on("workerListChanged", workerListChanged);
- } else {
- threadClient._parent.addListener(
- "workerListChanged",
- workerListChanged
- );
- }
- }
- }
+ addThreadEventListeners(threadClient);
+ tabTarget.on("workerListChanged", workerListChanged);
}
async function paused(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment