From: Jakub Skowron Date: Wed, 8 Jun 2016 10:05:13 +0000 (+0200) Subject: Protect JSON.stringify from being overridden X-Git-Tag: submit/tizen/20160609.034739~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a3b046a28d2e8a1a4dd1bef06e96c35882c6034;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git Protect JSON.stringify from being overridden Previously Object.freeze(JSON) was used to protect stringify method. Change-Id: I7f943d1b1ba7d22731ca24ab8860e8de53358c72 Signed-off-by: Jakub Skowron --- diff --git a/src/tizen/tizen_api.js b/src/tizen/tizen_api.js index f80ac5c8..eba3a463 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} );