Update change log and spec for wrt-plugins-tizen_0.4.9
[platform/framework/web/wrt-plugins-tizen.git] / src / Contact / ContactPhoneNumber.cpp
index a01a8ad..91ad6de 100755 (executable)
@@ -34,10 +34,19 @@ ContactPhoneNumber::ContactPhoneNumber() :
                m_isDefault(false)
 {
        m_types = ContactPhoneNumberTypeArrayPtr(new ContactPhoneNumberTypeArray());
+       is_typesSetJSArray = false;
+       m_context = NULL;
+       m_typesJsValue = NULL;
+       m_typesObj = NULL;
 }
 
 ContactPhoneNumber::~ContactPhoneNumber()
 {
+       if(IsTypesSetJSArray()){
+               JSContextRef contextRef = getContext();
+               JSObjectRef tempJSObject = getTypesJSObj();
+               JSValueUnprotect(contextRef, tempJSObject);
+       }
 }
 
 std::string ContactPhoneNumber::getNumber() const
@@ -127,5 +136,37 @@ ContactPhoneNumberPtr ContactPhoneNumber::clone() const
        return result;
 }
 
+void ContactPhoneNumber::setTypesJSArray(bool value, JSObjectRef initValue)
+{
+       is_typesSetJSArray = value;
+       m_typesObj = initValue;
+}
+
+JSObjectRef ContactPhoneNumber::getTypesJSObj()
+{
+       return m_typesObj;
+}
+
+JSValueRef ContactPhoneNumber::getTypesJSArray()
+{
+       return m_typesJsValue;
+}
+
+bool ContactPhoneNumber::IsTypesSetJSArray() const
+{
+       return is_typesSetJSArray;
+}
+
+void ContactPhoneNumber::setContext(JSContextRef contextRef)
+{
+       if(m_context == NULL)
+               m_context = contextRef;
+}
+
+JSContextRef ContactPhoneNumber::getContext()
+{
+       return m_context;
+}
+
 } // Contact
 } // DeviceAPI