From 1a3b046a28d2e8a1a4dd1bef06e96c35882c6034 Mon Sep 17 00:00:00 2001 From: Jakub Skowron Date: Wed, 8 Jun 2016 12:05:13 +0200 Subject: [PATCH] Protect JSON.stringify from being overridden Previously Object.freeze(JSON) was used to protect stringify method. Change-Id: I7f943d1b1ba7d22731ca24ab8860e8de53358c72 Signed-off-by: Jakub Skowron --- src/tizen/tizen_api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tizen/tizen_api.js b/src/tizen/tizen_api.js index f80ac5c..eba3a46 100644 --- a/src/tizen/tizen_api.js +++ b/src/tizen/tizen_api.js @@ -474,4 +474,6 @@ exports.SimpleCoordinates = function(lat, lng) { }; exports.SimpleCoordinates.prototype.constructor = exports.SimpleCoordinates; -Object.freeze(JSON); +// Protect JSON.stringify from being overriden by application +Object.defineProperty( window, 'JSON', {value:JSON, writable:false, configurable:false} ); +Object.defineProperty( JSON, 'stringify', {value:JSON.stringify, writable:false, configurable:false} ); -- 2.7.4