mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backing out bug 993029 due to Win8 debug test failures. CLOSED TREE
This commit is contained in:
parent
b1524fb953
commit
8d9237bdbb
@ -1167,9 +1167,9 @@ let RemoteDebugger = {
|
||||
};
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
DebuggerServer.on("connectionchange", function() {
|
||||
DebuggerServer.onConnectionChange = function(what) {
|
||||
AdbController.updateState();
|
||||
});
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,9 @@ Cu.import("resource:///modules/devtools/ViewHelpers.jsm");
|
||||
Cu.import("resource://gre/modules/devtools/Loader.jsm");
|
||||
let require = devtools.require;
|
||||
let Telemetry = require("devtools/shared/telemetry");
|
||||
let EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
const { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["BrowserToolboxProcess"];
|
||||
|
||||
let processes = Set();
|
||||
|
||||
/**
|
||||
* Constructor for creating a process that will hold a chrome toolbox.
|
||||
*
|
||||
@ -34,33 +30,15 @@ let processes = Set();
|
||||
* An object with properties for configuring BrowserToolboxProcess.
|
||||
*/
|
||||
this.BrowserToolboxProcess = function BrowserToolboxProcess(aOnClose, aOnRun, aOptions) {
|
||||
let emitter = new EventEmitter();
|
||||
this.on = emitter.on.bind(emitter);
|
||||
this.off = emitter.off.bind(emitter);
|
||||
this.once = emitter.once.bind(emitter);
|
||||
// Forward any events to the shared emitter.
|
||||
this.emit = function(...args) {
|
||||
emitter.emit(...args);
|
||||
BrowserToolboxProcess.emit(...args);
|
||||
}
|
||||
|
||||
// If first argument is an object, use those properties instead of
|
||||
// all three arguments
|
||||
if (typeof aOnClose === "object") {
|
||||
if (aOnClose.onClose) {
|
||||
this.on("close", aOnClose.onClose);
|
||||
}
|
||||
if (aOnClose.onRun) {
|
||||
this.on("run", aOnClose.onRun);
|
||||
}
|
||||
this._closeCallback = aOnClose.onClose;
|
||||
this._runCallback = aOnClose.onRun;
|
||||
this._options = aOnClose;
|
||||
} else {
|
||||
if (aOnClose) {
|
||||
this.on("close", aOnClose);
|
||||
}
|
||||
if (aOnRun) {
|
||||
this.on("run", aOnRun);
|
||||
}
|
||||
this._closeCallback = aOnClose;
|
||||
this._runCallback = aOnRun;
|
||||
this._options = aOptions || {};
|
||||
}
|
||||
|
||||
@ -71,12 +49,8 @@ this.BrowserToolboxProcess = function BrowserToolboxProcess(aOnClose, aOnRun, aO
|
||||
this._initServer();
|
||||
this._initProfile();
|
||||
this._create();
|
||||
|
||||
processes.add(this);
|
||||
};
|
||||
|
||||
EventEmitter.decorate(BrowserToolboxProcess);
|
||||
|
||||
/**
|
||||
* Initializes and starts a chrome toolbox process.
|
||||
* @return object
|
||||
@ -85,25 +59,6 @@ BrowserToolboxProcess.init = function(aOnClose, aOnRun, aOptions) {
|
||||
return new BrowserToolboxProcess(aOnClose, aOnRun, aOptions);
|
||||
};
|
||||
|
||||
/**
|
||||
* Passes a set of options to the BrowserAddonActors for the given ID.
|
||||
*
|
||||
* @param aId string
|
||||
* The ID of the add-on to pass the options to
|
||||
* @param aOptions object
|
||||
* The options.
|
||||
* @return a promise that will be resolved when complete.
|
||||
*/
|
||||
BrowserToolboxProcess.setAddonOptions = function DSC_setAddonOptions(aId, aOptions) {
|
||||
let promises = [];
|
||||
|
||||
for (let process of processes.values()) {
|
||||
promises.push(process.debuggerServer.setAddonOptions(aId, aOptions));
|
||||
}
|
||||
|
||||
return promise.all(promises);
|
||||
};
|
||||
|
||||
BrowserToolboxProcess.prototype = {
|
||||
/**
|
||||
* Initializes the debugger server.
|
||||
@ -122,9 +77,6 @@ BrowserToolboxProcess.prototype = {
|
||||
this.loader.main("devtools/server/main");
|
||||
this.debuggerServer = this.loader.DebuggerServer;
|
||||
dumpn("Created a separate loader instance for the DebuggerServer.");
|
||||
|
||||
// Forward interesting events.
|
||||
this.debuggerServer.on("connectionchange", this.emit.bind(this));
|
||||
}
|
||||
|
||||
if (!this.debuggerServer.initialized) {
|
||||
@ -217,7 +169,9 @@ BrowserToolboxProcess.prototype = {
|
||||
this._telemetry.toolOpened("jsbrowserdebugger");
|
||||
|
||||
dumpn("Chrome toolbox is now running...");
|
||||
this.emit("run", this);
|
||||
if (typeof this._runCallback == "function") {
|
||||
this._runCallback.call({}, this);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -242,8 +196,9 @@ BrowserToolboxProcess.prototype = {
|
||||
|
||||
dumpn("Chrome toolbox is now closed...");
|
||||
this.closed = true;
|
||||
this.emit("close", this);
|
||||
processes.delete(this);
|
||||
if (typeof this._closeCallback == "function") {
|
||||
this._closeCallback.call({}, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1113,7 +1113,6 @@ function BrowserAddonActor(aConnection, aAddon) {
|
||||
this._addon = aAddon;
|
||||
this._contextPool = null;
|
||||
this._threadActor = null;
|
||||
this._global = null;
|
||||
AddonManager.addAddonListener(this);
|
||||
}
|
||||
|
||||
@ -1136,10 +1135,6 @@ BrowserAddonActor.prototype = {
|
||||
return this._threadActor;
|
||||
},
|
||||
|
||||
get global() {
|
||||
return this._global;
|
||||
},
|
||||
|
||||
form: function BAA_form() {
|
||||
dbg_assert(this.actorID, "addon should have an actorID.");
|
||||
|
||||
@ -1153,36 +1148,20 @@ BrowserAddonActor.prototype = {
|
||||
},
|
||||
|
||||
disconnect: function BAA_disconnect() {
|
||||
this._addon = null;
|
||||
this._global = null;
|
||||
AddonManager.removeAddonListener(this);
|
||||
},
|
||||
|
||||
setOptions: function BAA_setOptions(aOptions) {
|
||||
if ("global" in aOptions) {
|
||||
this._global = aOptions.global;
|
||||
}
|
||||
},
|
||||
|
||||
onDisabled: function BAA_onDisabled(aAddon) {
|
||||
if (aAddon != this._addon) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._global = null;
|
||||
},
|
||||
|
||||
onUninstalled: function BAA_onUninstalled(aAddon) {
|
||||
if (aAddon != this._addon) {
|
||||
if (aAddon != this._addon)
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.attached) {
|
||||
this.onDetach();
|
||||
this.conn.send({ from: this.actorID, type: "tabDetached" });
|
||||
}
|
||||
|
||||
this.disconnect();
|
||||
this._addon = null;
|
||||
AddonManager.removeAddonListener(this);
|
||||
},
|
||||
|
||||
onAttach: function BAA_onAttach() {
|
||||
|
@ -11,7 +11,6 @@
|
||||
*/
|
||||
let DevToolsUtils = require("devtools/toolkit/DevToolsUtils.js");
|
||||
let Services = require("Services");
|
||||
let EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
|
||||
// Until all Debugger server code is converted to SDK modules,
|
||||
// imports Components.* alias from chrome module.
|
||||
@ -185,6 +184,19 @@ var DebuggerServer = {
|
||||
*/
|
||||
chromeWindowType: null,
|
||||
|
||||
/**
|
||||
* Set that to a function that will be called anytime a new connection
|
||||
* is opened or one is closed.
|
||||
*/
|
||||
onConnectionChange: null,
|
||||
|
||||
_fireConnectionChange: function(aWhat) {
|
||||
if (this.onConnectionChange &&
|
||||
typeof this.onConnectionChange === "function") {
|
||||
this.onConnectionChange(aWhat);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Prompt the user to accept or decline the incoming connection. This is the
|
||||
* default implementation that products embedding the debugger server may
|
||||
@ -284,6 +296,8 @@ var DebuggerServer = {
|
||||
this._transportInitialized = false;
|
||||
this._initialized = false;
|
||||
|
||||
this._fireConnectionChange("closed");
|
||||
|
||||
dumpn("Debugger server is shut down.");
|
||||
},
|
||||
|
||||
@ -402,30 +416,6 @@ var DebuggerServer = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Passes a set of options to the BrowserAddonActors for the given ID.
|
||||
*
|
||||
* @param aId string
|
||||
* The ID of the add-on to pass the options to
|
||||
* @param aOptions object
|
||||
* The options.
|
||||
* @return a promise that will be resolved when complete.
|
||||
*/
|
||||
setAddonOptions: function DS_setAddonOptions(aId, aOptions) {
|
||||
if (!this._initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
let promises = [];
|
||||
|
||||
// Pass to all connections
|
||||
for (let connID of Object.getOwnPropertyNames(this._connections)) {
|
||||
promises.push(this._connections[connID].setAddonOptions(aId, aOptions));
|
||||
}
|
||||
|
||||
return all(promises);
|
||||
},
|
||||
|
||||
/**
|
||||
* Listens on the given port or socket file for remote debugger connections.
|
||||
*
|
||||
@ -718,7 +708,7 @@ var DebuggerServer = {
|
||||
}
|
||||
aTransport.ready();
|
||||
|
||||
this.emit("connectionchange", "opened", conn);
|
||||
this._fireConnectionChange("opened");
|
||||
return conn;
|
||||
},
|
||||
|
||||
@ -727,7 +717,7 @@ var DebuggerServer = {
|
||||
*/
|
||||
_connectionClosed: function DS_connectionClosed(aConnection) {
|
||||
delete this._connections[aConnection.prefix];
|
||||
this.emit("connectionchange", "closed", aConnection);
|
||||
this._fireConnectionChange("closed");
|
||||
},
|
||||
|
||||
// DebuggerServer extension API.
|
||||
@ -822,8 +812,6 @@ var DebuggerServer = {
|
||||
}
|
||||
};
|
||||
|
||||
EventEmitter.decorate(DebuggerServer);
|
||||
|
||||
if (this.exports) {
|
||||
exports.DebuggerServer = DebuggerServer;
|
||||
}
|
||||
@ -1073,31 +1061,6 @@ DebuggerServerConnection.prototype = {
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Passes a set of options to the BrowserAddonActors for the given ID.
|
||||
*
|
||||
* @param aId string
|
||||
* The ID of the add-on to pass the options to
|
||||
* @param aOptions object
|
||||
* The options.
|
||||
* @return a promise that will be resolved when complete.
|
||||
*/
|
||||
setAddonOptions: function DSC_setAddonOptions(aId, aOptions) {
|
||||
let addonList = this.rootActor._parameters.addonList;
|
||||
if (!addonList) {
|
||||
return resolve();
|
||||
}
|
||||
return addonList.getList().then((addonActors) => {
|
||||
for (let actor of addonActors) {
|
||||
if (actor.id != aId) {
|
||||
continue;
|
||||
}
|
||||
actor.setOptions(aOptions);
|
||||
return;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/* Forwarding packets to other transports based on actor name prefixes. */
|
||||
|
||||
/*
|
||||
|
@ -35,8 +35,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
||||
"resource://gre/modules/osfile.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "BrowserToolboxProcess",
|
||||
"resource:///modules/devtools/ToolboxProcess.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this,
|
||||
"ChromeRegistry",
|
||||
@ -1872,14 +1870,6 @@ this.XPIProvider = {
|
||||
Services.prefs.addObserver(PREF_EM_MIN_COMPAT_PLATFORM_VERSION, this, false);
|
||||
Services.obs.addObserver(this, NOTIFICATION_FLUSH_PERMISSIONS, false);
|
||||
|
||||
try {
|
||||
BrowserToolboxProcess.on("connectionchange",
|
||||
this.onDebugConnectionChange.bind(this));
|
||||
}
|
||||
catch (e) {
|
||||
// BrowserToolboxProcess is not available in all applications
|
||||
}
|
||||
|
||||
let flushCaches = this.checkForChanges(aAppChanged, aOldAppVersion,
|
||||
aOldPlatformVersion);
|
||||
|
||||
@ -3865,15 +3855,6 @@ this.XPIProvider = {
|
||||
}
|
||||
},
|
||||
|
||||
onDebugConnectionChange: function(aEvent, aWhat, aConnection) {
|
||||
if (aWhat != "opened")
|
||||
return;
|
||||
|
||||
for (let id of Object.keys(this.bootstrapScopes)) {
|
||||
aConnection.setAddonOptions(id, { global: this.bootstrapScopes[id] });
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Notified when a preference we're interested in has changed.
|
||||
*
|
||||
@ -4138,13 +4119,6 @@ this.XPIProvider = {
|
||||
catch (e) {
|
||||
logger.warn("Error loading bootstrap.js for " + aId, e);
|
||||
}
|
||||
|
||||
try {
|
||||
BrowserToolboxProcess.setAddonOptions(aId, { global: this.bootstrapScopes[aId] });
|
||||
}
|
||||
catch (e) {
|
||||
// BrowserToolboxProcess is not available in all applications
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -4159,13 +4133,6 @@ this.XPIProvider = {
|
||||
delete this.bootstrappedAddons[aId];
|
||||
this.persistBootstrappedAddons();
|
||||
this.addAddonsToCrashReporter();
|
||||
|
||||
try {
|
||||
BrowserToolboxProcess.setAddonOptions(aId, { global: null });
|
||||
}
|
||||
catch (e) {
|
||||
// BrowserToolboxProcess is not available in all applications
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user