Bug 961392 - B2G RemoteDebugger.start() and toolkit DebuggerServer.addBrowserActors() duplicate code. r=ochameau, r=past

This commit is contained in:
Jan Keromnes 2014-01-24 12:11:00 +02:00
Родитель 5f01b185a2
Коммит a606e6d861
2 изменённых файлов: 32 добавлений и 46 удалений

Просмотреть файл

@ -1088,28 +1088,12 @@ let RemoteDebugger = {
if (!DebuggerServer.initialized) {
// Ask for remote connections.
DebuggerServer.init(this.prompt.bind(this));
DebuggerServer.chromeWindowType = "navigator:browser";
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webbrowser.js");
// Prevent tab actors to be loaded in parent process,
// unless we enable certified apps debugging
if (!Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps")) {
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/script.js");
DebuggerServer.addGlobalActor(DebuggerServer.ChromeDebuggerActor, "chromeDebugger");
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webconsole.js");
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/gcli.js");
if ("nsIProfiler" in Ci) {
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/profiler.js");
}
DebuggerServer.registerModule("devtools/server/actors/inspector");
DebuggerServer.registerModule("devtools/server/actors/styleeditor");
DebuggerServer.registerModule("devtools/server/actors/stylesheets");
DebuggerServer.registerModule("devtools/server/actors/tracer");
DebuggerServer.registerModule("devtools/server/actors/webgl");
DebuggerServer.registerModule("devtools/server/actors/memory");
}
// Add Firefox-specific actors, but prevent tab actors to be loaded in
// the parent process, unless we enable certified apps debugging.
let restrictPrivileges = Services.prefs.getBoolPref("devtools.debugger.forbid-certified-apps");
DebuggerServer.addBrowserActors("navigator:browser", restrictPrivileges);
DebuggerServer.addActors('chrome://browser/content/dbg-browser-actors.js');
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webapps.js");
DebuggerServer.registerModule("devtools/server/actors/device");
#ifdef MOZ_WIDGET_GONK
DebuggerServer.onConnectionChange = function(what) {
@ -1122,8 +1106,8 @@ let RemoteDebugger = {
"/data/local/debugger-socket";
try {
DebuggerServer.openListener(path);
// Temporary event, until bug 942756 lands and offer a way to know
// when the server is up and running
// Temporary event, until bug 942756 lands and offers a way to know
// when the server is up and running.
Services.obs.notifyObservers(null, 'debugger-server-started', null);
this._running = true;
} catch (e) {

Просмотреть файл

@ -341,24 +341,17 @@ var DebuggerServer = {
/**
* Install Firefox-specific actors.
*/
addBrowserActors: function(aWindowType) {
this.chromeWindowType = aWindowType ? aWindowType : "navigator:browser";
addBrowserActors: function(aWindowType = "navigator:browser", restrictPrivileges = false) {
this.chromeWindowType = aWindowType;
this.addActors("resource://gre/modules/devtools/server/actors/webbrowser.js");
this.addActors("resource://gre/modules/devtools/server/actors/script.js");
this.addGlobalActor(this.ChromeDebuggerActor, "chromeDebugger");
this.addActors("resource://gre/modules/devtools/server/actors/webconsole.js");
this.addActors("resource://gre/modules/devtools/server/actors/gcli.js");
if ("nsIProfiler" in Ci)
this.addActors("resource://gre/modules/devtools/server/actors/profiler.js");
if (!restrictPrivileges) {
this.addTabActors();
this.addGlobalActor(this.ChromeDebuggerActor, "chromeDebugger");
}
this.addActors("resource://gre/modules/devtools/server/actors/webapps.js");
this.registerModule("devtools/server/actors/inspector");
this.registerModule("devtools/server/actors/webgl");
this.registerModule("devtools/server/actors/tracer");
this.registerModule("devtools/server/actors/device");
this.registerModule("devtools/server/actors/stylesheets");
this.registerModule("devtools/server/actors/styleeditor");
this.registerModule("devtools/server/actors/memory");
},
/**
@ -370,21 +363,30 @@ var DebuggerServer = {
// but childtab.js hasn't been loaded yet.
if (!("BrowserTabActor" in this)) {
this.addActors("resource://gre/modules/devtools/server/actors/webbrowser.js");
this.addActors("resource://gre/modules/devtools/server/actors/script.js");
this.addActors("resource://gre/modules/devtools/server/actors/webconsole.js");
this.addActors("resource://gre/modules/devtools/server/actors/gcli.js");
this.registerModule("devtools/server/actors/inspector");
this.registerModule("devtools/server/actors/webgl");
this.registerModule("devtools/server/actors/stylesheets");
this.registerModule("devtools/server/actors/styleeditor");
this.registerModule("devtools/server/actors/tracer");
this.registerModule("devtools/server/actors/memory");
this.addTabActors();
}
if (!("ContentAppActor" in DebuggerServer)) {
this.addActors("resource://gre/modules/devtools/server/actors/childtab.js");
}
},
/**
* Install tab actors.
*/
addTabActors: function() {
this.addActors("resource://gre/modules/devtools/server/actors/script.js");
this.addActors("resource://gre/modules/devtools/server/actors/webconsole.js");
this.addActors("resource://gre/modules/devtools/server/actors/gcli.js");
this.registerModule("devtools/server/actors/inspector");
this.registerModule("devtools/server/actors/webgl");
this.registerModule("devtools/server/actors/stylesheets");
this.registerModule("devtools/server/actors/styleeditor");
this.registerModule("devtools/server/actors/tracer");
this.registerModule("devtools/server/actors/memory");
if ("nsIProfiler" in Ci)
this.addActors("resource://gre/modules/devtools/server/actors/profiler.js");
},
/**
* Listens on the given port or socket file for remote debugger connections.
*