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

Unified Diff: chrome/renderer/resources/extensions/miscellaneous_bindings.js

Issue 16226004: Replace JSON (de)serialization of extension messages with direct Value pickling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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
Index: chrome/renderer/resources/extensions/miscellaneous_bindings.js
diff --git a/chrome/renderer/resources/extensions/miscellaneous_bindings.js b/chrome/renderer/resources/extensions/miscellaneous_bindings.js
index 9a4937d1860c7bb0d79961549097117a031c11fa..7dbfe29a529c396241afe272dce30080cb64e6a5 100644
--- a/chrome/renderer/resources/extensions/miscellaneous_bindings.js
+++ b/chrome/renderer/resources/extensions/miscellaneous_bindings.js
@@ -8,7 +8,6 @@
// content scripts only.
require('json_schema');
- var json = require('json');
var lastError = require('lastError');
var miscNatives = requireNative('miscellaneous_bindings');
var chrome = requireNative('chrome').GetChrome();
@@ -55,10 +54,7 @@
// Sends a message asynchronously to the context on the other end of this
// port.
PortImpl.prototype.postMessage = function(msg) {
- // json.stringify doesn't support a root object which is undefined.
- if (msg === undefined)
- msg = null;
- PostMessage(this.portId_, json.stringify(msg));
+ PostMessage(this.portId_, msg);
};
// Disconnects the port from the other end.
@@ -266,12 +262,8 @@
// Called by native code when a message has been sent to the given port.
chromeHidden.Port.dispatchOnMessage = function(msg, portId) {
var port = ports[portId];
- if (port) {
- if (msg) {
- msg = json.parse(msg);
- }
+ if (port)
port.onMessage.dispatch(msg, port);
- }
};
// Shared implementation used by tabs.sendMessage and runtime.sendMessage.

Powered by Google App Engine
This is Rietveld 408576698