From 78190b73660b21ae9602d946edba11164483e104 Mon Sep 17 00:00:00 2001 From: Hyunjin Park Date: Wed, 28 Sep 2016 13:55:01 +0900 Subject: [PATCH] fix web runtime service TCT's fail - no window case Change-Id: If7e24cd6ebc8ce6a35ddc974f626108fbb6ae0e4 --- src/tizen/tizen_api.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tizen/tizen_api.js b/src/tizen/tizen_api.js index eba3a46..f5f8085 100644 --- a/src/tizen/tizen_api.js +++ b/src/tizen/tizen_api.js @@ -10,6 +10,14 @@ // WebAPIException and WebAPIError definition moved to src/utils/utils_api.js // for compliance reasons. You can find more info there. +var _global = {}; +if (typeof window != 'undefined') { + _global = window; +} +else if (typeof global != 'undefiend') { + _global = global; +} + /** * Filter match flags. @@ -475,5 +483,5 @@ exports.SimpleCoordinates = function(lat, lng) { exports.SimpleCoordinates.prototype.constructor = exports.SimpleCoordinates; // Protect JSON.stringify from being overriden by application -Object.defineProperty( window, 'JSON', {value:JSON, writable:false, configurable:false} ); +Object.defineProperty( _global, 'JSON', {value:JSON, writable:false, configurable:false} ); Object.defineProperty( JSON, 'stringify', {value:JSON.stringify, writable:false, configurable:false} ); -- 2.7.4