From: Hyunjin Park Date: Wed, 28 Sep 2016 04:55:01 +0000 (+0900) Subject: fix web runtime service TCT's fail - no window case X-Git-Tag: submit/tizen/20160928.055039~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F90011%2F1;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git fix web runtime service TCT's fail - no window case Change-Id: If7e24cd6ebc8ce6a35ddc974f626108fbb6ae0e4 --- diff --git a/src/tizen/tizen_api.js b/src/tizen/tizen_api.js index eba3a463..f5f8085e 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} );