From d24d8bdb5e2d22018b9bae8b1cc68a1a6ea7d498 Mon Sep 17 00:00:00 2001 From: Dongjin Choi Date: Tue, 9 Jul 2013 17:13:29 +0900 Subject: [PATCH] Update change log and spec for wrt-plugins-tizen_0.4.51 [model] REDWOOD [binary_type] PDA [customer] OPEN [Systeminfo] Change get Sim value code [Issue] N/A [Problem] UTC_download_start_P_001 is failed. [Cause] Using invalid destination virtual path [Solution] Uses valid path [WebSetting] Fix websetting privilege TCT issue as well as indentation adjustment. [Issue] N/A [Problem] usleep was not decleared [Cause] unistd.h was missing [Solution] including unistd.h [Issue] N/A [Problem] stopSync fail after sync called quickly [Cause] stopSync cannot get handle from email service [Solution] retry to get handle from email service [Issue#] DCM-2166 [Problem] N/A [Cause] Internal bug [Solution] modify code [Issue#] N/A [Problem] N/A [Cause] Internal bug [Solution] modify code [team] WebAPI [request] N/A [horizontal_expansion] N/A UnitTC passed. --- packaging/wrt-plugins-tizen.spec | 2 +- src/Alarm/JSAlarmAbsolute.cpp | 64 ++++------------- src/Alarm/JSAlarmAbsolute.h | 7 +- src/Alarm/JSAlarmManager.cpp | 4 -- src/Alarm/JSAlarmManager.h | 1 - src/Alarm/JSAlarmRelative.cpp | 43 ++++++------ src/Alarm/JSAlarmRelative.h | 2 - src/Application/JSApplicationControl.cpp | 21 +----- src/Application/JSApplicationControl.h | 8 --- src/Application/JSApplicationControlData.cpp | 27 +++---- src/Application/JSApplicationManager.cpp | 9 --- src/Application/JSApplicationManager.h | 5 -- src/Application/JSRequestedApplicationControl.cpp | 5 -- src/Application/JSRequestedApplicationControl.h | 12 ---- src/Messaging/Email.cpp | 33 +++++++-- src/Messaging/Messaging.cpp | 7 ++ src/Messaging/MessagingService.cpp | 25 +++++-- src/Messaging/MessagingService.h | 2 + src/Power/PowerManager.cpp | 1 + src/Systeminfo/Systeminfo.cpp | 8 +-- src/WebSetting/JSWebSettingManager.cpp | 79 +++++++++++++-------- src/WebSetting/JSWebSettingManager.h | 28 ++++---- src/WebSetting/WebSettingManager.cpp | 86 +++++++++++++---------- src/WebSetting/WebSettingManager.h | 12 ++-- src/WebSetting/WebSettingTypes.h | 6 +- src/WebSetting/plugin_config.cpp | 41 +++++------ src/WebSetting/plugin_config.h | 6 +- src/WebSetting/plugin_initializer.cpp | 26 ++++--- 28 files changed, 278 insertions(+), 292 deletions(-) mode change 100644 => 100755 src/WebSetting/JSWebSettingManager.h mode change 100644 => 100755 src/WebSetting/WebSettingTypes.h mode change 100644 => 100755 src/WebSetting/plugin_config.h diff --git a/packaging/wrt-plugins-tizen.spec b/packaging/wrt-plugins-tizen.spec index 91f473b..1600340 100755 --- a/packaging/wrt-plugins-tizen.spec +++ b/packaging/wrt-plugins-tizen.spec @@ -1,6 +1,6 @@ Name: wrt-plugins-tizen Summary: JavaScript plugins for WebRuntime -Version: 0.4.50 +Version: 0.4.51 Release: 0 Group: Development/Libraries License: Apache License, Version 2.0 diff --git a/src/Alarm/JSAlarmAbsolute.cpp b/src/Alarm/JSAlarmAbsolute.cpp index 1c78c4f..e18815d 100644 --- a/src/Alarm/JSAlarmAbsolute.cpp +++ b/src/Alarm/JSAlarmAbsolute.cpp @@ -107,20 +107,14 @@ void JSAlarmAbsolute::finalize(JSObjectRef object) } -bool JSAlarmAbsolute::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception) -{ - return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); -} JSObjectRef DLL_EXPORT JSAlarmAbsolute::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - try { - AlarmAbsolutePtr priv = AlarmAbsolutePtr(new AlarmAbsolute()); - if (!priv) { - throw TypeMismatchException("Private object is null"); - } + ArgumentValidator validator(ctx, argumentCount, arguments); - ArgumentValidator validator(ctx, argumentCount, arguments); + AlarmAbsolutePtr priv = AlarmAbsolutePtr(new AlarmAbsolute()); + + try { time_t date = validator.toTimeT(0); struct tm *startDate = localtime(&date); mktime(startDate); @@ -152,12 +146,19 @@ JSObjectRef DLL_EXPORT JSAlarmAbsolute::constructor(JSContextRef ctx, JSObjectRe priv->setInterval(interval); } } + } catch (const BasePlatformException& err) { + LoggerE("Exception occured while creating constructor : " << err.getMessage()); + } - return JSValueToObject(ctx, createJSObject(ctx, priv), exception); + JSAlarmAbsolutePriv *jspriv = new JSAlarmAbsolutePriv(ctx, priv); + JSObjectRef obj = JSObjectMake(ctx, getClassRef(), jspriv); - } catch (const BasePlatformException& err) { - return JSWebAPIErrorFactory::postException(ctx, exception, err); - } + JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor"); + JSObjectSetProperty(ctx, obj, ctorName, constructor, + kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL); + JSStringRelease(ctorName); + + return obj; } AlarmAbsolutePtr JSAlarmAbsolute::getPrivData(JSObjectRef object) @@ -173,17 +174,6 @@ AlarmAbsolutePtr JSAlarmAbsolute::getPrivData(JSObjectRef object) return result; } -JSValueRef JSAlarmAbsolute::createJSObject(JSContextRef context, const int id) -{ - AlarmAbsolutePtr privateData = AlarmAbsolutePtr(new AlarmAbsolute()); - privateData->setId(id); - - JSAlarmAbsolutePriv *priv = new JSAlarmAbsolutePriv(context, privateData); - if (!priv) { - throw TypeMismatchException("Private object is null"); - } - return JSObjectMake(context, getClassRef(), static_cast(priv)); -} JSValueRef JSAlarmAbsolute::createJSObject(JSContextRef context, AlarmAbsolutePtr privateData) { @@ -194,30 +184,6 @@ JSValueRef JSAlarmAbsolute::createJSObject(JSContextRef context, AlarmAbsolutePt return JSObjectMake(context, getClassRef(), static_cast(priv)); } -JSValueRef JSAlarmAbsolute::createJSObject(JSContextRef context, struct tm date, int interval) -{ - AlarmAbsolutePtr privateData = AlarmAbsolutePtr(new AlarmAbsolute()); - privateData->setDate(date); - - JSAlarmAbsolutePriv *priv = new JSAlarmAbsolutePriv(context, privateData); - if (!priv) { - throw TypeMismatchException("Private object is null"); - } - return JSObjectMake(context, getClassRef(), static_cast(priv)); -} - -JSValueRef JSAlarmAbsolute::createJSObject(JSContextRef context, struct tm date) -{ - AlarmAbsolutePtr privateData = AlarmAbsolutePtr(new AlarmAbsolute()); - privateData->setDate(date); - - JSAlarmAbsolutePriv *priv = new JSAlarmAbsolutePriv(context, privateData); - if (!priv) { - throw TypeMismatchException("Private object is null"); - } - return JSObjectMake(context, getClassRef(), static_cast(priv)); -} - JSValueRef JSAlarmAbsolute::getNextScheduledDate( JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception) { TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); diff --git a/src/Alarm/JSAlarmAbsolute.h b/src/Alarm/JSAlarmAbsolute.h index 309b6d6..b9ee64f 100755 --- a/src/Alarm/JSAlarmAbsolute.h +++ b/src/Alarm/JSAlarmAbsolute.h @@ -40,17 +40,12 @@ class JSAlarmAbsolute { public: static const JSClassDefinition* getClassInfo(); static const JSClassRef getClassRef(); - static JSValueRef createJSObject(JSContextRef context, const int id); - static JSValueRef createJSObject(JSContextRef context, AlarmAbsolutePtr privateData); - static JSValueRef createJSObject(JSContextRef context, struct tm date, int interval); - static JSValueRef createJSObject(JSContextRef context, struct tm date); static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); - + static JSValueRef createJSObject(JSContextRef context, AlarmAbsolutePtr privateData); protected: static void initialize(JSContextRef context, JSObjectRef object); static void finalize(JSObjectRef object); - static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); static JSValueRef getNextScheduledDate(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); private: diff --git a/src/Alarm/JSAlarmManager.cpp b/src/Alarm/JSAlarmManager.cpp index d59abb0..d491691 100644 --- a/src/Alarm/JSAlarmManager.cpp +++ b/src/Alarm/JSAlarmManager.cpp @@ -129,10 +129,6 @@ void JSAlarmManager::finalize(JSObjectRef object) { } -bool JSAlarmManager::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception) { - return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); -} - JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0); diff --git a/src/Alarm/JSAlarmManager.h b/src/Alarm/JSAlarmManager.h index a54768f..7100030 100755 --- a/src/Alarm/JSAlarmManager.h +++ b/src/Alarm/JSAlarmManager.h @@ -41,7 +41,6 @@ public: protected: static void initialize(JSContextRef context, JSObjectRef object); static void finalize(JSObjectRef object); - static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); static JSValueRef add(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); static JSValueRef remove(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); static JSValueRef removeAll(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); diff --git a/src/Alarm/JSAlarmRelative.cpp b/src/Alarm/JSAlarmRelative.cpp index f38bc8d..92c58bd 100644 --- a/src/Alarm/JSAlarmRelative.cpp +++ b/src/Alarm/JSAlarmRelative.cpp @@ -107,34 +107,33 @@ void JSAlarmRelative::finalize(JSObjectRef object) delete priv; } -bool JSAlarmRelative::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception) -{ - return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); -} - + JSObjectRef DLL_EXPORT JSAlarmRelative::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - try { - ArgumentValidator validator(ctx, argumentCount, arguments); + ArgumentValidator validator(ctx, argumentCount, arguments); + AlarmRelativePtr privateData = AlarmRelativePtr(new AlarmRelative()); + + try { long delay = validator.toLong(0); - if (delay < 0) { - throw InvalidValuesException("delay cannot be negative value"); - } - long period = validator.toLong(1, true, 0); - if (period < 0) { - throw InvalidValuesException("period cannot be negative value"); - } + privateData->setDelay(delay); - if ((argumentCount > 1) && !JSValueIsNull(ctx, arguments[1])) { - return JSValueToObject(ctx, createJSObject(ctx, delay, period), exception); - } else { - return JSValueToObject(ctx, createJSObject(ctx, delay, -1), exception); - } - } catch (const BasePlatformException& err) { - return JSWebAPIErrorFactory::postException(ctx, exception, err); - } + long period = validator.toLong(1, true, -1); + privateData->setPeriod(period); + + } catch (const BasePlatformException& err) { + LoggerE("Exception occured while creating constructor : " << err.getMessage()); + } + + JSAlarmRelativePriv *priv = new JSAlarmRelativePriv(ctx, privateData); + JSObjectRef obj = JSObjectMake(ctx, getClassRef(), priv); + + JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor"); + JSObjectSetProperty(ctx, obj, ctorName, constructor, + kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL); + JSStringRelease(ctorName); + return obj; } AlarmRelativePtr JSAlarmRelative::getPrivData(JSObjectRef object) diff --git a/src/Alarm/JSAlarmRelative.h b/src/Alarm/JSAlarmRelative.h index f0784a9..fee01ff 100755 --- a/src/Alarm/JSAlarmRelative.h +++ b/src/Alarm/JSAlarmRelative.h @@ -46,8 +46,6 @@ public: protected: static void initialize(JSContextRef context, JSObjectRef object); static void finalize(JSObjectRef object); - static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); - //static JSValueRef getRemainingDuration(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); static JSValueRef getRemainingSeconds(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef * exception); private: diff --git a/src/Application/JSApplicationControl.cpp b/src/Application/JSApplicationControl.cpp index 01d165f..803a5e4 100644 --- a/src/Application/JSApplicationControl.cpp +++ b/src/Application/JSApplicationControl.cpp @@ -116,18 +116,6 @@ ApplicationControlPtr DLL_EXPORT JSApplicationControl::getApplicationControl(JSC return priv->getObject(); } -#if 0 -ApplicationControlPtr JSApplicationControl::getPrivateData(JSContextRef context, JSObjectRef object) -{ - JSApplicationControlPriv* priv = static_cast(JSObjectGetPrivate(object)); - if (!priv) { - throw TypeMismatchException("Private object is null"); - } - - return priv->getObject(); -} -#endif - void JSApplicationControl::initialize(JSContextRef context,JSObjectRef object) { } @@ -162,7 +150,7 @@ JSObjectRef DLL_EXPORT JSApplicationControl::constructor(JSContextRef context, appsvc->setAppControlDataArray(appControlDataArray); } } catch (const BasePlatformException& err) { - return JSWebAPIErrorFactory::postException(context, exception, err); + LoggerE("Exception occured while creating constructor : " << err.getMessage()); } JSApplicationControlPriv *priv = new JSApplicationControlPriv(context, appsvc); @@ -279,12 +267,5 @@ bool JSApplicationControl::setProperty(JSContextRef context, JSObjectRef object, return false; } - -bool JSApplicationControl::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception) -{ - return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); -} - - } } diff --git a/src/Application/JSApplicationControl.h b/src/Application/JSApplicationControl.h index c047517..2720ad8 100755 --- a/src/Application/JSApplicationControl.h +++ b/src/Application/JSApplicationControl.h @@ -96,14 +96,6 @@ private: JSValueRef* exception); /** - * The callback invoked when an object is used as the target of an 'instanceof' expression. - */ - static bool hasInstance(JSContextRef context, - JSObjectRef constructor, - JSValueRef possibleInstance, - JSValueRef* exception); - - /** * This structure contains properties and callbacks that define a type of object. */ static JSClassDefinition m_classInfo; diff --git a/src/Application/JSApplicationControlData.cpp b/src/Application/JSApplicationControlData.cpp index 29ea6f7..a6eb790 100644 --- a/src/Application/JSApplicationControlData.cpp +++ b/src/Application/JSApplicationControlData.cpp @@ -88,25 +88,26 @@ JSObjectRef JSApplicationControlData::createJSObject(JSContextRef context, const JSObjectRef DLL_EXPORT JSApplicationControlData::constructor(JSContextRef context, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { - try { - ArgumentValidator validator(context, argumentCount, arguments); - ApplicationControlDataPtr appdata(new ApplicationControlData()); + ArgumentValidator validator(context, argumentCount, arguments); + + ApplicationControlDataPtr appdata(new ApplicationControlData()); + try { appdata->setKey(validator.toString(0)); appdata->setValue(JSUtil::JSArrayToStringVector(context, validator.toArrayObject(1))); + } catch (BasePlatformException &err) { + LoggerE("Exception occured while creating constructor : " << err.getMessage()); + } - JSApplicationControlDataPriv *priv = new JSApplicationControlDataPriv(context, appdata); - JSObjectRef obj = JSObjectMake(context, getClassRef(),priv); + JSApplicationControlDataPriv *priv = new JSApplicationControlDataPriv(context, appdata); + JSObjectRef obj = JSObjectMake(context, getClassRef(),priv); - JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor"); - JSObjectSetProperty(context, obj, ctorName, constructor, - kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL); - JSStringRelease(ctorName); + JSStringRef ctorName = JSStringCreateWithUTF8CString("constructor"); + JSObjectSetProperty(context, obj, ctorName, constructor, + kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete | kJSPropertyAttributeDontEnum, NULL); + JSStringRelease(ctorName); - return obj; - } catch (BasePlatformException &err) { - return JSWebAPIErrorFactory::postException(context, exception, err); - } + return obj; } void JSApplicationControlData::initialize(JSContextRef context, JSObjectRef object) diff --git a/src/Application/JSApplicationManager.cpp b/src/Application/JSApplicationManager.cpp index 96293cc..4de7f85 100644 --- a/src/Application/JSApplicationManager.cpp +++ b/src/Application/JSApplicationManager.cpp @@ -138,15 +138,6 @@ void JSApplicationManager::finalize(JSObjectRef object) delete priv; } -bool JSApplicationManager::hasInstance(JSContextRef context, - JSObjectRef constructor, - JSValueRef possibleInstance, - JSValueRef* exception) -{ - return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); -} - - JSValueRef JSApplicationManager::getCurrentApplication(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, diff --git a/src/Application/JSApplicationManager.h b/src/Application/JSApplicationManager.h index c7826d0..9cb9088 100644 --- a/src/Application/JSApplicationManager.h +++ b/src/Application/JSApplicationManager.h @@ -50,11 +50,6 @@ private: static void finalize(JSObjectRef object); /** - * The callback invoked when an object is used as the target of an 'instanceof' expression. - */ - static bool hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception); - - /** * Gets a current application */ static JSValueRef getCurrentApplication(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, diff --git a/src/Application/JSRequestedApplicationControl.cpp b/src/Application/JSRequestedApplicationControl.cpp index 5b59cf7..f0bb9d2 100644 --- a/src/Application/JSRequestedApplicationControl.cpp +++ b/src/Application/JSRequestedApplicationControl.cpp @@ -179,11 +179,6 @@ JSValueRef JSRequestedApplicationControl::getProperty(JSContextRef context, JSOb } -bool JSRequestedApplicationControl::hasInstance(JSContextRef context, JSObjectRef constructor, JSValueRef possibleInstance, JSValueRef* exception) -{ - return JSValueIsObjectOfClass(context, possibleInstance, getClassRef()); -} - JSValueRef JSRequestedApplicationControl::replyResult(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, diff --git a/src/Application/JSRequestedApplicationControl.h b/src/Application/JSRequestedApplicationControl.h index 736aa3b..cc5021a 100644 --- a/src/Application/JSRequestedApplicationControl.h +++ b/src/Application/JSRequestedApplicationControl.h @@ -47,11 +47,6 @@ public: static JSObjectRef createJSObject(JSContextRef context, const RequestedApplicationControlPtr &appsvc); - /** - * The Constructor of ApplicationControl - */ - static JSObjectRef constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception); - static bool isObjectOfClass(JSContextRef context, JSValueRef value); @@ -102,13 +97,6 @@ private: JSValueRef value, JSValueRef* exception); - /** - * The callback invoked when an object is used as the target of an 'instanceof' expression. - */ - static bool hasInstance(JSContextRef context, - JSObjectRef constructor, - JSValueRef possibleInstance, - JSValueRef* exception); /** * This structure contains properties and callbacks that define a type of object. diff --git a/src/Messaging/Email.cpp b/src/Messaging/Email.cpp index 667b864..fbff139 100644 --- a/src/Messaging/Email.cpp +++ b/src/Messaging/Email.cpp @@ -857,7 +857,7 @@ void Email::updateMessage() if(getCurrentFolder() == DRAFTBOX) { // updateBody(); -// updateSubject(); + updateSubject(); // updateRecipients(); // updateFrom(); // updateAttachments(); @@ -887,6 +887,23 @@ void Email::updateMessage() error = email_update_mail( m_mail.Get(), attachment, attachmentCount, meeting_req, 0); if (EMAIL_ERROR_NONE != error) { LoggerW("Nothing to update or error. [" << error << "]"); +/* + if(error == EMAIL_ERROR_DB_FAILURE) + { + int retry = 0; + while (retry < 2) { + LoggerW("wait 300 ms"); + usleep(300 * 1000); + email_update_mail( m_mail.Get(), attachment, attachmentCount, meeting_req, 0); + LoggerW("error. [" << error << "]"); + if (EMAIL_ERROR_NONE == error) { + break; + } + retry++; + + } + } +*/ } if(getCurrentFolder() == DRAFTBOX) @@ -920,12 +937,14 @@ void Email::updateMessage() LoggerW("email_update_mail_attribute error. [" << error << "]"); } } - tm* time = localtime(&result->date_time); - if (!time) { - LoggerE("localtime failed"); - Throw(WrtDeviceApis::Commons::PlatformException); - } - setDateTime(*time); + + tm* time = localtime(&result->date_time); + if (!time) { + LoggerE("localtime failed"); + Throw(WrtDeviceApis::Commons::PlatformException); + } + setDateTime(*time); + } if(result != NULL) { diff --git a/src/Messaging/Messaging.cpp b/src/Messaging/Messaging.cpp index 7625445..5626433 100644 --- a/src/Messaging/Messaging.cpp +++ b/src/Messaging/Messaging.cpp @@ -473,6 +473,13 @@ vector Messaging::queryEmailConversation(const std::string& sq std::set checkUnique; for(int i=0; i #include #include - +#include using namespace std; @@ -153,7 +153,7 @@ int MessagingService::createOpId(int type) index = type; } - LoggerD("m_opRequests size : " << cnt ); + LoggerD("m_opRequests cnt : " << cnt ); LoggerD("index " << index); m_opRequests.insert(std::make_pair(index, MessagingServiceOpData(0,type))); @@ -162,17 +162,29 @@ int MessagingService::createOpId(int type) int MessagingService::getHandleFromOpId(int opIdx) { - LoggerD("operation index size : " << opIdx); - + LoggerD("opIdx : " << opIdx); + LoggerD("m_opRequests.size() : " << m_opRequests.size() ); int handle = -1; OpRequestsIterator it = m_opRequests.find(opIdx); if ( m_opRequests.end() != it) { - handle = it->second.handle; + int retryCount = 0; + if(it->second.checkSetHandle == false) + { + while (retryCount < 2) { + LoggerW("Wait for handle"); + usleep(200 * 1000); + if (it->second.checkSetHandle) { + break; + } + retryCount++; + } + handle = it->second.handle; + } } - LoggerD("index " << handle); + LoggerD("handle " << handle); return handle; } @@ -237,6 +249,7 @@ void MessagingService::setHandleToOpId(int opIdx, int handle) { LoggerD(" find Message "); it->second.handle = handle; + it->second.checkSetHandle = true; } } diff --git a/src/Messaging/MessagingService.h b/src/Messaging/MessagingService.h index b518e60..3833eaf 100755 --- a/src/Messaging/MessagingService.h +++ b/src/Messaging/MessagingService.h @@ -86,12 +86,14 @@ private: { unsigned int handle; unsigned short type; + bool checkSetHandle; IMessagePtr message; EventMessagingServicePtr event; explicit MessagingServiceOpData(int handle, int type) : handle(handle), type(type), + checkSetHandle(false), message(NULL), event(NULL) { diff --git a/src/Power/PowerManager.cpp b/src/Power/PowerManager.cpp index 568d9a0..af4e39c 100755 --- a/src/Power/PowerManager.cpp +++ b/src/Power/PowerManager.cpp @@ -25,6 +25,7 @@ #include #include #include +#include using namespace DeviceAPI::Common; using namespace std; diff --git a/src/Systeminfo/Systeminfo.cpp b/src/Systeminfo/Systeminfo.cpp index f9f4f2d..5306a37 100755 --- a/src/Systeminfo/Systeminfo.cpp +++ b/src/Systeminfo/Systeminfo.cpp @@ -634,8 +634,6 @@ void Systeminfo::OnRequestReceived(const EventGetSysteminfoPtr& event) } LoggerD("simState : " << simState); event->setSimState(simState); - if (simState) - free(simState); if(strcmp(simState, "READY") == 0) { if (tel_get_sim_imsi(m_tapiHandle, &imsi) == TAPI_API_SUCCESS) { LoggerD("mcc : " << imsi.szMcc << " mnc : " << imsi.szMnc << " msin : " << imsi.szMsin); @@ -655,6 +653,8 @@ void Systeminfo::OnRequestReceived(const EventGetSysteminfoPtr& event) event->makeSimObject(); EventRequestReceiver::ManualAnswer(event); } + if (simState) + free(simState); } else { LoggerE("get fail sim state"); event->makeSimObject(); @@ -1283,8 +1283,8 @@ PROPERTY_GET_SYSTEMINFO_DEFINITION(Storage) { storagePtr->units[1].type = "MMC"; storagePtr->units[1].capacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_blocks; storagePtr->units[1].availableCapacity = (unsigned long long)fs.f_bsize * (unsigned long long)fs.f_bavail; - storagePtr->units[1].isRemoveable = false; - storagePtr->units[1].isRemovable = false; + storagePtr->units[1].isRemoveable = true; + storagePtr->units[1].isRemovable = true; storagePtr->cnt = 2; LoggerD("type : " << storagePtr->units[1].type); } diff --git a/src/WebSetting/JSWebSettingManager.cpp b/src/WebSetting/JSWebSettingManager.cpp index d0b45e6..4ee8a8c 100755 --- a/src/WebSetting/JSWebSettingManager.cpp +++ b/src/WebSetting/JSWebSettingManager.cpp @@ -31,10 +31,13 @@ using namespace WrtDeviceApis::Commons; using namespace DeviceAPI::Common; -namespace DeviceAPI { -namespace WebSetting { +namespace DeviceAPI +{ +namespace WebSetting +{ -JSClassDefinition JSWebSettingManager::m_classInfo = { +JSClassDefinition JSWebSettingManager::m_classInfo = +{ 0, kJSClassAttributeNone, "WebSettingManager", @@ -54,7 +57,8 @@ JSClassDefinition JSWebSettingManager::m_classInfo = { NULL //ConvertToType }; -JSStaticFunction JSWebSettingManager::m_function[] = { +JSStaticFunction JSWebSettingManager::m_function[] = +{ { WEB_SETTING_MANAGER_API_SET_USER_AGENT_STRING, setUserAgentString, kJSPropertyAttributeNone }, { WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES, removeAllCookies, kJSPropertyAttributeNone }, { 0, 0, 0 } @@ -64,7 +68,8 @@ JSClassRef JSWebSettingManager::m_jsClassRef = JSClassCreate(JSWebSettingManager const JSClassRef JSWebSettingManager::getClassRef() { - if (!m_jsClassRef) { + if (!m_jsClassRef) + { m_jsClassRef = JSClassCreate(&m_classInfo); } return m_jsClassRef; @@ -77,18 +82,20 @@ const JSClassDefinition* JSWebSettingManager::getClassInfo() void JSWebSettingManager::initialize(JSContextRef context, JSObjectRef object) { - if (!JSObjectGetPrivate(object)) { - SLoggerI("JSWebSettingManager::initialize called..."); + if (!JSObjectGetPrivate(object)) + { + SLoggerI("JSWebSettingManager::initialize called..."); WebSettingManager *priv = WebSettingManager::getInstance(); - JSObjectSetPrivate(object, static_cast(priv)); + JSObjectSetPrivate(object, static_cast(priv)); } } void JSWebSettingManager::finalize(JSObjectRef object) { - SLoggerI("JSWebSettingManager::finalize called..."); + SLoggerI("JSWebSettingManager::finalize called..."); WebSettingManager *priv = static_cast(JSObjectGetPrivate(object)); - if (priv) { + if (priv) + { JSObjectSetPrivate(object, NULL); } } @@ -100,10 +107,12 @@ JSValueRef JSWebSettingManager::setUserAgentString(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - try { + try + { // Private Object WebSettingManager *priv = static_cast(JSObjectGetPrivate(thisObject)); - if (!priv) { + if (!priv) + { throw TypeMismatchException("Private object is NULL."); } ArgumentValidator validator(context, argumentCount, arguments); @@ -121,21 +130,26 @@ JSValueRef JSWebSettingManager::setUserAgentString(JSContextRef context, // errorCallback JSObjectRef errorCallbackObj = validator.toFunction(2, true); - + if (errorCallbackObj) { callbacks->setCallback("onerror", errorCallbackObj); } priv->setUserAgentString(userAgent, callbacks); + return JSValueMakeUndefined(context); - } catch (const BasePlatformException &err) { - SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str()); - return JSWebAPIErrorFactory::postException(context, exception, err); - } catch (...) { + } + catch (const BasePlatformException &err) + { + SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str()); + return JSWebAPIErrorFactory::postException(context, exception, err); + } + catch (...) + { DeviceAPI::Common::UnknownException err("Unknown Error in WebSettingManager.setUserAgentString()."); - SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str()); - return JSWebAPIErrorFactory::postException(context, exception, err); + SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str()); + return JSWebAPIErrorFactory::postException(context, exception, err); } } @@ -146,13 +160,16 @@ JSValueRef JSWebSettingManager::removeAllCookies(JSContextRef context, const JSValueRef arguments[], JSValueRef* exception) { - //AceSecurityStatus status = WEB_SETTING_CHECK_ACCESS(WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES); - //TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + AceSecurityStatus status = WEB_SETTING_CHECK_ACCESS(WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES); + TIZEN_SYNC_ACCESS_HANDLER(status, context, exception); + SLoggerI("removeAllCookies::TIZEN_SYNC_ACCESS_HANDLER succeeded."); - try { + try + { // Private Object WebSettingManager *priv = static_cast(JSObjectGetPrivate(thisObject)); - if (!priv) { + if (!priv) + { throw TypeMismatchException("Private object is NULL."); } @@ -174,13 +191,17 @@ JSValueRef JSWebSettingManager::removeAllCookies(JSContextRef context, } priv->removeAllCookies(callbacks); return JSValueMakeUndefined(context); - } catch (const BasePlatformException &err) { - SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str()); - return JSWebAPIErrorFactory::postException(context, exception, err); - } catch (...) { + } + catch (const BasePlatformException &err) + { + SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str()); + return JSWebAPIErrorFactory::postException(context, exception, err); + } + catch (...) + { DeviceAPI::Common::UnknownException err("Unknown Error in WebSettingManager.removeAllCookies()."); - SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str()); - return JSWebAPIErrorFactory::postException(context, exception, err); + SLoggerE(err.getName().c_str() << ":" << err.getMessage().c_str()); + return JSWebAPIErrorFactory::postException(context, exception, err); } } diff --git a/src/WebSetting/JSWebSettingManager.h b/src/WebSetting/JSWebSettingManager.h old mode 100644 new mode 100755 index 0733ca8..b3c6f24 --- a/src/WebSetting/JSWebSettingManager.h +++ b/src/WebSetting/JSWebSettingManager.h @@ -22,8 +22,10 @@ #include "WebSettingManager.h" -namespace DeviceAPI { -namespace WebSetting { +namespace DeviceAPI +{ +namespace WebSetting +{ class JSWebSettingManager { @@ -36,7 +38,7 @@ private: * The callback invoked when an object is first created. */ static void initialize(JSContextRef context, - JSObjectRef object); + JSObjectRef object); /** * The callback invoked when an object is finalized. @@ -44,18 +46,18 @@ private: static void finalize(JSObjectRef object); static JSValueRef setUserAgentString(JSContextRef context, - JSObjectRef object, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception); + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); static JSValueRef removeAllCookies(JSContextRef context, - JSObjectRef object, - JSObjectRef thisObject, - size_t argumentCount, - const JSValueRef arguments[], - JSValueRef* exception); + JSObjectRef object, + JSObjectRef thisObject, + size_t argumentCount, + const JSValueRef arguments[], + JSValueRef* exception); /** * This member variable contains the values which has to be passed diff --git a/src/WebSetting/WebSettingManager.cpp b/src/WebSetting/WebSettingManager.cpp index 65200f4..3b443d1 100755 --- a/src/WebSetting/WebSettingManager.cpp +++ b/src/WebSetting/WebSettingManager.cpp @@ -26,8 +26,10 @@ #include -namespace DeviceAPI { -namespace WebSetting { +namespace DeviceAPI +{ +namespace WebSetting +{ std::list WebSettingManager::mUserAgentCallbacks; std::list WebSettingManager::mDeleteAllCookiesCallbacks; @@ -42,68 +44,76 @@ WebSettingManager::~WebSettingManager() SLoggerI("Desstructor of WebSettingManager..."); } -WebSettingManager* WebSettingManager::getInstance() +WebSettingManager* WebSettingManager::getInstance() { SLoggerI("Getting instance of WebSettingManager..."); static WebSettingManager instance; return &instance; } -void WebSettingManager::onAsyncUAStringReplyCallback(unsigned int num, void* user_data, const char* result) -{ - MultiCallbackUserData* multiPointer = static_cast(user_data); - if (multiPointer != NULL) { - int successStrLength = strlen("success"); - if ((strncmp(result,"success", successStrLength)== 0) && (strlen(result) == successStrLength)) { +void WebSettingManager::onAsyncUAStringReplyCallback(unsigned int num, void* user_data, const char* result) +{ + MultiCallbackUserData* multiPointer = static_cast(user_data); + if (multiPointer != NULL) + { + unsigned int successStrLength = strlen("success"); + if ((strncmp(result,"success", successStrLength) == 0) && (strlen(result) == successStrLength)) + { multiPointer->invokeCallback("onsuccess", NULL); } - else { + else + { UnknownException error("Unknown"); JSObjectRef errorObj = JSWebAPIErrorFactory::makeErrorObject(multiPointer->getContext(), error); - multiPointer->invokeCallback("onerror", errorObj); - } - WebSettingManager::mUserAgentCallbacks.remove(multiPointer); - delete multiPointer;; - } - else { - SLoggerI("[WebSettingManager::onAsyncUAStringReplyCallback] Warning. MultiCallbackUserData is NULL." << __LINE__);; - } + multiPointer->invokeCallback("onerror", errorObj); + } + WebSettingManager::mUserAgentCallbacks.remove(multiPointer); + delete multiPointer;; + } + else + { + SLoggerI("[WebSettingManager::onAsyncUAStringReplyCallback] Warning. MultiCallbackUserData is NULL." << __LINE__);; + } } -void WebSettingManager::onAsyncReplyRemoveAllCookiesCallback(unsigned int num, void* user_data, const char* result) -{ - MultiCallbackUserData* multiPointer = static_cast(user_data); - if (multiPointer != NULL) { - int successStrLength = strlen("success"); - if ((strncmp(result,"success", successStrLength)== 0) && (strlen(result) == successStrLength)) { - multiPointer->invokeCallback("onsuccess", NULL); - } - else { +void WebSettingManager::onAsyncReplyRemoveAllCookiesCallback(unsigned int num, void* user_data, const char* result) +{ + MultiCallbackUserData* multiPointer = static_cast(user_data); + if (multiPointer != NULL) + { + unsigned int successStrLength = strlen("success"); + if ((strncmp(result,"success", successStrLength)== 0) && (strlen(result) == successStrLength)) + { + multiPointer->invokeCallback("onsuccess", NULL); + } + else + { UnknownException error("Unknown"); JSObjectRef errorObj = JSWebAPIErrorFactory::makeErrorObject(multiPointer->getContext(), error); - multiPointer->invokeCallback("onerror", errorObj); - } - WebSettingManager::mDeleteAllCookiesCallbacks.remove(multiPointer); - delete multiPointer;; - } - else { - SLoggerI("[WebSettingManager::onAsyncReplyRemoveAllCookiesCallback] Warning. MultiCallbackUserData is NULL." << __LINE__);; - } + multiPointer->invokeCallback("onerror", errorObj); + } + WebSettingManager::mDeleteAllCookiesCallbacks.remove(multiPointer); + delete multiPointer;; + } + else + { + SLoggerI("[WebSettingManager::onAsyncReplyRemoveAllCookiesCallback] Warning. MultiCallbackUserData is NULL." << __LINE__);; + } } void WebSettingManager::setUserAgentString(std::string userAgent, MultiCallbackUserData* callbacks) { SLoggerI("WebSetting:setUserAgentString: " << userAgent); - WebSettingManager::mUserAgentCallbacks.push_back(callbacks); + WebSettingManager::mUserAgentCallbacks.push_back(callbacks); IPCMessageSupport::sendAsyncMessageToUiProcess(IPCMessageSupport::TIZEN_CHANGE_USERAGENT, userAgent.c_str(), WebSettingManager::onAsyncUAStringReplyCallback, callbacks); } void WebSettingManager::removeAllCookies(MultiCallbackUserData* callbacks) { SLoggerI("WebSetting:removeAllCookies: "); - WebSettingManager::mDeleteAllCookiesCallbacks.push_back(callbacks); + WebSettingManager::mDeleteAllCookiesCallbacks.push_back(callbacks); IPCMessageSupport::sendAsyncMessageToUiProcess(IPCMessageSupport::TIZEN_DELETE_ALL_COOKIES, NULL, WebSettingManager::onAsyncReplyRemoveAllCookiesCallback, callbacks); -} +} } } diff --git a/src/WebSetting/WebSettingManager.h b/src/WebSetting/WebSettingManager.h index bc75787..f9316e3 100755 --- a/src/WebSetting/WebSettingManager.h +++ b/src/WebSetting/WebSettingManager.h @@ -24,8 +24,10 @@ using namespace DeviceAPI::Common; -namespace DeviceAPI { -namespace WebSetting { +namespace DeviceAPI +{ +namespace WebSetting +{ class WebSettingManager { @@ -33,12 +35,12 @@ public: void setUserAgentString(std::string userAgent, MultiCallbackUserData* callbacks); void removeAllCookies(MultiCallbackUserData* callbacks); - static std::list mUserAgentCallbacks; - static std::list mDeleteAllCookiesCallbacks; + static std::list mUserAgentCallbacks; + static std::list mDeleteAllCookiesCallbacks; static void onAsyncUAStringReplyCallback(unsigned int num, void* user_data, const char* result); static void onAsyncReplyRemoveAllCookiesCallback(unsigned int num, void* user_data, const char* result); - static WebSettingManager* getInstance(); + static WebSettingManager* getInstance(); private: WebSettingManager(); virtual ~WebSettingManager(); diff --git a/src/WebSetting/WebSettingTypes.h b/src/WebSetting/WebSettingTypes.h old mode 100644 new mode 100755 index a25c897..6c4f54e --- a/src/WebSetting/WebSettingTypes.h +++ b/src/WebSetting/WebSettingTypes.h @@ -22,8 +22,10 @@ #include #include -namespace DeviceAPI { -namespace WebSetting { +namespace DeviceAPI +{ +namespace WebSetting +{ } // WebSetting diff --git a/src/WebSetting/plugin_config.cpp b/src/WebSetting/plugin_config.cpp index 539d902..3ceef6b 100755 --- a/src/WebSetting/plugin_config.cpp +++ b/src/WebSetting/plugin_config.cpp @@ -28,8 +28,10 @@ using namespace WrtDeviceApis::Commons; -namespace DeviceAPI { -namespace WebSetting { +namespace DeviceAPI +{ +namespace WebSetting +{ static FunctionMapping createWebSettingFunctions(); static FunctionMapping WebSettingFunctions = createWebSettingFunctions(); @@ -42,38 +44,37 @@ DEFINE_FUNCTION_GETTER(WebSetting, WebSettingFunctions); static FunctionMapping createWebSettingFunctions() { - FunctionMapping webSettingMapping; /** * Device capabilities - */ + */ ACE_CREATE_DEVICE_CAP(DEVICE_CAP_WEBSETTING, WEBSETTING_DEVICE_CAP); ACE_CREATE_DEVICE_CAPS_LIST(DEVICE_LIST_WEBSETTING); ACE_ADD_DEVICE_CAP(DEVICE_LIST_WEBSETTING, DEVICE_CAP_WEBSETTING); - + /** * Api Features */ ACE_CREATE_FEATURE(FEATURE_WEBSETTING, WEBSETTING_FEATURE_API); ACE_CREATE_FEATURE_LIST(WEBSETTING_FEATURES); - ACE_ADD_API_FEATURE(WEBSETTING_FEATURES, FEATURE_WEBSETTING); - + ACE_ADD_API_FEATURE(WEBSETTING_FEATURES, FEATURE_WEBSETTING); + /** * Functions */ FunctionMapping websettingMapping; - - // remove cookies - AceFunction removeAllCookiesFunc = ACE_CREATE_FUNCTION( - FUNCTION_ADD, - WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES, - WEBSETTING_FEATURES, - DEVICE_LIST_WEBSETTING); - - websettingMapping.insert(std::make_pair( - WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES, - removeAllCookiesFunc)); - - return webSettingMapping; + + // remove cookies + AceFunction removeAllCookiesFunc = ACE_CREATE_FUNCTION( + FUNCTION_REMOVE_ALL_COOKIES, + WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES, + WEBSETTING_FEATURES, + DEVICE_LIST_WEBSETTING); + + websettingMapping.insert(std::make_pair( + WEB_SETTING_MANAGER_API_REMOVE_ALL_COOKIES, + removeAllCookiesFunc)); + + return websettingMapping; } } // WebSetting diff --git a/src/WebSetting/plugin_config.h b/src/WebSetting/plugin_config.h old mode 100644 new mode 100755 index 9443546..fafd85f --- a/src/WebSetting/plugin_config.h +++ b/src/WebSetting/plugin_config.h @@ -24,8 +24,10 @@ #include -namespace DeviceAPI { -namespace WebSetting { +namespace DeviceAPI +{ +namespace WebSetting +{ // attributes diff --git a/src/WebSetting/plugin_initializer.cpp b/src/WebSetting/plugin_initializer.cpp index db1fca2..5c24308 100755 --- a/src/WebSetting/plugin_initializer.cpp +++ b/src/WebSetting/plugin_initializer.cpp @@ -29,16 +29,21 @@ using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; using namespace DeviceAPI::Common; -namespace DeviceAPI { -namespace WebSetting { +namespace DeviceAPI +{ +namespace WebSetting +{ void on_widget_start_callback(int widgetId) { SLoggerD("[Tizen\\WebSetting] on_widget_start_callback (%d)", widgetId); - try { + try + { WrtAccessSingleton::Instance().initialize(widgetId); - } catch (...) { + } + catch (...) + { SLoggerE("WrtAccess initialization failed"); } } @@ -46,9 +51,12 @@ void on_widget_start_callback(int widgetId) void on_widget_stop_callback(int widgetId) { SLoggerD("[Tizen\\WebSetting] on_widget_stop_callback (%d)", widgetId); - try { + try + { WrtAccessSingleton::Instance().deinitialize(widgetId); - } catch (...) { + } + catch (...) + { SLoggerE("WrtAccess deinitialization failed"); } } @@ -72,9 +80,9 @@ PLUGIN_ON_FRAME_UNLOAD(on_frame_unload_callback) PLUGIN_CLASS_MAP_BEGIN PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN, - "websetting", - (js_class_template_getter)JSWebSettingManager::getClassRef, - NULL) + "websetting", + (js_class_template_getter)JSWebSettingManager::getClassRef, + NULL) PLUGIN_CLASS_MAP_END } // WebSetting -- 2.7.4