Skip to content

Spawn native Chrome on ChromeOS#600

Merged
DanTup merged 4 commits intoflutter:masterfrom
DanTup:use-native-cros-browser
Apr 29, 2019
Merged

Spawn native Chrome on ChromeOS#600
DanTup merged 4 commits intoflutter:masterfrom
DanTup:use-native-cros-browser

Conversation

@DanTup
Copy link
Contributor

@DanTup DanTup commented Apr 29, 2019

For ChromeOS users where everything is accessible on tunnelled ports, we should use the ChromeOS browser (using Chrome.start() will attempt to run Chrome for Linux in the container).

Also added a / as path in the URI we launch. Without this, Dart was generating a URL like http://127.0.0.1:8000?uri=xxx (there's no / for the path) which ChromeOS was failing to realise was a bound port, and then rewriting as penguin.linux.test as we launched. We could've fixed this by adding a trailing slash to devToolsUrl but it would be easy to regress, so this ensures this will never happen regardless of changes further up.

(also removed a TODO that was done)

Fixes #582.

DanTup added 3 commits April 29, 2019 10:23
For ChromeOS users where everything is accessible on tunneled ports, we should use the ChromeOS browser (using Chrome.start() will attempt to run Chrome for Linux in the container).

Fixes flutter#582.
This missing slash would break launching the native browser on ChromeOS since it would not realise the host/port was tunneled, and then (usually helpfully) replace the IP with the containers IP. This would only work if the service is listening on the main container IP.
final bool _isChromeOS = new File('/dev/.cros_milestone').existsSync();

bool _isAccessibleToChromeOSNativeBrowser(Uri uri) {
const tunneledPorts = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a TODO to switch to a set literal once we can/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Though I'm hoping we can delete this method before long (see the TODO further up) :-)

@DanTup DanTup merged commit bb85a9c into flutter:master Apr 29, 2019
@DanTup DanTup deleted the use-native-cros-browser branch April 29, 2019 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

launchDevTools should use ChromeOS native browser

2 participants