Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup puppeteer.connect({browserURL}) #3766

Merged
merged 2 commits into from Jan 14, 2019

Conversation

aslushnikov
Copy link
Contributor

This patch:

  • renames browserUrl into browserURL
  • cleans up some code
  • adds tests for error handling

References #3537

This patch:
- renames `browserUrl` into `browserURL`
- cleans up some code
- adds tests for error handling

References puppeteer#3537
lib/Launcher.js Outdated
ignoreHTTPSErrors = false,
defaultViewport = {width: 800, height: 600},
transport,
slowMo = 0,
} = options;

let connectionUrl;
let connectionTransport;
assert(!!browserWSEndpoint + !!browserURL + !!transport === 1, 'Exactly one of browserWSEndpoint, browserURL or transport must be passed to puppeteer.connect');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fancy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It got even fancies thanks to TSC strictness

connectionTransport = await WebSocketTransport.create(connectionUrl);
let connection = null;
if (transport) {
connection = new Connection('', transport, slowMo);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Null instead of empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Must be a string per our docs and everything - I'd keep it as-is

@aslushnikov aslushnikov merged commit d346cb5 into puppeteer:master Jan 14, 2019
@aslushnikov aslushnikov deleted the cleanup-browser-url branch January 22, 2019 20:50
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.

None yet

2 participants