Bug 935014 - Allows to specify the devtool debuggger port via the command line. r=fabrice

This commit is contained in:
Alexandre Poirot 2014-03-24 08:15:00 -07:00
parent 6c4364ff2f
commit 4ab36f4adf
2 changed files with 24 additions and 1 deletions

View File

@ -46,7 +46,30 @@ function setupButtons() {
});
}
function checkDebuggerPort() {
// XXX: To be removed once bug 942756 lands.
// We are hacking 'unix-domain-socket' pref by setting a tcp port (number).
// DebuggerServer.openListener detects that it isn't a file path (string),
// and starts listening on the tcp port given here as command line argument.
// Get the command line arguments that were passed to the b2g client
let args = window.arguments[0].QueryInterface(Ci.nsICommandLine);
let dbgport;
try {
dbgport = args.handleFlagWithParam('start-debugger-server', false);
} catch(e) {}
if (dbgport) {
dump('Opening debugger server on ' + dbgport + '\n');
Services.prefs.setCharPref('devtools.debugger.unix-domain-socket', dbgport);
navigator.mozSettings.createLock().set(
{'debugger.remote-mode': 'adb-devtools'});
}
}
window.addEventListener('ContentStart', function() {
enableTouch();
setupButtons();
checkDebuggerPort();
});

View File

@ -171,7 +171,7 @@ exports.SimulatorProcess = Class({
Cu.reportError(profile);
// NOTE: push dbgport option on the b2g-desktop commandline
args.push("-dbgport", "" + this.remoteDebuggerPort);
args.push("-start-debugger-server", "" + this.remoteDebuggerPort);
// Ignore eventual zombie instances of b2g that are left over
args.push("-no-remote");