Revert "[Common] Replacing JS warnings + errors" 81/124781/1
authorPiotr Kosko <p.kosko@samsung.com>
Wed, 12 Apr 2017 10:27:07 +0000 (03:27 -0700)
committerPiotr Kosko <p.kosko@samsung.com>
Wed, 12 Apr 2017 10:27:07 +0000 (03:27 -0700)
This reverts commit 5ca12b157b0a9883a1f82ae97a37d9ff0cc27a67.

Change-Id: If075746cc87afb159e2146ef3774e6c784bfc513

12 files changed:
src/alarm/alarm_api.js
src/application/application_api.js
src/bluetooth/bluetooth_api.js
src/calendar/js/calendar_alarm.js
src/content/js/manager.js
src/humanactivitymonitor/humanactivitymonitor_api.js
src/nfc/nfc_api.js
src/power/power_api.js
src/push/push_api.js
src/systeminfo/systeminfo_api.js
src/time/time_api.js
src/utils/utils_api.js

index 278719b..e9abbd3 100755 (executable)
@@ -389,7 +389,7 @@ tizen.AlarmAbsolute = function(date, second, internal) {
                 if(!T.isNullOrUndefined(second)){
                     m_period = Converter.toLong(second);
                     if(_warningLogs.enableLog){
-                        privUtils_.warn("This Constructor is deprecated since Tizen 4.0." +
+                        console.warn("This Constructor is deprecated since Tizen 4.0." +
                         " Please consider using other constructors or other type of an alarm.");
                     }
                 }
index b668dbb..b0d5774 100755 (executable)
@@ -565,7 +565,7 @@ var APPLICATION_EVENT_LISTENER = 'ApplicationEventListener';
 var applicationEventListener = new ListenerManager(native, APPLICATION_EVENT_LISTENER);
 
 ApplicationManager.prototype.addAppInfoEventListener = function() {
-  privUtils_.warn('DEPRECATION WARNING: addAppInfoEventListener() is deprecated and will be removed from next release. '
+  console.warn('DEPRECATION WARNING: addAppInfoEventListener() is deprecated and will be removed from next release. '
       + 'Use tizen.package.setPackageInfoEventListener() instead.');
 
   var args = AV.validateMethod(arguments, [
@@ -580,7 +580,7 @@ ApplicationManager.prototype.addAppInfoEventListener = function() {
 };
 
 ApplicationManager.prototype.removeAppInfoEventListener = function() {
-  privUtils_.warn('DEPRECATION WARNING: removeAppInfoEventListener() is deprecated and will be removed from next release. '
+  console.warn('DEPRECATION WARNING: removeAppInfoEventListener() is deprecated and will be removed from next release. '
       + 'Use tizen.package.unsetPackageInfoEventListener() instead.');
 
   var args = AV.validateMethod(arguments, [
index 09979b3..117ff30 100755 (executable)
@@ -2034,7 +2034,7 @@ BluetoothAdapter.prototype.setName = function() {
 
 BluetoothAdapter.prototype.setPowered = function() {
     privUtils_.log('Entered BluetoothAdapter.setPowered()');
-    privUtils_.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. '
+    console.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. '
         + 'Let the user turn on/off Bluetooth through the Settings application instead.');
 
     var args = AV.validateMethod(arguments, [
index 6976ac5..08c2638 100755 (executable)
@@ -19,8 +19,6 @@ var AlarmMethod = {
   DISPLAY: 'DISPLAY'
 };
 
-var privUtils_ = xwalk.utils;
-
 var CalendarAlarm = function(time, method, description) {
   validator_.isConstructorCall(this, CalendarAlarm);
 
@@ -32,7 +30,7 @@ var CalendarAlarm = function(time, method, description) {
   try {
     _method = converter_.toEnum(method, Object.keys(AlarmMethod), false);
   } catch (e) {
-    privUtils_.warn('Failed to convert method: "' + method + '" to enum AlarmMethod.');
+    console.warn('Failed to convert method: "' + method + '" to enum AlarmMethod.');
     _method = method;
   }
 
index db388dc..6498d59 100755 (executable)
@@ -15,7 +15,6 @@
  */
 
 var T_ = xwalk.utils.type;
-var privUtils_ = xwalk.utils;
 var CONTENT_MANAGER_LISTENER_ID = 'ContentManagerChangeCallback';
 
 
@@ -336,7 +335,7 @@ ContentManager.prototype.removeChangeListener = function() {
 };
 
 ContentManager.prototype.setChangeListener = function(changeCallback) {
-  privUtils_.warn('DEPRECATION WARNING: setChangeListener() is deprecated and will be removed '
+  console.warn('DEPRECATION WARNING: setChangeListener() is deprecated and will be removed '
       + 'from next release. Use addChangeListener() instead.');
 
   var args = validator_.validateArgs(arguments, [{
@@ -371,7 +370,7 @@ ContentManager.prototype.setChangeListener = function(changeCallback) {
 };
 
 ContentManager.prototype.unsetChangeListener = function() {
-  privUtils_.warn('DEPRECATION WARNING: unsetChangeListener() is deprecated and will be removed '
+  console.warn('DEPRECATION WARNING: unsetChangeListener() is deprecated and will be removed '
       + 'from next release. Use removeChangeListener() instead.');
 
   var data = {};
index 7b3a8f7..6945eb5 100755 (executable)
@@ -109,7 +109,7 @@ function convertActivityData(type, data) {
     case HumanActivityType.SLEEP_MONITOR:
       return new HumanActivitySleepMonitorData(data);
     default:
-      utils_.error('Uknown human activity type: ' + type);
+      console.error('Uknown human activity type: ' + type);
   }
 }
 
@@ -139,7 +139,7 @@ function convertActivityRecorderData(type, data) {
       func = HumanActivityRecorderPressureData;
       break;
     default:
-      utils_.error('Uknown human activity recorder type: ' + type);
+      console.error('Uknown human activity recorder type: ' + type);
       return;
   }
 
@@ -572,7 +572,7 @@ GestureListenerManager.prototype.onListenerCalled = function(msg) {
       d = this.native.getErrorObject(msg);
       break;
     default:
-      utils_.log('Unknown mode: ' + msg.action);
+      console.log('Unknown mode: ' + msg.action);
       return;
   }
 
index 8aa8b58..db3d0e3 100644 (file)
@@ -272,7 +272,7 @@ function NFCAdapter() {
 }
 
 NFCAdapter.prototype.setPowered = function() {
-  privUtils_.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. Let the user turn NFC on/off '
+  console.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. Let the user turn NFC on/off '
       + 'through the Settings application instead.');
 
   var args = validator_.validateArgs(arguments, [
index 06453eb..f7a711d 100755 (executable)
@@ -18,7 +18,6 @@ var JSON_ = xwalk.JSON;
 var validator_ = xwalk.utils.validator;
 var types_ = validator_.Types;
 var native_ = new xwalk.utils.NativeManager(extension);
-var privUtils_ = xwalk.utils;
 
 function ListenerManager(native, listenerName) {
   this.listener;
@@ -128,7 +127,7 @@ PowerManager.prototype.request = function(resource, state) {
     ]);
 
     if (args['state'] && args.state === PowerScreenState['SCREEN_BRIGHT']) {
-        privUtils_.warn('DEPRECATION WARNING: SCREEN_BRIGHT is deprecated and will be removed from next release.');
+        console.warn('DEPRECATION WARNING: SCREEN_BRIGHT is deprecated and will be removed from next release.');
     }
 
     var nativeParam = {
@@ -279,7 +278,7 @@ PowerManager.prototype.restoreScreenBrightness = function() {
  * Turns on the screen.
  */
 PowerManager.prototype.turnScreenOn = function() {
-    privUtils_.warn('DEPRECATION WARNING: turnScreenOn() is deprecated and will be removed from next release. Use request() instead.');
+    console.warn('DEPRECATION WARNING: turnScreenOn() is deprecated and will be removed from next release. Use request() instead.');
 
     var nativeParam = {
     };
@@ -296,7 +295,7 @@ PowerManager.prototype.turnScreenOn = function() {
  * Turns off the screen.
  */
 PowerManager.prototype.turnScreenOff = function() {
-    privUtils_.warn('DEPRECATION WARNING: turnScreenOff() is deprecated and will be removed from next release. Use release() instead.');
+    console.warn('DEPRECATION WARNING: turnScreenOff() is deprecated and will be removed from next release. Use release() instead.');
 
     var nativeParam = {
     };
index 78d4113..6e623a6 100644 (file)
@@ -17,7 +17,7 @@
 var native = new xwalk.utils.NativeManager(extension);
 var validator = xwalk.utils.validator;
 var validatorType = xwalk.utils.type;
-var privUtils_ = xwalk.utils;
+
 
 /**
  * @const
@@ -59,7 +59,7 @@ function PushManager() {
 }
 
 PushManager.prototype.registerService = function() {
-  privUtils_.warn('DEPRECATION WARNING: registerService() is deprecated and will be removed from next release. Use register() instead.');
+  console.warn('DEPRECATION WARNING: registerService() is deprecated and will be removed from next release. Use register() instead.');
   var data = validator.validateArgs(arguments, [
     {
       name: 'appControl',
@@ -121,7 +121,7 @@ PushManager.prototype.register = function() {
 };
 
 PushManager.prototype.unregisterService = function() {
-  privUtils_.warn('DEPRECATION WARNING: unregisterService() is deprecated and will be removed from next release. Use unregister() instead.');
+  console.warn('DEPRECATION WARNING: unregisterService() is deprecated and will be removed from next release. Use unregister() instead.');
   var data = validator.validateArgs(arguments, [
     {
       name: 'successCallback',
@@ -182,7 +182,7 @@ PushManager.prototype.unregister = function() {
 };
 
 PushManager.prototype.connectService = function(notificationCallback) {
-  privUtils_.warn('DEPRECATION WARNING: connectService() is deprecated and will be removed from next release. Use connect() instead.');
+  console.warn('DEPRECATION WARNING: connectService() is deprecated and will be removed from next release. Use connect() instead.');
   var data = validator.validateArgs(arguments, [
     {
       name: 'notificationCallback',
@@ -246,7 +246,7 @@ PushManager.prototype.connect = function(notificationCallback) {
 };
 
 PushManager.prototype.disconnectService = function() {
-  privUtils_.warn('DEPRECATION WARNING: disconnectService() is deprecated and will be removed from next release. Use disconnect() instead.');
+  console.warn('DEPRECATION WARNING: disconnectService() is deprecated and will be removed from next release. Use disconnect() instead.');
   var ret = native.callSync('Push_disconnectService', {});
   if (native.isFailure(ret)) {
     throw native.getErrorObject(ret);
index e09c977..ce4755b 100644 (file)
@@ -737,7 +737,7 @@ var SystemInfo = function() {
 };
 
 SystemInfo.prototype.getCapabilities = function() {
-    privUtils_.warn('DEPRECATION WARNING: getCapabilities() is deprecated and will be removed from next release. Use getCapability() instead.');
+    console.warn('DEPRECATION WARNING: getCapabilities() is deprecated and will be removed from next release. Use getCapability() instead.');
 
     var result = native_.callSync('SystemInfo_getCapabilities', {});
     if (native_.isFailure(result)) {
index ba31ab8..95c9d6f 100644 (file)
@@ -533,7 +533,7 @@ tizen.TZDate.prototype.toString = function() {
 
 tizen.TZDate.prototype.getTimezoneAbbreviation = function() {
   utils_.log('Entered TZDate.getTimezoneAbbreviation');
-  utils_.warn('DEPRECATION WARNING: getTimezoneAbbreviation() is deprecated and will be removed from next release.');
+  console.warn('DEPRECATION WARNING: getTimezoneAbbreviation() is deprecated and will be removed from next release.');
 
   var result = native_.callSync('TZDate_getTimezoneAbbreviation',
       {timezone: String(this._timezoneName),
index 1653b54..ca61725 100644 (file)
@@ -5,16 +5,10 @@
 
 //Object xwalk.JSON - guaranteed to not being modified by the application programmer
 var JSON_ = {stringify: JSON.stringify, parse: JSON.parse};
-Object.freeze(JSON_);
+Object.freeze(JSON_)
 exports.JSON = JSON_;
 
 var _enableJsLogs = false;
-var _console = {
-  error: console.error,
-  log: console.log,
-  warn: console.warn
-};
-Object.freeze(_console);
 
 var _global = {};
 if (typeof window != 'undefined') {
@@ -152,19 +146,11 @@ function Utils() {
   });
 }
 
-Utils.prototype.error = function() {
-  _console.error.apply(_console, arguments);
-};
-
 Utils.prototype.log = function() {
   if (_enableJsLogs) {
-    _console.log.apply(_console, arguments);
+    console.log.apply(console, arguments);
   }
-};
-
-Utils.prototype.warn = function() {
-  _console.warn.apply(_console, arguments);
-};
+}
 
 Utils.prototype.repackFilter = function(filter) {
   if (filter instanceof tizen.AttributeFilter) {
@@ -989,19 +975,19 @@ var NativeManager = function(extension) {
   // TODO: Remove mockup if WRT implements sendRuntimeMessage
   // This is temporary mockup!
   extension.sendRuntimeMessage = extension.sendRuntimeMessage || function() {
-    _console.error('Runtime did not implement extension.sendRuntimeMessage!');
+    console.error('Runtime did not implement extension.sendRuntimeMessage!');
     throw new WebAPIException(WebAPIException.UNKNOWN_ERR,
         'Runtime did not implement extension.sendRuntimeMessage!');
   };
 
   extension.sendRuntimeAsyncMessage = extension.sendRuntimeAsyncMessage || function() {
-    _console.error('Runtime did not implement extension.sendRuntimeAsyncMessage!');
+    console.error('Runtime did not implement extension.sendRuntimeAsyncMessage!');
     throw new WebAPIException(WebAPIException.UNKNOWN_ERR,
         'Runtime did not implement extension.sendRuntimeAsyncMessage!');
   };
 
   extension.sendRuntimeSyncMessage = extension.sendRuntimeSyncMessage || function() {
-    _console.error('Runtime did not implement extension.sendRuntimeSyncMessage!');
+    console.error('Runtime did not implement extension.sendRuntimeSyncMessage!');
     throw new WebAPIException(WebAPIException.UNKNOWN_ERR,
         'Runtime did not implement extension.sendRuntimeSyncMessage!');
   };
@@ -1042,7 +1028,7 @@ var NativeManager = function(extension) {
       delete msg[this.CALLBACK_ID_KEY];
 
       if (!_type.isFunction(this.callbacks_[id])) {
-        _console.error('Wrong callback identifier. Ignoring message.');
+        console.error('Wrong callback identifier. Ignoring message.');
         return;
       }
 
@@ -1051,8 +1037,8 @@ var NativeManager = function(extension) {
         try {
           f(msg);
         } catch (e) {
-          _console.error('########## exception');
-          _console.error(e);
+          console.error('########## exception');
+          console.error(e);
         }
       }, 0);
       delete this.callbacks_[id];
@@ -1065,7 +1051,7 @@ var NativeManager = function(extension) {
       delete msg[this.LISTENER_ID_KEY];
 
       if (!_type.isFunction(this.listeners_[id])) {
-        _console.error('Wrong listener identifier. Ignoring message.');
+        console.error('Wrong listener identifier. Ignoring message.');
         return;
       }
 
@@ -1074,15 +1060,15 @@ var NativeManager = function(extension) {
         try {
           f(msg);
         } catch (e) {
-          _console.error('########## exception');
-          _console.error(e);
+          console.error('########## exception');
+          console.error(e);
         }
       }, 0);
 
       return;
     }
 
-    _console.error('Missing callback or listener identifier. Ignoring message.');
+    console.error('Missing callback or listener identifier. Ignoring message.');
 
   }.bind(this));
 };
@@ -1188,7 +1174,7 @@ NativeManager.prototype.callIfPossible = function(callback) {
  *            age: 28
  *        }
  *    });
- *    _console.log(result);
+ *    console.log(result);
  *
  *    To send async method and handle response:
  *    bridge.async({
@@ -1243,7 +1229,7 @@ var NativeBridge = (function (extension, debug) {
 
         CallbackManager.prototype = {
             add: function (/*callbacks, cid?*/) {
-                if (debug) _console.log('bridge.CallbackManager.add');
+                if (debug) console.log('bridge.CallbackManager.add');
                 var args = Array.prototype.slice.call(arguments);
                 var c = args.shift();
                 var cid = args.pop();
@@ -1260,11 +1246,11 @@ var NativeBridge = (function (extension, debug) {
                 return cid;
             },
             remove: function (cid) {
-                if (debug)  _console.log('bridge.CallbackManager.remove, cid: ' + cid);
+                if (debug)  console.log('bridge.CallbackManager.remove, cid: ' + cid);
                 if (_collection[cid]) delete _collection[cid];
             },
             call: function (cid, key, args, keep) {
-                if (debug) _console.log('bridge.CallbackManager.call, cid: '+ cid + ', key: ' + key);
+                if (debug) console.log('bridge.CallbackManager.call, cid: '+ cid + ', key: ' + key);
                 var callbacks = _collection[cid];
                 keep = !!keep;
                 if (callbacks) {
@@ -1296,13 +1282,13 @@ var NativeBridge = (function (extension, debug) {
 
         ListenerManager.prototype = {
             add: function (l) {
-                if (debug) _console.log('bridge.ListenerManager.add');
+                if (debug) console.log('bridge.ListenerManager.add');
                 var id = _next();
                 _listeners[id] = l;
                 return id;
             },
             resolve: function (id, action, data, keep) {
-                if (debug) _console.log('bridge.ListenerManager.resolve, id: ' + id + ', action: ' + action);
+                if (debug) console.log('bridge.ListenerManager.resolve, id: ' + id + ', action: ' + action);
                 keep = !!keep;
                 var l = _listeners[id];
                 if (l) {
@@ -1312,7 +1298,7 @@ var NativeBridge = (function (extension, debug) {
                 return l;
             },
             remove: function (id) {
-                if (debug) _console.log('bridge.ListenerManager.remove, id: ' + id);
+                if (debug) console.log('bridge.ListenerManager.remove, id: ' + id);
                 var l = _listeners[id];
                 if (l) {
                     var cm = Callbacks.getInstance();
@@ -1347,12 +1333,12 @@ var NativeBridge = (function (extension, debug) {
     })();
 
     var Listener = function () {
-        if (debug) _console.log('bridge: Listener constructor');
+        if (debug) console.log('bridge: Listener constructor');
         this.cid = null;
     };
     Listener.prototype = {
         then: function (c) {
-            if (debug) _console.log('bridge.Listener.then');
+            if (debug) console.log('bridge.Listener.then');
             var cm = Callbacks.getInstance();
             this.cid = cm.add(c, this.cid);
             return this;
@@ -1366,7 +1352,7 @@ var NativeBridge = (function (extension, debug) {
               cmd: data.cmd,
               args: data
             });
-            if (debug) _console.log('bridge.sync, json: ' + json);
+            if (debug) console.log('bridge.sync, json: ' + json);
             var result = extension.internal.sendSyncMessage(json);
             var obj = JSON_.parse(result);
             if (obj.error)
@@ -1380,7 +1366,7 @@ var NativeBridge = (function (extension, debug) {
                 cmd: data.cmd,
                 args: data
             });
-            if (debug) _console.log('bridge.async, json: ' + json);
+            if (debug) console.log('bridge.async, json: ' + json);
             setTimeout(function () {
                 extension.postMessage(json);
             });
@@ -1413,7 +1399,7 @@ var NativeBridge = (function (extension, debug) {
          *}
          */
 
-        if (debug) _console.log('bridge.setMessageListener, json: ' + json);
+        if (debug) console.log('bridge.setMessageListener, json: ' + json);
         var data = JSON_.parse(json);
         if (data.cid && data.action) {
             setTimeout(function() {