Bug 1262144 - Support "tool" query parameter on about:devtools-toolbox for default panel to open. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 12 Apr 2016 13:05:36 -0700
changeset 330752 adb9a383e5ec8114d788b859f80ea9ab38acfdbc
parent 330750 4cf4428ef3945efd64b92e50be56ecc608a2b7b5
child 330753 5abc57693914f76fae2616570e554f6a891df24e
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1262144
milestone48.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 1262144 - Support "tool" query parameter on about:devtools-toolbox for default panel to open. r=jryans
devtools/client/framework/toolbox-init.js
--- a/devtools/client/framework/toolbox-init.js
+++ b/devtools/client/framework/toolbox-init.js
@@ -21,16 +21,19 @@ if (url.search.length > 1) {
   const { DebuggerClient } = require("devtools/shared/client/main");
   const { Task } = require("resource://gre/modules/Task.jsm");
 
   // `host` is the frame element loading the toolbox.
   let host = window.QueryInterface(Ci.nsIInterfaceRequestor)
                    .getInterface(Ci.nsIDOMWindowUtils)
                    .containerElement;
 
+  // Specify the default tool to open
+  let tool = url.searchParams.get("tool");
+
   if (url.searchParams.has("target")) {
     // Attach toolbox to a given browser iframe (<xul:browser> or <html:iframe
     // mozbrowser>) whose reference is set on the host iframe.
 
     // `iframe` is the targeted document to debug
     let iframe = host.wrappedJSObject ? host.wrappedJSObject.target
                                       : host.target;
     // Need to use a xray and query some interfaces to have
@@ -50,20 +53,20 @@ if (url.search.length > 1) {
       let client = new DebuggerClient(DebuggerServer.connectPipe());
       Task.spawn(function*() {
         yield client.connect();
         // Creates a target for a given browser iframe.
         let response = yield client.getTab({ tab });
         let form = response.tab;
         let target = yield TargetFactory.forRemoteTab({client, form, chrome: false});
         let options = { customIframe: host };
-        yield gDevTools.showToolbox(target, null, Toolbox.HostType.CUSTOM, options);
+        yield gDevTools.showToolbox(target, tool, Toolbox.HostType.CUSTOM, options);
       });
     }
   } else {
     targetFromURL(url).then(target => {
       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 => {
       window.alert("Unable to start the toolbox:" + e.message);
     });
   }
 }