@@ -84,6 +84,7 @@ goog.inherits(webdriver.promise.CancellationError, goog.debug.Error);
84
84
* used to schedule callbacks on a promised value.
85
85
*
86
86
* @interface
87
+ * @extends {IThenable.<T> }
87
88
* @template T
88
89
*/
89
90
webdriver . promise . Thenable = function ( ) { } ;
@@ -108,7 +109,7 @@ webdriver.promise.Thenable.prototype.isPending = function() {};
108
109
* @param {?(function(T): (R|webdriver.promise.Promise.<R>))= } opt_callback The
109
110
* function to call if this promise is successfully resolved. The function
110
111
* should expect a single argument: the promise's resolved value.
111
- * @param {?(function(Error ): (R|webdriver.promise.Promise.<R>))= } opt_errback
112
+ * @param {?(function(* ): (R|webdriver.promise.Promise.<R>))= } opt_errback
112
113
* The function to call if this promise is rejected. The function should
113
114
* expect a single argument: the rejection reason.
114
115
* @return {!webdriver.promise.Promise.<R> } A new promise which will be
@@ -136,7 +137,7 @@ webdriver.promise.Thenable.prototype.then = function(
136
137
* });
137
138
* </code></pre>
138
139
*
139
- * @param {function(Error ): (R|webdriver.promise.Promise.<R>) } errback The
140
+ * @param {function(* ): (R|webdriver.promise.Promise.<R>) } errback The
140
141
* function to call if this promise is rejected. The function should
141
142
* expect a single argument: the rejection reason.
142
143
* @return {!webdriver.promise.Promise.<R> } A new promise which will be
@@ -249,6 +250,12 @@ webdriver.promise.Thenable.isImplementation = function(object) {
249
250
* fulfilled or rejected state, at which point the promise is considered
250
251
* resolved.
251
252
*
253
+ * @param {function(
254
+ * function((T|IThenable.<T>|Thenable)=),
255
+ * function(*=))} resolver
256
+ * Function that is invoked immediately to begin computation of this
257
+ * promise's value. The function should accept a pair of callback functions,
258
+ * one for fulfilling the promise and another for rejecting it.
252
259
* @param {webdriver.promise.ControlFlow= } opt_flow The control flow
253
260
* this instance was created under. Defaults to the currently active flow.
254
261
* @constructor
@@ -531,14 +538,22 @@ webdriver.promise.Deferred = function(opt_flow) {
531
538
}
532
539
} ;
533
540
534
- this . fulfill = function ( value ) {
535
- checkNotSelf ( value ) ;
536
- fulfill ( value ) ;
541
+ /**
542
+ * Resolves this deferred with the given value.
543
+ * @param {(T|IThenable.<T>|Thenable)= } opt_value The fulfilled value.
544
+ */
545
+ this . fulfill = function ( opt_value ) {
546
+ checkNotSelf ( opt_value ) ;
547
+ fulfill ( opt_value ) ;
537
548
} ;
538
549
539
- this . reject = function ( reason ) {
540
- checkNotSelf ( reason ) ;
541
- reject ( reason ) ;
550
+ /**
551
+ * Rejects this promise with the given reason.
552
+ * @param {*= } opt_reason The rejection reason.
553
+ */
554
+ this . reject = function ( opt_reason ) {
555
+ checkNotSelf ( opt_reason ) ;
556
+ reject ( opt_reason ) ;
542
557
} ;
543
558
} ;
544
559
webdriver . promise . Thenable . addImplementation ( webdriver . promise . Deferred ) ;
@@ -1587,10 +1602,11 @@ webdriver.promise.ControlFlow.prototype.abortFrame_ = function(error) {
1587
1602
* returned promise will be rejected.
1588
1603
*
1589
1604
* @param {!Function } fn The function to execute.
1590
- * @param {function(* ) } callback The function to call with a successful result.
1605
+ * @param {function(T ) } callback The function to call with a successful result.
1591
1606
* @param {function(*) } errback The function to call if there is an error.
1592
1607
* @param {boolean= } opt_activate Whether the active frame should be updated to
1593
1608
* the newly created frame so tasks are treated as sub-tasks.
1609
+ * @template T
1594
1610
* @private
1595
1611
*/
1596
1612
webdriver . promise . ControlFlow . prototype . runInNewFrame_ = function (
0 commit comments