Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/browser_launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Add `--test-type` and `--disable-session-crashed-bubble` flags when launching
chrome to prevent some warnings.
- Allow passing arbitrary command line arguments when starting Chrome.
- Separate CLI arguments from URLs with a `--` when launching Chrome.

## 1.1.3

Expand Down
19 changes: 6 additions & 13 deletions pkgs/browser_launcher/lib/src/chrome.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,10 @@ class Chrome {
// another, don't announce when the previous session crashed.
'--disable-session-crashed-bubble',
...additionalArguments,
if (headless) '--headless',
];
if (headless) {
args.add('--headless');
}

final process = await _startProcess(urls, args: args);
final process = await start(urls, args: args);

// Wait until the DevTools are listening before trying to connect.
final errorLines = <String>[];
Expand Down Expand Up @@ -177,15 +175,10 @@ class Chrome {
static Future<Process> start(
List<String> urls, {
List<String> args = const [],
}) async =>
await _startProcess(urls, args: args);

static Future<Process> _startProcess(
List<String> urls, {
List<String> args = const [],
}) async {
final processArgs = args.toList()..addAll(urls);
return await Process.start(_executable, processArgs);
}) {
assert(!args.contains('--'));
assert(!urls.contains('--'));
return Process.start(_executable, [...args, '--', ...urls]);
}

static Future<Chrome> _connect(Chrome chrome) async {
Expand Down
Loading