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

Unified Diff: remoting/webapp/crd/js/host_list.js

Issue 2621403004: Create proper object types when loading host cache. (Closed)
Patch Set: Created 3 years, 11 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 | « remoting/webapp/base/js/host_options.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/host_list.js
diff --git a/remoting/webapp/crd/js/host_list.js b/remoting/webapp/crd/js/host_list.js
index e9e878dc3e27474aab64cf0c40ec24ee87b2b8eb..45229051daf795d4c2dfc115bbcd9c8164185649 100644
--- a/remoting/webapp/crd/js/host_list.js
+++ b/remoting/webapp/crd/js/host_list.js
@@ -109,8 +109,10 @@ remoting.HostList.prototype.load = function(onDone) {
var storeHostList = function(items) {
if (items[remoting.HostList.HOSTS_KEY]) {
var cached = base.jsonParseSafe(items[remoting.HostList.HOSTS_KEY]);
- if (cached) {
- that.hosts_ = /** @type {Array<remoting.Host>} */ (cached);
+ if (cached && cached instanceof Array) {
+ that.hosts_ = cached
+ .map((host) => remoting.Host.fromObject(host))
+ .filter((host) => Boolean(host));
} else {
console.error('Invalid value for ' + remoting.HostList.HOSTS_KEY);
}
« no previous file with comments | « remoting/webapp/base/js/host_options.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698