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

--HG--
extra : rebase_source : 50d135beac736720aebce587d69ea59281152db4
This commit is contained in:
Julian Descottes 2017-10-10 23:21:20 +02:00
parent 8e93b00cfd
commit 13a5e182b4

View File

@ -363,7 +363,13 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
return deferred.promise; 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) { openContentProcessToolbox(gBrowser) {
let { childCount } = Services.ppmm; let { childCount } = Services.ppmm;
// Get the process message manager for the current tab // Get the process message manager for the current tab
@ -377,16 +383,17 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
} }
} }
if (processId) { if (processId) {
this._getContentProcessTarget(processId) return this._getContentProcessTarget(processId)
.then(target => { .then(target => {
// Display a new toolbox, in a new window, with debugger by default // Display a new toolbox, in a new window, with debugger by default
return gDevTools.showToolbox(target, "jsdebugger", return gDevTools.showToolbox(target, "jsdebugger",
Toolbox.HostType.WINDOW); 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);
}, },
/** /**