Bug 1407426 - return the toolbox created when opening BrowserContentToolbox;r=jlast
☠☠ backed out by c054502bd259 ☠ ☠
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 10 Oct 2017 23:21:20 +0200
changeset 386365 4c5add17691721c50eaf51407c3a75a05361f889
parent 386364 d10d26ba3d9862091f0e829c00f0355c7cfdf4e5
child 386366 6558a0eae22268c4ee1adcf67c6a3fec3d878774
push id53353
push userjdescottes@mozilla.com
push dateMon, 16 Oct 2017 09:52:47 +0000
treeherderautoland@6558a0eae222 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1407426
milestone58.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 1407426 - return the toolbox created when opening BrowserContentToolbox;r=jlast We need to retrieve the toolbox object created in openContentProcessToolbox in order to use it in tests; MozReview-Commit-ID: BC8bWaiYAnS
devtools/client/framework/devtools-browser.js
--- a/devtools/client/framework/devtools-browser.js
+++ b/devtools/client/framework/devtools-browser.js
@@ -358,40 +358,47 @@ var gDevToolsBrowser = exports.gDevTools
               });
               deferred.resolve(target);
             });
     });
 
     return deferred.promise;
   },
 
-   // Used by menus.js
+  /**
+   * Open the Browser Content Toolbox for the provided gBrowser instance.
+   * Returns a promise that resolves with a toolbox instance. If no content process is
+   * available, the promise will be rejected and a message will be displayed to the user.
+   *
+   * Used by menus.js
+  */
   openContentProcessToolbox(gBrowser) {
     let { childCount } = Services.ppmm;
     // Get the process message manager for the current tab
     let mm = gBrowser.selectedBrowser.messageManager.processMessageManager;
     let processId = null;
     for (let i = 1; i < childCount; i++) {
       let child = Services.ppmm.getChildAt(i);
       if (child == mm) {
         processId = i;
         break;
       }
     }
     if (processId) {
-      this._getContentProcessTarget(processId)
+      return this._getContentProcessTarget(processId)
           .then(target => {
             // Display a new toolbox, in a new window, with debugger by default
             return gDevTools.showToolbox(target, "jsdebugger",
                                          Toolbox.HostType.WINDOW);
           });
-    } else {
-      let msg = L10N.getStr("toolbox.noContentProcessForTab.message");
-      Services.prompt.alert(null, "", msg);
     }
+
+    let msg = L10N.getStr("toolbox.noContentProcessForTab.message");
+    Services.prompt.alert(null, "", msg);
+    return Promise.reject(msg);
   },
 
   /**
    * Install WebIDE widget
    */
   // Used by itself
   installWebIDEWidget() {
     if (this.isWebIDEWidgetInstalled()) {