Bug 1337516 - Fix the connect page when connecting to xpcshell tests. r=jryans draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 07 Feb 2017 22:20:49 +0100
changeset 480149 e0215b01548b75cdb887329d3b5643eb3687ab57
parent 479958 e677ba018b22558fef1d07b74d416fd3a28a5dc3
child 544878 31b1e80f70218398cd80a060b04a114b0522c4a3
push id44461
push userbmo:poirot.alex@gmail.com
push dateTue, 07 Feb 2017 21:49:39 +0000
reviewersjryans
bugs1337516
milestone54.0a1
Bug 1337516 - Fix the connect page when connecting to xpcshell tests. r=jryans MozReview-Commit-ID: KHCfhwaBcXp
devtools/client/framework/connect/connect.js
--- a/devtools/client/framework/connect/connect.js
+++ b/devtools/client/framework/connect/connect.js
@@ -74,35 +74,43 @@ var submit = Task.async(function* () {
 });
 
 /**
  * Connection is ready. List actors and build buttons.
  */
 var onConnectionReady = Task.async(function* ([aType, aTraits]) {
   clearTimeout(gConnectionTimeout);
 
-  let response = yield gClient.listAddons();
+  let addons = [];
+  try {
+    let response = yield gClient.listAddons();
+    if (!response.error && response.addons.length > 0) {
+      addons = response.addons;
+    }
+  } catch(e) {
+    // listAddons throws if the runtime doesn't support addons
+  }
 
   let parent = document.getElementById("addonActors");
-  if (!response.error && response.addons.length > 0) {
+  if (addons.length > 0) {
     // Add one entry for each add-on.
-    for (let addon of response.addons) {
+    for (let addon of addons) {
       if (!addon.debuggable) {
         continue;
       }
       buildAddonLink(addon, parent);
     }
   }
   else {
     // Hide the section when there are no add-ons
     parent.previousElementSibling.remove();
     parent.remove();
   }
 
-  response = yield gClient.listTabs();
+  let response = yield gClient.listTabs();
 
   parent = document.getElementById("tabActors");
 
   // Add Global Process debugging...
   let globals = Cu.cloneInto(response, {});
   delete globals.tabs;
   delete globals.selected;
   // ...only if there are appropriate actors (a 'from' property will always