Bug 1497264 - Remove references to AddonTargetActor setAddonOptions;r=ochameau,yulia

Depends on D15383

Differential Revision: https://phabricator.services.mozilla.com/D15384

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2019-01-08 18:42:44 +00:00
parent bb71a1eb72
commit 0baa80215b
4 changed files with 0 additions and 125 deletions

View File

@ -22,7 +22,6 @@ XPCOMUtils.defineLazyGetter(this, "EventEmitter", function() {
return require("devtools/shared/event-emitter");
});
const promise = require("promise");
const Services = require("Services");
this.EXPORTED_SYMBOLS = ["BrowserToolboxProcess"];
@ -72,8 +71,6 @@ this.BrowserToolboxProcess = function BrowserToolboxProcess(onClose, onRun, opti
this._telemetry = new Telemetry();
this._onConnectionChange = this._onConnectionChange.bind(this);
this.close = this.close.bind(this);
Services.obs.addObserver(this.close, "quit-application");
this._initServer();
@ -112,25 +109,6 @@ BrowserToolboxProcess.getBrowserToolboxSessionState = function() {
return false;
};
/**
* Passes a set of options to the AddonTargetActors 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) {
const promises = [];
for (const process of processes.values()) {
promises.push(process.debuggerServer.setAddonOptions(id, options));
}
return promise.all(promises);
};
BrowserToolboxProcess.prototype = {
/**
* Initializes the debugger server.
@ -155,9 +133,6 @@ BrowserToolboxProcess.prototype = {
this.debuggerServer = DebuggerServer;
dumpn("Created a separate loader instance for the DebuggerServer.");
// Forward interesting events.
this.debuggerServer.on("connectionchange", this._onConnectionChange);
this.debuggerServer.init();
// We mainly need a root actor and target actors for opening a toolbox, even
// against chrome/content/addon. But the "no auto hide" button uses the
@ -331,19 +306,6 @@ BrowserToolboxProcess.prototype = {
});
},
/**
* Called upon receiving the connectionchange event from a debuggerServer.
*
* @param {String} what
* Type of connection change (can be either 'opened' or 'closed').
* @param {DebuggerServerConnection} connection
* The connection that was opened or closed.
*/
_onConnectionChange: function(what, connection) {
const wrappedJSObject = { what, connection };
Services.obs.notifyObservers({ wrappedJSObject }, "toolbox-connection-change");
},
/**
* Closes the remote debugging server and kills the toolbox process.
*/
@ -370,7 +332,6 @@ BrowserToolboxProcess.prototype = {
}
if (this.debuggerServer) {
this.debuggerServer.off("connectionchange", this._onConnectionChange);
this.debuggerServer.destroy();
this.debuggerServer = null;
}
@ -406,10 +367,3 @@ Services.prefs.addObserver("devtools.debugger.log", {
wantLogging = Services.prefs.getBoolPref(args.pop());
},
});
Services.prefs.addObserver("toolbox-update-addon-options", {
observe: (subject) => {
const {id, options} = subject.wrappedJSObject;
BrowserToolboxProcess.setAddonOptions(id, options);
},
});

View File

@ -60,11 +60,6 @@ const WebExtensionActor = protocol.ActorClassWithSpec(webExtensionSpec, {
}
},
setOptions() {
// NOTE: not used anymore for webextensions, still used in the legacy addons,
// addon manager is currently going to call it automatically on every addon.
},
reload() {
return this.addon.reload().then(() => {
return {};

View File

@ -169,30 +169,6 @@ var DebuggerServer = {
this.registerActors({ root: true, browser: true, target: true });
},
/**
* Passes a set of options to the AddonTargetActors 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.
*/
setAddonOptions(id, options) {
if (!this._initialized) {
return Promise.resolve();
}
const promises = [];
// Pass to all connections
for (const connID of Object.getOwnPropertyNames(this._connections)) {
promises.push(this._connections[connID].setAddonOptions(id, options));
}
return Promise.all(promises);
},
get listeningSockets() {
return this._listeners.length;
},
@ -1200,31 +1176,6 @@ DebuggerServerConnection.prototype = {
this._actorResponses.set(from, responsePromise);
},
/**
* Passes a set of options to the AddonTargetActors 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.
*/
setAddonOptions(id, options) {
const addonList = this.rootActor._parameters.addonList;
if (!addonList) {
return Promise.resolve();
}
return addonList.getList().then((addonTargetActors) => {
for (const actor of addonTargetActors) {
if (actor.addonId != id) {
continue;
}
actor.setOptions(options);
return;
}
});
},
/**
* This function returns whether the connection was accepted by passed SocketListener.
*

View File

@ -106,8 +106,6 @@ const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60;
const DB_SCHEMA = 28;
const NOTIFICATION_TOOLBOX_CONNECTION_CHANGE = "toolbox-connection-change";
function encoded(strings, ...values) {
let result = [];
@ -1704,10 +1702,6 @@ class BootstrapScope {
this.scope = loader.loadScope(this.addon, this.file);
}
// 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");
}
/**
@ -1721,10 +1715,6 @@ class BootstrapScope {
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");
}
/**
@ -2153,7 +2143,6 @@ var XPIProvider = {
Services.prefs.addObserver(PREF_LANGPACK_SIGNATURES, this);
Services.prefs.addObserver(PREF_ALLOW_LEGACY, this);
Services.obs.addObserver(this, NOTIFICATION_FLUSH_PERMISSIONS);
Services.obs.addObserver(this, NOTIFICATION_TOOLBOX_CONNECTION_CHANGE);
let flushCaches = this.checkForChanges(aAppChanged, aOldAppVersion,
@ -2719,16 +2708,6 @@ var XPIProvider = {
return {addons: result, fullData: false};
},
onDebugConnectionChange({what, connection}) {
if (what != "opened")
return;
for (let [id, val] of this.activeAddons) {
connection.setAddonOptions(
id, { global: val.scope });
}
},
/*
* Notified when a preference we're interested in has changed.
*
@ -2742,10 +2721,6 @@ var XPIProvider = {
}
break;
case NOTIFICATION_TOOLBOX_CONNECTION_CHANGE:
this.onDebugConnectionChange(aSubject.wrappedJSObject);
break;
case "nsPref:changed":
switch (aData) {
case PREF_XPI_SIGNATURES_REQUIRED: