[Release] wrt-plugins-common_0.3.101 submit/tizen_2.2/20130702.112950
authorsung-su.kim <sung-su.kim@samsung.com>
Tue, 2 Jul 2013 11:09:32 +0000 (20:09 +0900)
committersung-su.kim <sung-su.kim@samsung.com>
Tue, 2 Jul 2013 11:09:32 +0000 (20:09 +0900)
Change-Id: I4ced7e9cc5cc479dca99d983a67d052b6bd0ef2c

packaging/wrt-plugins-common.spec
src/standards/W3C/Widget/CMakeLists.txt
src/standards/W3C/Widget/JSWidget.cpp
src/standards/W3C/Widget/JSWidget.h
src/standards/W3C/Widget/plugin_initializer.cpp

index 1893366..8722ef0 100644 (file)
@@ -1,7 +1,7 @@
 #git:framework/web/wrt-plugins-common
 Name:       wrt-plugins-common
 Summary:    wrt-plugins common library
-Version:    0.3.99
+Version:    0.3.101
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
index c586b31..fe0174f 100644 (file)
@@ -29,7 +29,6 @@ include_directories(
   ${API_WIDGET_PATH}
   ${webkit2_INCLUDE_DIRS}
   ${plugin-types_INCLUDE_DIRS}
-  ${PLUGINS_IPC_MESSAGE_DIRS}
 )
 
 add_library(${TARGET_NAME} SHARED ${SRCS})
@@ -42,7 +41,6 @@ target_link_libraries(${TARGET_NAME}
   wrt-plugins-localstorage
   wrt-plugins-storageevent
   wrt-dispatch-event
-  wrt-plugins-ipc-message
 )
 
 INSTALL(TARGETS ${TARGET_NAME} LIBRARY DESTINATION /usr/lib/wrt-plugins/w3c-widget-interface)
index 8a6843c..f4b9684 100644 (file)
@@ -32,6 +32,9 @@
 #include <LocalStorage/LocalStorageMgr.h>
 #include <Commons/WrtAccess/WrtAccess.h>
 
+// temporary
+extern "C" JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx);
+
 #define CATCH_EXCEPTION_NO_MODIFABLE \
     Catch(Commons::LocalStorageValueNoModifableException) { \
         LogError("The item is read only"); \
@@ -232,12 +235,17 @@ const JSClassDefinition* JSWidget::getClassInfo()
 
 JSClassRef JSWidget::m_jsClassRef = JSClassCreate(JSWidget::getClassInfo());
 
-JSContextRef JSWidget::m_globalContext = NULL;
-
 void JSWidget::initialize(JSContextRef context,
                           JSObjectRef object)
 {
-    LogDebug("entered. Context : " << context << ", Object: " << object);
+    JSGlobalContextRef g_context = JSContextGetGlobalContext(context);
+
+    LogDebug("entered. Context : " << context << "(global:" << g_context << "), Object: " << object);
+
+    if (context != g_context)
+    {
+        context = g_context;
+    }
 
     JSWidgetPrivateObject* priv =
         static_cast<JSWidgetPrivateObject*>(JSObjectGetPrivate(object));
@@ -295,18 +303,6 @@ void JSWidget::finalize(JSObjectRef object)
     }
 }
 
-void JSWidget::acquireGlobalContext(java_script_context_t global_context,
-                                    js_object_instance_t /*iframe*/,
-                                    js_object_instance_t /*object*/)
-{
-    if (!m_globalContext) {
-        m_globalContext = static_cast<JSContextRef>(global_context);
-        LogInfo("Global context acquired.");
-    } else {
-        LogInfo("Global context already set.");
-    }
-}
-
 JSValueRef JSWidget::getAuthor(JSContextRef context,
                                JSObjectRef object,
                                JSStringRef /*propertyName*/,
@@ -550,12 +546,7 @@ JSObjectRef JSWidget::callAsConstructor(JSContextRef context,
                                         JSValueRef* /*exception*/)
 {
     LogDebug("widget constructor");
-    if (!m_globalContext) {
-        LogError("Global context not set. Creating 'widget' object with "
-                 "local context!");
-        return JSObjectMake(context, JSWidget::getClassRef(), NULL);
-    }
-    return JSObjectMake(m_globalContext, JSWidget::getClassRef(), NULL);
+    return JSObjectMake(context, JSWidget::getClassRef(), NULL);
 }
 
 #undef CATCH_EXCEPTION_NO_MODIFABLE
index c0bf403..f1f979c 100644 (file)
@@ -49,18 +49,6 @@ class JSWidget
                                          const JSValueRef arguments[],
                                          JSValueRef* exception);
 
-    /**
-     * This function will acquire global context which is used later to
-     * keep JSValueProtect/Unprotect functionality working.
-     * This is workaround for JSCore semantic: when an object is created with
-     * JSObjectMakeConstructor a context passed to createCallback function
-     * is different (shorter lifecycle) than global context, so JSValueUnprotect
-     * called in finalize may fail because of invalid context.
-     */
-    static void acquireGlobalContext(java_script_context_t global_context,
-                                     js_object_instance_t iframe,
-                                     js_object_instance_t object);
-
   private:
     /**
      * The callback invoked when an object is first created.
@@ -86,11 +74,6 @@ class JSWidget
 
     static JSClassRef m_jsClassRef;
 
-    /**
-     * Global context acquired by acquireGlobalContext() function.
-     */
-    static JSContextRef m_globalContext;
-
     // getters for properties
     static JSValueRef getAuthor(JSContextRef context,
                                 JSObjectRef object,
index d296869..10cdea6 100644 (file)
@@ -44,7 +44,7 @@ class_definition_options_t WidgetOptions = {
     JS_CLASS,
     CREATE_INSTANCE,
     NONE_NOTICE,
-    USE_OVERLAYED, //ignored
+    IGNORED,
     NULL,
     NULL,
     NULL
@@ -53,9 +53,9 @@ class_definition_options_t WidgetOptions = {
 class_definition_options_t WidgetInterfaceOptions = {
     JS_INTERFACE,
     CREATE_INSTANCE,
-    ALWAYS_NOTICE,
-    USE_OVERLAYED, //ignored
-    JSWidget::acquireGlobalContext,
+    NONE_NOTICE,
+    IGNORED, //ignored
+    NULL,
     NULL,
     NULL
 };