Skip to content

Commit

Permalink
Remove deprecated functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyba committed Apr 1, 2014
1 parent 3fc84a5 commit 26cc094
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 105 deletions.
8 changes: 0 additions & 8 deletions javascript/webdriver/exports/exports_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,21 +265,13 @@ function checkPromise() {
assertFunction('webdriver.promise.Promise.prototype', 'thenCatch');
assertFunction('webdriver.promise.Promise.prototype', 'thenFinally');
assertFunction('webdriver.promise.Promise.prototype', 'cancel');
assertFunction('webdriver.promise.Promise.prototype', 'addBoth');
assertFunction('webdriver.promise.Promise.prototype', 'addCallback');
assertFunction('webdriver.promise.Promise.prototype', 'addCallbacks');
assertFunction('webdriver.promise.Promise.prototype', 'addErrback');
assertFunction('webdriver.promise.Promise.prototype', 'isPending');

assertFunction('webdriver.promise', 'Deferred');
assertFunction('new webdriver.promise.Deferred()', 'then');
assertFunction('new webdriver.promise.Deferred()', 'thenCatch');
assertFunction('new webdriver.promise.Deferred()', 'thenFinally');
assertFunction('new webdriver.promise.Deferred()', 'cancel');
assertFunction('new webdriver.promise.Deferred()', 'addBoth');
assertFunction('new webdriver.promise.Deferred()', 'addCallback');
assertFunction('new webdriver.promise.Deferred()', 'addCallbacks');
assertFunction('new webdriver.promise.Deferred()', 'addErrback');
assertFunction('new webdriver.promise.Deferred()', 'isPending');
assertFunction('new webdriver.promise.Deferred()', 'fulfill');
assertFunction('new webdriver.promise.Deferred()', 'reject');
Expand Down
83 changes: 1 addition & 82 deletions javascript/webdriver/promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,87 +182,6 @@ webdriver.promise.Promise.prototype.thenFinally = function(callback) {
};


/**
* Registers a function to be invoked when this promise is successfully
* resolved. This function is provided for backwards compatibility with the
* Dojo Deferred API.
*
* @param {Function} callback The function to call if this promise is
* successfully resolved. The function should expect a single argument: the
* promise's resolved value.
* @param {!Object=} opt_self The object which |this| should refer to when the
* function is invoked.
* @return {!webdriver.promise.Promise} A new promise which will be resolved
* with the result of the invoked callback.
* @deprecated Use {@link #then()} instead.
*/
webdriver.promise.Promise.prototype.addCallback = function(callback, opt_self) {
return this.then(goog.bind(callback, opt_self));
};


/**
* Registers a function to be invoked when this promise is rejected.
* This function is provided for backwards compatibility with the
* Dojo Deferred API.
*
* @param {Function} errback The function to call if this promise is
* rejected. The function should expect a single argument: the rejection
* reason.
* @param {!Object=} opt_self The object which |this| should refer to when the
* function is invoked.
* @return {!webdriver.promise.Promise} A new promise which will be resolved
* with the result of the invoked callback.
* @deprecated Use {@link #thenCatch()} instead.
*/
webdriver.promise.Promise.prototype.addErrback = function(errback, opt_self) {
return this.thenCatch(goog.bind(errback, opt_self));
};


/**
* Registers a function to be invoked when this promise is either rejected or
* resolved. This function is provided for backwards compatibility with the
* Dojo Deferred API.
*
* @param {Function} callback The function to call when this promise is
* either resolved or rejected. The function should expect a single
* argument: the resolved value or rejection error.
* @param {!Object=} opt_self The object which |this| should refer to when the
* function is invoked.
* @return {!webdriver.promise.Promise} A new promise which will be resolved
* with the result of the invoked callback.
* @deprecated Use {@link #thenFinally()} instead.
*/
webdriver.promise.Promise.prototype.addBoth = function(callback, opt_self) {
return this.thenFinally(goog.bind(callback, opt_self));
};


/**
* An alias for {@code webdriver.promise.Promise.prototype.then} that permits
* the scope of the invoked function to be specified. This function is provided
* for backwards compatibility with the Dojo Deferred API.
*
* @param {Function} callback The function to call if this promise is
* successfully resolved. The function should expect a single argument: the
* promise's resolved value.
* @param {Function} errback The function to call if this promise is
* rejected. The function should expect a single argument: the rejection
* reason.
* @param {!Object=} opt_self The object which |this| should refer to when the
* function is invoked.
* @return {!webdriver.promise.Promise} A new promise which will be resolved
* with the result of the invoked callback.
* @deprecated Use {@link #then()} instead.
*/
webdriver.promise.Promise.prototype.addCallbacks = function(
callback, errback, opt_self) {
return this.then(goog.bind(callback, opt_self),
goog.bind(errback, opt_self));
};



/**
* Represents a value that will be resolved at some point in the future. This
Expand Down Expand Up @@ -1849,7 +1768,7 @@ webdriver.promise.Frame_.prototype.lastInsertedChild_ = null;
* webdriver.promise.createFlow(function(flow) {
* someResult = flow.execute(function() {});
* throw Error();
* }).addErrback(function(err) {
* }).thenCatch(function(err) {
* console.log('flow failed: ' + err);
* someResult.then(function() {
* console.log('task succeeded!');
Expand Down
14 changes: 0 additions & 14 deletions javascript/webdriver/test/promise_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -395,20 +395,6 @@
}


function testInvokesCallbacksInRegisteredScope() {
var callback1, callback2;
webdriver.promise.fulfilled('abc').
addCallback(callback1 = callbackHelper(function(value) {
return value + this.count;
}), {count:123}).
then(callback2 = callbackHelper(function(value) {
assertEquals('abc123', value);
}));
callback1.assertCalled();
callback2.assertCalled();
}


function testResolvingAPromiseWithAnotherPromiseCreatesAChain_ourPromise() {
var d1 = new webdriver.promise.Deferred();
var d2 = new webdriver.promise.Deferred();
Expand Down
2 changes: 1 addition & 1 deletion javascript/webdriver/testing/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ goog.require('webdriver.promise.Promise');
* <pre><code>
* var testWindow = webdriver.testing.Window.create(driver);
* // Throw a custom error when the window fails to open.
* testWindow.addErrback(function(e) {
* testWindow.thenCatch(function(e) {
* throw Error('Failed to open test window: ' + e);
* });
* </code></pre>
Expand Down

0 comments on commit 26cc094

Please sign in to comment.