fix web runtime service TCT's fail - no window case 11/90011/1
authorHyunjin Park <hj.na.park@samsung.com>
Wed, 28 Sep 2016 04:55:01 +0000 (13:55 +0900)
committerHyunjin Park <hj.na.park@samsung.com>
Wed, 28 Sep 2016 04:55:01 +0000 (13:55 +0900)
Change-Id: If7e24cd6ebc8ce6a35ddc974f626108fbb6ae0e4

src/tizen/tizen_api.js

index eba3a46..f5f8085 100644 (file)
 // 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} );