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

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

Issue 12287011: Move the chromeHidden.toJSON paranoia out of event.js and into json.js, a new (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fixup Created 7 years, 10 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/extensions/json_js_unittest.cc ('k') | chrome/renderer/resources/extensions/json.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/event.js
diff --git a/chrome/renderer/resources/extensions/event.js b/chrome/renderer/resources/extensions/event.js
index 3c944590a74da4988c464be31a9b0b5019e997a4..4ff1b5ba88bc4712bb3799f57f9c5d0117ecf337 100644
--- a/chrome/renderer/resources/extensions/event.js
+++ b/chrome/renderer/resources/extensions/event.js
@@ -41,44 +41,6 @@
utils.lookup(eventType.functions, 'name', 'removeRules');
}
- // Local implementation of JSON.parse & JSON.stringify that protect us
- // from being clobbered by an extension.
- //
- // TODO(aa): This makes me so sad. We shouldn't need it, as we can just pass
- // Values directly over IPC without serializing to strings and use
- // JSONValueConverter.
- chromeHidden.JSON = new (function() {
- var $Object = Object;
- var $Array = Array;
- var $jsonStringify = JSON.stringify;
- var $jsonParse = JSON.parse;
-
- this.stringify = function(thing) {
- var customizedObjectToJSON = $Object.prototype.toJSON;
- var customizedArrayToJSON = $Array.prototype.toJSON;
- if (customizedObjectToJSON !== undefined) {
- $Object.prototype.toJSON = null;
- }
- if (customizedArrayToJSON !== undefined) {
- $Array.prototype.toJSON = null;
- }
- try {
- return $jsonStringify(thing);
- } finally {
- if (customizedObjectToJSON !== undefined) {
- $Object.prototype.toJSON = customizedObjectToJSON;
- }
- if (customizedArrayToJSON !== undefined) {
- $Array.prototype.toJSON = customizedArrayToJSON;
- }
- }
- };
-
- this.parse = function(thing) {
- return $jsonParse(thing);
- };
- })();
-
// A map of event names to the event object that is registered to that name.
var attachedNamedEvents = {};
« no previous file with comments | « chrome/renderer/extensions/json_js_unittest.cc ('k') | chrome/renderer/resources/extensions/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698