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

Unified Diff: chrome/renderer/resources/renderer_extension_bindings.js

Issue 115681: switch to using native JSON object (Closed)
Patch Set: all in one Created 11 years, 7 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 | « chrome/renderer/resources/extension_process_bindings.js ('k') | chrome/test/render_view_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/renderer_extension_bindings.js
diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js
index 667b97d477cfb1d125a7e8627c454d669f4bd36f..cc232b4ef2d2af0166c08ff7709b8d1b677a1a60 100644
--- a/chrome/renderer/resources/renderer_extension_bindings.js
+++ b/chrome/renderer/resources/renderer_extension_bindings.js
@@ -33,7 +33,7 @@ var chrome = chrome || {};
chrome.Port.dispatchOnConnect_ = function(portId, tab) {
var port = new chrome.Port(portId);
if (tab) {
- tab = goog.json.parse(tab);
+ tab = JSON.parse(tab);
}
port.tab = tab;
chrome.Event.dispatch_("channel-connect", [port]);
@@ -44,7 +44,7 @@ var chrome = chrome || {};
var port = chrome.Port.ports_[portId];
if (port) {
if (msg) {
- msg = goog.json.parse(msg);
+ msg = JSON.parse(msg);
}
port.onMessage.dispatch(msg, port);
}
@@ -53,7 +53,10 @@ var chrome = chrome || {};
// Sends a message asynchronously to the context on the other end of this
// port.
chrome.Port.prototype.postMessage = function(msg) {
- PostMessage(this.portId_, goog.json.serialize(msg));
+ // JSON.stringify doesn't support a root object which is undefined.
+ if (msg === undefined)
+ msg = null;
+ PostMessage(this.portId_, JSON.stringify(msg));
};
// Extension object.
« no previous file with comments | « chrome/renderer/resources/extension_process_bindings.js ('k') | chrome/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698