feat(page): Allow Page.goto's timeout to be 0 to disable timeout (#887)

This patch allows passing 0 to disable timeout for the following methods:

- page.goto
- page.waitForNavigation
- page.goForward
- page.goBack

Fixes #782.
This commit is contained in:
Adi Prasetyo
2017-09-30 14:29:38 +07:00
committed by Andrey Lushnikov
parent bafd937fc3
commit 53531c9a92
3 changed files with 16 additions and 8 deletions

View File

@@ -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);
}
if (!this._ignoreHTTPSErrors) {
const certificateError = new Promise(fulfill => {