Bug 1561392 - Handle backward-compat for new event-breakpoint implementation. r=davidwalsh
authorLogan Smyth <loganfsmyth@gmail.com>
Tue, 25 Jun 2019 20:17:24 +0000
changeset 480088 308ea5eaadf1401186e31428f4528120b9803235
parent 480087 caacd1cb3ec10b6d39a4fbdc5eb09a7a703d87c3
child 480089 725ea89ab2d28d570b4311c5ba77069bc7fcf19c
push id36201
push usercsabou@mozilla.com
push dateWed, 26 Jun 2019 03:57:29 +0000
treeherdermozilla-central@a3cad1d7836c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidwalsh
bugs1561392
milestone69.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 1561392 - Handle backward-compat for new event-breakpoint implementation. r=davidwalsh Differential Revision: https://phabricator.services.mozilla.com/D35847
devtools/client/debugger/src/client/firefox/commands.js
--- a/devtools/client/debugger/src/client/firefox/commands.js
+++ b/devtools/client/debugger/src/client/firefox/commands.js
@@ -372,17 +372,33 @@ async function setEventListenerBreakpoin
   await threadClient.setActiveEventBreakpoints(ids);
   await forEachWorkerThread(thread => thread.setActiveEventBreakpoints(ids));
 }
 
 // eslint-disable-next-line
 async function getEventListenerBreakpointTypes(): Promise<
   EventListenerCategoryList
 > {
-  return threadClient.getAvailableEventBreakpoints();
+  let categories;
+  try {
+    categories = await threadClient.getAvailableEventBreakpoints();
+
+    if (!Array.isArray(categories)) {
+      // When connecting to older browser that had our placeholder
+      // implementation of the 'getAvailableEventBreakpoints' endpoint, we
+      // actually get back an object with a 'value' property containing
+      // the categories. Since that endpoint wasn't actually backed with a
+      // functional implementation, we just bail here instead of storing the
+      // 'value' property into the categories.
+      categories = null;
+    }
+  } catch (err) {
+    // Event bps aren't supported on this firefox version.
+  }
+  return categories || [];
 }
 
 function pauseGrip(thread: string, func: Function): ObjectClient {
   return lookupThreadClient(thread).pauseGrip(func);
 }
 
 function registerSourceActor(sourceActorId: string, sourceId: SourceId) {
   sourceActors[sourceActorId] = sourceId;