From 23e4353dfe2483dcfc7511bf2b23643fbdc5a949 Mon Sep 17 00:00:00 2001 From: "jamiewalch@google.com" Date: Mon, 25 Jun 2012 23:46:46 +0000 Subject: Pass OAuth token refresh errors back to the caller. This allows the app to advise the user to sign back in to Chromoting only when we believe it will actually help. As a bonus, the unhelpfully-named ERROR_GENERIC is now gone--apart from OAuth refresh failures, it was being used for edge-cases where we don't expect anything to go wrong (these now use the more suitably-named ERROR_UNEXPECTED). As part of fixing this, I have cleaned up some OAuth call points that were written before callWithToken existed, and which weren't using it. BUG=122899,130794 TEST=Corrupt the oauth2-refresh-token value in HTML Local Storage Review URL: https://chromiumcodereview.appspot.com/10579012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144059 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/webapp/host_controller.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'remoting/webapp/host_controller.js') diff --git a/remoting/webapp/host_controller.js b/remoting/webapp/host_controller.js index 63ef1f1..845e65d 100644 --- a/remoting/webapp/host_controller.js +++ b/remoting/webapp/host_controller.js @@ -225,14 +225,14 @@ remoting.HostController.prototype.start = function(hostPin, consent, callback) { * @param {string} publicKey */ function onKeyGenerated(privateKey, publicKey) { remoting.oauth2.callWithToken( - /** @param {string?} oauthToken */ + /** @param {string} oauthToken */ function(oauthToken) { - if (oauthToken) { - doRegisterHost(privateKey, publicKey, oauthToken); - } else { - // TODO(jamiewalch): Have a more specific error code here? - callback(remoting.HostController.AsyncResult.FAILED); - } + doRegisterHost(privateKey, publicKey, oauthToken); + }, + /** @param {remoting.Error} error */ + function(error) { + // TODO(jamiewalch): Have a more specific error code here? + callback(remoting.HostController.AsyncResult.FAILED); }); }; -- cgit v1.1