Skip to content

Commit

Permalink
Replace applescript with browser-launcher2
Browse files Browse the repository at this point in the history
This allows...

1. launching Chrome on platforms other than OS X
2. users to launch their own instance of Chrome (e.g. via command line)
   rather than being forced to use the default instance (i.e.
   `tell application "Chrome"` always used the default instance)

`isDebuggerConnected()` addresses the problem in facebook#510 where the dev tools
would only open once per server session.

Add a '--dangerouslyDisableChromeDebuggerWebSecurity' flag to
packager.js to enable Chrome '--disable-web-security' flag.

This allows users to inspect network requests in Chrome by commenting
the xhr polyfill in InitializeJavaScriptAppEngine.js:
  facebook#934 (comment)

Usage:

    node packager.js --dangerouslyDisableChromeDebuggerWebSecurity

or:

    packager.sh --dangerouslyDisableChromeDebuggerWebSecurity
  • Loading branch information
elliottsj committed Aug 22, 2015
1 parent d51d32f commit 225a019
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packager/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ var options = parseCommandLine([{
type: 'string',
default: require.resolve('./transformer.js'),
description: 'Specify a custom transformer to be used (absolute path)'
}, {
command: 'dangerouslyDisableChromeDebuggerWebSecurity',
description: 'Disable the Chrome debugger\'s same-origin policy'
}]);

if (options.projectRoots) {
Expand Down Expand Up @@ -199,6 +202,10 @@ function getDevToolsLauncher(options) {
return;
}
var debuggerURL = 'http://localhost:' + options.port + '/debugger-ui';
var chromeOptions =
options.dangerouslyDisableChromeDebuggerWebSecurity ?
['--disable-web-security'] :
[];
console.log('Launching Dev Tools...');
launcher(function(err, launch) {
if (err) {
Expand All @@ -207,6 +214,7 @@ function getDevToolsLauncher(options) {
}
launch(debuggerURL, {
browser: 'chrome',
options: chromeOptions,
}, function(err, instance) {
if (err) {
console.error('Failed to launch chrome', err);
Expand Down

0 comments on commit 225a019

Please sign in to comment.