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

Unified Diff: remoting/webapp/client_plugin_async.js

Issue 10221021: Protect all uses of JSON.parse against exceptions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Log errors if JSON parsing fails. Created 8 years, 8 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/client_screen.js » ('j') | remoting/webapp/host_list.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/client_plugin_async.js
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js
index b0baec36d3deda87223cafb2130698777b9b3dbd..222a98c985a49b41536bead7f4c4648456b08870 100644
--- a/remoting/webapp/client_plugin_async.js
+++ b/remoting/webapp/client_plugin_async.js
@@ -89,9 +89,9 @@ remoting.ClientPluginAsync.prototype.API_MIN_VERSION_ = 5;
*/
remoting.ClientPluginAsync.prototype.handleMessage_ = function(message_str) {
Wez 2012/04/28 00:00:42 cleanup: message_str -> messageStr
Jamie 2012/04/28 00:15:41 Done.
var message = /** @type {{method:string, data:Object.<string,string>}} */
- JSON.parse(message_str);
+ jsonParseSafe(message_str);
- if (!('method' in message) || !('data' in message)) {
+ if (!message || !('method' in message) || !('data' in message)) {
console.error('Received invalid message from the plugin: ' + message_str);
return;
}
« no previous file with comments | « no previous file | remoting/webapp/client_screen.js » ('j') | remoting/webapp/host_list.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698