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

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: Reviewer comments. 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') | no next file with comments »
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..43b111022a465b71e08b22999bbe74fd69418b87 100644
--- a/remoting/webapp/client_plugin_async.js
+++ b/remoting/webapp/client_plugin_async.js
@@ -87,11 +87,11 @@ remoting.ClientPluginAsync.prototype.API_MIN_VERSION_ = 5;
/**
* @param {string} message_str Message from the plugin.
*/
-remoting.ClientPluginAsync.prototype.handleMessage_ = function(message_str) {
+remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) {
var message = /** @type {{method:string, data:Object.<string,string>}} */
- JSON.parse(message_str);
+ jsonParseSafe(messageStr);
- 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698