зеркало из https://github.com/mozilla/gecko-dev.git
Bug 739966 - Add a Debugger listener to Fennec (r=mfinkle)
This commit is contained in:
Родитель
170bc5749c
Коммит
ad64adb2ee
|
@ -706,3 +706,6 @@ pref("full-screen-api.enabled", true);
|
|||
|
||||
pref("direct-texture.force.enabled", false);
|
||||
pref("direct-texture.force.disabled", false);
|
||||
|
||||
pref("remote-debugger.enabled", false);
|
||||
pref("remote-debugger.port", 6000);
|
||||
|
|
|
@ -52,6 +52,11 @@ XPCOMUtils.defineLazyGetter(this, "PluralForm", function() {
|
|||
return PluralForm;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "DebuggerServer", function() {
|
||||
Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
|
||||
return DebuggerServer;
|
||||
});
|
||||
|
||||
// Lazily-loaded browser scripts:
|
||||
[
|
||||
["SelectHelper", "chrome://browser/content/SelectHelper.js"],
|
||||
|
@ -237,6 +242,7 @@ var BrowserApp = {
|
|||
SearchEngines.init();
|
||||
ActivityObserver.init();
|
||||
WebappsUI.init();
|
||||
RemoteDebugger.init();
|
||||
|
||||
// Init LoginManager
|
||||
Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
|
||||
|
@ -417,6 +423,7 @@ var BrowserApp = {
|
|||
CharacterEncoding.uninit();
|
||||
SearchEngines.uninit();
|
||||
WebappsUI.uninit();
|
||||
RemoteDebugger.uninit();
|
||||
},
|
||||
|
||||
// This function returns false during periods where the browser displayed document is
|
||||
|
@ -4618,3 +4625,69 @@ var WebappsUI = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
var RemoteDebugger = {
|
||||
init: function rd_init() {
|
||||
Services.prefs.addObserver("remote-debugger.", this, false);
|
||||
|
||||
if (this._isEnabled())
|
||||
this._start();
|
||||
},
|
||||
|
||||
observe: function rd_observe(aSubject, aTopic, aData) {
|
||||
if (aTopic != "nsPref:changed")
|
||||
return;
|
||||
|
||||
switch (aData) {
|
||||
case "remote-debugger.enabled":
|
||||
if (this._isEnabled())
|
||||
this._start();
|
||||
else
|
||||
this._stop();
|
||||
break;
|
||||
|
||||
case "remote-debugger.port":
|
||||
if (this._isEnabled())
|
||||
this._restart();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
uninit: function rd_uninit() {
|
||||
Services.prefs.removeObserver("remote-debugger.", this);
|
||||
this._stop();
|
||||
},
|
||||
|
||||
_getPort: function _rd_getPort() {
|
||||
return Services.prefs.getIntPref("remote-debugger.port");
|
||||
},
|
||||
|
||||
_isEnabled: function rd_isEnabled() {
|
||||
return Services.prefs.getBoolPref("remote-debugger.enabled");
|
||||
},
|
||||
|
||||
_restart: function rd_restart() {
|
||||
this._stop();
|
||||
this._start();
|
||||
},
|
||||
|
||||
_start: function rd_start() {
|
||||
try {
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addActors("chrome://browser/content/dbg-browser-actors.js");
|
||||
}
|
||||
|
||||
let port = this._getPort();
|
||||
DebuggerServer.openListener(port, false);
|
||||
dump("Remote debugger listening on port " + port);
|
||||
} catch(e) {
|
||||
dump("Remote debugger didn't start: " + e);
|
||||
}
|
||||
},
|
||||
|
||||
_stop: function rd_start() {
|
||||
DebuggerServer.closeListener();
|
||||
dump("Remote debugger stopped");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,6 +199,8 @@
|
|||
@BINPATH@/components/jar.xpt
|
||||
@BINPATH@/components/jetpack.xpt
|
||||
@BINPATH@/components/jsdservice.xpt
|
||||
@BINPATH@/components/jsdebugger.xpt
|
||||
@BINPATH@/components/jsinspector.xpt
|
||||
@BINPATH@/components/layout_base.xpt
|
||||
@BINPATH@/components/layout_forms.xpt
|
||||
#ifdef NS_PRINTING
|
||||
|
|
Загрузка…
Ссылка в новой задаче