Update change log and spec for wrt-plugins-tizen_0.4.60
authorDongjin Choi <milkelf.choi@samsung.com>
Wed, 14 Aug 2013 10:31:59 +0000 (19:31 +0900)
committerDongjin Choi <milkelf.choi@samsung.com>
Wed, 14 Aug 2013 10:31:59 +0000 (19:31 +0900)
[model] REDWOOD
[binary_type] PDA
[customer] OPEN

[Issue#] Intensive TC
[Problem] Improper UnkownError throw.
[Solution] Throw InvaluesValuesError
[SCMRequest] N/A

[Issue] N/A
[Problem] sms and mms send check routine modification
[Cause] sms and mms send check routine modification
[Solution] sms and mms send check routine modification

[Issue] N/A
[Problem] can assign null value to non-nullable.
[Cause] don't use StaticValue.
[Solution] using StaticValue.

[Issue#] CID-12643/12644
[Problem] Copy-paste error (COPY_PASTE_ERROR)
[Cause] Copy-paste error (COPY_PASTE_ERROR)
[Solution] Change Log Message

[Contact] comply with TCT's attribute converting rule

[Issue#] N/A
[Problem] Calendar alarm description and task prgoress value validation failed.
[Cause] Wrong default value and conversion.
[Solution] Set the default description value as guided and fix the progress conversion routine.

[Issue] N/A
[Problem] minor bug
[Cause] N/A
[Solution] 1. ignore the set operation when invalid data is set for orientation
           2. add the 'catch' condition for filter operation.
           3. change the exception type from platformexception
           4. unsetChangeListener API call before calling set operation

[Issue#] redmine 1511/1512/1513/1514
[Problem] Wrong attributes handling.
[Cause] Wrong array and default value management.
[Solution] Fix array management routine and set correct default values.

[Issue#] Intensive TC
[Problem] According to spec, the default timeout MUST be set
[Cause] N/A
[Solution] N/A

[Issue#] Intensive TC
[Problem] UnknownError is returned
[Cause] N/A
[Solution] N/A

[Issue#] N/A
[Problem] InvalidValuesError is thrown
[Cause] N/A
[Solution] N/A

[Issue#] N/A
[Problem] Wrong default calendar alarm description value.
[Cause] Wrong default value used.
[Solution] Set the empty string defautl value.

[Issue#] N/A
[Problem] Build warning occurs.
[Cause] unused variable
[Solution] removed unused variable

[Issue#] N/A
[Problem] Dummy constructor may needed in the future
[Cause] Needed for type checking (use with instanceof)
[Solution] Inserted dummy constructor

[Issue#] N/A
[Problem] Type comparison waring
[Cause] N/A
[Solution] Convert type

[Issue#] TTS-1840
[Problem] onprogress cb gives empty pkgid sometimes
[Cause] package-manager callback gives empty string with wrong package
[Solution] inserted defence code for empty string

[Issue#] N/A
[Problem] Calendar array attribute values not updated.
[Cause] Wrong array attribute set routine.
[Solution] Renew the saved JS object in set routine.

[Issue#] prevent 10951 17433 17454 17455
[Problem] find flaw by 'prevent' tool
[Cause] internal error
[Solution] change code

[Issue#] N_SE-48519
[Problem] Message sent successfully but still progress icon and progressing shows
[Cause] update message network status and folder for old data
[Solution] update message network status and folder for new data

[Issue] N/A
[Problem] setProperty function be called by self.
[Cause] using JSUtil::setProperty function in setProperty function(Static Values).
[solution] removed JSUtil::setProperty.

[Issue#] N/A
[Problem] WRT security API has been changed.
[Cause] Security error layed has been added.
[Solution] Inserted the routine to process new error.

[Issue#] N/A
[Problem] Filter had wrong default values
[Cause] Code error
[Solution] Fixed error codes

[Issue] N/A
[Problem] An error occurs when coping file in wgt-package
[Cause] checking permissions in copyTo
[Solution] removed check permission module.

[team] WebAPI
[request] N/A
[horizontal_expansion] N/A

UnitTC passed.

49 files changed:
packaging/wrt-plugins-tizen.spec
src/Alarm/JSAlarmAbsolute.cpp
src/Bluetooth/BluetoothAdapter.cpp
src/Bluetooth/JSBluetoothAdapter.cpp
src/Calendar/CalendarConverter.cpp
src/Calendar/CalendarEvent.cpp
src/Calendar/CalendarEvent.h
src/Calendar/EventId.cpp
src/Calendar/JSCalendarItemProperties.cpp
src/Calendar/JSCalendarRecurrenceRule.cpp
src/Calendar/JSCalendarTask.cpp
src/Common/JSWebAPIError.cpp
src/Common/JSWebAPIError.h
src/Common/JSWebAPIException.cpp
src/Common/JSWebAPIException.h
src/Common/Logger.h
src/Common/SecurityExceptions.h
src/Contact/ContactSearchEngine.cpp
src/Contact/JSContact.cpp
src/Contact/JSContactAddress.cpp
src/Contact/JSContactAnniversary.cpp
src/Contact/JSContactGroup.cpp
src/Contact/JSContactName.cpp
src/Contact/JSContactOrganization.cpp
src/Contact/JSContactWebSite.cpp
src/Contact/JSPerson.cpp
src/Contact/PersonSearchEngine.cpp
src/Content/ContentManager.cpp
src/Content/ContentSearchVisitor.cpp
src/Content/IContentManager.cpp
src/Content/JSImage.cpp
src/Filesystem/INode.h
src/Filesystem/JSFile.cpp [changed mode: 0644->0755]
src/Filesystem/JSFilesystemManager.cpp
src/Filesystem/Manager.cpp
src/Filesystem/Manager.h
src/Filesystem/Node.cpp
src/Filesystem/Node.h
src/Filesystem/ResponseDispatcher.cpp
src/Messaging/Mms.cpp
src/Messaging/Sms.cpp
src/Notification/JSNotificationDetailInfo.cpp
src/Notification/JSNotificationDetailInfo.h
src/Notification/JSStatusNotification.cpp
src/Notification/JSStatusNotification.h
src/Package/PackageManager.cpp
src/TimeUtil/TimeUtilTools.cpp
src/Tizen/JSAttributeFilter.cpp
src/Tizen/JSAttributeRangeFilter.cpp

index 4cd16c2..cdec69c 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       wrt-plugins-tizen
 Summary:    JavaScript plugins for WebRuntime
-Version:    0.4.59
+Version:    0.4.60
 Release:    0
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index 7f24090..e0f8507 100644 (file)
@@ -125,7 +125,7 @@ JSObjectRef DLL_EXPORT JSAlarmAbsolute::constructor(JSContextRef ctx, JSObjectRe
             if (JSIsArrayValue(ctx, arguments[1])) {
                 std::vector<std::string> daysOfTheWeek =  validator.toStringVector(1);
 
-                for (int i = 0; i < daysOfTheWeek.size(); i++ ) {
+                for (size_t i = 0; i < daysOfTheWeek.size(); i++ ) {
                     if ( (daysOfTheWeek[i]!="SU") && (daysOfTheWeek[i]!="MO") &&
                          (daysOfTheWeek[i]!="TU") && (daysOfTheWeek[i]!="WE") &&
                          (daysOfTheWeek[i]!="TH") && (daysOfTheWeek[i]!="FR") &&
index 0203a4e..026120c 100644 (file)
@@ -402,6 +402,14 @@ void BluetoothAdapter::onBondCreatedCB(int result, bt_device_info_s *deviceInfo,
                 callback->invokeCallback("success", deviceObj);
             }
         }
+        if(result == BT_ERROR_REMOTE_DEVICE_NOT_FOUND) {
+            if(callback) {
+                LoggerE("Not found");
+                JSContextRef context = callback->getContext();
+                NotFoundException error("Not found");
+                callback->invokeCallback("error", JSWebAPIErrorFactory::makeErrorObject(context, error));
+            }
+        }
         else {
             if(callback) {
                 JSContextRef context = callback->getContext();
index 22badc7..e5168dd 100644 (file)
@@ -265,7 +265,7 @@ JSValueRef JSBluetoothAdapter::setVisible(JSContextRef context,
         bool mode = validator.toBool(0);  // mode
         JSObjectRef successCallback = validator.toFunction(1, true);  // successCallback  
         JSObjectRef errorCallback = validator.toFunction(2, true);  // errorCallback
-        unsigned long timeout = validator.toULong(3, true);  // timeout 
+        unsigned long timeout = validator.toULong(3, true, 180);  // timeout
         if(timeout > 65535)
             timeout = 180;
 
@@ -664,7 +664,7 @@ JSValueRef JSBluetoothAdapter::getBluetoothProfileHandler(JSContextRef context,
         TIME_TRACER_ITEM_END(__FUNCTION__, 1);
 
         if(!isCorrectParameter) {
-            throw InvalidValuesException("Invalid Value");
+            throw TypeMismatchException("Type Mismatch");
         }
         
         return profileHandler;
index 03e6fca..d2e015e 100755 (executable)
@@ -867,9 +867,7 @@ CalendarEventPtr CalendarConverter::toItem(const JSValueRef value, bool updateMo
     if (!JSValueIsUndefined(m_context, durationData) && !JSValueIsNull(m_context, durationData)) {
            Try {
                        DurationPropertiesPtr duration = timeUtilConverter.getDuration(durationData);
-               long long length = duration->length;
-               int unit = duration->unit;
-               LoggerD("duration length: "<<length<<", unit "<<unit);
+               LoggerD("duration length: "<<duration->length<<", unit "<<duration->unit);
 
                        result->setDuration(duration);
        } Catch(Exception) {
@@ -958,7 +956,7 @@ CalendarEventPtr CalendarConverter::toItem(const JSValueRef value, bool updateMo
 
     }
     if (!JSValueIsUndefined(m_context, progressData)) {
-        result->setProgress(toInt(progressData));
+        result->setProgress(toUChar(progressData));
     }
     LoggerD("timezone: "<<result->getTimeZone());
 
index 4636f7b..ec3558c 100755 (executable)
@@ -32,6 +32,7 @@ CalendarEvent::CalendarEvent():
     m_recurrence(new EventRecurrenceRule()),
     m_status(UNDEFINED_STATUS),
     m_alarms(new EventAlarmList()),
+    m_alarmsJSRef(NULL),
     m_categories(new StringArray()),
     m_categoriesJSRef(NULL),
     m_isAllDay(false),
@@ -41,6 +42,7 @@ CalendarEvent::CalendarEvent():
     m_uid(UNDEFINED_ID),
     m_recurrenceId(UNDEFINED_TIME),
     m_attendees(new EventAttendeeList()),
+    m_attendeesJSRef(NULL),
     m_isDetached(false),
     m_geolocation(new DeviceAPI::Tizen::SimpleCoordinates(UNDEFINED_GEO, UNDEFINED_GEO)),
     m_timeZone(DEFAULT_TIMEZONE),
@@ -104,6 +106,7 @@ CalendarEvent::CalendarEvent(const CalendarEvent &original)
         alarmPtr->setDescription(original.getAlarms()->at(i)->getDescription());
         m_alarms->push_back(alarmPtr);
     }
+       m_alarmsJSRef = NULL;
 
     StringArrayPtr categoriesPtr( new StringArray() );
     m_categories = categoriesPtr;
@@ -136,6 +139,7 @@ CalendarEvent::CalendarEvent(const CalendarEvent &original)
         attendeePtr->setContactId(original.getAttendees()->at(i)->getContactId());
         m_attendees->push_back(attendeePtr);
     }
+       m_attendeesJSRef = NULL;
 
     m_isDetached = original.getIsDetached();
 
@@ -154,10 +158,20 @@ CalendarEvent::CalendarEvent(const CalendarEvent &original)
 
 CalendarEvent::~CalendarEvent()
 {
+       if(m_alarmsJSRef) {
+               LoggerD("Unprotect JS alarms.");
+               JSValueUnprotect(m_context, m_alarmsJSRef);
+       }
+
        if(m_categoriesJSRef) {
                LoggerD("Unprotect JS categories.");
                JSValueUnprotect(m_context, m_categoriesJSRef);
        }
+
+       if(m_attendeesJSRef) {
+               LoggerD("Unprotect JS attendees.");
+               JSValueUnprotect(m_context, m_attendeesJSRef);
+       }
 }
 
 int CalendarEvent::getId() const
@@ -295,6 +309,14 @@ void CalendarEvent::setAlarms(const EventAlarmListPtr value)
 {
     m_alarms = value;
 }
+JSObjectRef CalendarEvent::getAlarmsJSRef() const
+{
+    return m_alarmsJSRef;
+}
+void CalendarEvent::setAlarmsJSRef(const JSObjectRef value)
+{
+    m_alarmsJSRef = value;
+}
 
 StringArrayPtr CalendarEvent::getCategories() const
 {
@@ -428,6 +450,14 @@ void CalendarEvent::setAttendees(const EventAttendeeListPtr value)
 {
     m_attendees = value;
 }
+JSObjectRef CalendarEvent::getAttendeesJSRef() const
+{
+    return m_attendeesJSRef;
+}
+void CalendarEvent::setAttendeesJSRef(const JSObjectRef value)
+{
+    m_attendeesJSRef = value;
+}
 
 bool CalendarEvent::getIsDetached() const
 {
index c88737a..10c4f6b 100755 (executable)
@@ -137,6 +137,8 @@ class CalendarEvent
 
     EventAlarmListPtr getAlarms() const;
     void setAlarms(const EventAlarmListPtr value);
+    JSObjectRef getAlarmsJSRef() const;
+    void setAlarmsJSRef(const JSObjectRef value);
 
     StringArrayPtr getCategories() const;
     void setCategories(const StringArrayPtr value);
@@ -169,6 +171,8 @@ class CalendarEvent
 
     EventAttendeeListPtr getAttendees() const;
     void setAttendees(const EventAttendeeListPtr value);
+    JSObjectRef getAttendeesJSRef() const;
+    void setAttendeesJSRef(const JSObjectRef value);
 
     bool getIsDetached() const;
     void setIsDetached(bool value);
@@ -210,6 +214,7 @@ class CalendarEvent
     EventRecurrenceRulePtr m_recurrence;
     EventStatus m_status;
     EventAlarmListPtr m_alarms;
+       JSObjectRef m_alarmsJSRef;
     StringArrayPtr m_categories;
        JSObjectRef m_categoriesJSRef;
     bool m_isAllDay;
@@ -220,6 +225,7 @@ class CalendarEvent
     std::string m_uid; // uid is same with id.
     long long int m_recurrenceId;
     EventAttendeeListPtr m_attendees;
+       JSObjectRef m_attendeesJSRef;
     bool m_isDetached;
        DeviceAPI::Tizen::SimpleCoordinatesPtr m_geolocation;
     std::string m_timeZone;
index d91979f..d89f4bd 100755 (executable)
@@ -23,8 +23,8 @@ namespace Calendar {
 
 EventId::EventId()
 {
-    m_uid = "";
-    m_recurrenceId = "0";
+    m_uid = UNDEFINED_ID;
+    m_recurrenceId = UNDEFINED_ID;
     m_calendarType = CalendarEvent::UNDEFINED_TYPE;
 }
 
index d0c643e..834bc95 100755 (executable)
@@ -559,9 +559,17 @@ bool JSCalendarItemProperties::setPropertyCategories(JSContextRef context,
 {
     Try
     {
-        CalendarEventPtr event = getPrivateObject(object);
+        CalendarEventPtr item = getPrivateObject(object);
         CalendarConverter converter(context);
-               event->setCategories(converter.toStringArray(value));
+               item->setCategories(converter.toStringArray(value));
+
+               if(item->getCategoriesJSRef()) {
+                       LoggerI("Replace a JS object for categories.");
+                       JSValueUnprotect(item->getContext(), item->getCategoriesJSRef());
+                       item->setCategoriesJSRef(converter.toJSObjectRef(value));
+                       JSValueProtect(item->getContext(), value);
+               }
+
         return true;
     }
     Catch(Exception)
@@ -622,18 +630,30 @@ JSValueRef JSCalendarItemProperties::getPropertyAlarms(JSContextRef context,
 {
     Try
     {
-        CalendarEventPtr event = getPrivateObject(object);
+        CalendarEventPtr item = getPrivateObject(object);
 
-        JSObjectRef jsResult = JSCreateArrayObject(context, 0, NULL);
-        if (NULL == jsResult) {
-            ThrowMsg(NullPointerException, "Can not create array object.");
-        }
-        for( unsigned int i=0; i<event->getAlarms()->size(); i++) {
-            if (!JSSetArrayElement(context, jsResult, i, JSCalendarAlarm::createJSCalendarAlarm(context, event->getAlarms()->at(i)))) {
-               ThrowMsg(UnknownException, "Can not insert value into array.");
-            }
-        }
-        return jsResult;
+               if(item->getAlarmsJSRef()) {
+                       return item->getAlarmsJSRef();
+               } else {
+                       LoggerI("Create a JS object for alarms.");
+                   JSObjectRef jsAlarms = JSCreateArrayObject(context, 0, NULL);
+                   if (NULL == jsAlarms) {
+                       ThrowMsg(NullPointerException, "Cannot create an array object.");
+                   }
+                   for( unsigned int i=0; i<item->getAlarms()->size(); i++) {
+                       if (!JSSetArrayElement(context, jsAlarms, i, JSCalendarAlarm::createJSCalendarAlarm(context, item->getAlarms()->at(i)))) {
+                          ThrowMsg(UnknownException, "Cannot insert a value into array.");
+                       }
+                   }
+
+                       JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
+               CalendarConverter converter(globalContext);
+                       item->setAlarmsJSRef(converter.toJSObjectRef(jsAlarms));
+                       JSValueProtect(globalContext, jsAlarms);
+                       item->setContext(globalContext);
+
+                   return jsAlarms;
+               }
     }
     Catch(Exception)
     {
@@ -648,15 +668,23 @@ bool JSCalendarItemProperties::setPropertyAlarms(JSContextRef context,
         JSValueRef value,
         JSValueRef* exception)
 {
-    CalendarEventPtr event(NULL);
+    CalendarEventPtr item(NULL);
     Try
     {
-        event = getPrivateObject(object);
+        item = getPrivateObject(object);
         CalendarConverter converter(context);
 
         EventAlarmListPtr alarms = converter.toVectorOfEventAlarmsFromReference(value);
 
-        event->setAlarms(alarms);
+        item->setAlarms(alarms);
+
+               if(item->getAlarmsJSRef()) {
+                       LoggerI("Replace a JS object for alarms.");
+                       JSValueUnprotect(item->getContext(), item->getAlarmsJSRef());
+                       item->setAlarmsJSRef(converter.toJSObjectRef(value));
+                       JSValueProtect(item->getContext(), value);
+               }
+
         return true;
     }
     Catch(Exception)
@@ -843,14 +871,7 @@ bool JSCalendarItemProperties::setPropertyDuration(JSContextRef context,
         TimeUtilConverter timeUtilConverter(context);
 
                DurationPropertiesPtr duration = timeUtilConverter.getDuration(value);
-        long long length = duration->length;
-        int unit = duration->unit;
-        if (length < 0) {
-            DeviceAPI::Common::JSWebAPIErrorFactory::postException(context, exception, DeviceAPI::Common::JSWebAPIErrorFactory::INVALID_VALUES_ERROR);
-            return false;
-        }
-
-        LoggerD("length: "<<length<< ", unit:" <<unit);
+        LoggerD("length: "<<duration->length<< ", unit:" <<duration->unit);
                item->setDuration(duration);
 
                item->setEndTime(UNDEFINED_TIME);
@@ -911,19 +932,30 @@ JSValueRef JSCalendarItemProperties::getPropertyAttendees(JSContextRef context,
 {
     Try
     {
-        CalendarEventPtr event = getPrivateObject(object);
-        EventAttendeeListPtr attendees = event->getAttendees();
-        if (attendees) {
-            JSObjectRef jsResult = JSCreateArrayObject(context, 0, NULL);
-            if (NULL == jsResult) {
-                ThrowMsg(NullPointerException, "Can not create array object.");
+        CalendarEventPtr item = getPrivateObject(object);
+
+               if(item->getAttendeesJSRef()) {
+                       return item->getAttendeesJSRef();
+               } else {
+                       LoggerI("Create a JS object for attendees.");
+            JSObjectRef jsAttendees = JSCreateArrayObject(context, 0, NULL);
+            if (NULL == jsAttendees) {
+                ThrowMsg(NullPointerException, "Cannot create an array object.");
             }
+               EventAttendeeListPtr attendees = item->getAttendees();
             for(unsigned int i=0; i<attendees->size(); i++) {
-                if (!JSSetArrayElement(context, jsResult, i, JSCalendarAttendee::createJSCalendarAttendee(context, attendees->at(i)))) {
-                   ThrowMsg(UnknownException, "Can not insert value into array.");
+                if (!JSSetArrayElement(context, jsAttendees, i, JSCalendarAttendee::createJSCalendarAttendee(context, attendees->at(i)))) {
+                   ThrowMsg(UnknownException, "Cannot insert a value into array.");
                 }
             }
-            return jsResult;
+
+                       JSContextRef globalContext = GlobalContextManager::getInstance()->getGlobalContext(context);
+               CalendarConverter converter(globalContext);
+                       item->setAttendeesJSRef(converter.toJSObjectRef(jsAttendees));
+                       JSValueProtect(globalContext, jsAttendees);
+                       item->setContext(globalContext);
+
+                       return jsAttendees;
         }
     }
     Catch(Exception)
@@ -941,9 +973,17 @@ bool JSCalendarItemProperties::setPropertyAttendees(JSContextRef context,
 {
     Try
     {
-        CalendarEventPtr event = getPrivateObject(object);
+        CalendarEventPtr item = getPrivateObject(object);
         CalendarConverter converter(context);
-        event->setAttendees(converter.toVectorOfAttendeesFromReference(value));
+        item->setAttendees(converter.toVectorOfAttendeesFromReference(value));
+
+               if(item->getAttendeesJSRef()) {
+                       LoggerI("Replace a JS object for attendees.");
+                       JSValueUnprotect(item->getContext(), item->getAttendeesJSRef());
+                       item->setAttendeesJSRef(converter.toJSObjectRef(value));
+                       JSValueProtect(item->getContext(), value);
+               }
+
         return true;
     }
     Catch(Exception)
@@ -972,7 +1012,7 @@ JSValueRef JSCalendarItemProperties::getPropertyDueDate(JSContextRef context,
         }
 
         if (UNDEFINED_TIME==task->getEndTime()) {
-            return JSValueMakeUndefined(context);
+            return JSValueMakeNull(context);
         } else {
             TimeUtilConverter timeConverter(context);
             return timeConverter.toJSValueRefTZDate((double)(task->getEndTime()*1000.0), task->getTimeZone());
index 56332d3..592691c 100755 (executable)
@@ -310,7 +310,7 @@ bool JSCalendarRecurrenceRule::setProperty(JSContextRef context,
             rrule->setFrequency(converter.toRecurrenceFrequency(frequency));
             return true;
         } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_INTERVAL)) {
-            int interval = converter.toInt(value);
+            unsigned short interval = (unsigned short)(converter.toULong(value));
             rrule->setInterval(interval);
             return true;
         } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_UNTIL_DATE)) {
@@ -337,6 +337,14 @@ bool JSCalendarRecurrenceRule::setProperty(JSContextRef context,
             return true;*/
         } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_DAYS_OF_THE_WEEK)) {
             rrule->setDaysOfTheWeek(converter.toStringArray(value));
+
+                       if(rrule->getDaysOfTheWeekJSRef()) {
+                               LoggerI("Replace a JS object for rrule daysOfTheWeek.");
+                               JSValueUnprotect(rrule->getContext(), rrule->getDaysOfTheWeekJSRef());
+                               rrule->setDaysOfTheWeekJSRef(converter.toJSObjectRef(value));
+                               JSValueProtect(rrule->getContext(), value);
+                       }
+
             return true;
         /*} else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_DAYS_OF_THE_YEAR)) {
             std::vector<int> daysOfTheYear = converter.toVectorOfInts(value);
@@ -348,9 +356,25 @@ bool JSCalendarRecurrenceRule::setProperty(JSContextRef context,
             return true;*/
         } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_SET_POSITIONS)) {
             rrule->setSetPositions(converter.toNumberArray(value));
+
+                       if(rrule->getSetPositionsJSRef()) {
+                               LoggerI("Replace a JS object for rrule setPositions.");
+                               JSValueUnprotect(rrule->getContext(), rrule->getSetPositionsJSRef());
+                               rrule->setSetPositionsJSRef(converter.toJSObjectRef(value));
+                               JSValueProtect(rrule->getContext(), value);
+                       }
+
             return true;
         } else if (JSStringIsEqualToUTF8CString(propertyName, TIZEN_RECURRENCE_RULE_EXCEPTIONS)) {
             rrule->setExceptions(converter.toTZDateArray(value));
+
+                       if(rrule->getExceptionsJSRef()) {
+                               LoggerI("Replace a JS object for rrule exceptions.");
+                               JSValueUnprotect(rrule->getContext(), rrule->getExceptionsJSRef());
+                               rrule->setExceptionsJSRef(converter.toJSObjectRef(value));
+                               JSValueProtect(rrule->getContext(), value);
+                       }
+
             return true;
         }
     }
index a6dcece..27f6c87 100755 (executable)
@@ -285,7 +285,7 @@ JSValueRef JSCalendarTask::getPropertyCompletedDate(JSContextRef context,
         }
 
         if (UNDEFINED_TIME==task->getCompletedDate()) {
-            return JSValueMakeUndefined(context);
+            return JSValueMakeNull(context);
         } else {
             TimeUtilConverter timeConverter(context);
             return timeConverter.toJSValueRefTZDate((double)(task->getCompletedDate()*1000.0), task->getTimeZone());
@@ -365,7 +365,7 @@ bool JSCalendarTask::setPropertyProgress(JSContextRef context,
     {
         CalendarEventPtr task = getPrivateObject(object);
         Converter converter(context);
-        int progress = converter.toInt(value);
+        int progress = converter.toUChar(value);
         task->setProgress(progress);
         return true;
     }
index c600aa8..6380462 100644 (file)
@@ -50,7 +50,7 @@ JSClassDefinition JSWebAPIError::m_classInfo =
        NULL, // getPropertyNames,
        NULL, // callAsFunction,
        NULL, // callAsConstructor,
-       hasInstance,
+       NULL, // hasInstance,
        NULL, // convertToType,
 };
 
@@ -105,6 +105,17 @@ WebAPIError* JSWebAPIError::getPriv(JSContextRef context, JSObjectRef object)
        return static_cast<WebAPIError*>(JSObjectGetPrivate(object));
 }
 
+JSObjectRef JSWebAPIError::constructor(JSContextRef context,
+               JSObjectRef constructor,
+               size_t argumentCount,
+               const JSValueRef arguments[],
+               JSValueRef* exception)
+{
+       return JSWebAPIErrorFactory::postException(context, exception,
+                       JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR,
+                       "Illegal constructor");
+}
+
 void JSWebAPIError::initialize(JSContextRef /*context*/, JSObjectRef /*object*/)
 {
 }
@@ -182,13 +193,5 @@ JSValueRef JSWebAPIError::toString(JSContextRef context,
        return JSUtil::toJSValueRef(context, result);
 }
 
-bool JSWebAPIError::hasInstance(JSContextRef context,
-               JSObjectRef constructor,
-               JSValueRef possibleInstance,
-               JSValueRef* /*exception*/)
-{
-       return JSValueIsObjectOfClass(context, constructor, getClassRef());
-}
-
 } // Common
 } // DeviceAPI
index c39a588..3596a9d 100644 (file)
@@ -37,6 +37,12 @@ public:
 
        static bool isObjectOfClass(JSContextRef context, JSValueRef value);
 
+       static JSObjectRef constructor(JSContextRef context,
+                       JSObjectRef constructor,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
+
 private:
        static JSObjectRef createJSObject(JSContextRef context, WebAPIError* webapiError);
 
@@ -51,11 +57,6 @@ private:
                        JSStringRef propertyName,
                        JSValueRef* exception);
 
-       static bool hasInstance(JSContextRef context,
-                       JSObjectRef constructor,
-                       JSValueRef possibleInstance,
-                       JSValueRef* exception);
-
        static JSValueRef toString(JSContextRef context,
                        JSObjectRef object,
                        JSObjectRef thisObject,
index d2600eb..0aac394 100644 (file)
@@ -19,7 +19,7 @@
 #include <string>
 #include <map>
 #include "JSUtil.h"
-#include "JSWebAPIError.h"
+#include "JSStringRefWrapper.h"
 #include "Logger.h"
 
 namespace DeviceAPI {
@@ -27,6 +27,11 @@ namespace Common {
 
 #define CLASS_NAME  "WebAPIException"
 
+#define PROPERTY_CODE                           "code"
+#define PROPERTY_NAME                           "name"
+#define PROPERTY_TYPE                           "type"
+#define PROPERTY_MESSAGE                                               "message"
+
 #define PROPERTY_INDEX_SIZE_ERR                 "INDEX_SIZE_ERR"
 #define PROPERTY_DOMSTRING_SIZE_ERR             "DOMSTRING_SIZE_ERR"
 #define PROPERTY_HIERARCHY_REQUEST_ERR          "HIERARCHY_REQUEST_ERR"
@@ -90,7 +95,7 @@ JSClassDefinition JSWebAPIException::m_classInfo =
        0,
        kJSClassAttributeNone,
        CLASS_NAME,
-       JSWebAPIError::getClassRef(),
+       0,
        m_properties,
        m_function,
        initialize,
@@ -102,7 +107,7 @@ JSClassDefinition JSWebAPIException::m_classInfo =
        NULL, // getPropertyNames,
        NULL, // callAsFunction,
        NULL, // callAsConstructor,
-       hasInstance,
+       NULL, // hasInstance,
        NULL, // convertToType,
 };
 
@@ -113,6 +118,10 @@ JSStaticFunction JSWebAPIException::m_function[] =
 };
 
 JSStaticValue JSWebAPIException::m_properties[] = {
+       { PROPERTY_CODE,                            getProperty, NULL, kJSPropertyAttributeReadOnly },
+       { PROPERTY_NAME,                            getProperty, NULL, kJSPropertyAttributeReadOnly },
+       { PROPERTY_TYPE,                            getProperty, NULL, kJSPropertyAttributeReadOnly },
+       { PROPERTY_MESSAGE,                         getProperty, NULL, kJSPropertyAttributeReadOnly },
        { PROPERTY_INDEX_SIZE_ERR,                  getStaticProperty, NULL, kJSPropertyAttributeReadOnly },
        { PROPERTY_DOMSTRING_SIZE_ERR,              getStaticProperty, NULL, kJSPropertyAttributeReadOnly },
        { PROPERTY_HIERARCHY_REQUEST_ERR,           getStaticProperty, NULL, kJSPropertyAttributeReadOnly },
@@ -178,6 +187,27 @@ WebAPIError* JSWebAPIException::getPriv(JSContextRef context, JSObjectRef object
        return static_cast<WebAPIError*>(JSObjectGetPrivate(object));
 }
 
+JSObjectRef JSWebAPIException::constructor(JSContextRef context,
+               JSObjectRef constructor,
+               size_t argumentCount,
+               const JSValueRef arguments[],
+               JSValueRef* exception)
+{
+       return JSWebAPIErrorFactory::postException(context, exception,
+                       JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR,
+                       "Illegal constructor");
+}
+
+void JSWebAPIException::initializeConstructor(JSContextRef context, JSObjectRef constructor)
+{
+       for(DeviceAPIErrorCodeMap::iterator iter = errorCodes.begin(); iter != errorCodes.end(); iter++)
+       {
+               JSStringRefWrapper name(iter->first);
+               JSValueRef value = JSValueMakeNumber(context, static_cast<double>(iter->second));
+               JSObjectSetProperty(context, constructor, name.get(), value, kJSPropertyAttributeReadOnly, NULL);
+       }
+}
+
 void JSWebAPIException::initialize(JSContextRef /*context*/, JSObjectRef /*object*/)
 {
 }
@@ -186,6 +216,47 @@ void JSWebAPIException::finalize(JSObjectRef /*object*/)
 {
 }
 
+JSValueRef JSWebAPIException::getProperty(JSContextRef context,
+               JSObjectRef object,
+               JSStringRef propertyName,
+               JSValueRef* /*exception*/)
+{
+       WebAPIError* webapiErrObj = getPriv(context, object);
+       if(!webapiErrObj)
+       {
+               LoggerE("Private object is not set.");
+               return JSValueMakeUndefined(context);
+       }
+
+       try
+       {
+               std::string propertyNameStr = JSUtil::JSStringToString(context, propertyName);
+
+               if (propertyNameStr == PROPERTY_CODE)
+               {
+                       return JSUtil::toJSValueRef(context, static_cast<long>(webapiErrObj->getCode()));
+               }
+               else if (propertyNameStr == PROPERTY_NAME)
+               {
+                       return JSUtil::toJSValueRef(context, webapiErrObj->getName());
+               }
+               else if (propertyNameStr == PROPERTY_TYPE)
+               {
+                       return JSUtil::toJSValueRef(context, webapiErrObj->getName());
+               }
+               else if (propertyNameStr == PROPERTY_MESSAGE)
+               {
+                       return JSUtil::toJSValueRef(context, webapiErrObj->getMessage());
+               }
+       }
+       catch(const BasePlatformException & err)
+       {
+               LoggerE("Exception: " << err.getMessage());
+       }
+
+       return JSValueMakeUndefined(context);
+}
+
 JSValueRef JSWebAPIException::getStaticProperty(JSContextRef context,
                JSObjectRef object,
                JSStringRef propertyName,
@@ -229,13 +300,5 @@ JSValueRef JSWebAPIException::toString(JSContextRef context,
        return JSUtil::toJSValueRef(context, result);
 }
 
-bool JSWebAPIException::hasInstance(JSContextRef context,
-               JSObjectRef constructor,
-               JSValueRef possibleInstance,
-               JSValueRef* /*exception*/)
-{
-       return JSValueIsObjectOfClass(context, constructor, getClassRef());
-}
-
 } // Common
 } // DeviceAPI
index 25b884e..cc726e5 100644 (file)
@@ -37,6 +37,14 @@ public:
 
        static bool isObjectOfClass(JSContextRef context, JSValueRef value);
 
+       static JSObjectRef constructor(JSContextRef context,
+                       JSObjectRef constructor,
+                       size_t argumentCount,
+                       const JSValueRef arguments[],
+                       JSValueRef* exception);
+
+       static void initializeConstructor(JSContextRef context, JSObjectRef constructor);
+
 private:
        static JSObjectRef createJSObject(JSContextRef context, WebAPIError* webapiError);
 
@@ -46,14 +54,14 @@ private:
 
        static void finalize(JSObjectRef object);
 
-       static JSValueRef getStaticProperty(JSContextRef context,
+       static JSValueRef getProperty(JSContextRef context,
                        JSObjectRef object,
                        JSStringRef propertyName,
                        JSValueRef* exception);
 
-       static bool hasInstance(JSContextRef context,
-                       JSObjectRef constructor,
-                       JSValueRef possibleInstance,
+       static JSValueRef getStaticProperty(JSContextRef context,
+                       JSObjectRef object,
+                       JSStringRef propertyName,
                        JSValueRef* exception);
 
        static JSValueRef toString(JSContextRef context,
index 662e266..5101e9f 100644 (file)
         print_log(prio, LOG_TAG, platformLog.str().c_str(), __MODULE__, __func__, __LINE__, ##args); \
     } while(0)
 
-#define LoggerD(fmt, args...)    _LOGGER(DLOG_DEBUG, fmt, ##args)
-#define LoggerI(fmt, args...)     _LOGGER(DLOG_INFO, fmt, ##args)
-#define LoggerW(fmt, args...)  _LOGGER(DLOG_WARN, fmt, ##args)
-#define LoggerE(fmt, args...)    _LOGGER(DLOG_ERROR, fmt, ##args)
+#ifdef TIZEN_ENGINEER_MODE
+    #define LoggerD(fmt, args...)   _LOGGER(DLOG_DEBUG, fmt, ##args)
+#else
+    #define LoggerD(fmt, args...)   do { } while(0)
+#endif
+
+#define LoggerI(fmt, args...)   _LOGGER(DLOG_INFO, fmt, ##args)
+#define LoggerW(fmt, args...)   _LOGGER(DLOG_WARN, fmt, ##args)
+#define LoggerE(fmt, args...)   _LOGGER(DLOG_ERROR, fmt, ##args)
 
-#ifdef _SECURE_LOG
+
+#ifdef TIZEN_ENGINEER_MODE
 #define _SLOGGER(prio, fmt, args...) \
     do { \
         std::ostringstream platformLog; \
         print_log(prio, LOG_TAG, platformLog.str().c_str(), __MODULE__, __func__, __LINE__, ##args); \
     } while(0)
 #else
-#define _SLOGGER(prio,fmt,args...) (0)
+#define _SLOGGER(prio,fmt,args...)  do { } while(0)
 #endif
 
-
-#define SLoggerD(fmt, args...)    _SLOGGER(DLOG_DEBUG, fmt, ##args)
-#define SLoggerI(fmt, args...)     _SLOGGER(DLOG_INFO, fmt, ##args)
-#define SLoggerE(fmt, args...)    _SLOGGER(DLOG_ERROR, fmt, ##args)
+#define SLoggerD(fmt, args...)  _SLOGGER(DLOG_DEBUG, fmt, ##args)
+#define SLoggerI(fmt, args...)  _SLOGGER(DLOG_INFO, fmt, ##args)
+#define SLoggerE(fmt, args...)  _SLOGGER(DLOG_ERROR, fmt, ##args)
 
 #endif // __TIZEN_COMMON_LOGGER_H__
index f76b623..7ce0402 100644 (file)
@@ -31,16 +31,20 @@ namespace Common {
        #define TIZEN_SYNC_ACCESS_HANDLER(status, context, exception) \
        do { \
                switch (status) { \
-                       case AceSecurityStatus::InternalError: \
-                               return JSWebAPIErrorFactory::postException(context, exception, \
-                                               JSWebAPIErrorFactory::UNKNOWN_ERROR); \
-                               break; \
-                       case AceSecurityStatus::AccessDenied:                                  \
-                               return JSWebAPIErrorFactory::postException(context, exception, \
-                                       JSWebAPIErrorFactory::SECURITY_ERROR); \
-                               break; \
-                       default: \
-                               break; \
+               case AceSecurityStatus::InternalError: \
+                       return JSWebAPIErrorFactory::postException(context, exception, \
+                                       JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error"); \
+                       break; \
+               case AceSecurityStatus::PrivacyDenied: \
+                       return JSWebAPIErrorFactory::postException(context, exception, \
+                                       JSWebAPIErrorFactory::SECURITY_ERROR, "The user blocks an application from calling this method."); \
+                       break; \
+               case AceSecurityStatus::AccessDenied: \
+                       return JSWebAPIErrorFactory::postException(context, exception, \
+                                       JSWebAPIErrorFactory::SECURITY_ERROR, "The application does not have the privilege to call this method."); \
+                       break; \
+               default: \
+                       break; \
                } \
        } while (0)
 
@@ -53,11 +57,15 @@ namespace Common {
                switch (status) { \
                case AceSecurityStatus::InternalError: \
                        cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, \
-                                       "SECURITY_ERROR", "internal error")); \
+                                       JSWebAPIErrorFactory::UNKNOWN_ERROR, "Internal error")); \
+                       return JSValueMakeNull(context); \
+               case AceSecurityStatus::PrivacyDenied: \
+                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, \
+                                       JSWebAPIErrorFactory::SECURITY_ERROR, "The user blocks an application from calling this method.")); \
                        return JSValueMakeNull(context); \
                case AceSecurityStatus::AccessDenied: \
                        cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, \
-                                               JSWebAPIErrorFactory::SECURITY_ERROR, "Security Error")); \
+                                       JSWebAPIErrorFactory::SECURITY_ERROR, "The application does not have the privilege to call this method.")); \
                        return JSValueMakeNull(context); \
                default: \
                        break; \
index f310218..23bb9f2 100755 (executable)
@@ -859,6 +859,9 @@ void ContactSearchEngine::queryAttributeString(AttributeProperties& attributePro
 
        _CONTACTS_SVC_QUERY_FUNC_PREFIX(view_uri, query, filter);
 
+       if(property_id == _contacts_number.number && match == CONTACTS_MATCH_CONTAINS)
+               property_id = _contacts_number.normalized_number;
+
        errorCode = contacts_filter_add_str(filter, property_id, match, match_value);
        if(errorCode != CONTACTS_ERROR_NONE)
        {
@@ -979,12 +982,13 @@ void ContactSearchEngine::queryAttributeRangeInt(AttributeProperties& attributeP
                errorCode = contacts_filter_add_int(sub_filter, property_id,
                                CONTACTS_MATCH_GREATER_THAN_OR_EQUAL, initial_value);
 
-               contacts_filter_add_operator(sub_filter, CONTACTS_FILTER_OPERATOR_AND);
+               errorCode = contacts_filter_add_operator(sub_filter, CONTACTS_FILTER_OPERATOR_AND);
 
                errorCode = contacts_filter_add_int(sub_filter, property_id,
                                CONTACTS_MATCH_LESS_THAN_OR_EQUAL, end_value);
 
                errorCode = contacts_filter_add_filter(filter, sub_filter);
+               errorCode = contacts_filter_destroy(sub_filter);
        }
        else if(initial_value_is_set)
        {
@@ -1032,6 +1036,7 @@ void ContactSearchEngine::queryAttributeRangeString(AttributeProperties& attribu
                                CONTACTS_MATCH_ENDSWITH, end_value);
 
                errorCode = contacts_filter_add_filter(filter, sub_filter);
+               errorCode = contacts_filter_destroy(sub_filter);
        }
        else if(initial_value != NULL)
        {
index c2cf3c9..ef9420b 100755 (executable)
@@ -566,9 +566,9 @@ bool JSContact::setPhotoURI(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contact->unsetPhotoURI();
-               else
+               else*/
                        contact->setPhotoURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -742,9 +742,9 @@ bool JSContact::setBirthday(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contact->unsetBirthday();
-               else
+               else*/
                        contact->setBirthday(converter->toDateTm(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -1050,9 +1050,9 @@ bool JSContact::setRingtoneURI(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contact->unsetRingtoneURI();
-               else
+               else*/
                        contact->setRingtoneURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
index 12c11cf..1ae7d56 100755 (executable)
@@ -267,9 +267,9 @@ bool JSContactAddress::setCountry(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactAddress->unsetCountry();
-               else
+               else*/
                        contactAddress->setCountry(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -316,9 +316,9 @@ bool JSContactAddress::setRegion(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactAddress->unsetRegion();
-               else
+               else*/
                        contactAddress->setRegion(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -364,9 +364,9 @@ bool JSContactAddress::setCity(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactAddress->unsetCity();
-               else
+               else*/
                        contactAddress->setCity(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -413,9 +413,9 @@ bool JSContactAddress::setStreetAddress(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactAddress->unsetStreetAddress();
-               else
+               else*/
                        contactAddress->setStreetAddress(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -462,9 +462,9 @@ bool JSContactAddress::setAdditionalInformation(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactAddress->unsetAdditionalInformation();
-               else
+               else*/
                        contactAddress->setAdditionalInformation(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -511,9 +511,9 @@ bool JSContactAddress::setPostalCode(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactAddress->unsetPostalCode();
-               else
+               else*/
                        contactAddress->setPostalCode(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -661,9 +661,9 @@ bool JSContactAddress::setLabel(JSContextRef context,
                ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactAddress->unsetLabel();
-               else
+               else*/
                        contactAddress->setLabel(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
index 330b7ff..21e4d68 100755 (executable)
@@ -293,9 +293,9 @@ bool JSContactAnniversary::setLabel(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//anniversary->unsetLabel();
-               else
+               else*/
                        anniversary->setLabel(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
index 7210e73..b6f70ea 100755 (executable)
@@ -256,9 +256,9 @@ bool JSContactGroup::setId(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactGroup->unsetId();
-               else
+               else*/
                        contactGroup->setId(converter->toString(value));
                return true;
        }
@@ -307,9 +307,9 @@ bool JSContactGroup::setAddressBookId(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactGroup->unsetAddressBookId();
-               else
+               else*/
                        contactGroup->setAddressBookId(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -357,9 +357,9 @@ bool JSContactGroup::setName(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactGroup->unsetName();
-               else
+               else*/
                        contactGroup->setName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -407,9 +407,9 @@ bool JSContactGroup::setRingtoneURI(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactGroup->unsetRingtoneURI();
-               else
+               else*/
                        contactGroup->setRingtoneURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -457,9 +457,9 @@ bool JSContactGroup::setPhotoURI(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactGroup->unsetRingtoneURI();
-               else
+               else*/
                        contactGroup->setPhotoURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
index a001a5d..060c83f 100755 (executable)
@@ -277,9 +277,9 @@ bool JSContactName::setPrefix(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactName->unsetPrefix();
-               else
+               else*/
                        contactName->setPrefix(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -325,9 +325,9 @@ bool JSContactName::setSuffix(JSContextRef context,
                ContactConverterFactory::ConverterType converter =
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactName->unsetSuffix();
-               else
+               else*/
                        contactName->setSuffix(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -372,9 +372,9 @@ bool JSContactName::setFirstName(JSContextRef context,
                ContactNamePtr contactName = getPrivData(object);
                ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactName->unsetFirstName();
-               else
+               else*/
                        contactName->setFirstName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -422,9 +422,9 @@ bool JSContactName::setMiddleName(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactName->unsetMiddleName();
-               else
+               else*/
                        contactName->setMiddleName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -472,9 +472,9 @@ bool JSContactName::setLastName(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactName->unsetLastName();
-               else
+               else*/
                        contactName->setLastName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -603,9 +603,9 @@ bool JSContactName::setPhoneticFirstName(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactName->unsetPhoneticFirstName();
-               else
+               else*/
                        contactName->setPhoneticFirstName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -653,9 +653,9 @@ bool JSContactName::setPhoneticMiddleName(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactName->unsetPhoneticMiddleName();
-               else
+               else*/
                        contactName->setPhoneticMiddleName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -703,9 +703,9 @@ bool JSContactName::setPhoneticLastName(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//contactName->unsetPhoneticLastName();
-               else
+               else*/
                        contactName->setPhoneticLastName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
index a0b5e1e..0092e77 100755 (executable)
@@ -271,9 +271,9 @@ bool JSContactOrganization::setName(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetName();
-               else
+               else*/
                        organization->setName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -320,9 +320,9 @@ bool JSContactOrganization::setDepartment(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetDepartment();
-               else
+               else*/
                        organization->setDepartment(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -368,9 +368,9 @@ bool JSContactOrganization::setTitle(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetTitle();
-               else
+               else*/
                        organization->setTitle(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -416,9 +416,9 @@ bool JSContactOrganization::setRole(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetRole();
-               else
+               else*/
                        organization->setRole(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -464,9 +464,9 @@ bool JSContactOrganization::setLogoURI(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetLogoURI();
-               else
+               else*/
                        organization->setLogoURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -512,9 +512,9 @@ bool JSContactOrganization::setAssistant(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetAssistant();
-               else
+               else*/
                        organization->setAssistant(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -557,9 +557,9 @@ bool JSContactOrganization::setLocation(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetLocation();
-               else
+               else*/
                        organization->setLocation(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -605,9 +605,9 @@ bool JSContactOrganization::setDescription(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetDescription();
-               else
+               else*/
                        organization->setDescription(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -653,9 +653,9 @@ bool JSContactOrganization::setPhoneticName(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetPhoneticName();
-               else
+               else*/
                        organization->setPhoneticName(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -701,9 +701,9 @@ bool JSContactOrganization::setType(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetType();
-               else
+               else*/
                        organization->setType(converter->toContactOrganizationType(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -746,9 +746,9 @@ bool JSContactOrganization::setLabel(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//organization->unsetLabel();
-               else
+               else*/
                        organization->setLabel(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
index 5301aeb..9092bea 100755 (executable)
@@ -298,9 +298,9 @@ bool JSContactWebSite::setType(JSContextRef context,
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator =
                                BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//webSite->unsetType();
-               else
+               else*/
                {
                        ContactWebSiteType type = converter->toContactWebSiteType(converter->toString(value));
                        webSite->setType(type);
index 0d2acdd..33ea99f 100755 (executable)
@@ -366,9 +366,9 @@ bool JSPerson::setPhotoURI(JSContextRef context,
                ContactConverterFactory::ConverterType converter =
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//person->unsetPhotoURI();
-               else
+               else*/
                        person->setPhotoURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -415,9 +415,9 @@ bool JSPerson::setRingtoneURI(JSContextRef context,
                ContactConverterFactory::ConverterType converter =
                                ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//person->unsetRingtoneURI();
-               else
+               else*/
                        person->setRingtoneURI(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
@@ -462,9 +462,9 @@ bool JSPerson::setDisplayContactId(JSContextRef context,
                PersonPtr person = getPrivData(object);
                ContactConverterFactory::ConverterType converter = ContactConverterFactory::getConverter(context);
                BasicValidator validator = BasicValidatorFactory::getValidator(context, exception);
-               if(validator->isNullOrUndefined(value))
+/*             if(validator->isNullOrUndefined(value))
                        return true;//person->unsetDisplayContactId();
-               else
+               else*/
                        person->setDisplayContactId(converter->toString(value));
        }
        Catch(WrtDeviceApis::Commons::Exception)
index 47a641f..fa046cc 100755 (executable)
@@ -99,7 +99,9 @@ void PersonSearchEngine::setSortMode(SortModePtr attr)
        else
                is_ascending = false;
 
-       contacts_query_set_sort(m_query, property.propertyId, is_ascending);
+       int errorCode = contacts_query_set_sort(m_query, property.propertyId, is_ascending);
+       if(errorCode != CONTACTS_ERROR_NONE)
+               ThrowMsg(PlatformException, "Fail contacts_query_set_sort (ret:" << errorCode << ")");
 }
 
 PersonArrayPtr PersonSearchEngine::getResult()
@@ -347,7 +349,7 @@ void PersonSearchEngine::visitAttributeRange(string& attrName, AnyPtr& initialVa
                        errorCode = contacts_filter_add_int(sub_filter, property.propertyId,
                                        CONTACTS_MATCH_GREATER_THAN_OR_EQUAL, initialValueInt);
 
-                       contacts_filter_add_operator(sub_filter, CONTACTS_FILTER_OPERATOR_AND);
+                       errorCode = contacts_filter_add_operator(sub_filter, CONTACTS_FILTER_OPERATOR_AND);
 
                        errorCode = contacts_filter_add_int(sub_filter, property.propertyId,
                                        CONTACTS_MATCH_LESS_THAN_OR_EQUAL, endValueInt);
@@ -355,6 +357,7 @@ void PersonSearchEngine::visitAttributeRange(string& attrName, AnyPtr& initialVa
                        if(depth != 0)
                        {
                                errorCode = contacts_filter_add_filter(filter, sub_filter);
+                               errorCode = contacts_filter_destroy(sub_filter);
                        }
                }
                else if(initialValueExists)
@@ -412,6 +415,7 @@ void PersonSearchEngine::visitAttributeRange(string& attrName, AnyPtr& initialVa
                        if(depth != 0)
                        {
                                errorCode = contacts_filter_add_filter(filter, sub_filter);
+                               errorCode = contacts_filter_destroy(sub_filter);
                        }
                }
                else if(initialValueExists)
index 6d6d798..58eca60 100755 (executable)
@@ -766,7 +766,6 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse
                 bool success = jsFilter->validate(validator);
 
                 if(!success){
-                    eBrowse->setExceptionCode(ExceptionCodes::InvalidArgumentException);
                     ThrowMsg(InvalidArgumentException, "Invalid attirbutes.");
                 }
 
@@ -876,11 +875,16 @@ void MediacontentManager::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse
             }
         }
     }
+    catch(const InvalidArgumentException &ex) {
+        LoggerE("Exception: " << ex.DumpToString());
+        eBrowse->setExceptionCode(ExceptionCodes::InvalidArgumentException);
+        eBrowse->setResult(false);
+    }
     catch(const Exception &ex)
     {
         LoggerE("Exception: " << ex.DumpToString());
+        eBrowse->setExceptionCode(ExceptionCodes::UnknownException);
         eBrowse->setResult(false);
-        return;
     }
 }
 
index 9518ae7..41074ae 100755 (executable)
@@ -111,7 +111,7 @@ void MediaSearchVisitor::visitInComposite(FilterType& type, int depth)
        else if(type == INTERSECTION_FILTER)
                m_query.append(STR_AND);
        else{
-               ThrowMsg(PlatformException, "Filter Type is wrong.");
+               ThrowMsg(InvalidArgumentException, "Filter Type is wrong.");
        }
 }
 
@@ -136,7 +136,7 @@ string MediaSearchVisitor::getPlatformAttr(string attrName)
                }
                else
                {
-                       ThrowMsg(PlatformException, "Attribute(" << attrName << ") is not supported.");
+                       ThrowMsg(InvalidArgumentException, "Attribute(" << attrName << ") is not supported.");
                }
        }
        else if(queryType == QUERY_MEDIA)
@@ -149,7 +149,7 @@ string MediaSearchVisitor::getPlatformAttr(string attrName)
                }
                else
                {
-                       ThrowMsg(PlatformException, "Attribute(" << attrName << ") is not supported.");
+                       ThrowMsg(InvalidArgumentException, "Attribute(" << attrName << ") is not supported.");
                }
 
        }
@@ -197,7 +197,7 @@ string MediaSearchVisitor::convertAttribute(string &attrName, AnyPtr& matchValue
                        matchValueStr = "4";
                else
                {
-                       ThrowMsg(PlatformException, "mediaType(" << matchValue->getString() << ") is not supported.");
+                       ThrowMsg(InvalidArgumentException, "mediaType(" << matchValue->getString() << ") is not supported.");
                }
        }
        else if(attrName.compare("MEDIA_PATH")==0 || attrName.compare("MEDIA_THUMBNAIL_PATH")==0)
@@ -208,7 +208,7 @@ string MediaSearchVisitor::convertAttribute(string &attrName, AnyPtr& matchValue
             if(matchValue->getDouble() < MIN_LATITUDE || 
                 matchValue->getDouble() > MAX_LATITUDE)
             {
-                ThrowMsg(PlatformException, "latitude range is -90 ~ 90");
+                ThrowMsg(InvalidArgumentException, "latitude range is -90 ~ 90");
             }
             else
             {
@@ -219,7 +219,7 @@ string MediaSearchVisitor::convertAttribute(string &attrName, AnyPtr& matchValue
             if(matchValue->getDouble() < MIN_LONGITUDE|| 
                 matchValue->getDouble() > MAX_LONGITUDE)
             {
-                ThrowMsg(PlatformException, "longitude range is -180 ~ 180");
+                ThrowMsg(InvalidArgumentException, "longitude range is -180 ~ 180");
             }
             else
             {
index df69d90..5d9a40f 100755 (executable)
@@ -293,10 +293,12 @@ static void content_notification_cb(
 bool IMediacontentManager::setListener( void* user_data)
 {
     bool ret = false;
-
-    if(media_content_set_db_updated_cb(content_notification_cb,user_data) == MEDIA_CONTENT_ERROR_NONE)
+    if(media_content_unset_db_updated_cb() == MEDIA_CONTENT_ERROR_NONE)
     {
-        ret = true;
+        if(media_content_set_db_updated_cb(content_notification_cb,user_data) == MEDIA_CONTENT_ERROR_NONE)
+        {
+            ret = true;
+        }
     }
     return ret;
 }
index b897667..0644672 100755 (executable)
@@ -206,12 +206,18 @@ bool      JSImage::setPropertyOrientation(
                                JSValueRef value,
                                JSValueRef* exception)
 {
-    Try
+    try
     {
         Converter converter(context);
         MediacontentImagePtr objImg = getImageObject(object);
 
         string orientation = converter.toString(value);
+        if (orientation != "NORMAL" && orientation != "FLIP_HORIZONTAL" && 
+            orientation != "ROTATE_180" && orientation != "FLIP_VERTICAL" &&
+            orientation != "TRANSPOSE" && orientation != "ROTATE_90" &&
+            orientation != "TRANSVERSE" && orientation != "ROTATE_270"){
+            throw TypeMismatchException("Invalid orientation type");
+        }
 
         if ((objImg->getImageOrientation()).compare(orientation) !=0 )
         {
@@ -220,10 +226,9 @@ bool       JSImage::setPropertyOrientation(
 
         return true;                   
     }
-    Catch(Exception)
+    catch(...)
     {
         LoggerW("trying to get incorrect value");
-        return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR);
     }
 
     return false;
index e6b3611..163de54 100755 (executable)
@@ -176,7 +176,7 @@ class INode : public WrtDeviceApis::Commons::EventRequestReceiver<EventListNodes
     virtual void read(const EventReadTextPtr& event) = 0;
 
     virtual std::string toUri(int widgetId) const = 0;
-    virtual bool checkPermission(const IPathPtr& path, const std::string &mode, NodeType type) = 0;
+    virtual bool checkPermission(const std::string mode) = 0;
 
   protected:
     INode();
old mode 100644 (file)
new mode 100755 (executable)
index b669a6c..e9db5c8
@@ -539,7 +539,9 @@ JSValueRef JSFile::openStream(JSContextRef context,
                }
 
                if ((AM_READ != mode) && (PERM_READ == privateObject->getObject()->getNode()->getPermissions())) {
-                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
+                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, 
+                               JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "permission denied error"));                        
+                       return JSValueMakeUndefined(context);
                }
 
                std::string path = privateObject->getObject()->getNode()->getPath()->getFullPath();
@@ -725,7 +727,13 @@ JSValueRef JSFile::copyTo(JSContextRef context,
                IPathPtr src = Utils::fromVirtualPath(globalContext, converter.toString(reserveArguments[0]));
                IPathPtr dest = Utils::fromVirtualPath(globalContext, converter.toString(reserveArguments[1]));
                bool overwrite = converter.toBool(reserveArguments[2]);;
-               
+/*
+               if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) {
+                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, 
+                               JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "permission denied error"));                        
+                       return JSValueMakeUndefined(context);
+               }
+*/
                if (NT_DIRECTORY != privateObject->getObject()->getNode()->getType()) {
                        cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::IO_ERROR, "IO error"));
                        return JSValueMakeUndefined(context);
@@ -815,10 +823,6 @@ JSValueRef JSFile::moveTo(JSContextRef context,
                                reserveArguments[index] = JSValueMakeUndefined(context);                                                        
                }
 
-               if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) {
-                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
-               }
-
                Converter converter(context);
                JSValueRef onSuccess = NULL;
                JSValueRef onError = NULL;
@@ -829,6 +833,12 @@ JSValueRef JSFile::moveTo(JSContextRef context,
                cbm->setOnError(onError);
                cbm->setObject(thisObject);
 
+               if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) {
+                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, 
+                               JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "permission denied error"));                        
+                       return JSValueMakeUndefined(context);
+               }               
+
                if (NT_DIRECTORY != privateObject->getObject()->getNode()->getType()) {
                        cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::IO_ERROR, "io error"));
                        return JSValueMakeUndefined(context);
@@ -895,6 +905,9 @@ JSValueRef JSFile::createDirectory(JSContextRef context,
                if (argc < 1) {
                        ThrowMsg(InvalidArgumentException, "Invalid path name");
                }
+               if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) {
+                       ThrowMsg(WrtDeviceApis::Commons::SecurityException, "Permission denied error");
+               }
 
                IPathPtr path = converter.toPath(argv[0]);
                INodePtr node(privateObject->getObject()->getNode()->createChild(path, NT_DIRECTORY, OPT_RECURSIVE));
@@ -905,7 +918,10 @@ JSValueRef JSFile::createDirectory(JSContextRef context,
 
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
-       } catch (const WrtDeviceApis::Commons::PlatformException& ex) {
+       } catch (const WrtDeviceApis::Commons::SecurityException& ex) {
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage());
+       }
+       catch (const WrtDeviceApis::Commons::PlatformException& ex) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::IO_ERROR, ex.GetMessage());
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, ex.GetMessage());
@@ -942,6 +958,10 @@ JSValueRef JSFile::createFile(JSContextRef context,
                        ThrowMsg(InvalidArgumentException, "Invalid path name");
                }
 
+               if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) {
+                       ThrowMsg(WrtDeviceApis::Commons::SecurityException, "Permission denied error");
+               }
+
                IPathPtr path = converter.toPath(argv[0]);
                INodePtr node = privateObject->getObject()->getNode()->createChild(path, NT_FILE);
 
@@ -949,10 +969,9 @@ JSValueRef JSFile::createFile(JSContextRef context,
                privData->pushParentPermissions(privateObject->getObject()->getNode()->getPermissions());
                TIME_TRACER_ITEM_END(__FUNCTION__, 0);
                return WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(privateObject->getContext(), getClassRef(), privData);
-               /*
-               IPathPtr path = converter.toPath(argv[0]);
-               INodePtr node = privateObject->getObject()->getNode()->createChild(path, NT_FILE);
-               return JSUtils::makeObject(privateObject->getContext(), getClassRef(), node);*/
+
+       } catch (const WrtDeviceApis::Commons::SecurityException& ex) {
+               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage());
        } catch (const WrtDeviceApis::Commons::PlatformException& ex) {
                return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::IO_ERROR, ex.GetMessage());
        } catch(const WrtDeviceApis::Commons::ConversionException& ex) {
@@ -1083,7 +1102,9 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
                cbm->setObject(thisObject);
 
                if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) {
-                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
+                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, 
+                               JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "permission denied error"));                        
+                       return JSValueMakeUndefined(context);
                }
 
                if (privateObject->getObject()->getNode()->getType() != NT_DIRECTORY) {
@@ -1096,7 +1117,7 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
                bool recursive = converter.toBool(reserveArguments[1]);
 
                if (*privateObject->getObject()->getNode()->getPath() != path->getPath()) {
-                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::NOT_FOUND_ERROR, "not found error"));
+                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::NOT_FOUND_ERROR, "not found error in current directory"));
                        return JSValueMakeUndefined(context);
                }
 
@@ -1108,6 +1129,9 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
 
                                if(eventResolve->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) 
                                        ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "Not found error");
+                               else if(eventResolve->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException){
+                                       ThrowMsg(WrtDeviceApis::Commons::SecurityException, "Permission denied error");
+                               }
                                else 
                                        ThrowMsg(PlatformException, "IO Error");
                        }
@@ -1139,7 +1163,9 @@ JSValueRef JSFile::deleteDirectory(JSContextRef context,
                cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage()));
        } catch(const WrtDeviceApis::Commons::NotFoundException& ex) {
                cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::NOT_FOUND_ERROR, ex.GetMessage()));
-       } catch(const WrtDeviceApis::Commons::Exception& ex) {
+       } catch(const WrtDeviceApis::Commons::SecurityException& ex) {
+               cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage()));
+       }catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage()));
        }
        TIME_TRACER_ITEM_END(__FUNCTION__, 0);
@@ -1192,11 +1218,6 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
                                reserveArguments[index] = JSValueMakeUndefined(context);                                                        
                }
 
-
-               if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) {
-                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
-               }
-
                JSValueRef onSuccess = NULL;
                JSValueRef onError = NULL;
 
@@ -1207,6 +1228,12 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
                cbm->setOnError(onError);
                cbm->setObject(thisObject);
 
+               if ((privateObject->getObject()->getNode()->getPermissions() & PERM_WRITE) == 0) {
+                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, 
+                               JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "permission denied error"));                        
+                       return JSValueMakeUndefined(context);
+               }
+
                if (privateObject->getObject()->getNode()->getType() != NT_DIRECTORY) {
                        cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::IO_ERROR, "IO error"));
                        return JSValueMakeUndefined(context);
@@ -1216,6 +1243,12 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
                Converter converter(context);
                IPathPtr path = Utils::fromVirtualPath(globalContext, converter.toString(reserveArguments[0]));
 
+               if (*privateObject->getObject()->getNode()->getPath() != path->getPath()) {
+                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::NOT_FOUND_ERROR, "not found error in current directory"));
+                       return JSValueMakeUndefined(context);
+               }
+
+
                EventResolvePtr eventResolve(new EventResolve(path));
                if (eventResolve->setForSynchronousCall()) { 
                        IManager::getInstance().getNode(eventResolve);
@@ -1225,6 +1258,9 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
                                        LoggerD("POST IO NOT_FOUND_ERROR");
                                        ThrowMsg(WrtDeviceApis::Commons::NotFoundException, "Not found error");
                                }
+                               if(eventResolve->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException){
+                                       ThrowMsg(WrtDeviceApis::Commons::SecurityException, "Permission denied error");
+                               }
 
                                LoggerD("POST IO ERROR");
                                cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::IO_ERROR, "IO error"));
@@ -1255,6 +1291,8 @@ JSValueRef JSFile::deleteFile(JSContextRef context,
                cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage()));
        } catch(const WrtDeviceApis::Commons::NotFoundException& ex) {
                cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::NOT_FOUND_ERROR, ex.GetMessage()));
+       } catch(const WrtDeviceApis::Commons::SecurityException& ex) {
+               cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage()));
        } catch(const WrtDeviceApis::Commons::Exception& ex) {
                cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, JSWebAPIErrorFactory::UNKNOWN_ERROR, ex.GetMessage()));
        }
index b6c0cef..c88b13a 100644 (file)
@@ -543,6 +543,34 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
                if (!Utils::isVirtualPath(virtualPath) && !Utils::isUriPath(virtualPath)) {
                        ThrowMsg(Commons::NotFoundException, "Location not found.");
                }
+               
+               std::string rootPath;
+               std::size_t found;
+               
+               if ((found = virtualPath.find("/")) == std::string::npos) {
+                       rootPath = virtualPath;
+               }
+               else {
+                       rootPath = virtualPath.substr(0, found);
+               }
+                       
+               if (virtualPath.find("removable") != std::string::npos) {                       
+                       LoggerD(rootPath << " : " << virtualPath);
+                       EventGetStoragePtr getStroageEvent(new EventGetStorage());
+                       getStroageEvent->setLabel(rootPath);
+                       if (getStroageEvent->setForSynchronousCall()) {
+
+                               IManager::getInstance().getStorage(getStroageEvent);
+                               StoragePropertiesPtr storage = getStroageEvent->getResult();
+
+                               if (storage->getState() != StorageProperties::STATE_MOUNTED &&
+                                       storage->getState() != StorageProperties::STATE_MOUNTED_READONLY)
+                               {
+                                       ThrowMsg(Commons::NotFoundException, "removable stroage is not available.");
+                               }
+                       }
+
+               }
 
                path = Utils::fromVirtualPath(globalContext, virtualPath);
 
@@ -556,14 +584,16 @@ JSValueRef JSFilesystemManager::resolve(JSContextRef context,
                        perm = converter->toString(reserveArguments[3]);
                        LoggerD("perms:[" << perm << "]");
                        if (("r" != perm) && ("rw" != perm) && ("w" != perm) && ("a" != perm)) {
-                               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Invalid permission");
+                               return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Invalid mode");
                        } else if ("r" == perm) {
                                permissions = PERM_READ;
                        }
                }
 
                if (permissions & PERM_WRITE && ((virtualPath == "wgt-package" ) || (virtualPath == "ringtones" ))) {
-                       return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::SECURITY_ERROR, "permission denied");
+                       cbm->callOnError(JSWebAPIErrorFactory::makeErrorObject(context, 
+                               JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "invalid mode, permission denied error"));                  
+                       return JSValueMakeUndefined(context);
                }
 
                PermissionsAccessInfo perms(permissions, virtualPath);
index 692efeb..106474c 100644 (file)
@@ -423,7 +423,7 @@ void Manager::OnRequestReceived(const EventResolvePtr& event)
 {
     try {
         INodePtr node = Node::resolve(event->getPath());
-        if (node->checkPermission(event->getPath(), event->getMode(), node->getType()) == false)
+        if (node->checkPermission(event->getMode()) == false)
         {
             ThrowMsg(Commons::SecurityException, "Permission Denied Error");
         }
@@ -519,14 +519,25 @@ void Manager::OnRequestReceived(const EventCopyPtr& event)
         }
   
         INodePtr parent;
+               
         Try {
             parent = Node::resolve(IPath::create(dest->getPath()));
+                       
+                       if (parent->checkPermission("rw") == false)
+                       {
+                               Throw(Commons::SecurityException);
+                       }
         }
         Catch(Commons::NotFoundException) 
         {
             event->setExceptionCode(_rethrown_exception.getCode());
             ReThrowMsg(Commons::NotFoundException, "could not find a destination path.");
         }
+               Catch(Commons::SecurityException)
+               {
+            event->setExceptionCode(_rethrown_exception.getCode());
+            ReThrowMsg(Commons::SecurityException, "no permission on the destination path");
+               }
         Catch (Commons::Exception) 
         {
             event->setExceptionCode(_rethrown_exception.getCode());
@@ -546,7 +557,8 @@ void Manager::OnRequestReceived(const EventCopyPtr& event)
                        ThrowMsg(Commons::PlatformException,
                        "Destination is same as source.");
                }
-               
+
+
 
         errno = 0;
         struct stat info;
@@ -642,6 +654,11 @@ void Manager::OnRequestReceived(const EventMovePtr& event)
         INodePtr parent;
         Try {
             parent = Node::resolve(IPath::create(dest->getPath()));
+                                       
+                       if (parent->checkPermission("rw") == false)
+                       {
+                               Throw(Commons::SecurityException);
+                       }
         }
                
         Catch(Commons::NotFoundException) 
@@ -649,6 +666,11 @@ void Manager::OnRequestReceived(const EventMovePtr& event)
             event->setExceptionCode(_rethrown_exception.getCode());
             ReThrowMsg(Commons::NotFoundException, "could not find a destination path.");
         }
+               Catch(Commons::SecurityException)
+               {
+            event->setExceptionCode(_rethrown_exception.getCode());
+            ReThrowMsg(Commons::SecurityException, "no permission on the destination path");
+               }
         Catch(Commons::Exception) 
         {
             LoggerE("Exception: " << _rethrown_exception.GetMessage());
@@ -770,7 +792,13 @@ void Manager::OnRequestReceived(const EventRemovePtr& event)
 {
     if (!event->checkCancelled()) {
         Try {
+
             INodePtr node = Node::resolve(event->getPath());
+                       
+                       if (node->checkPermission("rw") == false)
+                       {
+                       ThrowMsg(Commons::SecurityException, "no permission on the path");
+                       }
             node->remove(event->getOptions());
         }
         catch (const Commons::Exception& ex) 
index fb5f5e7..47b6ea9 100755 (executable)
@@ -170,6 +170,7 @@ public :
     void copyElement(const std::string &src,
                      const std::string &dest,
                      bool recursive = true) const;
+       
 
   private:
     static RootList m_rootlist;
index 08c602d..1451ec3 100644 (file)
@@ -44,13 +44,13 @@ namespace DeviceAPI {
 namespace Filesystem {
 
 #define MAX_NODE_LENGTH 256
-bool Node::checkPermission(const IPathPtr &path, const std::string &mode, NodeType type)
+bool Node::checkPermission(const std::string mode)
 {
-       switch (type)
+       switch (m_type)
        {
        case NT_DIRECTORY:
        {
-               DIR* dir = opendir(path->getFullPath().c_str());                
+               DIR* dir = opendir(m_path->getFullPath().c_str());              
                
                if (!dir) 
                        ThrowMsg(Commons::SecurityException, "Node has been deleted from platform.");
@@ -68,7 +68,7 @@ bool Node::checkPermission(const IPathPtr &path, const std::string &mode, NodeTy
                time_t now;
                time(&now);
                ss << now;
-               IPathPtr tempFilePath = IPath::create(path->getFullPath());
+               IPathPtr tempFilePath = IPath::create(m_path->getFullPath());
                tempFilePath->append(ss.str());
                try 
                {
@@ -104,7 +104,7 @@ bool Node::checkPermission(const IPathPtr &path, const std::string &mode, NodeTy
                        ThrowMsg(Commons::InvalidArgumentException, "invalid mode");
                }
                
-               stream.open(path->getFullPath().c_str(), modeBit);
+               stream.open(m_path->getFullPath().c_str(), modeBit);
 
                if (stream.is_open())
                {
index 2a59ddf..94bf411 100755 (executable)
@@ -43,7 +43,7 @@ class Node : public INode,
 
 
   public:
-    bool checkPermission(const IPathPtr& path, const std::string &mode, NodeType type);
+    bool checkPermission(const std::string mode);
     IPathPtr getPath() const;
     NodeType getType() const;
     int getPermissions() const;
index 8c8673a..9f98ff2 100644 (file)
@@ -89,7 +89,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventResolvePtr& event)
                        jsException = JSWebAPIErrorFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError");
                } 
                else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "PermissionDeniedError");
+                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "PermissionDeniedError");
                }
                else {
                        jsException = JSWebAPIErrorFactory::makeErrorObject(data->getCallbackManager()->getContext(), JSWebAPIErrorFactory::UNKNOWN_ERROR, "Unknown error");
@@ -120,11 +120,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventListNodesPtr& event)
                }
        } else {
                JSObjectRef jsException = NULL;
-               if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
-               } else {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::IO_ERROR, "IO error");
-               }
+               jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::IO_ERROR, "IO error");
                data->callOnError(jsException);
        }
 }
@@ -146,6 +142,9 @@ void ResponseDispatcher::OnAnswerReceived(const EventOpenPtr& event)
                if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
                        jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError");
                }
+               else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
+                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Permission Denied Error");
+               }
                else {
                        jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::IO_ERROR, "IO error");
                }
@@ -171,7 +170,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventCopyPtr& event)
        } else {
                JSObjectRef jsException = NULL;
                if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
+                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Permission denied error");
                } 
                else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
                        jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError");
@@ -202,7 +201,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventMovePtr& event)
        } else {
                JSObjectRef jsException = NULL;
                if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
+                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Permission denied error");
                } 
                else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
                        jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError");
@@ -227,7 +226,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventRemovePtr& event)
        } else {
                JSObjectRef jsException = NULL;
                if (event->getExceptionCode() ==WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
+                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Permission denied error");
                } 
                else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
                        jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError");
@@ -274,7 +273,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventReadTextPtr& event)
        }  else {
                JSObjectRef jsException = NULL;
                if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
+                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Permission denied error");
                } 
                else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
                        jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "NotFoundError");
@@ -302,10 +301,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventGetStoragePtr& event)
                }
        } else {
                JSObjectRef jsException = NULL;
-               if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
-               } 
-               else if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
+               if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::NotFoundException) {
                        jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::NOT_FOUND_ERROR, "Not found error");                      
                }
                else {
@@ -331,11 +327,7 @@ void ResponseDispatcher::OnAnswerReceived(const EventListStoragesPtr& event)
                }
        } else {
                JSObjectRef jsException = NULL;
-               if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::SecurityException) {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::SECURITY_ERROR, "Permission denied error");
-               } else {
-                       jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::IO_ERROR, "IO error");
-               }
+               jsException = JSWebAPIErrorFactory::makeErrorObject(data->getContext(), JSWebAPIErrorFactory::IO_ERROR, "IO error");
                data->callOnError(jsException);
        }
 }
index b48920e..1567f8c 100644 (file)
@@ -24,7 +24,7 @@
 #include "CallbackMgr.h"
 #include "MsgServiceHandleMgr.h"
 #include <Logger.h>
-#include <net_connection.h>
+#include <vconf.h>
 
 extern "C" {
 #include <msg.h>
@@ -1105,6 +1105,8 @@ void Mms::updateMessage()
 {
        LoggerD("updating m_id=" << getIdRef());
        msg_error_t err = MSG_SUCCESS;
+       int tempInt = 0;
+
        msg_struct_t msg = NULL;
        msg_struct_t sendOpt = NULL;
        
@@ -1124,8 +1126,8 @@ void Mms::updateMessage()
                
                if (err != MSG_SUCCESS)
                {
-                       LoggerE("Get Message Failed!");
-                       ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message");
+                       LoggerE("msg_get_message() Failed!");
+                       ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to get message for update");
                }
        
                if (this->getIdRef().empty()) {
@@ -1133,12 +1135,24 @@ void Mms::updateMessage()
                        ThrowMsg(WrtDeviceApis::Commons::PlatformException,
                                        "existing msgId is zero, update msg not done");
                }
-               
+
+               err = msg_get_int_value(msg, MSG_MESSAGE_NETWORK_STATUS_INT, &tempInt);
+               if(err == MSG_SUCCESS)
+               {
+                       msg_set_int_value(m_messageData, MSG_MESSAGE_NETWORK_STATUS_INT, tempInt);
+               }
+
+               err = msg_get_int_value(msg, MSG_MESSAGE_FOLDER_ID_INT, &tempInt);
+               if(err == MSG_SUCCESS)
+               {
+                       msg_set_int_value(m_messageData, MSG_MESSAGE_FOLDER_ID_INT, tempInt);
+               }
+
                update(TRUE);
                
                if (MSG_SUCCESS != msg_update_message(MsgGetCommonHandle(), m_messageData, sendOpt))
                {
-                       LoggerE("Failed to update message");
+                       LoggerE("msg_update_message() Failed!");
                        ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message");
                }
                msg_release_struct(&msg);
@@ -1678,21 +1692,26 @@ FolderType Mms::toFolder(const std::string &folder)
 bool Mms::getCellularOn()
 {
     auto cellularOn = true;
-    void* connectionHandle;
-    if (CONNECTION_ERROR_NONE == connection_create(&connectionHandle)) {
-        connection_cellular_state_e cellularState;
-        if (CONNECTION_ERROR_NONE == connection_get_cellular_state (connectionHandle,
-                                                         &cellularState)) {
-            if (CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE  == cellularState || CONNECTION_CELLULAR_STATE_FLIGHT_MODE == cellularState) {
-                cellularOn = false;
-                LoggerW("Cellular State Error" << cellularState);
-            }
-        } else {
-            LoggerE("Can't obtain state of cellular connection");
-        }
-        connection_destroy(connectionHandle);
-    } else {
-        LoggerE("Can't obtain state of cellular connection");
+    int tempInt;
+    int tempbool;
+
+    vconf_get_int(VCONFKEY_TELEPHONY_SVCTYPE, &tempInt);
+    vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &tempbool);
+    if(tempInt <= VCONFKEY_TELEPHONY_SVCTYPE_SEARCH || tempbool == TRUE)
+    {
+        LoggerE("VCONFKEY_TELEPHONY_SVCTYPE error " << tempInt);
+        LoggerE("VCONFKEY_TELEPHONY_FLIGHT_MODE error " << tempbool);
+        cellularOn = false;
+        return cellularOn;
+    }
+
+    vconf_get_bool(VCONFKEY_3G_ENABLE, &tempbool);
+    vconf_get_int(VCONFKEY_TELEPHONY_SVC_PS, &tempInt);
+    if(tempbool == FALSE || tempInt != VCONFKEY_TELEPHONY_SVC_PS_ON)
+    {
+        LoggerE("VCONFKEY_3G_ENABLE error " << tempbool);
+        LoggerE("VCONFKEY_TELEPHONY_SVC_PS_ON error " << tempInt);
+        cellularOn = false;
     }
     return cellularOn;
 }
index 74e7cfc..e3ac3c3 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "Sms.h"
 #include <vconf.h>
-#include <net_connection.h>
 #include <Commons/Exception.h>
 #include "ReqReceiverMessage.h"
 #include "Messaging.h"
@@ -338,21 +337,24 @@ FolderType Sms::toFolder(const std::string &folder)
 bool Sms::getCellularOn()
 {
     auto cellularOn = true;
-    void* connectionHandle;
-    if (CONNECTION_ERROR_NONE == connection_create(&connectionHandle)) {
-        connection_cellular_state_e cellularState;
-        if (CONNECTION_ERROR_NONE == connection_get_cellular_state (connectionHandle,
-                                                         &cellularState)) {
-            if (CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE  == cellularState || CONNECTION_CELLULAR_STATE_FLIGHT_MODE == cellularState) {
-                cellularOn = false;
-                LoggerW("Cellular State Error" << cellularState);
-            }
-        } else {
-            LoggerE("Can't obtain state of cellular connection");
-        }
-        connection_destroy(connectionHandle);
-    } else {
-        LoggerE("Can't obtain state of cellular connection");
+    int tempInt;
+    int tempbool;
+
+    vconf_get_int(VCONFKEY_TELEPHONY_SVCTYPE, &tempInt);
+    vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &tempbool);
+    if(tempInt <= VCONFKEY_TELEPHONY_SVCTYPE_SEARCH || tempbool == TRUE)
+    {
+        LoggerE("VCONFKEY_TELEPHONY_SVCTYPE error " << tempInt);
+        LoggerE("VCONFKEY_TELEPHONY_FLIGHT_MODE error " << tempbool);
+        cellularOn = false;
+        return cellularOn;
+    }
+
+    vconf_get_int(VCONFKEY_TELEPHONY_SVC_CS, &tempInt);
+    if(tempInt != VCONFKEY_TELEPHONY_SVC_CS_ON)
+    {
+        LoggerE("VCONFKEY_TELEPHONY_SVC_CS error " << tempInt);
+        cellularOn = false;
     }
     return cellularOn;
 }
@@ -721,7 +723,8 @@ void Sms::updateMessage()
 {
        LoggerD("updating m_id=" << getIdRef());
        msg_error_t err = MSG_SUCCESS;
-       
+       int tempInt = 0;
+
        msg_struct_t msg = NULL;
        msg_struct_t sendOpt = NULL;
        
@@ -741,8 +744,8 @@ void Sms::updateMessage()
                
                if (err != MSG_SUCCESS)
                {
-                       LoggerE("Get Message Failed!");
-                       ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message");
+                       LoggerE("msg_get_message() Failed!");
+                       ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to get message for update");
                }
        
                if (this->getIdRef().empty()) {
@@ -750,12 +753,24 @@ void Sms::updateMessage()
                        ThrowMsg(WrtDeviceApis::Commons::PlatformException,
                                        "existing msgId is zero, update msg not done");
                }
-               
+
+               err = msg_get_int_value(msg, MSG_MESSAGE_NETWORK_STATUS_INT, &tempInt);
+               if(err == MSG_SUCCESS)
+               {
+                       msg_set_int_value(m_messageData, MSG_MESSAGE_NETWORK_STATUS_INT, tempInt);
+               }
+
+               err = msg_get_int_value(msg, MSG_MESSAGE_FOLDER_ID_INT, &tempInt);
+               if(err == MSG_SUCCESS)
+               {
+                       msg_set_int_value(m_messageData, MSG_MESSAGE_FOLDER_ID_INT, tempInt);
+               }
+
                update(TRUE);
                
                if (MSG_SUCCESS != msg_update_message(MsgGetCommonHandle(), m_messageData, sendOpt))
                {
-                       LoggerE("Failed to update message");
+                       LoggerE("msg_update_message() Failed!");
                        ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to update message");
                }
                msg_release_struct(&msg);
index 731df34..1f6df63 100755 (executable)
@@ -39,7 +39,7 @@ JSClassDefinition JSNotificationDetailInfo::m_classInfo = {
     kJSClassAttributeNone,
     "NotificationDetailInfo",
     NULL, //ParentClass
-    NULL, //StaticValues
+    m_property, //StaticValues
     NULL, //StaticFunctions
     initialize, //Initialize
     finalize, //Finalize
@@ -54,6 +54,11 @@ JSClassDefinition JSNotificationDetailInfo::m_classInfo = {
     NULL //ConvertToType
 };
 
+JSStaticValue JSNotificationDetailInfo::m_property[] = 
+{
+       {NOTIFICATION_DETAIL_INFO_MAIN_TEXT,  JSNotificationDetailInfo::getProperty, JSNotificationDetailInfo::setProperty,     kJSPropertyAttributeNone },
+       {0, 0, 0, 0}
+};
 
 JSClassRef JSNotificationDetailInfo::m_jsClassRef = JSClassCreate(JSNotificationDetailInfo::getClassInfo());
 
@@ -89,6 +94,96 @@ void JSNotificationDetailInfo::finalize(JSObjectRef object)
     }
 }
 
+bool JSNotificationDetailInfo::setProperty(JSContextRef context,
+        JSObjectRef object,
+        JSStringRef propertyName,
+        JSValueRef value,
+        JSValueRef* exception)
+{
+
+    NotificationDetailInfo *priv = static_cast<NotificationDetailInfo*>(JSObjectGetPrivate(object));
+    if (!priv) {
+        throw TypeMismatchException("NotificationDetailInfo's private object is NULL.");
+    }
+
+       try {
+                   std::string property;
+                   size_t jsSize = JSStringGetMaximumUTF8CStringSize(propertyName);
+                   if (jsSize > 0) {
+                       jsSize = jsSize + 1;
+                       char* buffer = new char[jsSize];        
+                       size_t written = JSStringGetUTF8CString(propertyName, buffer, jsSize);
+                       if (written > jsSize) {
+                           throw InvalidValuesException("Conversion could not be fully performed.");
+                       }
+                       property = buffer;
+                       delete[] buffer;
+                   }
+
+                  LoggerI("property =" << property);
+                 
+                 if ( property == NOTIFICATION_DETAIL_INFO_MAIN_TEXT)
+                  {
+                       std::string mainText = JSUtil::JSValueToString(context, value);
+                       LoggerI("       mainText = " << mainText);
+                       priv->setMainText(mainText);
+
+                        //JSUtil::setProperty(context, object, NOTIFICATION_DETAIL_INFO_MAIN_TEXT,
+                               //JSUtil::toJSValueRef(context, mainText), kJSPropertyAttributeNone);
+                  }
+                                  
+    }
+    catch ( const BasePlatformException& err) 
+    {
+        LoggerW(" notification convertion is failed.  "   << err.getName().c_str() << ":"  << err.getMessage().c_str());
+    }
+
+    return false;
+}
+
+JSValueRef JSNotificationDetailInfo::getProperty(JSContextRef context,
+                                                                               JSObjectRef object,
+                                                                               JSStringRef propertyName,
+                                                                               JSValueRef* exception)
+{
+
+       NotificationDetailInfo *priv = static_cast<NotificationDetailInfo*>(JSObjectGetPrivate(object));
+       if (!priv) {
+               throw TypeMismatchException("NotificationDetailInfo's private object is NULL.");
+       }
+
+       try {
+                   std::string property;
+                   size_t jsSize = JSStringGetMaximumUTF8CStringSize(propertyName);
+                   if (jsSize > 0) {
+                       jsSize = jsSize + 1;
+                       char* buffer = new char[jsSize];        
+                       size_t written = JSStringGetUTF8CString(propertyName, buffer, jsSize);
+                       if (written > jsSize) {
+                           throw InvalidValuesException("Conversion could not be fully performed.");
+                       }
+                       property = buffer;
+                       delete[] buffer;
+                   }
+
+                  LoggerI("property =" << property);
+                  if ( property == NOTIFICATION_DETAIL_INFO_MAIN_TEXT)
+                  {
+                       std::string main = priv->getMainText();
+                  
+                       return JSUtil::toJSValueRef(context, main);
+                  }
+
+    }
+    catch ( const BasePlatformException& err) 
+    {
+        LoggerW(" notification convertion is failed. "   << err.getName().c_str() << ":"  << err.getMessage().c_str());
+       return NULL;
+    }
+
+   return NULL;
+}
+
 JSObjectRef JSNotificationDetailInfo::constructor(JSContextRef context,
     JSObjectRef constructor,
     size_t argumentCount,
index 1843ea5..e031303 100755 (executable)
@@ -39,6 +39,8 @@ public:
 
     static NotificationDetailInfo* getPrivateObject(JSContextRef context, JSObjectRef object);
     static void setPrivateObject(JSContextRef context, JSObjectRef object, NotificationDetailInfo *priv);
+    static bool setProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef value, JSValueRef* exception);
+    static JSValueRef getProperty(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception);  
 private:
 
     /**
index caf18ff..471351a 100755 (executable)
@@ -61,6 +61,9 @@ JSStaticValue JSStatusNotification::m_property[] =
 {
        {STATUS_NOTIFICATION_PROGRESS_TYPE,  JSStatusNotification::getProperty, JSStatusNotification::setProperty,      kJSPropertyAttributeNone },
        {STATUS_NOTIFICATION_PROGRESS_VALUE,  JSStatusNotification::getProperty, JSStatusNotification::setProperty,     kJSPropertyAttributeNone },
+       {STATUS_NOTIFICATION_LIGHT_ONTIME, JSStatusNotification::getProperty, JSStatusNotification::setProperty,        kJSPropertyAttributeNone },
+       {STATUS_NOTIFICATION_LIGHT_OFFTIME,  JSStatusNotification::getProperty, JSStatusNotification::setProperty,      kJSPropertyAttributeNone },
+       {STATUS_NOTIFICATION_VIBRATION,  JSStatusNotification::getProperty, JSStatusNotification::setProperty,  kJSPropertyAttributeNone },
        {0, 0, 0, 0}
 };
 
@@ -129,11 +132,38 @@ bool JSStatusNotification::setProperty(JSContextRef context,
 
                            return true;
                   }
+                  else if ( property == STATUS_NOTIFICATION_LIGHT_ONTIME) 
+                  {
+                       unsigned long onPeriod = JSUtil::JSValueToULong(context, value);
+                       LoggerI("       LEDonPeriod = " << onPeriod);
+                       priv->setLightOnTime(onPeriod);
 
+                       // JSUtil::setProperty(context, object, STATUS_NOTIFICATION_LIGHT_ONTIME,
+                       //      JSUtil::toJSValueRef(context, onPeriod), kJSPropertyAttributeNone);
+                  }
+                  else if ( property == STATUS_NOTIFICATION_LIGHT_OFFTIME)
+                  {
+                       unsigned long offPeriod = JSUtil::JSValueToULong(context, value);
+                       LoggerI("       LEDoffPeriod = " << offPeriod);
+                       priv->setLightOffTime(offPeriod);
+
+                       // JSUtil::setProperty(context, object, STATUS_NOTIFICATION_LIGHT_OFFTIME,
+                       //      JSUtil::toJSValueRef(context, offPeriod), kJSPropertyAttributeNone);
+                  }
+                  else if ( property == STATUS_NOTIFICATION_VIBRATION)
+                  {
+                       bool vibration = JSUtil::JSValueToBoolean(context, value);
+                       LoggerI("       vibration = " << vibration);
+                       priv->setDefaultVibration(vibration);
+
+                       // JSUtil::setProperty(context, object, STATUS_NOTIFICATION_VIBRATION,
+                       //      JSUtil::toJSValueRef(context, vibration), kJSPropertyAttributeNone);
+                  }
+                  
     }
     catch ( const BasePlatformException& err) 
     {
-        LoggerW(" notification convertion is failed. "   << err.getName().c_str() << ":"  << err.getMessage().c_str());
+        LoggerW(" notification convertion is failed.  "   << err.getName().c_str() << ":"  << err.getMessage().c_str());
     }
        
 
@@ -209,7 +239,21 @@ JSValueRef JSStatusNotification::getProperty(JSContextRef context,
                                return  JSUtil::toJSValueRef(context, progressVal);
                        }
                   }
-
+                  else if ( property == STATUS_NOTIFICATION_LIGHT_ONTIME)
+                  {                            
+                       unsigned long onTime = priv->getLightOnTime();
+                       return  JSUtil::toJSValueRef(context, onTime);
+                  }
+                  else if ( property == STATUS_NOTIFICATION_LIGHT_OFFTIME)
+                  {                            
+                       unsigned long offTime = priv->getLightOffTime();
+                       return  JSUtil::toJSValueRef(context, offTime);
+                  }
+                  else if ( property == STATUS_NOTIFICATION_VIBRATION)
+                  {
+                       bool vibration = priv->getDefaultVibration();
+                       return  JSUtil::toJSValueRef(context, vibration);
+                  }
     }
     catch ( const BasePlatformException& err) 
     {
index a2c2a49..420ac0e 100755 (executable)
@@ -59,7 +59,6 @@ private:
      */
     static JSClassDefinition m_classInfo;
 
-
     /**
      * This member variable contains the initialization values for the
      * properties of this class. The values are given according to
index dac54e2..25a5ecc 100644 (file)
@@ -550,7 +550,7 @@ void install_request_cb(int id, const char *type, const char *package,
        }
        case PACAKGE_MANAGER_EVENT_STATE_STARTED:
        case PACAKGE_MANAGER_EVENT_STATE_PROCESSING: {
-               if (callback->getOnProgress()) {
+               if (callback->getOnProgress() && package && package[0]!='\0') {
                        Converter converter(context);
                        JSValueRef args[2] = {converter.toJSValueRef(package), converter.toJSValueRef(progress)};
                        callback->getOnProgress()->callSuccessCallback(2, args);
index 793a263..128c2bc 100755 (executable)
@@ -170,13 +170,14 @@ UnicodeString TimeUtilTools::getDateTimeFormat(DateTimeFormatType type, bool bLo
        return "";
 }
 
+
 void TimeUtilTools::printDate(Calendar *cal)
 {
-       UErrorCode ec = U_ZERO_ERROR;
-       
        if (cal == NULL)
                return;
-       
+#ifdef TIZEN_ENGINEER_MODE     
+       UErrorCode ec = U_ZERO_ERROR;
+
        LoggerD("year : " << tolong(cal->get(UCAL_YEAR, ec)));
        LoggerD("month : " << tolong(cal->get(UCAL_MONTH, ec)));
        LoggerD("day : " << tolong(cal->get(UCAL_DATE, ec)));
@@ -190,6 +191,7 @@ void TimeUtilTools::printDate(Calendar *cal)
        LoggerD("zone offset : " << tolong(cal->get(UCAL_ZONE_OFFSET, ec)));
        LoggerD("dst offset : " << tolong(cal->get(UCAL_DST_OFFSET, ec)));
        LoggerD("is leap month? : " << tolong(cal->get(UCAL_IS_LEAP_MONTH, ec)));
+#endif
 }
 
 }
index 882f600..2e6c167 100644 (file)
@@ -189,7 +189,7 @@ JSObjectRef JSAttributeFilter::constructor(JSContextRef context,
        if(argumentCount >= 3)
                jsValueMatchValue = arguments[2];
        else
-               jsValueMatchValue = JSValueMakeUndefined(context);
+               jsValueMatchValue = JSValueMakeNull(context);
 
        AttributeFilterPtr attributeFilter(new AttributeFilter(attributeName, matchFlag, matchValue));
 
index fafd903..3856afc 100644 (file)
@@ -159,14 +159,14 @@ JSObjectRef JSAttributeRangeFilter::constructor(JSContextRef context,
        if(argumentCount >= 2)
                jsValueInitialValue = arguments[1];
        else
-               jsValueInitialValue = JSValueMakeUndefined(context);
+               jsValueInitialValue = JSValueMakeNull(context);
 
        endValue = AnyFactory::createAnyEmpty(context);
 
        if(argumentCount >= 3)
                jsValueEndValue = arguments[2];
        else
-               jsValueEndValue = JSValueMakeUndefined(context);
+               jsValueEndValue = JSValueMakeNull(context);
 
        AttributeRangeFilterPtr attributeRangeFilter(new AttributeRangeFilter(attributeName, initialValue, endValue));