Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Add chrome launching code to browser_launcher #4

Merged
merged 13 commits into from
Apr 26, 2019

Conversation

kenzieschmoll
Copy link
Contributor

@kenzieschmoll kenzieschmoll commented Apr 25, 2019

Pulled code from https://github.com/dart-lang/webdev/blob/master/webdev/lib/src/serve/chrome.dart with some slight modifications like named parameters and a method to launch chrome without a debug port

Pulled test code from https://github.com/dart-lang/webdev/blob/master/webdev/test/serve/chrome_test.dart

lib/src/chrome.dart Outdated Show resolved Hide resolved
lib/src/chrome.dart Outdated Show resolved Hide resolved
test/chrome_test.dart Outdated Show resolved Hide resolved
test/chrome_test.dart Outdated Show resolved Hide resolved
lib/src/chrome.dart Outdated Show resolved Hide resolved
lib/src/chrome.dart Outdated Show resolved Hide resolved
lib/src/chrome.dart Outdated Show resolved Hide resolved
lib/src/chrome.dart Outdated Show resolved Hide resolved
static Future<Chrome> startWithPort(
List<String> urls, {
String userDataDir,
int remoteDebuggingPort,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to be in the business of keeping track of all Chrome configuration. There are a ton of possible flags. We should probably make this more generic and just use an iterable of strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made these named params per Nate's comment on the proposal doc:

"if there are common args that multiple usages need to have knowledge of it would be cool to have named args or something here."

@natebosch am I misunderstanding your request? Or do you think there are some that should be named and some that should not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to a list of strings. If we want to make some named in the future, we can do that as needed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are args that multiple clients need to know about I'd be in favor of encoding knowledge here. @grouma what is your concern? Why do you prefer to duplicate this knowledge in other clients?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concerns don't need to be blocking - as you mention we can always add new named args in the future.

Copy link
Contributor

@grouma grouma Apr 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nate and I discussed offline.

My concern was having a significant list of unused optional arguments and trying to keep that in sync with the available Chrome flags. Right now we have three potential clients of this package, package:test, package:webdev and DevTools. From what I can tell the only arguments that are really configured / changed are --headless (which includes others by default) and --remote-debugging-port.

We agreed that the best approach is to provide optional arguments for those two options only. We will still pass the other options and just document their use. If and when other clients need to configure more options we can easily add another optional argument in a non-breaking way.

Ignore my suggestion of providing a mechanism to add arbitrary arguments. We can revisit that if necessary but it won't be likely given the low number of users for this package.

Sorry for the churn!

lib/src/chrome.dart Show resolved Hide resolved
lib/src/chrome.dart Outdated Show resolved Hide resolved
test/chrome_test.dart Outdated Show resolved Hide resolved
Copy link

@jakemac53 jakemac53 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general meta-comment but i wonder if the whole singleton instance stuff makes sense generally or not?

If multiple packages want to launch chrome it will end up just failing I think, and any package can implement their own canonical instance logic on their own?

@kenzieschmoll
Copy link
Contributor Author

removed the completer logic requiring there to be only once connected instance of Chrome at a time. Discussed offline with Jake. It makes more sense for Webdev to implement something on top of the browser_launcher code if this is necessary.

@kenzieschmoll kenzieschmoll merged commit 5c179e5 into dart-archive:master Apr 26, 2019
@kenzieschmoll kenzieschmoll deleted the launchChrome branch April 26, 2019 17:44
mosuem pushed a commit to dart-lang/tools that referenced this pull request Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants