Bug 935014 - Allows to specify the devtool debuggger port via the command line. r=fabrice
--- a/b2g/chrome/content/desktop.js
+++ b/b2g/chrome/content/desktop.js
@@ -41,12 +41,35 @@ function setupButtons() {
rotateButton.classList.add('active');
});
rotateButton.addEventListener('touchend', function() {
GlobalSimulatorScreen.flipScreen();
rotateButton.classList.remove('active');
});
}
+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();
});
--- a/b2g/simulator/lib/simulator-process.js
+++ b/b2g/simulator/lib/simulator-process.js
@@ -166,17 +166,17 @@ exports.SimulatorProcess = Class({
get b2gArguments() {
let args = [];
let profile = URL.toFilename(PROFILE_URL);
args.push("-profile", profile);
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");
return args;
},
});