diff options
author | jamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-28 21:54:49 +0000 |
---|---|---|
committer | jamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-28 21:54:49 +0000 |
commit | df17d6488f6d1d907e2df64af8fe49f57c3897da (patch) | |
tree | 8106b7f6d0662a0601f932a3b9b64272e8fc4610 | |
parent | 3edc45b0502450007b6dd3eb27ba20e4117754e0 (diff) | |
download | chromium_src-df17d6488f6d1d907e2df64af8fe49f57c3897da.zip chromium_src-df17d6488f6d1d907e2df64af8fe49f57c3897da.tar.gz chromium_src-df17d6488f6d1d907e2df64af8fe49f57c3897da.tar.bz2 |
Remove bogus warnings at start-up.
BUG=129433
TEST=Start the web-app with no hosts registered. There should be no errors on the console.
Review URL: https://chromiumcodereview.appspot.com/10679011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144810 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/webapp/_locales/en/messages.json | 4 | ||||
-rw-r--r-- | remoting/webapp/host_controller.js | 4 | ||||
-rw-r--r-- | remoting/webapp/host_list.js | 34 | ||||
-rw-r--r-- | remoting/webapp/oauth2.js | 12 | ||||
-rw-r--r-- | remoting/webapp/remoting.js | 3 |
5 files changed, 36 insertions, 21 deletions
diff --git a/remoting/webapp/_locales/en/messages.json b/remoting/webapp/_locales/en/messages.json index fe9a84f..46547c0 100644 --- a/remoting/webapp/_locales/en/messages.json +++ b/remoting/webapp/_locales/en/messages.json @@ -154,6 +154,10 @@ "message": "Unable to reach the host. This is probably due to the configuration of the network you are using.", "description": "Error displayed when the host is online, but we are unable to connect to it due to network configuration." }, + "ERROR_NOT_AUTHENTICATED": { + "message": "You are not signed in to Chromoting. Please sign in and try again.", + "description": "Error displayed when an operation is attempted that requires a signed-in user, but no-one is currently signed in." + }, "ERROR_MISSING_PLUGIN": { "message": "Some components required for Chromoting are missing. Please make sure you're running the latest version of Chromium and try again.", "description": "Error displayed if the client plugin fails to load." diff --git a/remoting/webapp/host_controller.js b/remoting/webapp/host_controller.js index 845e65d..08f3f2e 100644 --- a/remoting/webapp/host_controller.js +++ b/remoting/webapp/host_controller.js @@ -274,7 +274,9 @@ function parseHostConfig_(configStr) { typeof config['xmpp_login'] == 'string') { return config; } else { - console.error('Invalid getDaemonConfig response.'); + if (configStr != '{}') { + console.error('Invalid getDaemonConfig response.'); + } } return null; } diff --git a/remoting/webapp/host_list.js b/remoting/webapp/host_list.js index 540067e..399c3f1 100644 --- a/remoting/webapp/host_list.js +++ b/remoting/webapp/host_list.js @@ -131,21 +131,25 @@ remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) { if (xhr.status == 200) { var response = /** @type {{data: {items: Array}}} */ jsonParseSafe(xhr.responseText); - if (response && response.data && response.data.items) { - this.hosts_ = response.data.items; - /** - * @param {remoting.Host} a - * @param {remoting.Host} b - */ - var cmp = function(a, b) { - if (a.status < b.status) { - return 1; - } else if (b.status < a.status) { - return -1; - } - return 0; - }; - this.hosts_ = /** @type {Array} */ this.hosts_.sort(cmp); + if (response && response.data) { + if (response.data.items) { + this.hosts_ = response.data.items; + /** + * @param {remoting.Host} a + * @param {remoting.Host} b + */ + var cmp = function(a, b) { + if (a.status < b.status) { + return 1; + } else if (b.status < a.status) { + return -1; + } + return 0; + }; + this.hosts_ = /** @type {Array} */ this.hosts_.sort(cmp); + } else { + this.hosts_ = []; + } } else { console.error('Invalid "hosts" response from server.'); } diff --git a/remoting/webapp/oauth2.js b/remoting/webapp/oauth2.js index e030822..ece2619 100644 --- a/remoting/webapp/oauth2.js +++ b/remoting/webapp/oauth2.js @@ -344,10 +344,14 @@ remoting.OAuth2.prototype.revokeToken_ = function(token) { * @return {void} Nothing. */ remoting.OAuth2.prototype.callWithToken = function(onOk, onError) { - if (this.needsNewAccessToken()) { - this.refreshAccessToken_(this.onRefreshToken_.bind(this, onOk, onError)); - } else { - onOk(this.getAccessToken_()); + try { + if (this.needsNewAccessToken()) { + this.refreshAccessToken_(this.onRefreshToken_.bind(this, onOk, onError)); + } else { + onOk(this.getAccessToken_()); + } + } catch (error) { + onError(remoting.Error.NOT_AUTHENTICATED); } }; diff --git a/remoting/webapp/remoting.js b/remoting/webapp/remoting.js index 5fa18f4..a32d4a8 100644 --- a/remoting/webapp/remoting.js +++ b/remoting/webapp/remoting.js @@ -23,7 +23,8 @@ remoting.Error = { NETWORK_FAILURE: /*i18n-content*/'ERROR_NETWORK_FAILURE', HOST_OVERLOAD: /*i18n-content*/'ERROR_HOST_OVERLOAD', UNEXPECTED: /*i18n-content*/'ERROR_UNEXPECTED', - SERVICE_UNAVAILABLE: /*i18n-content*/'ERROR_SERVICE_UNAVAILABLE' + SERVICE_UNAVAILABLE: /*i18n-content*/'ERROR_SERVICE_UNAVAILABLE', + NOT_AUTHENTICATED: /*i18n-content*/'ERROR_NOT_AUTHENTICATED' }; /** |