Bug 1694140 - [devtools] Add getToolboxForTab and closeToolboxForTab helpers on gDevTools r=ochameau

Depends on D105743

Differential Revision: https://phabricator.services.mozilla.com/D105998
This commit is contained in:
Julian Descottes 2021-02-25 12:58:13 +00:00
parent b0dd175880
commit a49f853e14

View File

@ -706,6 +706,20 @@ DevTools.prototype = {
return TargetFactory.forTab(tab);
},
/**
* Retrieve an existing toolbox for the provided tab if it was created before.
* Returns null otherwise.
*/
async getToolboxForTab(tab) {
const target = await this.getTargetForTab(tab);
return this._toolboxes.get(target);
},
async closeToolboxForTab(tab) {
const target = await this.getTargetForTab(tab);
return this.closeToolbox(target);
},
/**
* Compatibility layer for web-extensions. Used by DevToolsShim for
* browser/components/extensions/ext-devtools.js