Skip to content

Commit

Permalink
Bug 1100124 - Add --jsdebugger to run marionette under the jsdebugger…
Browse files Browse the repository at this point in the history
….;r=ato
  • Loading branch information
chmanchester committed Dec 18, 2014
1 parent bbf86bc commit 576352c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
9 changes: 9 additions & 0 deletions testing/marionette/client/marionette/geckoinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ def start(self):
profile_args["preferences"]["marionette.defaultPrefs.port"] = self.marionette_port
if self.prefs:
profile_args["preferences"].update(self.prefs)
if '-jsdebugger' in self.app_args:
profile_args["preferences"].update({
"devtools.browsertoolbox.panel": "jsdebugger",
"devtools.debugger.remote-enabled": True,
"devtools.debugger.chrome-enabled": True,
"devtools.chrome.enabled": True,
"devtools.debugger.prompt-connection": False,
"marionette.debugging.clicktostart": True,
})

if hasattr(self, "profile_path") and self.profile is None:
if not self.profile_path:
Expand Down
9 changes: 8 additions & 1 deletion testing/marionette/client/marionette/runner/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ def __init__(self, **kwargs):
action='store',
default='Marionette-based Tests',
help='Define the name to associate with the logger used')

self.add_option('--jsdebugger',
dest='jsdebugger',
action='store_true',
default=False,
help='Enable the jsdebugger for marionette javascript.')

def parse_args(self, args=None, values=None):
options, tests = OptionParser.parse_args(self, args, values)
Expand Down Expand Up @@ -440,6 +444,9 @@ def verify_usage(self, options, tests):
if not 1 <= options.this_chunk <= options.total_chunks:
self.error('Chunk to run must be between 1 and %s.' % options.total_chunks)

if options.jsdebugger:
options.app_args.append('-jsdebugger')

for handler in self.verify_usage_handlers:
handler(options, tests)

Expand Down
2 changes: 2 additions & 0 deletions testing/marionette/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ class MachCommands(MachCommandBase):
help='Path to gecko profile to use.')
@CommandArgument('--gecko-log',
help='Path to gecko log file, or "-" for stdout.')
@CommandArgument('--jsdebugger', action='store_true',
help='Enable the jsdebugger for marionette javascript.')
@CommandArgument('tests', nargs='*', metavar='TESTS',
help='Path to test(s) to run.')
def run_marionette_test(self, tests, **kwargs):
Expand Down
19 changes: 18 additions & 1 deletion testing/marionette/marionette-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,24 @@ MarionetteServerConnection.prototype = {
win.addEventListener("load", listener, true);
}
else {
this.startBrowser(win, true);
let clickToStart;
try {
clickToStart = Services.prefs.getBoolPref('marionette.debugging.clicktostart');
Services.prefs.setBoolPref('marionette.debugging.clicktostart', false);
} catch (e) { }
if (clickToStart && (appName != "B2G")) {
let nbox = win.gBrowser.getNotificationBox();
let message = "Starting marionette tests with chrome debugging enabled...";
let buttons = [{
label: "Start execution of marionette tests",
accessKey: 'S',
callback: () => this.startBrowser(win, true)
}];
nbox.appendNotification(message, null, null,
nbox.PRIORITY_WARNING_MEDIUM, buttons);
} else {
this.startBrowser(win, true);
}
}
}

Expand Down

0 comments on commit 576352c

Please sign in to comment.