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

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: A simpler solution. 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') | remoting/webapp/remoting.js » ('J')
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..a03f4b03a4c88ef31caf8e6b4e303851ebecc3e5 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_ = '';
Wez 2012/07/11 20:48:10 Are you relying on the fact that lastError_ will o
Jamie 2012/07/11 20:53:11 No, I think your next comment is correct, and I sh
remoting.oauth2.callWithToken(getHosts, onError);
};
@@ -135,6 +134,7 @@ remoting.HostList.prototype.refresh = function(onDone) {
* @private
*/
remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) {
+ this.hosts_ = [];
Wez 2012/07/11 20:48:10 I think you need to clear lastError_ here to avoid
Jamie 2012/07/11 20:53:11 Done.
try {
if (xhr.status == 200) {
var response =
@@ -155,10 +155,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') | remoting/webapp/remoting.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698