зеркало из https://github.com/mozilla/gecko-dev.git
Bug 832000 - Use unix domain socket file for devtools remote connection. r=jimb, r=vingtetun
This commit is contained in:
Родитель
4e91c0eee6
Коммит
717abd0302
|
@ -751,6 +751,10 @@ pref("dom.promise.enabled", false);
|
|||
// 0 disables the timer.
|
||||
pref("b2g.adb.timeout-hours", 12);
|
||||
|
||||
// Absolute path to the devtool unix domain socket file used
|
||||
// to communicate with a usb cable via adb forward
|
||||
pref("devtools.debugger.unix-domain-socket", "/data/local/debugger-socket");
|
||||
|
||||
// enable Skia/GL (OpenGL-accelerated 2D drawing) for large enough 2d canvases,
|
||||
// falling back to Skia/software for smaller canvases
|
||||
pref("gfx.canvas.azure.backends", "skia");
|
||||
|
|
|
@ -1030,9 +1030,10 @@ let RemoteDebugger = {
|
|||
}
|
||||
}
|
||||
|
||||
let port = Services.prefs.getIntPref('devtools.debugger.remote-port') || 6000;
|
||||
let path = Services.prefs.getCharPref("devtools.debugger.unix-domain-socket") ||
|
||||
"/data/local/debugger-socket";
|
||||
try {
|
||||
DebuggerServer.openListener(port);
|
||||
DebuggerServer.openListener(path);
|
||||
} catch (e) {
|
||||
dump('Unable to start debugger server: ' + e + '\n');
|
||||
}
|
||||
|
|
|
@ -185,7 +185,8 @@ WebappsActor.prototype = {
|
|||
}
|
||||
});
|
||||
// Cleanup by removing the temporary directory.
|
||||
aDir.remove(true);
|
||||
if (aDir.exists())
|
||||
aDir.remove(true);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ if (this.require) {
|
|||
|
||||
const DBG_STRINGS_URI = "chrome://global/locale/devtools/debugger.properties";
|
||||
|
||||
const nsFile = CC("@mozilla.org/file/local;1", "nsIFile", "initWithPath");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
let wantLogging = Services.prefs.getBoolPref("devtools.debugger.log");
|
||||
|
@ -92,6 +93,9 @@ loadSubScript.call(this, "resource://gre/modules/devtools/server/transport.js");
|
|||
const ServerSocket = CC("@mozilla.org/network/server-socket;1",
|
||||
"nsIServerSocket",
|
||||
"initSpecialConnection");
|
||||
const UnixDomainServerSocket = CC("@mozilla.org/network/server-socket;1",
|
||||
"nsIServerSocket",
|
||||
"initWithFilename");
|
||||
|
||||
var gRegisteredModules = Object.create(null);
|
||||
|
||||
|
@ -384,12 +388,13 @@ var DebuggerServer = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Listens on the given port for remote debugger connections.
|
||||
* Listens on the given port or socket file for remote debugger connections.
|
||||
*
|
||||
* @param aPort int
|
||||
* The port to listen on.
|
||||
* @param aPortOrPath int, string
|
||||
* If given an integer, the port to listen on.
|
||||
* Otherwise, the path to the unix socket domain file to listen on.
|
||||
*/
|
||||
openListener: function DS_openListener(aPort) {
|
||||
openListener: function DS_openListener(aPortOrPath) {
|
||||
if (!Services.prefs.getBoolPref("devtools.debugger.remote-enabled")) {
|
||||
return false;
|
||||
}
|
||||
|
@ -407,11 +412,21 @@ var DebuggerServer = {
|
|||
}
|
||||
|
||||
try {
|
||||
let socket = new ServerSocket(aPort, flags, 4);
|
||||
let backlog = 4;
|
||||
let socket;
|
||||
let port = Number(aPortOrPath);
|
||||
if (port) {
|
||||
socket = new ServerSocket(port, flags, backlog);
|
||||
} else {
|
||||
let file = nsFile(aPortOrPath);
|
||||
if (file.exists())
|
||||
file.remove(false);
|
||||
socket = new UnixDomainServerSocket(file, parseInt("600", 8), backlog);
|
||||
}
|
||||
socket.asyncListen(this);
|
||||
this._listener = socket;
|
||||
} catch (e) {
|
||||
dumpn("Could not start debugging listener on port " + aPort + ": " + e);
|
||||
dumpn("Could not start debugging listener on '" + aPortOrPath + "': " + e);
|
||||
throw Cr.NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
this._socketConnections++;
|
||||
|
|
Загрузка…
Ссылка в новой задаче