-
Notifications
You must be signed in to change notification settings - Fork 9k
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
Allow options.timeout to be 0
to disable timeout
#887
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,9 +40,12 @@ class NavigatorWatcher { | |
|
||
this._eventListeners = []; | ||
|
||
const watchdog = new Promise(fulfill => this._maximumTimer = setTimeout(fulfill, this._timeout)) | ||
.then(() => 'Navigation Timeout Exceeded: ' + this._timeout + 'ms exceeded'); | ||
const navigationPromises = [watchdog]; | ||
const navigationPromises = []; | ||
if (this._timeout) { | ||
const watchdog = new Promise(fulfill => this._maximumTimer = setTimeout(fulfill, this._timeout)) | ||
.then(() => 'Navigation Timeout Exceeded: ' + this._timeout + 'ms exceeded'); | ||
navigationPromises.push(watchdog); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is as the @aslushnikov suggestion, it's simple and clear code. But it think it still have problem if user pass timeout 0 as a string. I'd like add more conditional check, or we just rely on the documentation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @brutalcrozt yes, we should rely on documentation in this case and expect user to pass in a number. There's also a check that timeout is always a number: https://github.com/GoogleChrome/puppeteer/blob/c46c41d89caefd1e1951055fb041521a2bcc933b/lib/NavigatorWatcher.js#L28 |
||
|
||
if (!this._ignoreHTTPSErrors) { | ||
const certificateError = new Promise(fulfill => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bunch of other methods that rely on NavigationWatcher, so you should add this clarification there as well: