[Release] wrt_0.8.165
authorleerang song <leerang.song@samsung.com>
Thu, 21 Mar 2013 02:34:02 +0000 (11:34 +0900)
committerleerang song <leerang.song@samsung.com>
Thu, 21 Mar 2013 02:34:02 +0000 (11:34 +0900)
Change-Id: I76abe7fb817433551a62d3bfc48f9382e96c91f7

15 files changed:
debian/changelog
packaging/wrt.spec
src/api_new/ewk_context_manager.cpp [changed mode: 0644->0755]
src/api_new/ewk_context_manager.h [changed mode: 0644->0755]
src/view/common/view_logic_security_origin_support.cpp [changed mode: 0644->0755]
src/view/common/view_logic_security_origin_support.h [changed mode: 0644->0755]
src/view/webkit/bundles/CMakeLists.txt
src/view/webkit/bundles/page_global_context_container.cpp [new file with mode: 0644]
src/view/webkit/bundles/page_global_context_container.h [new file with mode: 0644]
src/view/webkit/bundles/wrt-wk2-bundle.cpp
src/view/webkit/bundles/wrt-wk2-bundle.h
src/view/webkit/view_logic.cpp [changed mode: 0644->0755]
src/view/webkit/view_logic_geolocation_support_webkit2.cpp [changed mode: 0644->0755]
src/view/webkit/view_logic_usermedia_support.cpp [changed mode: 0644->0755]
src/view/webkit/view_logic_web_notification_support.cpp [changed mode: 0644->0755]

index 109b103..dad8a95 100644 (file)
@@ -1,3 +1,11 @@
+wrt (0.8.165) unstable; urgency=low
+
+  * JS Global Context PluginModule starting and stoping bug fix
+  * Set background support API
+  * Set ewk context tizen expensible API
+
+ -- leerang <leerang.song@samsung.com>  Thu, 21 Mar 2013 11:26:40 +0900
+
 wrt (0.8.164) unstable; urgency=low
 
   * Fixed decryption logic
index 4f8b2c7..8e8034a 100644 (file)
@@ -1,7 +1,7 @@
-#git:framework/web/wrt wrt_0.8.164
+#git:framework/web/wrt wrt_0.8.165
 Name:       wrt
 Summary:    web runtime
-Version:    0.8.164
+Version:    0.8.165
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
old mode 100644 (file)
new mode 100755 (executable)
index d1ae016..186173d
@@ -29,6 +29,7 @@
 #include <profiling_util.h>
 #include <i_view_module.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <dpl/wrt-dao-ro/widget_dao_types.h>
 #include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/utils/wrt_global_settings.h>
 #include "ewk_context_manager.h"
@@ -121,6 +122,9 @@ bool EwkContextManager::initialize()
             static_cast<WrtDB::SettingsType>(result) ==
             WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
 
+    setAutoFullscreenMode();
+    setBackgroundSupport();
+
     m_initialized = true;
 
     return true;
@@ -157,6 +161,51 @@ void EwkContextManager::setCallbacks()
             this);
 }
 
