Bug 1241050 - Ensure reloading the developer toolbar when using the reload addon. r=jwalker
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 16 Feb 2016 07:23:57 -0800
changeset 284497 34458fbb9cdc7a71babb5fbd73fdd0cfa1d17f4c
parent 284496 8bb5aaf8357167ec91a62c4124d8653b5a539b53
child 284498 6702685a691946eedbfdecc414c1d17f5768c57e
push id71993
push usercbook@mozilla.com
push dateWed, 17 Feb 2016 11:16:29 +0000
treeherdermozilla-inbound@60f020c84b23 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalker
bugs1241050
milestone47.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 1241050 - Ensure reloading the developer toolbar when using the reload addon. r=jwalker
devtools/bootstrap.js
--- a/devtools/bootstrap.js
+++ b/devtools/bootstrap.js
@@ -100,16 +100,34 @@ function reload(event) {
         // We have to use a frame script to query "baseURI"
         mm.loadFrameScript("data:text/javascript,new " + function () {
           let isJSONView = content.document.baseURI.startsWith("resource://devtools/");
           if (isJSONView) {
             content.location.reload();
           }
         }, false);
       }
+
+      // Manually reload gcli if it has been used
+      // Bug 1248348: Inject the developer toolbar dynamically within browser/
+      // so that we can easily remove/reinject it
+      const desc = Object.getOwnPropertyDescriptor(window, "DeveloperToolbar");
+      if (desc && !desc.get) {
+        let wasVisible = window.DeveloperToolbar.visible;
+        window.DeveloperToolbar.hide()
+          .then(() => {
+            window.DeveloperToolbar.destroy();
+
+            let { DeveloperToolbar } = devtools.require("devtools/client/shared/developer-toolbar");
+            window.DeveloperToolbar = new DeveloperToolbar(window, window.document.getElementById("developer-toolbar"));
+            if (wasVisible) {
+              window.DeveloperToolbar.show();
+            }
+          });
+      }
     } else if (windowtype === "devtools:webide") {
       window.location.reload();
     } else if (windowtype === "devtools:webconsole") {
       // Browser console document can't just be reloaded.
       // HUDService is going to close it on unload.
       // Instead we have to manually toggle it.
       let HUDService = devtools.require("devtools/client/webconsole/hudservice");
       HUDService.toggleBrowserConsole()