From: Piotr Kosko
Date: Wed, 12 Apr 2017 10:27:15 +0000 (-0700)
Subject: Revert "[Common] Replacing JS warnings + errors"
X-Git-Tag: submit/tizen_3.0/20170412.105625~1^2
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ccbc72dbbced354cc945e3041c2c5d109781cad;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
Revert "[Common] Replacing JS warnings + errors"
This reverts commit b49d637448236b92380fa24e8c195056d968822f.
Change-Id: Ia92ed37fbdc45e43ef2ad2eb74bc67cc10244f7f
---
diff --git a/src/application/application_api.js b/src/application/application_api.js
index b668dbbb..b0d5774d 100755
--- a/src/application/application_api.js
+++ b/src/application/application_api.js
@@ -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, [
diff --git a/src/bluetooth/bluetooth_api.js b/src/bluetooth/bluetooth_api.js
index 09979b31..117ff30a 100755
--- a/src/bluetooth/bluetooth_api.js
+++ b/src/bluetooth/bluetooth_api.js
@@ -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, [
diff --git a/src/calendar/js/calendar_alarm.js b/src/calendar/js/calendar_alarm.js
index 6976ac5a..08c26386 100755
--- a/src/calendar/js/calendar_alarm.js
+++ b/src/calendar/js/calendar_alarm.js
@@ -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;
}
diff --git a/src/content/js/manager.js b/src/content/js/manager.js
index db388dc6..6498d596 100755
--- a/src/content/js/manager.js
+++ b/src/content/js/manager.js
@@ -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 = {};
diff --git a/src/humanactivitymonitor/humanactivitymonitor_api.js b/src/humanactivitymonitor/humanactivitymonitor_api.js
index 3f060040..81002ebf 100755
--- a/src/humanactivitymonitor/humanactivitymonitor_api.js
+++ b/src/humanactivitymonitor/humanactivitymonitor_api.js
@@ -97,7 +97,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);
}
}
@@ -127,7 +127,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;
}
diff --git a/src/nfc/nfc_api.js b/src/nfc/nfc_api.js
index 8aa8b58d..db3d0e31 100644
--- a/src/nfc/nfc_api.js
+++ b/src/nfc/nfc_api.js
@@ -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, [
diff --git a/src/power/power_api.js b/src/power/power_api.js
index 06453ebd..f7a711de 100755
--- a/src/power/power_api.js
+++ b/src/power/power_api.js
@@ -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 = {
};
diff --git a/src/push/push_api.js b/src/push/push_api.js
index 78d4113e..6e623a66 100644
--- a/src/push/push_api.js
+++ b/src/push/push_api.js
@@ -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);
diff --git a/src/systeminfo/systeminfo_api.js b/src/systeminfo/systeminfo_api.js
index e09c977d..ce4755b5 100644
--- a/src/systeminfo/systeminfo_api.js
+++ b/src/systeminfo/systeminfo_api.js
@@ -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)) {
diff --git a/src/time/time_api.js b/src/time/time_api.js
index ba31ab89..95c9d6f7 100644
--- a/src/time/time_api.js
+++ b/src/time/time_api.js
@@ -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),
diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js
index 1653b546..ca617251 100644
--- a/src/utils/utils_api.js
+++ b/src/utils/utils_api.js
@@ -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() {