diff options
-rw-r--r-- | remoting/webapp/client_plugin_async.js | 5 | ||||
-rw-r--r-- | remoting/webapp/host_settings.js | 6 | ||||
-rw-r--r-- | remoting/webapp/storage.js | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js index a4ac9eb..f457d15 100644 --- a/remoting/webapp/client_plugin_async.js +++ b/remoting/webapp/client_plugin_async.js @@ -203,7 +203,7 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) { this.onDebugMessageHandler(message.data['message']); } else if (message.method == 'onConnectionStatus') { if (typeof message.data['state'] != 'string' || - !(message.data['state'] in remoting.ClientSession.State) || + !remoting.ClientSession.State.hasOwnProperty(message.data['state']) || typeof message.data['error'] != 'string') { console.error('Received invalid onConnectionState message: ' + messageStr); @@ -213,7 +213,8 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) { /** @type {remoting.ClientSession.State} */ var state = remoting.ClientSession.State[message.data['state']]; var error; - if (message.data['error'] in remoting.ClientSession.ConnectionError) { + if (remoting.ClientSession.ConnectionError.hasOwnProperty( + message.data['error'])) { error = /** @type {remoting.ClientSession.ConnectionError} */ remoting.ClientSession.ConnectionError[message.data['error']]; } else { diff --git a/remoting/webapp/host_settings.js b/remoting/webapp/host_settings.js index 57e7731..65b5fdd 100644 --- a/remoting/webapp/host_settings.js +++ b/remoting/webapp/host_settings.js @@ -85,16 +85,16 @@ remoting.HostSettings.loadInternal_ = function(hostId, callback) { if (typeof(result) != 'object') { console.error("Error loading host settings: Not an object"); result = {}; - } else if (hostId in result && + } else if (/** @type {Object} */ (result).hasOwnProperty(hostId) && typeof(result[hostId]) == 'object') { - callback(result[hostId], /** @type {Object} */(result)); + callback(result[hostId], result); return; } } catch (err) { var typedErr = /** @type {*} */ (err); console.error('Error loading host settings:', typedErr); } - callback({}, /** @type {Object} */(result)); + callback({}, /** @type {Object} */ (result)); }; remoting.storage.local.get(remoting.HostSettings.KEY_, onDone); }; diff --git a/remoting/webapp/storage.js b/remoting/webapp/storage.js index 63dd941..72c3ff6 100644 --- a/remoting/webapp/storage.js +++ b/remoting/webapp/storage.js @@ -59,7 +59,7 @@ remoting.MockStorage.prototype.get = function(items, callback) { } else if (typeof(items) == 'string') { // If the input is a string, return one or zero items, depending on // whether or not the value is stored in localStorage. - if (items in window.localStorage) { + if (window.localStorage.hasOwnProperty(items)) { result[items] = window.localStorage.getItem(items); } @@ -69,7 +69,7 @@ remoting.MockStorage.prototype.get = function(items, callback) { for (var index in items) { /** @type {string} */ var item = items[index]; - if (item in window.localStorage) { + if (window.localStorage.hasOwnProperty(item)) { result[item] = window.localStorage.getItem(item); } } @@ -78,7 +78,7 @@ remoting.MockStorage.prototype.get = function(items, callback) { // If the input is a dictionary, return the localStorage value for // items that are stored, and the dictionary value otherwise. for (var item in items) { - if (item in window.localStorage) { + if (window.localStorage.hasOwnProperty(item)) { result[item] = window.localStorage.getItem(item); } else { result[item] = items[item]; |