selenium-webdriver
Advanced tools
Comparing version 2.29.1 to 2.30.0
@@ -80,4 +80,5 @@ // Copyright 2011 Software Freedom Conservancy. All Rights Reserved. | ||
* process. | ||
* @param {*} reason The reason this promise is being cancelled. While typically | ||
* an {@code Error}, any type is permissible. | ||
* @param {*} reason The reason this promise is being cancelled. If not an | ||
* {@code Error}, one will be created using the value's string | ||
* representation. | ||
*/ | ||
@@ -103,5 +104,4 @@ webdriver.promise.Promise.prototype.cancel = function(reason) { | ||
* @param {Function=} opt_errback The function to call if this promise is | ||
* rejected. The function should expect a single argument: the failure | ||
* reason. While this argument is typically an {@code Error}, any type is | ||
* permissible. | ||
* rejected. The function should expect a single argument: the | ||
* {@code Error} that caused the promise to be rejected. | ||
* @return {!webdriver.promise.Promise} A new promise which will be resolved | ||
@@ -140,5 +140,4 @@ * with the result of the invoked callback. | ||
* @param {Function} errback The function to call if this promise is | ||
* rejected. The function should expect a single argument: the failure | ||
* reason. While this argument is typically an {@code Error}, any type is | ||
* permissible. | ||
* rejected. The function should expect a single argument: the | ||
* {@code Error} that caused the promise to be rejected. | ||
* @param {!Object=} opt_self The object which |this| should refer to when the | ||
@@ -182,5 +181,4 @@ * function is invoked. | ||
* @param {Function} errback The function to call if this promise is | ||
* rejected. The function should expect a single argument: the failure | ||
* reason. While this argument is typically an {@code Error}, any type is | ||
* permissible. | ||
* rejected. The function should expect a single argument: the | ||
* {@code Error} that caused the promise to be rejected. | ||
* @param {!Object=} opt_self The object which |this| should refer to when the | ||
@@ -280,2 +278,8 @@ * function is invoked. | ||
if (newState == webdriver.promise.Deferred.State_.REJECTED && | ||
!webdriver.promise.isError_(newValue) && | ||
!webdriver.promise.isPromise(newValue)) { | ||
newValue = Error(newValue); | ||
} | ||
state = newState; | ||
@@ -405,5 +409,5 @@ value = newValue; | ||
* rejected value. | ||
* @param {*} reason The reason for cancelling this promise. | ||
* @param {*=} opt_reason The reason for cancelling this promise. | ||
*/ | ||
function cancel(reason) { | ||
function cancel(opt_reason) { | ||
if (!isPending()) { | ||
@@ -414,3 +418,3 @@ throw Error('This Deferred has already been resolved.'); | ||
if (opt_canceller) { | ||
reason = opt_canceller(reason) || reason; | ||
opt_reason = opt_canceller(opt_reason) || opt_reason; | ||
} | ||
@@ -425,3 +429,3 @@ | ||
if (isPending()) { | ||
reject(reason); | ||
reject(opt_reason); | ||
} | ||
@@ -475,2 +479,19 @@ } | ||
/** | ||
* Tests if a value is an Error-like object. This is more than an straight | ||
* instanceof check since the value may originate from another context. | ||
* @param {*} value The value to test. | ||
* @return {boolean} Whether the value is an error. | ||
* @private | ||
*/ | ||
webdriver.promise.isError_ = function(value) { | ||
return value instanceof Error || | ||
goog.isObject(value) && | ||
(Object.prototype.toString.call(value) === '[object Error]' || | ||
// A special test for goog.testing.JsUnitException. | ||
value.isJsUnitException); | ||
}; | ||
/** | ||
* Determines whether a {@code value} should be treated as a promise. | ||
@@ -535,9 +556,9 @@ * Any object whose "then" property is a function will be considered a promise. | ||
* Creates a promise that has been rejected with the given reason. | ||
* @param {*} reason The rejection reason; may be any value, but is usually an | ||
* @param {*=} opt_reason The rejection reason; may be any value, but is usually an | ||
* Error or a string. | ||
* @return {!webdriver.promise.Promise} The rejected promise. | ||
*/ | ||
webdriver.promise.rejected = function(reason) { | ||
webdriver.promise.rejected = function(opt_reason) { | ||
var deferred = new webdriver.promise.Deferred(); | ||
deferred.reject(reason); | ||
deferred.reject(opt_reason); | ||
return deferred.promise; | ||
@@ -1055,3 +1076,3 @@ }; | ||
/** @type {!Error} */(e).stack += [ | ||
/** @type {!Error} */(e).stack = (e.stack || e.stackTrace || '') + [ | ||
'\n==== async task ====\n', | ||
@@ -1413,8 +1434,4 @@ history.join('\n==== async task ====\n') | ||
webdriver.promise.ControlFlow.prototype.abortFrame_ = function(error) { | ||
// Annotate the error value if it is Error-like. We cannot use an instanceof | ||
// check because in Node the value may come from a different context than | ||
// this script so instanceof Error would fail. | ||
if (goog.isObject(error) && | ||
goog.isString(error['message']) && | ||
goog.isString(error['stack'])) { | ||
// Annotate the error value if it is Error-like. | ||
if (webdriver.promise.isError_(error)) { | ||
this.annotateError((/** @type {!Error} */error)); | ||
@@ -1421,0 +1438,0 @@ } |
{ | ||
"name": "selenium-webdriver", | ||
"version": "2.29.1", | ||
"version": "2.30.0", | ||
"description": "The official WebDriver JavaScript bindings from the Selenium project", | ||
@@ -13,3 +13,5 @@ "keywords": [ | ||
"homepage": "https://code.google.com/p/selenium/", | ||
"bugs": "https://code.google.com/p/selenium/issues/list", | ||
"bugs": { | ||
"url": "https://code.google.com/p/selenium/issues/list" | ||
}, | ||
"main": "./index", | ||
@@ -16,0 +18,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
604078
15546
1