Rename 'maxTime' option of Page.navigate into 'timeout'

The motivation behind this rename is to name all the 'timeout' options
across methods similarly.

References #39.
This commit is contained in:
Andrey Lushnikov
2017-07-22 16:25:00 -07:00
parent 98ee35655f
commit 5757bc18f2
4 changed files with 6 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ class NavigatorWatcher {
constructor(client, networkManager, options = {}) {
this._client = client;
this._networkManager = networkManager;
this._maxTime = typeof options['maxTime'] === 'number' ? options['maxTime'] : 30000;
this._timeout = typeof options['timeout'] === 'number' ? options['timeout'] : 30000;
this._idleTime = typeof options['networkIdleTimeout'] === 'number' ? options['networkIdleTimeout'] : 1000;
this._idleInflight = typeof options['networkIdleInflight'] === 'number' ? options['networkIdleInflight'] : 2;
this._waitUntil = typeof options['waitUntil'] === 'string' ? options['waitUntil'] : 'load';
@@ -43,7 +43,7 @@ class NavigatorWatcher {
.then(error => new Error('SSL Certiciate error: ' + error.errorType));
let networkIdle = new Promise(fulfill => this._networkIdleCallback = fulfill).then(() => null);
let loadEventFired = new Promise(fulfill => this._client.once('Page.loadEventFired', fulfill)).then(() => null);
let watchdog = new Promise(fulfill => this._maximumTimer = setTimeout(fulfill, this._maxTime)).then(() => new Error('Navigation Timeout Exceeded: ' + this._maxTime + 'ms exceeded'));
let watchdog = new Promise(fulfill => this._maximumTimer = setTimeout(fulfill, this._timeout)).then(() => new Error('Navigation Timeout Exceeded: ' + this._timeout + 'ms exceeded'));
try {
// Await for the command to throw exception in case of illegal arguments.