Bug 1527203 Part 5 - Listen to workerListChanged events on the tab target, r=jlast.
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 26 Feb 2019 11:37:09 -1000
changeset 519517 f5580a62e4e64030319bda7dec10bff4bc1d38c2
parent 519516 389de12c8724caec91d6905c7465a21ab64d3fb8
child 519518 b299e2b9886134da1abdc0d58459bd59d3ab0a88
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1527203
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1527203 Part 5 - Listen to workerListChanged events on the tab target, r=jlast.
devtools/client/debugger/new/src/client/firefox.js
devtools/client/debugger/new/src/client/firefox/events.js
--- a/devtools/client/debugger/new/src/client/firefox.js
+++ b/devtools/client/debugger/new/src/client/firefox.js
@@ -30,19 +30,17 @@ export async function onConnect(connecti
 
   setupCommands({
     threadClient,
     tabTarget,
     debuggerClient,
     supportsWasm
   });
 
-  if (actions) {
-    setupEvents({ threadClient, actions, supportsWasm });
-  }
+  setupEvents({ threadClient, tabTarget, actions, supportsWasm });
 
   tabTarget.on("will-navigate", actions.willNavigate);
   tabTarget.on("navigate", actions.navigated);
 
   await threadClient.reconfigure({
     observeAsmJS: true,
     pauseWorkersUntilAttach: true,
     wasmBinarySource: supportsWasm,
--- a/devtools/client/debugger/new/src/client/firefox/events.js
+++ b/devtools/client/debugger/new/src/client/firefox/events.js
@@ -4,62 +4,51 @@
 
 // @flow
 
 import type {
   SourcePacket,
   ResumedPacket,
   PausedPacket,
   ThreadClient,
-  Actions
+  Actions,
+  TabTarget
 } from "./types";
 
 import { createPause, createSource } from "./create";
 import sourceQueue from "../../utils/source-queue";
 
 const CALL_STACK_PAGE_SIZE = 1000;
 
 type Dependencies = {
   threadClient: ThreadClient,
+  tabTarget: TabTarget,
   actions: Actions,
   supportsWasm: boolean
 };
 
 let actions: Actions;
 let supportsWasm: boolean;
 let isInterrupted: boolean;
 
 function addThreadEventListeners(client: ThreadClient) {
   Object.keys(clientEvents).forEach(eventName => {
     client.addListener(eventName, clientEvents[eventName].bind(null, 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(
   threadClient: ThreadClient,
   _: "paused",
   packet: PausedPacket
 ) {
   // If paused by an explicit interrupt, which are generated by the