Bug 1262144 - Support "tool" query parameter on about:devtools-toolbox for default panel to open. r=jryans

This commit is contained in:
Alexandre Poirot 2016-04-12 13:05:36 -07:00
Родитель 694116566d
Коммит fb4f69ff96
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -26,6 +26,9 @@ if (url.search.length > 1) {
.getInterface(Ci.nsIDOMWindowUtils) .getInterface(Ci.nsIDOMWindowUtils)
.containerElement; .containerElement;
// Specify the default tool to open
let tool = url.searchParams.get("tool");
if (url.searchParams.has("target")) { if (url.searchParams.has("target")) {
// Attach toolbox to a given browser iframe (<xul:browser> or <html:iframe // Attach toolbox to a given browser iframe (<xul:browser> or <html:iframe
// mozbrowser>) whose reference is set on the host iframe. // mozbrowser>) whose reference is set on the host iframe.
@ -55,13 +58,13 @@ if (url.search.length > 1) {
let form = response.tab; let form = response.tab;
let target = yield TargetFactory.forRemoteTab({client, form, chrome: false}); let target = yield TargetFactory.forRemoteTab({client, form, chrome: false});
let options = { customIframe: host }; let options = { customIframe: host };
yield gDevTools.showToolbox(target, null, Toolbox.HostType.CUSTOM, options); yield gDevTools.showToolbox(target, tool, Toolbox.HostType.CUSTOM, options);
}); });
} }
} else { } else {
targetFromURL(url).then(target => { targetFromURL(url).then(target => {
let options = { customIframe: host }; let options = { customIframe: host };
return gDevTools.showToolbox(target, null, Toolbox.HostType.CUSTOM, options); return gDevTools.showToolbox(target, tool, Toolbox.HostType.CUSTOM, options);
}).then(null, e => { }).then(null, e => {
window.alert("Unable to start the toolbox:" + e.message); window.alert("Unable to start the toolbox:" + e.message);
}); });