Bug 1407426 - return the toolbox created when opening BrowserContentToolbox;r=jlast
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 10 Oct 2017 23:21:20 +0200
changeset 386401 0f216d29ac806bc6168da2eb516f21b3ff07a0ba
parent 386400 f22d51b93cf81f184d3d782429a5ca7bbb1925a4
child 386402 caef338370a531902aea56a36f3c8f9b6e41c501
push id32694
push userarchaeopteryx@coole-files.de
push dateTue, 17 Oct 2017 09:43:13 +0000
treeherdermozilla-central@3bd3448d9684 [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()) {