Bug 1356244 - call DevTools shim on devtools startup;r=ochameau
authorJulian Descottes <jdescottes@mozilla.com>
Sat, 13 May 2017 00:46:45 +0200
changeset 359380 e18063b2ed57265bd48e55cf0841515dc1f2c14d
parent 359379 a65577f40ebd1ef2dd1b0bd81347e1e171815448
child 359381 861f125ec68fc0c29690bd85593d8d9481fb02ab
push id31854
push userarchaeopteryx@coole-files.de
push dateSat, 20 May 2017 16:46:00 +0000
treeherdermozilla-central@51736db67723 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1356244
milestone55.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 1356244 - call DevTools shim on devtools startup;r=ochameau MozReview-Commit-ID: 7p4gviVsGu8
devtools/client/framework/devtools.js
--- a/devtools/client/framework/devtools.js
+++ b/devtools/client/framework/devtools.js
@@ -2,16 +2,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {Cu} = require("chrome");
 const Services = require("Services");
 
+const {DevToolsShim} = Cu.import("chrome://devtools-shim/content/DevToolsShim.jsm", {});
+
 // Load gDevToolsBrowser toolbox lazily as they need gDevTools to be fully initialized
 loader.lazyRequireGetter(this, "TargetFactory", "devtools/client/framework/target", true);
 loader.lazyRequireGetter(this, "Toolbox", "devtools/client/framework/toolbox", true);
 loader.lazyRequireGetter(this, "ToolboxHostManager", "devtools/client/framework/toolbox-host-manager", true);
 loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true);
 
 const {defaultTools: DefaultTools, defaultThemes: DefaultThemes} =
   require("devtools/client/definitions");
@@ -40,16 +42,21 @@ function DevTools() {
   AboutDevTools.register();
 
   EventEmitter.decorate(this);
 
   // This is important step in initialization codepath where we are going to
   // start registering all default tools and themes: create menuitems, keys, emit
   // related events.
   this.registerDefaults();
+
+  // Register this new DevTools instance to Firefox. DevToolsShim is part of Firefox,
+  // integrating with all Firefox codebase and making the glue between code from
+  // mozilla-central and DevTools add-on on github
+  DevToolsShim.register(this);
 }
 
 DevTools.prototype = {
   // The windowtype of the main window, used in various tools. This may be set
   // to something different by other gecko apps.
   chromeWindowType: "navigator:browser",
 
   registerDefaults() {
@@ -503,16 +510,20 @@ DevTools.prototype = {
     for (let [key, ] of this.getToolDefinitionMap()) {
       this.unregisterTool(key, true);
     }
 
     JsonView.destroy();
 
     gDevTools.unregisterDefaults();
 
+    // Notify the DevToolsShim that DevTools are no longer available, particularly if the
+    // destroy was caused by disabling/removing the DevTools add-on.
+    DevToolsShim.unregister();
+
     // Cleaning down the toolboxes: i.e.
     //   for (let [target, toolbox] of this._toolboxes) toolbox.destroy();
     // Is taken care of by the gDevToolsBrowser.forgetBrowserWindow
   },
 
   /**
    * Iterator that yields each of the toolboxes.
    */