+void EwkContextManager::setAutoFullscreenMode()
+{
+    using namespace WrtDB;
+    WrtDB::WidgetDAOReadOnly dao(DPL::FromUTF8String(m_appId));
+    if(!m_ewkContext) {
+        return;
+    }
+    std::list<DPL::String> widgetPrivilege = dao.getWidgetPrivilege();
+    bool fullscreen = false;
+
+    FOREACH(it, widgetPrivilege) {
+        std::map<std::string, Feature>::const_iterator result =
+        g_W3CPrivilegeTextMap.find(DPL::ToUTF8String(*it));
+            if (result != g_W3CPrivilegeTextMap.end()) {
+                if (result->second == FEATURE_FULLSCREEN_MODE) {
+                    fullscreen = true;
+                    break;
+            }
+        }
+    }
+    ewk_context_tizen_extensible_api_set(m_ewkContext,
+        EWK_EXTENSIBLE_API_FULL_SCREEN,
+        fullscreen);
+}
+
+void EwkContextManager::setBackgroundSupport()
+{
+    WrtDB::WidgetDAOReadOnly dao(DPL::FromUTF8String(m_appId));
+    if(!m_ewkContext) {
+        return;
+    }
+
+    WidgetSettings widgetSettings;
+    dao.getWidgetSettings(widgetSettings);
+    WidgetSettingList settings(widgetSettings);
+    bool backgroundSupport = false;
+    if(settings.getBackgroundSupport() == BackgroundSupport_Enable) {
+        backgroundSupport = true;
+    }
+    ewk_context_tizen_extensible_api_set(
+        m_ewkContext,
+        EWK_EXTENSIBLE_API_BACKGROUND_MUSIC,
+        backgroundSupport);
+}
+
 void EwkContextManager::unsetCallbacks()
 {
     if (!m_initialized) {
old mode 100644 (file)
new mode 100755 (executable)
index 7ef9dcd..327b3a2
@@ -42,8 +42,9 @@ class EwkContextManager : public AbstractContextManager {
         bool initialize();
         void destroy();
         void setCallbacks();
+        void setAutoFullscreenMode();
         void unsetCallbacks();
-
+        void setBackgroundSupport();
         // ewk context callback functions
         static void messageFromInjectedBundleCallback(
                 const char* name,
old mode 100644 (file)
new mode 100755 (executable)
index 48cac1e..b80c304
@@ -74,9 +74,10 @@ class SecurityOriginSupportImplementation
     }
 
     WrtDB::SettingsType isNeedPermissionCheck(
-        SecurityOriginDB::Feature feature)
+        WrtDB::Feature feature)
     {
         using namespace SecurityOriginDB;
+        using namespace WrtDB;
         std::string key;
         if (feature == FEATURE_GEOLOCATION) {
             key = WrtDB::VconfConfig::GetVconfKeyGeolocationUsage(
@@ -111,7 +112,7 @@ SecurityOriginDB::SecurityOriginDAO* SecurityOriginSupport::
 }
 
 WrtDB::SettingsType SecurityOriginSupport::isNeedPermissionCheck(
-    SecurityOriginDB::Feature feature)
+    WrtDB::Feature feature)
 {
     return m_impl->isNeedPermissionCheck(feature);
 }
old mode 100644 (file)
new mode 100755 (executable)
index 2563aec..3779f2b
@@ -44,7 +44,7 @@ class SecurityOriginSupport
     virtual ~SecurityOriginSupport();
     SecurityOriginDB::SecurityOriginDAO* getSecurityOriginDAO();
     WrtDB::SettingsType isNeedPermissionCheck(
-        SecurityOriginDB::Feature feature);
+        WrtDB::Feature feature);
 
   private:
     std::unique_ptr<SecurityOriginSupportImplementation> m_impl;
index 2069856..aaf8e49 100644 (file)
@@ -34,6 +34,7 @@ PKG_CHECK_MODULES(BUNDLES_DEP
 SET(BUNDLES_SOURCES
     ${PROJECT_SOURCE_DIR}/src/view/webkit/bundles/wrt-wk2-bundle.cpp
     ${PROJECT_SOURCE_DIR}/src/view/webkit/bundles/bundle_uri_handling.cpp
+    ${PROJECT_SOURCE_DIR}/src/view/webkit/bundles/page_global_context_container.cpp
     ${PROJECT_SOURCE_DIR}/src/view/common/scheme.cpp
 )
 
diff --git a/src/view/webkit/bundles/page_global_context_container.cpp b/src/view/webkit/bundles/page_global_context_container.cpp
new file mode 100644 (file)
index 0000000..11cbe98
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/**
+ * @file wrt-wk2-PageGlobalContextContainer.cpp
+ * @author Tomasz Iwanek (t.iwanek@smasung.com)
+ * @brief Declares container for global context that holds its references
+ */
+#include "page_global_context_container.h"
+
+#include <dpl/foreach.h>
+
+PageGlobalContextContainer::PageGlobalContextContainer()
+{
+}
+
+PageGlobalContextContainer::~PageGlobalContextContainer()
+{
+    FOREACH(iter, m_map)
+    {
+        JSGlobalContextRelease(iter->second);
+    }
+}
+
+void PageGlobalContextContainer::insertContextForPage(WKBundlePageRef page, JSGlobalContextRef context)
+{
+    PageGlobalContext::iterator iter = m_map.find(page);
+    if(iter != m_map.end())
+    {
+        JSGlobalContextRelease(m_map[page]);
+    }
+    JSGlobalContextRetain(context);
+    m_map[page] = context;
+}
+
+void PageGlobalContextContainer::removeContextForPage(WKBundlePageRef page)
+{
+    PageGlobalContext::iterator iter = m_map.find(page);
+    if(iter != m_map.end())
+    {
+        JSGlobalContextRelease(m_map[page]);
+    }
+    m_map.erase(iter);
+}
+
+JSGlobalContextRef PageGlobalContextContainer::getContextForPage(WKBundlePageRef page) const
+{
+    return m_map.find(page)->second;
+}
+
+PageGlobalContextContainer::const_iterator PageGlobalContextContainer::begin() const
+{
+    return m_map.begin();
+}
+PageGlobalContextContainer::const_iterator PageGlobalContextContainer::find(WKBundlePageRef ref) const
+{
+    return m_map.find(ref);
+}
+PageGlobalContextContainer::const_iterator PageGlobalContextContainer::end() const
+{
+    return m_map.end();
+}
diff --git a/src/view/webkit/bundles/page_global_context_container.h b/src/view/webkit/bundles/page_global_context_container.h
new file mode 100644 (file)
index 0000000..e42c76b
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+/**
+ * @file wrt-wk2-PageGlobalContextContainer.h
+ * @author Tomasz Iwanek (t.iwanek@smasung.com)
+ * @brief Declares container for global context that holds its references
+ */
+#ifndef PAGE_GLOBAL_CONTEXT_CONTAINER_H
+#define PAGE_GLOBAL_CONTEXT_CONTAINER_H
+
+#include <map>
+
+#include <JavaScriptCore/JSContextRef.h>
+#include <WKBundlePage.h>
+
+/**
+ * @brief The PageGlobalContextContainer class
+ *
+ * Container for global contexts that increments reference for holded elements
+ */
+class PageGlobalContextContainer
+{
+public:
+    typedef std::map<WKBundlePageRef, JSGlobalContextRef> PageGlobalContext;
+    typedef PageGlobalContext::iterator iterator;
+    typedef PageGlobalContext::const_iterator const_iterator;
+    typedef PageGlobalContext::value_type value_type;
+
+    PageGlobalContextContainer();
+    ~PageGlobalContextContainer();
+
+    PageGlobalContextContainer(const PageGlobalContextContainer&) = delete;
+    PageGlobalContextContainer& operator=(const PageGlobalContextContainer&) = delete;
+
+    void insertContextForPage(WKBundlePageRef page, JSGlobalContextRef context);
+    void removeContextForPage(WKBundlePageRef page);
+    /**
+     * @brief getContextForPage gets context for given page
+     * @param page wk page
+     * Page should be valid for container.
+     * If you don't know if page is present in container use find
+     *
+     * @return context
+     */
+    JSGlobalContextRef getContextForPage(WKBundlePageRef page) const;
+
+    const_iterator begin() const;
+    const_iterator find(WKBundlePageRef ref) const;
+    const_iterator end() const;
+private:
+    PageGlobalContext m_map;
+};
+
+#endif // PAGE_GLOBAL_CONTEXT_CONTAINER_H
index fde4023..8a2bc07 100644 (file)
@@ -193,7 +193,7 @@ void Bundle::didCreatePage(WKBundlePageRef page)
     auto mainFrame = WKBundlePageGetMainFrame(page);
     auto context = WKBundleFrameGetJavaScriptContext(mainFrame);
     m_pagesList.push_back(page);
-    m_pageGlobalContext[page] = context;
+    m_pageGlobalContext.insertContextForPage(page, context);
     LogDebug("created Page : " << page << " created JSContext : " << context);
 
     WKBundlePageResourceLoadClient resourceLoadClient = {
@@ -262,9 +262,9 @@ void Bundle::willDestroyPage(WKBundlePageRef page)
 {
     LogDebug("Destroyed page : " << page);
 
-    auto context = m_pageGlobalContext[page];
+    auto context = m_pageGlobalContext.getContextForPage(page);
     m_pagesList.remove(page);
-    m_pageGlobalContext.erase(page);
+    m_pageGlobalContext.removeContextForPage(page);
     m_pageContext[page].erase(context);
 
     PluginModule::unloadFrame(context);
@@ -310,7 +310,7 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
         LogDebug("Got message text: " << msgString);
         LogDebug("loading Page : " << m_pagesList.back() <<
                  " loading JSContext : " <<
-                 m_pageGlobalContext[m_pagesList.back()]);
+                 m_pageGlobalContext.getContextForPage(m_pagesList.back()));
         // set information from ui process
         std::stringstream ssMsg(msgString);
         std::string argScale;
@@ -359,7 +359,7 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
         fixWKMessageArgs(argScale, argEncodedBundle, argTheme);
 
         //apply for each context
-        PageGlobalContext::iterator it = m_pageGlobalContext.begin();
+        PageGlobalContextContainer::const_iterator it = m_pageGlobalContext.begin();
         for (; it != m_pageGlobalContext.end(); ++it) {
             PluginModule::setCustomProperties(it->second,
                                               m_scale,
@@ -388,7 +388,7 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
         }
 
         //apply for each context
-        PageGlobalContext::iterator it = m_pageGlobalContext.begin();
+        PageGlobalContextContainer::const_iterator it = m_pageGlobalContext.begin();
         for (; it != m_pageGlobalContext.end(); ++it) {
             PluginModule::dispatchJavaScriptEvent(
                 it->second,
@@ -486,7 +486,7 @@ void Bundle::didStartProvisionalLoadForFrameCallback(
         }
     }
 
-    if (This->m_pageGlobalContext.count(page) == 0) {
+    if (This->m_pageGlobalContext.find(page) == This->m_pageGlobalContext.end()) {
         return;
     }
     if (This->m_pageContext.count(page) == 0) {
@@ -599,10 +599,23 @@ void Bundle::didCommitLoadForFrameCallback(
     LogInfo("result from UI process : " << result);
 
     if (result == URICHANGE_PLUGIN_STOP_ONLY) {
-        PluginModule::stop(context);
+        if(This->m_pageGlobalContext.find(page) != This->m_pageGlobalContext.end())
+        {
+            LogDebug("Previous context: " << This->m_pageGlobalContext.getContextForPage(page));
+            PluginModule::stop(This->m_pageGlobalContext.getContextForPage(page));
+        }
+        LogDebug("New context: " << context);
+        This->m_pageGlobalContext.insertContextForPage(page, context);
     } else if (result == URICHANGE_PLUGIN_RESTART) {
-        PluginModule::stop(context);
-        This->m_pageGlobalContext[page] = context;
+        if(This->m_pageGlobalContext.find(page) != This->m_pageGlobalContext.end())
+        {
+            LogDebug("Previous context: " << This->m_pageGlobalContext.getContextForPage(page));
+            PluginModule::stop(This->m_pageGlobalContext.getContextForPage(page));
+        }
+        LogDebug("New context: " << context);
+        //note that since we need old context for unloading plugins it must be sotred
+        //custom container take care of increamenting and decrementing references
+        This->m_pageGlobalContext.insertContextForPage(page, context);
         LOG_PROFILE_START("PluginModule start");
         PluginModule::start(
             WrtDB::WidgetDAOReadOnly::getHandle(This->m_widgetTizenId),
@@ -999,7 +1012,7 @@ void WKBundleInitialize(WKBundleRef bundle,
     DPL::Event::GetMainEventDispatcherInstance().ResetCrossEventCallHandler();
     LogDebug("ResetCrossEventCallHandler()");
 
-    static Bundle s_bundle = Bundle(bundle);
+    static Bundle s_bundle(bundle);
 
     WKBundleClient client = {
         kWKBundleClientCurrentVersion,
index 920c640..6c64d65 100644 (file)
@@ -21,8 +21,8 @@
 #ifndef WRT_SRC_VIEW_WEBKIT2_WRT_WK2_BUNDLE_H_
 #define WRT_SRC_VIEW_WEBKIT2_WRT_WK2_BUNDLE_H_
 
-#include <set>
 #include <map>
+#include <set>
 #include <list>
 #include <string>
 #include <WKBundle.h>
@@ -30,6 +30,7 @@
 #include <WKBundlePage.h>
 #include <dpl/string.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include "page_global_context_container.h"
 
 extern "C" {
 WK_EXPORT void WKBundleInitialize(WKBundleRef bundle, WKTypeRef);
@@ -41,6 +42,9 @@ class Bundle
     Bundle(WKBundleRef bundle);
     ~Bundle();
 
+    Bundle(const Bundle&) = delete;
+    Bundle& operator=(const Bundle&) = delete;
+
     // WKBundleClient callback
     static void didCreatePageCallback(
         WKBundleRef bundle,
@@ -64,9 +68,8 @@ class Bundle
     PagesList m_pagesList;
     typedef std::set<JSGlobalContextRef> ContextSet;
     typedef std::map<WKBundlePageRef, ContextSet> PageContextList;
-    typedef std::map<WKBundlePageRef, JSGlobalContextRef> PageGlobalContext;
     PageContextList m_pageContext;
-    PageGlobalContext m_pageGlobalContext;
+    PageGlobalContextContainer m_pageGlobalContext;
     DPL::String m_widgetTizenId;
     double m_scale;
     std::string m_encodedBundle;
old mode 100644 (file)
new mode 100755 (executable)
index 1e4c7ff..f9a48bf
@@ -1250,7 +1250,7 @@ void ViewLogic::geolocationPermissionRequestCallback(
         static_cast<Ewk_Geolocation_Permission_Request*>(eventInfo);
 
     if (This->m_securityOriginSupport->isNeedPermissionCheck(
-            SecurityOriginDB::FEATURE_GEOLOCATION)
+            WrtDB::FEATURE_GEOLOCATION)
         == WrtDB::SETTINGS_TYPE_OFF)
     {
         ewk_geolocation_permission_request_set(permissionRequest, EINA_FALSE);
@@ -1321,7 +1321,7 @@ void ViewLogic::notificationPermissionRequestCallback(
     Assert(data);
     ViewLogic* This = static_cast<ViewLogic*>(data);
     if (This->m_securityOriginSupport->isNeedPermissionCheck(
-            SecurityOriginDB::FEATURE_WEB_NOTIFICATION)
+            WrtDB::FEATURE_WEB_NOTIFICATION)
         == WrtDB::SETTINGS_TYPE_OFF)
     {
         Ewk_Notification_Permission_Request* request =
old mode 100644 (file)
new mode 100755 (executable)
index 9729833..33251e1
@@ -108,7 +108,7 @@ void geolocationPermissionRequest(
     Assert(ewkOrigin);
 
     SecurityOriginData securityOriginData(
-        FEATURE_GEOLOCATION,
+        WrtDB::FEATURE_GEOLOCATION,
         Origin(
             DPL::FromUTF8String(ewk_security_origin_protocol_get(ewkOrigin)),
             DPL::FromUTF8String(ewk_security_origin_host_get(ewkOrigin)),
old mode 100644 (file)
new mode 100755 (executable)
index 15516ea..f3260ee
@@ -107,7 +107,7 @@ void UsermediaSupport::usermediaPermissionRequest(Evas_Object* window,
         static_cast<Ewk_User_Media_Permission_Request*>(data);
 
     SecurityOriginData securityOriginData(
-        FEATURE_USER_MEDIA,
+        WrtDB::FEATURE_USER_MEDIA,
         Origin(DPL::FromUTF8String(""), DPL::FromUTF8String(""), 0));
 
     // In case of usermedia ewk doesn't support origin data
old mode 100644 (file)
new mode 100755 (executable)
index 2284dbe..cf93a39
@@ -83,7 +83,7 @@ void webNotificationPermissionRequest(
     Assert(ewkOrigin);
 
     SecurityOriginData securityOriginData(
-        FEATURE_WEB_NOTIFICATION,
+        WrtDB::FEATURE_WEB_NOTIFICATION,
         Origin(
             DPL::FromUTF8String(ewk_security_origin_protocol_get(ewkOrigin)),
             DPL::FromUTF8String(ewk_security_origin_host_get(ewkOrigin)),