From c5b7caf9df58de787742ef5ee04b9a339c82af30 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 12 Apr 2017 03:27:07 -0700 Subject: [PATCH 01/16] Revert "[Common] Replacing JS warnings + errors" This reverts commit 5ca12b157b0a9883a1f82ae97a37d9ff0cc27a67. Change-Id: If075746cc87afb159e2146ef3774e6c784bfc513 --- src/alarm/alarm_api.js | 2 +- src/application/application_api.js | 4 +- src/bluetooth/bluetooth_api.js | 2 +- src/calendar/js/calendar_alarm.js | 4 +- src/content/js/manager.js | 5 +- .../humanactivitymonitor_api.js | 6 +- src/nfc/nfc_api.js | 2 +- src/power/power_api.js | 7 +-- src/push/push_api.js | 10 ++-- src/systeminfo/systeminfo_api.js | 2 +- src/time/time_api.js | 2 +- src/utils/utils_api.js | 64 +++++++++------------- 12 files changed, 46 insertions(+), 64 deletions(-) diff --git a/src/alarm/alarm_api.js b/src/alarm/alarm_api.js index 278719b..e9abbd3 100755 --- a/src/alarm/alarm_api.js +++ b/src/alarm/alarm_api.js @@ -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."); } } diff --git a/src/application/application_api.js b/src/application/application_api.js index b668dbb..b0d5774 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 09979b3..117ff30 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 6976ac5..08c2638 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 db388dc..6498d59 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 7b3a8f7..6945eb5 100755 --- a/src/humanactivitymonitor/humanactivitymonitor_api.js +++ b/src/humanactivitymonitor/humanactivitymonitor_api.js @@ -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; } diff --git a/src/nfc/nfc_api.js b/src/nfc/nfc_api.js index 8aa8b58..db3d0e3 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 06453eb..f7a711d 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 78d4113..6e623a6 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 e09c977..ce4755b 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 ba31ab8..95c9d6f 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 1653b54..ca61725 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() { -- 2.7.4 From 3ccbc72dbbced354cc945e3041c2c5d109781cad Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 12 Apr 2017 03:27:15 -0700 Subject: [PATCH 02/16] Revert "[Common] Replacing JS warnings + errors" This reverts commit b49d637448236b92380fa24e8c195056d968822f. Change-Id: Ia92ed37fbdc45e43ef2ad2eb74bc67cc10244f7f --- src/application/application_api.js | 4 +- src/bluetooth/bluetooth_api.js | 2 +- src/calendar/js/calendar_alarm.js | 4 +- src/content/js/manager.js | 5 +- .../humanactivitymonitor_api.js | 4 +- src/nfc/nfc_api.js | 2 +- src/power/power_api.js | 7 +-- src/push/push_api.js | 10 ++-- src/systeminfo/systeminfo_api.js | 2 +- src/time/time_api.js | 2 +- src/utils/utils_api.js | 64 +++++++++------------- 11 files changed, 44 insertions(+), 62 deletions(-) diff --git a/src/application/application_api.js b/src/application/application_api.js index b668dbb..b0d5774 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 09979b3..117ff30 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 6976ac5..08c2638 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 db388dc..6498d59 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 3f06004..81002eb 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 8aa8b58..db3d0e3 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 06453eb..f7a711d 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 78d4113..6e623a6 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 e09c977..ce4755b 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 ba31ab8..95c9d6f 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 1653b54..ca61725 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() { -- 2.7.4 From 7bda5ba90dd8e24d838b5ae01538cac5249b03d2 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 12 Apr 2017 12:30:21 +0200 Subject: [PATCH 03/16] [version] 1.79 Change-Id: I14fc0fceb47c1ec56e37dbd9e380def535fdbdec Signed-off-by: Piotr Kosko --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 699c5f9..893ccb5 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 1.78 +Version: 1.79 Release: 0 License: Apache-2.0 and BSD-3-Clause and MIT Group: Development/Libraries -- 2.7.4 From c3d14de881958daf3dba608b455978fb8cfdfda3 Mon Sep 17 00:00:00 2001 From: Szymon Jastrzebski Date: Wed, 12 Apr 2017 14:22:42 +0200 Subject: [PATCH 04/16] [Common] Replacing JS warnings + errors [Verification] Related TCT result did not change Change-Id: I1bba84050fd6eb66f2d5b070614dad7e1a4dd738 Signed-off-by: Szymon Jastrzebski --- src/application/application_api.js | 4 +- src/bluetooth/bluetooth_api.js | 2 +- src/calendar/js/calendar_alarm.js | 4 +- src/content/js/manager.js | 5 +- .../humanactivitymonitor_api.js | 4 +- src/nfc/nfc_api.js | 2 +- src/power/power_api.js | 7 +-- src/push/push_api.js | 10 ++-- src/systeminfo/systeminfo_api.js | 2 +- src/time/time_api.js | 2 +- src/utils/utils_api.js | 54 +++++++++++----------- 11 files changed, 49 insertions(+), 47 deletions(-) diff --git a/src/application/application_api.js b/src/application/application_api.js index b0d5774..b668dbb 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() { - console.warn('DEPRECATION WARNING: addAppInfoEventListener() is deprecated and will be removed from next release. ' + privUtils_.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() { - console.warn('DEPRECATION WARNING: removeAppInfoEventListener() is deprecated and will be removed from next release. ' + privUtils_.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 117ff30..09979b3 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()'); - console.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. ' + privUtils_.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 08c2638..6976ac5 100755 --- a/src/calendar/js/calendar_alarm.js +++ b/src/calendar/js/calendar_alarm.js @@ -19,6 +19,8 @@ var AlarmMethod = { DISPLAY: 'DISPLAY' }; +var privUtils_ = xwalk.utils; + var CalendarAlarm = function(time, method, description) { validator_.isConstructorCall(this, CalendarAlarm); @@ -30,7 +32,7 @@ var CalendarAlarm = function(time, method, description) { try { _method = converter_.toEnum(method, Object.keys(AlarmMethod), false); } catch (e) { - console.warn('Failed to convert method: "' + method + '" to enum AlarmMethod.'); + privUtils_.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 6498d59..db388dc 100755 --- a/src/content/js/manager.js +++ b/src/content/js/manager.js @@ -15,6 +15,7 @@ */ var T_ = xwalk.utils.type; +var privUtils_ = xwalk.utils; var CONTENT_MANAGER_LISTENER_ID = 'ContentManagerChangeCallback'; @@ -335,7 +336,7 @@ ContentManager.prototype.removeChangeListener = function() { }; ContentManager.prototype.setChangeListener = function(changeCallback) { - console.warn('DEPRECATION WARNING: setChangeListener() is deprecated and will be removed ' + privUtils_.warn('DEPRECATION WARNING: setChangeListener() is deprecated and will be removed ' + 'from next release. Use addChangeListener() instead.'); var args = validator_.validateArgs(arguments, [{ @@ -370,7 +371,7 @@ ContentManager.prototype.setChangeListener = function(changeCallback) { }; ContentManager.prototype.unsetChangeListener = function() { - console.warn('DEPRECATION WARNING: unsetChangeListener() is deprecated and will be removed ' + privUtils_.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 81002eb..3f06004 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: - console.error('Uknown human activity type: ' + type); + utils_.error('Uknown human activity type: ' + type); } } @@ -127,7 +127,7 @@ function convertActivityRecorderData(type, data) { func = HumanActivityRecorderPressureData; break; default: - console.error('Uknown human activity recorder type: ' + type); + utils_.error('Uknown human activity recorder type: ' + type); return; } diff --git a/src/nfc/nfc_api.js b/src/nfc/nfc_api.js index db3d0e3..8aa8b58 100644 --- a/src/nfc/nfc_api.js +++ b/src/nfc/nfc_api.js @@ -272,7 +272,7 @@ function NFCAdapter() { } NFCAdapter.prototype.setPowered = function() { - console.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. Let the user turn NFC on/off ' + privUtils_.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 f7a711d..06453eb 100755 --- a/src/power/power_api.js +++ b/src/power/power_api.js @@ -18,6 +18,7 @@ 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; @@ -127,7 +128,7 @@ PowerManager.prototype.request = function(resource, state) { ]); if (args['state'] && args.state === PowerScreenState['SCREEN_BRIGHT']) { - console.warn('DEPRECATION WARNING: SCREEN_BRIGHT is deprecated and will be removed from next release.'); + privUtils_.warn('DEPRECATION WARNING: SCREEN_BRIGHT is deprecated and will be removed from next release.'); } var nativeParam = { @@ -278,7 +279,7 @@ PowerManager.prototype.restoreScreenBrightness = function() { * Turns on the screen. */ PowerManager.prototype.turnScreenOn = function() { - console.warn('DEPRECATION WARNING: turnScreenOn() is deprecated and will be removed from next release. Use request() instead.'); + privUtils_.warn('DEPRECATION WARNING: turnScreenOn() is deprecated and will be removed from next release. Use request() instead.'); var nativeParam = { }; @@ -295,7 +296,7 @@ PowerManager.prototype.turnScreenOn = function() { * Turns off the screen. */ PowerManager.prototype.turnScreenOff = function() { - console.warn('DEPRECATION WARNING: turnScreenOff() is deprecated and will be removed from next release. Use release() instead.'); + privUtils_.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 6e623a6..78d4113 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() { - console.warn('DEPRECATION WARNING: registerService() is deprecated and will be removed from next release. Use register() instead.'); + privUtils_.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() { - console.warn('DEPRECATION WARNING: unregisterService() is deprecated and will be removed from next release. Use unregister() instead.'); + privUtils_.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) { - console.warn('DEPRECATION WARNING: connectService() is deprecated and will be removed from next release. Use connect() instead.'); + privUtils_.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() { - console.warn('DEPRECATION WARNING: disconnectService() is deprecated and will be removed from next release. Use disconnect() instead.'); + privUtils_.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 ce4755b..e09c977 100644 --- a/src/systeminfo/systeminfo_api.js +++ b/src/systeminfo/systeminfo_api.js @@ -737,7 +737,7 @@ var SystemInfo = function() { }; SystemInfo.prototype.getCapabilities = function() { - console.warn('DEPRECATION WARNING: getCapabilities() is deprecated and will be removed from next release. Use getCapability() instead.'); + privUtils_.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 95c9d6f..ba31ab8 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'); - console.warn('DEPRECATION WARNING: getTimezoneAbbreviation() is deprecated and will be removed from next release.'); + utils_.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 ca61725..08cf659 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -5,7 +5,7 @@ //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; @@ -146,11 +146,9 @@ function Utils() { }); } -Utils.prototype.log = function() { - if (_enableJsLogs) { - console.log.apply(console, arguments); - } -} +Utils.prototype.error = console.error.bind(console); +Utils.prototype.warn = console.warn.bind(console); +Utils.prototype.log = _enableJsLogs ? console.log.bind(console) : function(){}; Utils.prototype.repackFilter = function(filter) { if (filter instanceof tizen.AttributeFilter) { @@ -975,19 +973,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!'); }; @@ -1028,7 +1026,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; } @@ -1037,8 +1035,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]; @@ -1051,7 +1049,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; } @@ -1060,15 +1058,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)); }; @@ -1174,7 +1172,7 @@ NativeManager.prototype.callIfPossible = function(callback) { * age: 28 * } * }); - * console.log(result); + * _console.log(result); * * To send async method and handle response: * bridge.async({ @@ -1229,7 +1227,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(); @@ -1246,11 +1244,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) { @@ -1282,13 +1280,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) { @@ -1298,7 +1296,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(); @@ -1333,12 +1331,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; @@ -1352,7 +1350,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) @@ -1366,7 +1364,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); }); @@ -1399,7 +1397,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() { -- 2.7.4 From 50aee57f1ad223f95257b2c47c38ea517546f86e Mon Sep 17 00:00:00 2001 From: Szymon Jastrzebski Date: Wed, 12 Apr 2017 14:24:31 +0200 Subject: [PATCH 05/16] [Common] Replacing JS warnings + errors [Verification] Related TCT result did not change Change-Id: I707c8ad25c517c92bc43060f62e762116f65233f Signed-off-by: Szymon Jastrzebski --- src/alarm/alarm_api.js | 2 +- src/application/application_api.js | 4 +- src/bluetooth/bluetooth_api.js | 2 +- src/calendar/js/calendar_alarm.js | 4 +- src/content/js/manager.js | 5 +- .../humanactivitymonitor_api.js | 6 +-- src/nfc/nfc_api.js | 2 +- src/power/power_api.js | 7 +-- src/push/push_api.js | 10 ++-- src/systeminfo/systeminfo_api.js | 2 +- src/time/time_api.js | 2 +- src/utils/utils_api.js | 54 +++++++++++----------- 12 files changed, 51 insertions(+), 49 deletions(-) diff --git a/src/alarm/alarm_api.js b/src/alarm/alarm_api.js index e9abbd3..278719b 100755 --- a/src/alarm/alarm_api.js +++ b/src/alarm/alarm_api.js @@ -389,7 +389,7 @@ tizen.AlarmAbsolute = function(date, second, internal) { if(!T.isNullOrUndefined(second)){ m_period = Converter.toLong(second); if(_warningLogs.enableLog){ - console.warn("This Constructor is deprecated since Tizen 4.0." + + privUtils_.warn("This Constructor is deprecated since Tizen 4.0." + " Please consider using other constructors or other type of an alarm."); } } diff --git a/src/application/application_api.js b/src/application/application_api.js index b0d5774..b668dbb 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() { - console.warn('DEPRECATION WARNING: addAppInfoEventListener() is deprecated and will be removed from next release. ' + privUtils_.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() { - console.warn('DEPRECATION WARNING: removeAppInfoEventListener() is deprecated and will be removed from next release. ' + privUtils_.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 117ff30..09979b3 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()'); - console.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. ' + privUtils_.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 08c2638..6976ac5 100755 --- a/src/calendar/js/calendar_alarm.js +++ b/src/calendar/js/calendar_alarm.js @@ -19,6 +19,8 @@ var AlarmMethod = { DISPLAY: 'DISPLAY' }; +var privUtils_ = xwalk.utils; + var CalendarAlarm = function(time, method, description) { validator_.isConstructorCall(this, CalendarAlarm); @@ -30,7 +32,7 @@ var CalendarAlarm = function(time, method, description) { try { _method = converter_.toEnum(method, Object.keys(AlarmMethod), false); } catch (e) { - console.warn('Failed to convert method: "' + method + '" to enum AlarmMethod.'); + privUtils_.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 6498d59..db388dc 100755 --- a/src/content/js/manager.js +++ b/src/content/js/manager.js @@ -15,6 +15,7 @@ */ var T_ = xwalk.utils.type; +var privUtils_ = xwalk.utils; var CONTENT_MANAGER_LISTENER_ID = 'ContentManagerChangeCallback'; @@ -335,7 +336,7 @@ ContentManager.prototype.removeChangeListener = function() { }; ContentManager.prototype.setChangeListener = function(changeCallback) { - console.warn('DEPRECATION WARNING: setChangeListener() is deprecated and will be removed ' + privUtils_.warn('DEPRECATION WARNING: setChangeListener() is deprecated and will be removed ' + 'from next release. Use addChangeListener() instead.'); var args = validator_.validateArgs(arguments, [{ @@ -370,7 +371,7 @@ ContentManager.prototype.setChangeListener = function(changeCallback) { }; ContentManager.prototype.unsetChangeListener = function() { - console.warn('DEPRECATION WARNING: unsetChangeListener() is deprecated and will be removed ' + privUtils_.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 6945eb5..7b3a8f7 100755 --- a/src/humanactivitymonitor/humanactivitymonitor_api.js +++ b/src/humanactivitymonitor/humanactivitymonitor_api.js @@ -109,7 +109,7 @@ function convertActivityData(type, data) { case HumanActivityType.SLEEP_MONITOR: return new HumanActivitySleepMonitorData(data); default: - console.error('Uknown human activity type: ' + type); + utils_.error('Uknown human activity type: ' + type); } } @@ -139,7 +139,7 @@ function convertActivityRecorderData(type, data) { func = HumanActivityRecorderPressureData; break; default: - console.error('Uknown human activity recorder type: ' + type); + utils_.error('Uknown human activity recorder type: ' + type); return; } @@ -572,7 +572,7 @@ GestureListenerManager.prototype.onListenerCalled = function(msg) { d = this.native.getErrorObject(msg); break; default: - console.log('Unknown mode: ' + msg.action); + utils_.log('Unknown mode: ' + msg.action); return; } diff --git a/src/nfc/nfc_api.js b/src/nfc/nfc_api.js index db3d0e3..8aa8b58 100644 --- a/src/nfc/nfc_api.js +++ b/src/nfc/nfc_api.js @@ -272,7 +272,7 @@ function NFCAdapter() { } NFCAdapter.prototype.setPowered = function() { - console.warn('DEPRECATION WARNING: setPowered() is deprecated and will be removed from next release. Let the user turn NFC on/off ' + privUtils_.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 f7a711d..06453eb 100755 --- a/src/power/power_api.js +++ b/src/power/power_api.js @@ -18,6 +18,7 @@ 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; @@ -127,7 +128,7 @@ PowerManager.prototype.request = function(resource, state) { ]); if (args['state'] && args.state === PowerScreenState['SCREEN_BRIGHT']) { - console.warn('DEPRECATION WARNING: SCREEN_BRIGHT is deprecated and will be removed from next release.'); + privUtils_.warn('DEPRECATION WARNING: SCREEN_BRIGHT is deprecated and will be removed from next release.'); } var nativeParam = { @@ -278,7 +279,7 @@ PowerManager.prototype.restoreScreenBrightness = function() { * Turns on the screen. */ PowerManager.prototype.turnScreenOn = function() { - console.warn('DEPRECATION WARNING: turnScreenOn() is deprecated and will be removed from next release. Use request() instead.'); + privUtils_.warn('DEPRECATION WARNING: turnScreenOn() is deprecated and will be removed from next release. Use request() instead.'); var nativeParam = { }; @@ -295,7 +296,7 @@ PowerManager.prototype.turnScreenOn = function() { * Turns off the screen. */ PowerManager.prototype.turnScreenOff = function() { - console.warn('DEPRECATION WARNING: turnScreenOff() is deprecated and will be removed from next release. Use release() instead.'); + privUtils_.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 6e623a6..78d4113 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() { - console.warn('DEPRECATION WARNING: registerService() is deprecated and will be removed from next release. Use register() instead.'); + privUtils_.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() { - console.warn('DEPRECATION WARNING: unregisterService() is deprecated and will be removed from next release. Use unregister() instead.'); + privUtils_.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) { - console.warn('DEPRECATION WARNING: connectService() is deprecated and will be removed from next release. Use connect() instead.'); + privUtils_.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() { - console.warn('DEPRECATION WARNING: disconnectService() is deprecated and will be removed from next release. Use disconnect() instead.'); + privUtils_.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 ce4755b..e09c977 100644 --- a/src/systeminfo/systeminfo_api.js +++ b/src/systeminfo/systeminfo_api.js @@ -737,7 +737,7 @@ var SystemInfo = function() { }; SystemInfo.prototype.getCapabilities = function() { - console.warn('DEPRECATION WARNING: getCapabilities() is deprecated and will be removed from next release. Use getCapability() instead.'); + privUtils_.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 95c9d6f..ba31ab8 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'); - console.warn('DEPRECATION WARNING: getTimezoneAbbreviation() is deprecated and will be removed from next release.'); + utils_.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 ca61725..08cf659 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -5,7 +5,7 @@ //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; @@ -146,11 +146,9 @@ function Utils() { }); } -Utils.prototype.log = function() { - if (_enableJsLogs) { - console.log.apply(console, arguments); - } -} +Utils.prototype.error = console.error.bind(console); +Utils.prototype.warn = console.warn.bind(console); +Utils.prototype.log = _enableJsLogs ? console.log.bind(console) : function(){}; Utils.prototype.repackFilter = function(filter) { if (filter instanceof tizen.AttributeFilter) { @@ -975,19 +973,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!'); }; @@ -1028,7 +1026,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; } @@ -1037,8 +1035,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]; @@ -1051,7 +1049,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; } @@ -1060,15 +1058,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)); }; @@ -1174,7 +1172,7 @@ NativeManager.prototype.callIfPossible = function(callback) { * age: 28 * } * }); - * console.log(result); + * _console.log(result); * * To send async method and handle response: * bridge.async({ @@ -1229,7 +1227,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(); @@ -1246,11 +1244,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) { @@ -1282,13 +1280,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) { @@ -1298,7 +1296,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(); @@ -1333,12 +1331,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; @@ -1352,7 +1350,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) @@ -1366,7 +1364,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); }); @@ -1399,7 +1397,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() { -- 2.7.4 From b64fd116d30247e352b039ddd09f4088620ecdbb Mon Sep 17 00:00:00 2001 From: "hk57.kim" Date: Wed, 5 Apr 2017 13:14:59 +0900 Subject: [PATCH 06/16] [Tizen] Remove emulator build dependencies - This is for Tizen 4.0. - When you SR this, you need to create JIRA-TRE issue of: : add webapi-plugins-mobile-extension-emulator for mobile emulator : add webapi-plugins-wearable-extension-emulator for wearable emulator (It's add, not replace.) Change-Id: Ifed917e8f1d35194d09fd415e6e587bdf593c5a4 Signed-off-by: hk57.kim --- packaging/webapi-plugins.spec | 369 ++++++++++++++++++------- src/systeminfo/systeminfo.gyp | 3 - src/systeminfo/systeminfo_device_capability.cc | 69 +++-- 3 files changed, 318 insertions(+), 123 deletions(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index bafeeb1..5801759 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -15,23 +15,6 @@ Group: Development/Libraries Summary: Tizen Web APIs implemented Source0: %{name}-%{version}.tar.gz -# TODO: x86/x64 may be non-emulator. please fix it. (and arm emulator may exist) -%ifarch %{arm} aarch64 -# ARM -%define tizen_is_emulator 0 -%else -# I586 -%define tizen_is_emulator 1 -%endif - -%ifarch aarch64 -# 64bit -%define tizen_is_arm64 1 -%else -# 32bit -%define tizen_is_arm64 0 -%endif - #################################################################### # Common Profile : artik # #################################################################### @@ -101,11 +84,7 @@ Source0: %{name}-%{version}.tar.gz %define tizen_mobile_feature_application_support 1 %define tizen_mobile_feature_archive_support 1 %define tizen_mobile_feature_badge_support 1 -%if 0%{?tizen_is_emulator} -%define tizen_mobile_feature_bluetooth_support 0 -%else %define tizen_mobile_feature_bluetooth_support 1 -%endif %define tizen_mobile_feature_bookmark_support 1 %define tizen_mobile_feature_calendar_support 1 %define tizen_mobile_feature_contact_support 1 @@ -117,41 +96,27 @@ Source0: %{name}-%{version}.tar.gz %define tizen_mobile_feature_feedback_support 1 %define tizen_mobile_feature_filesystem_support 1 -# FM radio feature -%if 0%{?tizen_is_emulator} -%define tizen_mobile_feature_fm_radio_support 1 -%else -%if 0%{?tizen_is_arm64} +%ifarch aarch64 %define tizen_mobile_feature_fm_radio_support 0 %else %define tizen_mobile_feature_fm_radio_support 1 %endif -%endif -%if 0%{?tizen_is_emulator} -%define tizen_mobile_feature_ham_support 1 -%else %define tizen_mobile_feature_ham_support 0 -%endif + %define tizen_mobile_feature_iotcon_support 1 %define tizen_mobile_feature_location_batch 0 %define tizen_mobile_feature_key_manager_support 1 %define tizen_mobile_feature_media_controller_support 1 -%if 0%{?tizen_is_emulator} -%define tizen_mobile_feature_media_key_support 0 -%else + %define tizen_mobile_feature_media_key_support 1 -%endif + %define tizen_mobile_feature_message_port_support 1 %define tizen_mobile_feature_messaging_support 1 -%if 0%{?tizen_is_emulator} -%define tizen_mobile_feature_nfc_emulation_support 0 -%define tizen_mobile_feature_nfc_support 1 -%else %define tizen_mobile_feature_nfc_emulation_support 0 %define tizen_mobile_feature_nfc_support 0 -%endif + %define tizen_mobile_feature_notification_support 1 %define tizen_mobile_feature_package_support 1 %define tizen_mobile_feature_player_util_support 1 @@ -160,15 +125,11 @@ Source0: %{name}-%{version}.tar.gz %define tizen_mobile_feature_push_support 1 # secure element feature -%if 0%{?tizen_is_emulator} -%define tizen_mobile_feature_se_support 0 -%else -%if 0%{?tizen_is_arm64} +%ifarch aarch64 %define tizen_mobile_feature_se_support 0 %else %define tizen_mobile_feature_se_support 1 %endif -%endif %define tizen_mobile_feature_sensor_support 1 %define tizen_mobile_feature_sound_support 1 @@ -176,33 +137,23 @@ Source0: %{name}-%{version}.tar.gz %define tizen_mobile_feature_system_setting_support 1 # telephony feature -%if 0%{?tizen_is_emulator} -%define tizen_mobile_feature_telephony_support 1 -%else -%if 0%{?tizen_is_arm64} +%ifarch aarch64 %define tizen_mobile_feature_telephony_support 0 +%define tizen_mobile_feature_callhistory_support 0 +%define tizen_mobile_feature_nbs_support 0 %else %define tizen_mobile_feature_telephony_support 1 -%endif +%define tizen_mobile_feature_callhistory_support 1 +%define tizen_mobile_feature_nbs_support 1 %endif %define tizen_mobile_feature_time_support 1 %define tizen_mobile_feature_web_setting_support 1 %define tizen_mobile_feature_widget_service_support 1 -%if 0%{?tizen_is_emulator} -%define tizen_mobile_feature_wi_fi_support 0 -%else + %define tizen_mobile_feature_wi_fi_support 1 -%endif -%define tizen_mobile_feature_inputdevice_support 1 -%if 0%{?tizen_mobile_feature_telephony_support} -%define tizen_mobile_feature_callhistory_support 1 -%define tizen_mobile_feature_nbs_support 1 -%else -%define tizen_mobile_feature_callhistory_support 0 -%define tizen_mobile_feature_nbs_support 0 -%endif +%define tizen_mobile_feature_inputdevice_support 1 %define tizen_mobile_feature_tvinputdevice_support 0 @@ -228,11 +179,7 @@ Source0: %{name}-%{version}.tar.gz # Badge API is mandatory in Tizen Wearable Profile. %define tizen_wearable_feature_badge_support 1 -%if 0%{?tizen_is_emulator} -%define tizen_wearable_feature_bluetooth_support 0 -%else %define tizen_wearable_feature_bluetooth_support 1 -%endif # Bookmark API is optional in Tizen Wearable Profile. %define tizen_wearable_feature_bookmark_support 0 @@ -255,11 +202,7 @@ Source0: %{name}-%{version}.tar.gz # MediayKey API is optional in Tizen Wearable Profile. # tizen.org/feature/network.bluetooth.audio.media is required for MediayKey API -%if 0%{?tizen_is_emulator} -%define tizen_wearable_feature_media_key_support 0 -%else %define tizen_wearable_feature_media_key_support 1 -%endif %define tizen_wearable_feature_key_manager_support 1 %define tizen_wearable_feature_message_port_support 1 %define tizen_wearable_feature_messaging_support 0 @@ -271,20 +214,19 @@ Source0: %{name}-%{version}.tar.gz %define tizen_wearable_feature_power_support 1 %define tizen_wearable_feature_preference_support 1 %define tizen_wearable_feature_push_support 1 -%if 0%{?tizen_is_emulator} -%define tizen_wearable_feature_se_support 0 -%else %define tizen_wearable_feature_se_support 1 -%endif %define tizen_wearable_feature_sensor_support 1 %define tizen_wearable_feature_sound_support 1 %define tizen_wearable_feature_system_info_support 1 %define tizen_wearable_feature_system_setting_support 1 -%if 0%{?tizen_is_emulator} -%define tizen_wearable_feature_telephony_support 1 -%else + +#- telephony related APIs +# CallHistory API is optional in Tizen Wearable Profile. +# NetworkBearerSelection API is optional in Tizen Wearable Profile. %define tizen_wearable_feature_telephony_support 0 -%endif +%define tizen_wearable_feature_callhistory_support 0 +%define tizen_wearable_feature_nbs_support 0 + %define tizen_wearable_feature_time_support 1 %define tizen_wearable_feature_web_setting_support 0 %define tizen_wearable_feature_widget_service_support 1 @@ -292,17 +234,6 @@ Source0: %{name}-%{version}.tar.gz %define tizen_wearable_feature_inputdevice_support 1 %define tizen_wearable_feature_tvinputdevice_support 0 -#- telephony related APIs -# CallHistory API is optional in Tizen Wearable Profile. -# NetworkBearerSelection API is optional in Tizen Wearable Profile. -%if 0%{?tizen_wearable_feature_telephony_support} -%define tizen_wearable_feature_callhistory_support 1 -%define tizen_wearable_feature_nbs_support 1 -%else -%define tizen_wearable_feature_callhistory_support 0 -%define tizen_wearable_feature_nbs_support 0 -%endif - %define tizen_wearable_feature_convergence_support 1 @@ -423,7 +354,6 @@ Source0: %{name}-%{version}.tar.gz %define tizen_feature_convergence_support %{expand:%tizen_%{?profile}_feature_convergence_support} %endif - BuildRequires: pkgconfig(security-privilege-manager) BuildRequires: ninja BuildRequires: pkgconfig(appcore-common) @@ -654,6 +584,14 @@ Conflicts: %{name}-profile_ivi %description profile_mobile Tizen Web API implementation binaries for Tizen mobile profile. +%ifarch %{ix86} x86_64 +%package mobile-extension-emulator +Summary: webapi-plugin binaries for mobile emulator +Requires: %{name}-profile_mobile = %{version}-%{release} +%description mobile-extension-emulator +Tizen Web API implementation binaries for Tizen mobile emulator. +%endif + %package profile_wearable Summary: webapi-plugin binaries for wearable profile Provides: %{name}-compat = %{version}-%{release} @@ -664,6 +602,14 @@ Conflicts: %{name}-profile_ivi %description profile_wearable Tizen Web API implementation binaries for Tizen wearable profile. +%ifarch %{ix86} x86_64 +%package wearable-extension-emulator +Summary: webapi-plugin binaries for wearable emulator +Requires: %{name}-profile_wearable = %{version}-%{release} +%description wearable-extension-emulator +Tizen Web API implementation binaries for Tizen wearable emulator. +%endif + %package profile_tv Summary: webapi-plugin binaries for tv profile Provides: %{name}-compat = %{version}-%{release} @@ -708,7 +654,6 @@ GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=%{display_type}" GYP_OPTIONS="$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}" # feature flags -GYP_OPTIONS="$GYP_OPTIONS -Dtizen_is_emulator=%{?tizen_is_emulator}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_account_support=%{?tizen_mobile_feature_account_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_alarm_support=%{?tizen_mobile_feature_alarm_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_app_control_settings_support=%{?tizen_mobile_feature_app_control_settings_support}" @@ -767,13 +712,99 @@ pushd out mv Default bin_mobile popd +# mobile-extension-emulator +%ifarch %{ix86} x86_64 + +%define tizen_mobile_feature_bluetooth_support 0 + +# FM radio feature +%define tizen_mobile_feature_fm_radio_support 1 + +%define tizen_mobile_feature_ham_support 1 +%define tizen_mobile_feature_media_key_support 0 +%define tizen_mobile_feature_nfc_emulation_support 0 +%define tizen_mobile_feature_nfc_support 1 + +# secure element feature +%define tizen_mobile_feature_se_support 0 + +# telephony feature +%define tizen_mobile_feature_telephony_support 1 +%define tizen_mobile_feature_callhistory_support 1 +%define tizen_mobile_feature_nbs_support 1 + +%define tizen_mobile_feature_wi_fi_support 0 + +GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=mobile -Dprivilege_engine=%{tizen_mobile_privilege_engine}" +GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=%{display_type}" +GYP_OPTIONS="$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}" + +# feature flags +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_account_support=%{?tizen_mobile_feature_account_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_alarm_support=%{?tizen_mobile_feature_alarm_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_app_control_settings_support=%{?tizen_mobile_feature_app_control_settings_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_application_support=%{?tizen_mobile_feature_application_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_archive_support=%{?tizen_mobile_feature_archive_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_badge_support=%{?tizen_mobile_feature_badge_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bluetooth_support=%{?tizen_mobile_feature_bluetooth_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bookmark_support=%{?tizen_mobile_feature_bookmark_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_calendar_support=%{?tizen_mobile_feature_calendar_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_callhistory_support=%{?tizen_mobile_feature_callhistory_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_contact_support=%{?tizen_mobile_feature_contact_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_content_support=%{?tizen_mobile_feature_content_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_datacontrol_support=%{?tizen_mobile_feature_datacontrol_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_datasync_support=%{?tizen_mobile_feature_datasync_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_download_support=%{?tizen_mobile_feature_download_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_exif_support=%{?tizen_mobile_feature_exif_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_feedback_support=%{?tizen_mobile_feature_feedback_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_filesystem_support=%{?tizen_mobile_feature_filesystem_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_fm_radio_support=%{?tizen_mobile_feature_fm_radio_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_ham_support=%{?tizen_mobile_feature_ham_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_iotcon_support=%{?tizen_mobile_feature_iotcon_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_location_batch=%{?tizen_mobile_feature_location_batch}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_key_manager_support=%{?tizen_mobile_feature_key_manager_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_media_controller_support=%{?tizen_mobile_feature_media_controller_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_media_key_support=%{?tizen_mobile_feature_media_key_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_message_port_support=%{?tizen_mobile_feature_message_port_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_messaging_support=%{?tizen_mobile_feature_messaging_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_nbs_support=%{?tizen_mobile_feature_nbs_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_nfc_emulation_support=%{?tizen_mobile_feature_nfc_emulation_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_nfc_support=%{?tizen_mobile_feature_nfc_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_notification_support=%{?tizen_mobile_feature_notification_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_package_support=%{?tizen_mobile_feature_package_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_player_util_support=%{?tizen_mobile_feature_player_util_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_power_support=%{?tizen_mobile_feature_power_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_preference_support=%{?tizen_mobile_feature_preference_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_push_support=%{?tizen_mobile_feature_push_support}" +#GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_sap_support=%{?tizen_mobile_feature_sap_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_sensor_support=%{?tizen_mobile_feature_sensor_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_se_support=%{?tizen_mobile_feature_se_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_sound_support=%{?tizen_mobile_feature_sound_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_system_info_support=%{?tizen_mobile_feature_system_info_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_system_setting_support=%{?tizen_mobile_feature_system_setting_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_telephony_support=%{?tizen_mobile_feature_telephony_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_time_support=%{?tizen_mobile_feature_time_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_inputdevice_support=%{?tizen_mobile_feature_inputdevice_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_web_setting_support=%{?tizen_mobile_feature_web_setting_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_widget_service_support=%{?tizen_mobile_feature_widget_service_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_wi_fi_support=%{?tizen_mobile_feature_wi_fi_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_tvinputdevice_support=%{?tizen_mobile_feature_tvinputdevice_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_convergence_support=%{?tizen_mobile_feature_convergence_support}" + +./tools/gyp/gyp $GYP_OPTIONS src/tizen-wrt.gyp + +ninja -C out/Default %{?_smp_mflags} +pushd out +mv Default bin_mobile_emulator +popd +%endif + # WEARABLE GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=wearable -Dprivilege_engine=%{tizen_wearable_privilege_engine}" GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=%{display_type}" GYP_OPTIONS="$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}" # feature flags -GYP_OPTIONS="$GYP_OPTIONS -Dtizen_is_emulator=%{?tizen_is_emulator}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_account_support=%{?tizen_wearable_feature_account_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_alarm_support=%{?tizen_wearable_feature_alarm_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_app_control_settings_support=%{?tizen_wearable_feature_app_control_settings_support}" @@ -832,13 +863,93 @@ pushd out mv Default bin_wearable popd +# wearable-extension-emulator +%ifarch %{ix86} x86_64 + +%define tizen_wearable_feature_bluetooth_support 0 + +# MediayKey API is optional in Tizen Wearable Profile. +# tizen.org/feature/network.bluetooth.audio.media is required for MediayKey API +%define tizen_wearable_feature_media_key_support 0 + +#- telephony related APIs +# CallHistory API is optional in Tizen Wearable Profile. +# NetworkBearerSelection API is optional in Tizen Wearable Profile. +%define tizen_wearable_feature_se_support 0 +%define tizen_wearable_feature_telephony_support 1 +%define tizen_wearable_feature_callhistory_support 1 +%define tizen_wearable_feature_nbs_support 1 + +GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=wearable -Dprivilege_engine=%{tizen_wearable_privilege_engine}" +GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=%{display_type}" +GYP_OPTIONS="$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}" + +# feature flags +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_account_support=%{?tizen_wearable_feature_account_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_alarm_support=%{?tizen_wearable_feature_alarm_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_app_control_settings_support=%{?tizen_wearable_feature_app_control_settings_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_application_support=%{?tizen_wearable_feature_application_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_archive_support=%{?tizen_wearable_feature_archive_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_badge_support=%{?tizen_wearable_feature_badge_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bluetooth_support=%{?tizen_wearable_feature_bluetooth_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_bookmark_support=%{?tizen_wearable_feature_bookmark_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_calendar_support=%{?tizen_wearable_feature_calendar_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_callhistory_support=%{?tizen_wearable_feature_callhistory_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_contact_support=%{?tizen_wearable_feature_contact_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_content_support=%{?tizen_wearable_feature_content_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_datacontrol_support=%{?tizen_wearable_feature_datacontrol_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_datasync_support=%{?tizen_wearable_feature_datasync_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_download_support=%{?tizen_wearable_feature_download_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_exif_support=%{?tizen_wearable_feature_exif_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_feedback_support=%{?tizen_wearable_feature_feedback_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_filesystem_support=%{?tizen_wearable_feature_filesystem_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_fm_radio_support=%{?tizen_wearable_feature_fm_radio_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_ham_support=%{?tizen_wearable_feature_ham_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_iotcon_support=%{?tizen_wearable_feature_iotcon_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_location_batch=%{?tizen_wearable_feature_location_batch}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_key_manager_support=%{?tizen_wearable_feature_key_manager_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_media_controller_support=%{?tizen_wearable_feature_media_controller_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_media_key_support=%{?tizen_wearable_feature_media_key_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_message_port_support=%{?tizen_wearable_feature_message_port_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_messaging_support=%{?tizen_wearable_feature_messaging_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_nbs_support=%{?tizen_wearable_feature_nbs_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_nfc_emulation_support=%{?tizen_wearable_feature_nfc_emulation_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_nfc_support=%{?tizen_wearable_feature_nfc_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_notification_support=%{?tizen_wearable_feature_notification_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_package_support=%{?tizen_wearable_feature_package_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_player_util_support=%{?tizen_wearable_feature_player_util_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_power_support=%{?tizen_wearable_feature_power_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_preference_support=%{?tizen_wearable_feature_preference_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_push_support=%{?tizen_wearable_feature_push_support}" +#GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_sap_support=%{?tizen_wearable_feature_sap_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_sensor_support=%{?tizen_wearable_feature_sensor_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_se_support=%{?tizen_wearable_feature_se_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_sound_support=%{?tizen_wearable_feature_sound_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_system_info_support=%{?tizen_wearable_feature_system_info_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_system_setting_support=%{?tizen_wearable_feature_system_setting_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_telephony_support=%{?tizen_wearable_feature_telephony_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_time_support=%{?tizen_wearable_feature_time_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_inputdevice_support=%{?tizen_wearable_feature_inputdevice_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_web_setting_support=%{?tizen_wearable_feature_web_setting_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_widget_service_support=%{?tizen_wearable_feature_widget_service_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_wi_fi_support=%{?tizen_wearable_feature_wi_fi_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_tvinputdevice_support=%{?tizen_wearable_feature_tvinputdevice_support}" +GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_convergence_support=%{?tizen_wearable_feature_convergence_support}" + +./tools/gyp/gyp $GYP_OPTIONS src/tizen-wrt.gyp + +ninja -C out/Default %{?_smp_mflags} +pushd out +mv Default bin_wearable_emulator +popd +%endif + # TV GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=tv -Dprivilege_engine=%{tizen_tv_privilege_engine}" GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=%{display_type}" GYP_OPTIONS="$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}" # feature flags -GYP_OPTIONS="$GYP_OPTIONS -Dtizen_is_emulator=%{?tizen_is_emulator}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_account_support=%{?tizen_tv_feature_account_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_alarm_support=%{?tizen_tv_feature_alarm_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_app_control_settings_support=%{?tizen_tv_feature_app_control_settings_support}" @@ -899,7 +1010,6 @@ popd %endif - # Unified: common/ Others: its own profile %if "%{?profile}" != "mobile" && "%{?profile}" != "tv" && "%{?profile}" != "wearable" && "%{?profile}" != "ivi" GYP_OPTIONS="--depth=. -Dtizen=1 -Dextension_build_type=Debug -Dextension_host_os=common -Dprivilege_engine=%{tizen_privilege_engine}" @@ -910,7 +1020,6 @@ GYP_OPTIONS="$GYP_OPTIONS -Ddisplay_type=%{display_type}" GYP_OPTIONS="$GYP_OPTIONS -Dcrosswalk_extensions_path=%{crosswalk_extensions_path}" # feature flags -GYP_OPTIONS="$GYP_OPTIONS -Dtizen_is_emulator=%{?tizen_is_emulator}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_account_support=%{?tizen_feature_account_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_alarm_support=%{?tizen_feature_alarm_support}" GYP_OPTIONS="$GYP_OPTIONS -Dtizen_feature_app_control_settings_support=%{?tizen_feature_app_control_settings_support}" @@ -1010,7 +1119,21 @@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{crosswalk_extensions_path}/mobile # temporary plugins description for lazy loading install -p -m 644 plugins.json %{buildroot}%{crosswalk_extensions_path}/mobile/plugins.json -%endif + +# mobile-extension-emulator +%ifarch %{ix86} x86_64 +mkdir -p %{buildroot}%{crosswalk_extensions_path}/mobile_emulator +install -p -m 644 out/bin_mobile_emulator/libtizen*.so %{buildroot}%{crosswalk_extensions_path}/mobile_emulator +# execute desc_gentool +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{crosswalk_extensions_path}/mobile_emulator out/Default/desc_gentool \ + %{crosswalk_extensions_path}/mobile_emulator \ + %{buildroot}%{crosswalk_extensions_path}/mobile_emulator > plugins.json + +# temporary plugins description for lazy loading +install -p -m 644 plugins.json %{buildroot}%{crosswalk_extensions_path}/mobile_emulator/plugins.json +%endif // mobile-extension-emulator + +%endif // mobile %if "%{?unified_build}" == "1" || "%{?profile}" == "wearable" mkdir -p %{buildroot}%{crosswalk_extensions_path}/wearable @@ -1022,7 +1145,21 @@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{crosswalk_extensions_path}/wearab # temporary plugins description for lazy loading install -p -m 644 plugins.json %{buildroot}%{crosswalk_extensions_path}/wearable/plugins.json -%endif + +# wearable-extension-emulator +%ifarch %{ix86} x86_64 +mkdir -p %{buildroot}%{crosswalk_extensions_path}/wearable_emulator +install -p -m 644 out/bin_wearable_emulator/libtizen*.so %{buildroot}%{crosswalk_extensions_path}/wearable_emulator +# execute desc_gentool +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{crosswalk_extensions_path}/mobile_emulator out/Default/desc_gentool \ + %{crosswalk_extensions_path}/wearable_emulator \ + %{buildroot}%{crosswalk_extensions_path}/wearable_emulator > plugins.json + +# temporary plugins description for lazy loading +install -p -m 644 plugins.json %{buildroot}%{crosswalk_extensions_path}/wearable_emulator/plugins.json +%endif // wearable-extension-emulator + +%endif // wearable %if "%{?unified_build}" == "1" || "%{?profile}" == "tv" mkdir -p %{buildroot}%{crosswalk_extensions_path}/tv @@ -1101,7 +1238,24 @@ fi %{crosswalk_extensions_path}/mobile/libtizen*.so %{crosswalk_extensions_path}/mobile/plugins.json %manifest webapi-plugins.manifest -%endif + +# mobile-extension-emulator +%ifarch %{ix86} x86_64 +%post mobile-extension-emulator +ln -sf %{crosswalk_extensions_path}/mobile_emulator/* %{crosswalk_extensions_path} +%preun mobile-extension-emulator +# This is an un-installation. +if [ "$1" == "0" ]; then + rm %{crosswalk_extensions_path}/libtizen*.so + rm %{crosswalk_extensions_path}/plugins.json +fi +%files mobile-extension-emulator +%dir %{crosswalk_extensions_path}/mobile_emulator/ +%{crosswalk_extensions_path}/mobile_emulator/libtizen*.so +%{crosswalk_extensions_path}/mobile_emulator/plugins.json +%manifest webapi-plugins.manifest +%endif // mobile-extension-emulator +%endif // mobile %if "%{?unified_build}" == "1" || "%{?profile}" == "wearable" %post profile_wearable @@ -1117,7 +1271,24 @@ fi %{crosswalk_extensions_path}/wearable/libtizen*.so %{crosswalk_extensions_path}/wearable/plugins.json %manifest webapi-plugins.manifest -%endif + +# wearable-extension-emulator +%ifarch %{ix86} x86_64 +%post wearable-extension-emulator +ln -sf %{crosswalk_extensions_path}/wearable_emulator/* %{crosswalk_extensions_path} +%preun wearable-extension-emulator +# This is an un-installation. +if [ "$1" == "0" ]; then + rm %{crosswalk_extensions_path}/libtizen*.so + rm %{crosswalk_extensions_path}/plugins.json +fi +%files wearable-extension-emulator +%dir %{crosswalk_extensions_path}/wearable_emulator/ +%{crosswalk_extensions_path}/wearable_emulator/libtizen*.so +%{crosswalk_extensions_path}/wearable_emulator/plugins.json +%manifest webapi-plugins.manifest +%endif // wearable-extension-emulator +%endif // wearable %if "%{?unified_build}" == "1" || "%{?profile}" == "tv" %post profile_tv diff --git a/src/systeminfo/systeminfo.gyp b/src/systeminfo/systeminfo.gyp index ae9d39f..5822c00 100644 --- a/src/systeminfo/systeminfo.gyp +++ b/src/systeminfo/systeminfo.gyp @@ -47,9 +47,6 @@ ] }, }], - ['tizen_is_emulator == 1', { - 'defines': ['TIZEN_IS_EMULATOR'], - }], ], }, ], diff --git a/src/systeminfo/systeminfo_device_capability.cc b/src/systeminfo/systeminfo_device_capability.cc index 65675fc..cec92de 100644 --- a/src/systeminfo/systeminfo_device_capability.cc +++ b/src/systeminfo/systeminfo_device_capability.cc @@ -566,17 +566,44 @@ bool SystemInfoDeviceCapability::IsScreen() { return true; } + +#define MODEL_NAME "http://tizen.org/system/model_name" +#define MODEL_EMULATOR "Emulator" +bool _is_emulator(void) +{ + int ret; + char *model_name = NULL; + static bool emul = false; + static int set = 0; + + if (set) + return emul; + + ret = system_info_get_platform_string(MODEL_NAME, &model_name); + if (ret < 0) { + LoggerD("Cannot get model name(%d)", ret); + return emul; + } + + if (!strncmp(MODEL_EMULATOR, model_name, strlen(model_name) + 1)) + emul = true; + + set = 1; + free(model_name); + + return emul; +} + PlatformResult SystemInfoDeviceCapability::GetPlatformCoreCpuFrequency(int* return_value) { LoggerD("Entered"); std::string freq; std::string file_name; -#ifdef TIZEN_IS_EMULATOR - file_name = "/proc/cpuinfo"; -#else - file_name = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"; -#endif + if(_is_emulator()) + file_name = "/proc/cpuinfo"; + else + file_name = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"; std::ifstream cpuinfo_freq(file_name); if (!cpuinfo_freq.is_open()) { @@ -585,24 +612,24 @@ PlatformResult SystemInfoDeviceCapability::GetPlatformCoreCpuFrequency(int* retu ("Failed to get cpu frequency")); } -#ifdef TIZEN_IS_EMULATOR - //get frequency value from cpuinfo file - //example entry for frequency looks like below - //cpu MHz : 3392.046 - std::size_t found; - do { - getline(cpuinfo_freq, freq); - found = freq.find("cpu MHz"); - } while (std::string::npos == found && !cpuinfo_freq.eof()); + if(_is_emulator()) { + //get frequency value from cpuinfo file + //example entry for frequency looks like below + //cpu MHz : 3392.046 + std::size_t found; + do { + getline(cpuinfo_freq, freq); + found = freq.find("cpu MHz"); + } while (std::string::npos == found && !cpuinfo_freq.eof()); - found = freq.find(":"); - if (std::string::npos != found) { - *return_value = std::stoi(freq.substr(found + 2)); + found = freq.find(":"); + if (std::string::npos != found) { + *return_value = std::stoi(freq.substr(found + 2)); + } + } else { + getline(cpuinfo_freq, freq); + *return_value = std::stoi(freq) / 1000; // unit: MHz } -#else - getline(cpuinfo_freq, freq); - *return_value = std::stoi(freq) / 1000; // unit: MHz -#endif cpuinfo_freq.close(); LoggerD("cpu frequency : %d", *return_value); -- 2.7.4 From 0f5cfa872d0821ee155d1c61e4df51e69fe55d38 Mon Sep 17 00:00:00 2001 From: Pawel Wasowski Date: Wed, 19 Apr 2017 11:40:25 +0200 Subject: [PATCH 07/16] [Bluetooth] Fix for a memory leak [Verification] Code compiles Change-Id: Ie45718fa00d5841eb947e882c3ab694b8f79c285 Signed-off-by: Pawel Wasowski --- src/bluetooth/bluetooth_gatt_service.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bluetooth/bluetooth_gatt_service.cc b/src/bluetooth/bluetooth_gatt_service.cc index 98d0b53..f16fb92 100755 --- a/src/bluetooth/bluetooth_gatt_service.cc +++ b/src/bluetooth/bluetooth_gatt_service.cc @@ -398,6 +398,8 @@ void BluetoothGATTService::ReadValue(const picojson::value& args, }; int ret = bt_gatt_client_read_value(handle, read_value, (void*)user_data); if (BT_ERROR_NONE != ret) { + delete user_data; + user_data = nullptr; LoggerE("Couldn't register callback for read value %d (%s)", ret, get_error_message(ret)); } -- 2.7.4 From eb49f8c4317671bf19266f038819a46d1467ac73 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 19 Apr 2017 12:33:08 +0200 Subject: [PATCH 08/16] [version] 1.80 Change-Id: I92ecb9191887c1d748ab21d20c5a4203d432912f Signed-off-by: Piotr Kosko --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 893ccb5..3162b37 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 1.79 +Version: 1.80 Release: 0 License: Apache-2.0 and BSD-3-Clause and MIT Group: Development/Libraries -- 2.7.4 From 52e9afa3227f9a3186f85c18bd08bc25899b4b8d Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 19 Apr 2017 17:08:29 +0200 Subject: [PATCH 09/16] [Application] delay of reporting failure changed to 10 seconds [verification] code compiles without error. TCT passrate 100% Change-Id: Ife3d8c2053c7884ab0513c0b4b429a8eb2eada24 Signed-off-by: Piotr Kosko --- src/application/application_manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/application/application_manager.cc b/src/application/application_manager.cc index 328d6ff..091fe02 100755 --- a/src/application/application_manager.cc +++ b/src/application/application_manager.cc @@ -174,7 +174,7 @@ class TerminateHandler { void LaunchCheckTerminate() { LoggerD("Entered"); - timeout_id_ = g_timeout_add(3000, CheckTerminate, this); + timeout_id_ = g_timeout_add(10000, CheckTerminate, this); LoggerD("END"); } -- 2.7.4 From 0bbfc115435dd2911575ddbaa49a73c9864a4771 Mon Sep 17 00:00:00 2001 From: Szymon Jastrzebski Date: Fri, 21 Apr 2017 08:41:39 +0200 Subject: [PATCH 10/16] Revert "[Application] delay of reporting failure changed to 10 seconds" This reverts commit 52e9afa3227f9a3186f85c18bd08bc25899b4b8d. Change-Id: I22bc8e4e1e3f61b6fa2e45de139391620c80dc53 Signed-off-by: Szymon Jastrzebski --- src/application/application_manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/application/application_manager.cc b/src/application/application_manager.cc index 091fe02..328d6ff 100755 --- a/src/application/application_manager.cc +++ b/src/application/application_manager.cc @@ -174,7 +174,7 @@ class TerminateHandler { void LaunchCheckTerminate() { LoggerD("Entered"); - timeout_id_ = g_timeout_add(10000, CheckTerminate, this); + timeout_id_ = g_timeout_add(3000, CheckTerminate, this); LoggerD("END"); } -- 2.7.4 From 5feb6b7519b43e1f7bdf130f913814987c49b239 Mon Sep 17 00:00:00 2001 From: Szymon Jastrzebski Date: Fri, 21 Apr 2017 08:35:06 +0200 Subject: [PATCH 11/16] [Application] Commenting LaunchCheckTerminate() The issue in crosswalk-tizen seems to be solved, so we can no longer make workaround. [Verification] Application TCT passed 100% Change-Id: Ib196b583e2acd8bb488ae993bd805ea28aed476e Signed-off-by: Szymon Jastrzebski --- src/application/application_manager.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/application/application_manager.cc b/src/application/application_manager.cc index 328d6ff..0d8ed50 100755 --- a/src/application/application_manager.cc +++ b/src/application/application_manager.cc @@ -367,7 +367,7 @@ void ApplicationManager::Kill(const picojson::value& args) { // due to platform issue, sometimes termination event is not reported to callback // registered with app_manager_set_app_context_event_cb() // this is a workaround, it should be removed when issue is solved - handler->LaunchCheckTerminate(); + //handler->LaunchCheckTerminate(); LoggerD("Kill async, KILL!!!!!!!!!"); -- 2.7.4 From 93cb19ac814eeb3ee66e49f82e4a1ed35518bc27 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Tue, 25 Apr 2017 08:49:51 +0200 Subject: [PATCH 12/16] [Content] changed included header [Verification] Code compiles without errors. Change-Id: Idd10e10297d71368391db575d91d35a634f96c8a Signed-off-by: Piotr Kosko --- src/content/content_instance.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/content_instance.h b/src/content/content_instance.h index af1b717..a9d1ed3 100755 --- a/src/content/content_instance.h +++ b/src/content/content_instance.h @@ -19,7 +19,7 @@ #include -#include +#include #include "common/extension.h" namespace extension { -- 2.7.4 From f76c6d7af159ed18cab5e4412d9e3250c2ae473a Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Wed, 26 Apr 2017 11:45:14 +0200 Subject: [PATCH 13/16] [Utils] Fix for undefined _console function. [Verification] Code compiles. Change-Id: I752ee4cbf05645b891a70c73419d02928c22fc0c Signed-off-by: Tomasz Marciniak --- src/utils/utils_api.js | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 08cf659..3c4d46e 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -973,19 +973,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!'); + xwalk.utils.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!'); + xwalk.utils.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!'); + xwalk.utils.error('Runtime did not implement extension.sendRuntimeSyncMessage!'); throw new WebAPIException(WebAPIException.UNKNOWN_ERR, 'Runtime did not implement extension.sendRuntimeSyncMessage!'); }; @@ -1026,7 +1026,7 @@ var NativeManager = function(extension) { delete msg[this.CALLBACK_ID_KEY]; if (!_type.isFunction(this.callbacks_[id])) { - _console.error('Wrong callback identifier. Ignoring message.'); + xwalk.utils.error('Wrong callback identifier. Ignoring message.'); return; } @@ -1035,8 +1035,8 @@ var NativeManager = function(extension) { try { f(msg); } catch (e) { - _console.error('########## exception'); - _console.error(e); + xwalk.utils.error('########## exception'); + xwalk.utils.error(e); } }, 0); delete this.callbacks_[id]; @@ -1049,7 +1049,7 @@ var NativeManager = function(extension) { delete msg[this.LISTENER_ID_KEY]; if (!_type.isFunction(this.listeners_[id])) { - _console.error('Wrong listener identifier. Ignoring message.'); + xwalk.utils.error('Wrong listener identifier. Ignoring message.'); return; } @@ -1058,15 +1058,15 @@ var NativeManager = function(extension) { try { f(msg); } catch (e) { - _console.error('########## exception'); - _console.error(e); + xwalk.utils.error('########## exception'); + xwalk.utils.error(e); } }, 0); return; } - _console.error('Missing callback or listener identifier. Ignoring message.'); + xwalk.utils.error('Missing callback or listener identifier. Ignoring message.'); }.bind(this)); }; @@ -1172,7 +1172,7 @@ NativeManager.prototype.callIfPossible = function(callback) { * age: 28 * } * }); - * _console.log(result); + * xwalk.utils.log(result); * * To send async method and handle response: * bridge.async({ @@ -1227,7 +1227,7 @@ var NativeBridge = (function (extension, debug) { CallbackManager.prototype = { add: function (/*callbacks, cid?*/) { - if (debug) _console.log('bridge.CallbackManager.add'); + if (debug) xwalk.utils.log('bridge.CallbackManager.add'); var args = Array.prototype.slice.call(arguments); var c = args.shift(); var cid = args.pop(); @@ -1244,11 +1244,11 @@ var NativeBridge = (function (extension, debug) { return cid; }, remove: function (cid) { - if (debug) _console.log('bridge.CallbackManager.remove, cid: ' + cid); + if (debug) xwalk.utils.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) xwalk.utils.log('bridge.CallbackManager.call, cid: '+ cid + ', key: ' + key); var callbacks = _collection[cid]; keep = !!keep; if (callbacks) { @@ -1280,13 +1280,13 @@ var NativeBridge = (function (extension, debug) { ListenerManager.prototype = { add: function (l) { - if (debug) _console.log('bridge.ListenerManager.add'); + if (debug) xwalk.utils.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) xwalk.utils.log('bridge.ListenerManager.resolve, id: ' + id + ', action: ' + action); keep = !!keep; var l = _listeners[id]; if (l) { @@ -1296,7 +1296,7 @@ var NativeBridge = (function (extension, debug) { return l; }, remove: function (id) { - if (debug) _console.log('bridge.ListenerManager.remove, id: ' + id); + if (debug) xwalk.utils.log('bridge.ListenerManager.remove, id: ' + id); var l = _listeners[id]; if (l) { var cm = Callbacks.getInstance(); @@ -1331,12 +1331,12 @@ var NativeBridge = (function (extension, debug) { })(); var Listener = function () { - if (debug) _console.log('bridge: Listener constructor'); + if (debug) xwalk.utils.log('bridge: Listener constructor'); this.cid = null; }; Listener.prototype = { then: function (c) { - if (debug) _console.log('bridge.Listener.then'); + if (debug) xwalk.utils.log('bridge.Listener.then'); var cm = Callbacks.getInstance(); this.cid = cm.add(c, this.cid); return this; @@ -1350,7 +1350,7 @@ var NativeBridge = (function (extension, debug) { cmd: data.cmd, args: data }); - if (debug) _console.log('bridge.sync, json: ' + json); + if (debug) xwalk.utilss.log('bridge.sync, json: ' + json); var result = extension.internal.sendSyncMessage(json); var obj = JSON_.parse(result); if (obj.error) @@ -1364,7 +1364,7 @@ var NativeBridge = (function (extension, debug) { cmd: data.cmd, args: data }); - if (debug) _console.log('bridge.async, json: ' + json); + if (debug) xwalk.utils.log('bridge.async, json: ' + json); setTimeout(function () { extension.postMessage(json); }); @@ -1397,7 +1397,7 @@ var NativeBridge = (function (extension, debug) { *} */ - if (debug) _console.log('bridge.setMessageListener, json: ' + json); + if (debug) xwalk.utils.log('bridge.setMessageListener, json: ' + json); var data = JSON_.parse(json); if (data.cid && data.action) { setTimeout(function() { -- 2.7.4 From 86db5aa67e052f26925d3a66780d96024cb0bc5e Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Wed, 26 Apr 2017 12:50:07 +0200 Subject: [PATCH 14/16] [version] 1.81 Change-Id: I12c6cf70787ee9dcfbe94592084ee89b2965eb60 Signed-off-by: Piotr Kosko --- packaging/webapi-plugins.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 3162b37..99df838 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -10,7 +10,7 @@ %define crosswalk_extensions_path %{_libdir}/%{crosswalk_extensions} Name: webapi-plugins -Version: 1.80 +Version: 1.81 Release: 0 License: Apache-2.0 and BSD-3-Clause and MIT Group: Development/Libraries -- 2.7.4 From b8b6af88c5551ee781196a4f6e389cf4f2984625 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Thu, 27 Apr 2017 10:15:02 +0200 Subject: [PATCH 15/16] [Common][Contact][Callhistory] changed required rpm name [Comment] related native change https://review.tizen.org/gerrit/#/c/126363/ need to be merged first. Change-Id: I5d7280a38bfd07a9d73ae11d66a53c14d549146d Signed-off-by: Piotr Kosko --- packaging/webapi-plugins.spec | 4 ++-- src/callhistory/callhistory.gyp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 03cb942..13e108b 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -495,11 +495,11 @@ BuildRequires: pkgconfig(calendar-service2) %endif %if "%{?tizen_feature_contact_support}" == "1" || "%{?unified_build}" == "1" -BuildRequires: pkgconfig(contacts-service2) +BuildRequires: pkgconfig(contacts-service) %endif %if "%{?tizen_feature_callhistory_support}" == "1" || "%{?unified_build}" == "1" -BuildRequires: pkgconfig(contacts-service2) +BuildRequires: pkgconfig(contacts-service) %endif %if "%{?tizen_feature_exif_support}" == "1" || "%{?unified_build}" == "1" diff --git a/src/callhistory/callhistory.gyp b/src/callhistory/callhistory.gyp index 3e88ecc..7494b58 100644 --- a/src/callhistory/callhistory.gyp +++ b/src/callhistory/callhistory.gyp @@ -37,4 +37,4 @@ ], }, ], -} \ No newline at end of file +} -- 2.7.4 From 8a328936585b578926207fae7f233910ea6489a5 Mon Sep 17 00:00:00 2001 From: Piotr Kosko Date: Fri, 28 Apr 2017 05:50:06 +0000 Subject: [PATCH 16/16] Revert "[Common][Contact][Callhistory] changed required rpm name" .pc file name was not changed, commit is not needed. This reverts commit b8b6af88c5551ee781196a4f6e389cf4f2984625. Change-Id: I8edc1e68cce0d0fcb4057bef3d838ff0406a7c53 --- packaging/webapi-plugins.spec | 4 ++-- src/callhistory/callhistory.gyp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/webapi-plugins.spec b/packaging/webapi-plugins.spec index 13e108b..03cb942 100644 --- a/packaging/webapi-plugins.spec +++ b/packaging/webapi-plugins.spec @@ -495,11 +495,11 @@ BuildRequires: pkgconfig(calendar-service2) %endif %if "%{?tizen_feature_contact_support}" == "1" || "%{?unified_build}" == "1" -BuildRequires: pkgconfig(contacts-service) +BuildRequires: pkgconfig(contacts-service2) %endif %if "%{?tizen_feature_callhistory_support}" == "1" || "%{?unified_build}" == "1" -BuildRequires: pkgconfig(contacts-service) +BuildRequires: pkgconfig(contacts-service2) %endif %if "%{?tizen_feature_exif_support}" == "1" || "%{?unified_build}" == "1" diff --git a/src/callhistory/callhistory.gyp b/src/callhistory/callhistory.gyp index 7494b58..3e88ecc 100644 --- a/src/callhistory/callhistory.gyp +++ b/src/callhistory/callhistory.gyp @@ -37,4 +37,4 @@ ], }, ], -} +} \ No newline at end of file -- 2.7.4