Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(813)

Unified Diff: remoting/webapp/host_list.js

Issue 10736020: Fixed host list cache and "no hosts" icon flash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/webapp/remoting.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/host_list.js
diff --git a/remoting/webapp/host_list.js b/remoting/webapp/host_list.js
index c3d2d23d14cd3dfd3bc1e54da3f2f7acfa00016f..05f03735550371092fa289eaa2d9f8779faf25c1 100644
--- a/remoting/webapp/host_list.js
+++ b/remoting/webapp/host_list.js
@@ -116,11 +116,10 @@ remoting.HostList.prototype.refresh = function(onDone) {
};
/** @param {remoting.Error} error */
var onError = function(error) {
+ that.hosts_ = [];
that.lastError_ = error;
onDone(false);
};
- this.hosts_ = [];
- this.lastError_ = '';
remoting.oauth2.callWithToken(getHosts, onError);
};
@@ -135,6 +134,8 @@ remoting.HostList.prototype.refresh = function(onDone) {
* @private
*/
remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) {
+ this.hosts_ = [];
+ this.lastError_ = '';
try {
if (xhr.status == 200) {
var response =
@@ -155,10 +156,9 @@ remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) {
return 0;
};
this.hosts_ = /** @type {Array} */ this.hosts_.sort(cmp);
- } else {
- this.hosts_ = [];
}
} else {
+ this.lastError_ = remoting.Error.UNEXPECTED;
console.error('Invalid "hosts" response from server.');
}
} else {
« no previous file with comments | « no previous file | remoting/webapp/remoting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698