diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-16 01:59:39 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-16 02:00:31 +0100 |
commit | bd65bb67e25a79b019d745b7262b2008ce2adb15 (patch) | |
tree | 89e1b032103a63737f1a703e6a943832ef261704 /node_modules/selenium-webdriver/remote | |
parent | f91466595b651721690133f58ab37f977539e95b (diff) |
incrementally verify denoms
The denominations are not stored in a separate object store.
Diffstat (limited to 'node_modules/selenium-webdriver/remote')
-rw-r--r-- | node_modules/selenium-webdriver/remote/index.js | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/node_modules/selenium-webdriver/remote/index.js b/node_modules/selenium-webdriver/remote/index.js index ab76b4476..87dee7e8d 100644 --- a/node_modules/selenium-webdriver/remote/index.js +++ b/node_modules/selenium-webdriver/remote/index.js @@ -247,15 +247,18 @@ class DriverService { pathname: self.path_ }); - return new Promise(function(fulfill, reject) { - var ready = httpUtil.waitForServer(serverUrl, timeout) - .then(fulfill, reject); - earlyTermination.catch(function(e) { - ready.cancel(/** @type {Error} */(e)); - reject(Error(e.message)); - }); - }).then(function() { - return serverUrl; + return new Promise((fulfill, reject) => { + let cancelToken = + earlyTermination.catch(e => reject(Error(e.message))); + + httpUtil.waitForServer(serverUrl, timeout, cancelToken) + .then(_ => fulfill(serverUrl), err => { + if (err instanceof promise.CancellationError) { + fulfill(serverUrl); + } else { + reject(err); + } + }); }); }); })); @@ -283,7 +286,7 @@ class DriverService { /** * Schedules a task in the current control flow to stop the server if it is * currently running. - * @return {!promise.Promise} A promise that will be resolved when + * @return {!promise.Thenable} A promise that will be resolved when * the server has been stopped. */ stop() { @@ -297,8 +300,9 @@ class DriverService { * @return {!Promise<!Array<string>>} */ function resolveCommandLineFlags(args) { - return Promise.resolve(args) // Resolve the outer array. - .then(args => Promise.all(args)); // Then resolve the individual flags. + // Resolve the outer array, then the individual flags. + return Promise.resolve(args) + .then(/** !Array<CommandLineFlag> */args => Promise.all(args)); } |