Bug 1461062: Part 2 - Remove dead code. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 11 May 2018 21:44:46 -0700
changeset 795017 06b5593511f72633c21fe785974184e476ca1ce5
parent 795016 dc655b111d4c28db532285f0d4649573c56d333e
child 795946 d935cdd32a2974bb42188b6bd0adaeed20247823
push id109833
push usermaglione.k@gmail.com
push dateMon, 14 May 2018 21:02:44 +0000
reviewersaswan
bugs1461062
milestone62.0a1
Bug 1461062: Part 2 - Remove dead code. r?aswan MozReview-Commit-ID: GgVkfO25tdt
devtools/client/framework/ToolboxProcess.jsm
toolkit/mozapps/extensions/internal/XPIProvider.jsm
--- a/devtools/client/framework/ToolboxProcess.jsm
+++ b/devtools/client/framework/ToolboxProcess.jsm
@@ -17,17 +17,16 @@ ChromeUtils.defineModuleGetter(this, "Ap
 
 XPCOMUtils.defineLazyGetter(this, "Telemetry", function() {
   return require("devtools/client/shared/telemetry");
 });
 XPCOMUtils.defineLazyGetter(this, "EventEmitter", function() {
   return require("devtools/shared/event-emitter");
 });
 
-const promise = require("promise");
 const Services = require("Services");
 
 this.EXPORTED_SYMBOLS = ["BrowserToolboxProcess"];
 
 var processes = new Set();
 
 /**
  * Constructor for creating a process that will hold a chrome toolbox.
@@ -107,35 +106,16 @@ BrowserToolboxProcess.getBrowserToolboxS
     // Don't worry about addon toolboxes, we only want to restore the Browser Toolbox.
     if (!process._options || !process._options.addonID) {
       return true;
     }
   }
   return false;
 };
 
-/**
- * Passes a set of options to the BrowserAddonActors for the given ID.
- *
- * @param id string
- *        The ID of the add-on to pass the options to
- * @param options object
- *        The options.
- * @return a promise that will be resolved when complete.
- */
-BrowserToolboxProcess.setAddonOptions = function(id, options) {
-  let promises = [];
-
-  for (let process of processes.values()) {
-    promises.push(process.debuggerServer.setAddonOptions(id, options));
-  }
-
-  return promise.all(promises);
-};
-
 BrowserToolboxProcess.prototype = {
   /**
    * Initializes the debugger server.
    */
   _initServer: function() {
     if (this.debuggerServer) {
       dumpn("The chrome toolbox server is already running.");
       return;
@@ -388,15 +368,8 @@ function dumpn(str) {
 
 var wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");
 
 Services.prefs.addObserver("devtools.debugger.log", {
   observe: (...args) => {
     wantLogging = Services.prefs.getBoolPref(args.pop());
   }
 });
-
-Services.prefs.addObserver("toolbox-update-addon-options", {
-  observe: (subject) => {
-    let {id, options} = subject.wrappedJSObject;
-    BrowserToolboxProcess.setAddonOptions(id, options);
-  }
-});
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -1477,37 +1477,29 @@ class BootstrapScope {
           () => new ConsoleAPI({ consoleID: `addon/${this.addon.id}` }));
 
         this.scope.__SCRIPT_URI_SPEC__ = uri;
         Services.scriptloader.loadSubScript(uri, this.scope);
       } catch (e) {
         logger.warn(`Error loading bootstrap.js for ${this.addon.id}`, e);
       }
     }
-
-    // Notify the BrowserToolboxProcess that a new addon has been loaded.
-    let wrappedJSObject = { id: this.addon.id, options: { global: this.scope }};
-    Services.obs.notifyObservers({ wrappedJSObject }, "toolbox-update-addon-options");
   }
 
   /**
    * Unloads a bootstrap scope by dropping all references to it and then
    * updating the list of active add-ons with the crash reporter.
    */
   unloadBootstrapScope() {
     XPIProvider.activeAddons.delete(this.addon.id);
     XPIProvider.addAddonsToCrashReporter();
 
     this.scope = null;
     this.startupPromise = null;
     this.instanceID = null;
-
-    // Notify the BrowserToolboxProcess that an addon has been unloaded.
-    let wrappedJSObject = { id: this.addon.id, options: { global: null }};
-    Services.obs.notifyObservers({ wrappedJSObject }, "toolbox-update-addon-options");
   }
 
   /**
    * Calls the bootstrap scope's startup method, with the given reason
    * and extra parameters.
    *
    * @param {integer} reason
    *        The reason code for the startup call.