-
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
page.waitForNavigation() timeout=0 does not disable timeout, but actually sets it to zero #1417
Comments
Or on second thought, maybe it isn't "setting it to zero seconds" rather than just breaking it somehow as it doesn't throw a timeout error, but the promise returned just seems to disappear (starts out as pending but silently goes to null immediately). In any case, it doesn't work. |
So here is the relevant bit of code from NavigatorWatcher.js, line 49 and following:
If timeout is set to zero, then _createTimeoutPromise returns a non-Promise plain null, which ends up in the Promise.race function above it, apparently with the idea that it would just ignore it, but any non-Promise given to Promise.race will "win the race" immediately and be returned as the resolved value, thus resolving _navigationPromise with null, which should never happen. |
Since non-promise values always win the `Promise.race`, we shouldn't return `null` for timeout promise in NavigationWatcher. Instead, we can return a promise that never resolved. It should be GC'd later with the navigation watcher itself. Fixes puppeteer#1417.
@vonGameTheory thank you for the investigation. I've sent the fix. |
v1.0.0-rc page.waitForNavigation()
setting timeout:0 should disable timeout according to the docs (meaning it never times out), but it seems to just actually set it to 0 seconds, and then promise reverts to null immediately everytime.
The text was updated successfully, but these errors were encountered: