From: leerang song Date: Thu, 21 Mar 2013 02:34:02 +0000 (+0900) Subject: [Release] wrt_0.8.165 X-Git-Tag: 2.1b_release~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=da7f34a363a8bcfe63ad14d500dcb30a470191be;p=platform%2Fframework%2Fweb%2Fwrt.git [Release] wrt_0.8.165 Change-Id: I76abe7fb817433551a62d3bfc48f9382e96c91f7 --- diff --git a/debian/changelog b/debian/changelog index 109b103..dad8a95 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 21 Mar 2013 11:26:40 +0900 + wrt (0.8.164) unstable; urgency=low * Fixed decryption logic diff --git a/packaging/wrt.spec b/packaging/wrt.spec index 4f8b2c7..8e8034a 100644 --- a/packaging/wrt.spec +++ b/packaging/wrt.spec @@ -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 diff --git a/src/api_new/ewk_context_manager.cpp b/src/api_new/ewk_context_manager.cpp old mode 100644 new mode 100755 index d1ae016..186173d --- a/src/api_new/ewk_context_manager.cpp +++ b/src/api_new/ewk_context_manager.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include "ewk_context_manager.h" @@ -121,6 +122,9 @@ bool EwkContextManager::initialize() static_cast(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 widgetPrivilege = dao.getWidgetPrivilege(); + bool fullscreen = false; + + FOREACH(it, widgetPrivilege) { + std::map::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) { diff --git a/src/api_new/ewk_context_manager.h b/src/api_new/ewk_context_manager.h old mode 100644 new mode 100755 index 7ef9dcd..327b3a2 --- a/src/api_new/ewk_context_manager.h +++ b/src/api_new/ewk_context_manager.h @@ -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, diff --git a/src/view/common/view_logic_security_origin_support.cpp b/src/view/common/view_logic_security_origin_support.cpp old mode 100644 new mode 100755 index 48cac1e..b80c304 --- a/src/view/common/view_logic_security_origin_support.cpp +++ b/src/view/common/view_logic_security_origin_support.cpp @@ -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); } diff --git a/src/view/common/view_logic_security_origin_support.h b/src/view/common/view_logic_security_origin_support.h old mode 100644 new mode 100755 index 2563aec..3779f2b --- a/src/view/common/view_logic_security_origin_support.h +++ b/src/view/common/view_logic_security_origin_support.h @@ -44,7 +44,7 @@ class SecurityOriginSupport virtual ~SecurityOriginSupport(); SecurityOriginDB::SecurityOriginDAO* getSecurityOriginDAO(); WrtDB::SettingsType isNeedPermissionCheck( - SecurityOriginDB::Feature feature); + WrtDB::Feature feature); private: std::unique_ptr m_impl; diff --git a/src/view/webkit/bundles/CMakeLists.txt b/src/view/webkit/bundles/CMakeLists.txt index 2069856..aaf8e49 100644 --- a/src/view/webkit/bundles/CMakeLists.txt +++ b/src/view/webkit/bundles/CMakeLists.txt @@ -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 index 0000000..11cbe98 --- /dev/null +++ b/src/view/webkit/bundles/page_global_context_container.cpp @@ -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 + +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 index 0000000..e42c76b --- /dev/null +++ b/src/view/webkit/bundles/page_global_context_container.h @@ -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 + +#include +#include + +/** + * @brief The PageGlobalContextContainer class + * + * Container for global contexts that increments reference for holded elements + */ +class PageGlobalContextContainer +{ +public: + typedef std::map 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 diff --git a/src/view/webkit/bundles/wrt-wk2-bundle.cpp b/src/view/webkit/bundles/wrt-wk2-bundle.cpp index fde4023..8a2bc07 100644 --- a/src/view/webkit/bundles/wrt-wk2-bundle.cpp +++ b/src/view/webkit/bundles/wrt-wk2-bundle.cpp @@ -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, diff --git a/src/view/webkit/bundles/wrt-wk2-bundle.h b/src/view/webkit/bundles/wrt-wk2-bundle.h index 920c640..6c64d65 100644 --- a/src/view/webkit/bundles/wrt-wk2-bundle.h +++ b/src/view/webkit/bundles/wrt-wk2-bundle.h @@ -21,8 +21,8 @@ #ifndef WRT_SRC_VIEW_WEBKIT2_WRT_WK2_BUNDLE_H_ #define WRT_SRC_VIEW_WEBKIT2_WRT_WK2_BUNDLE_H_ -#include #include +#include #include #include #include @@ -30,6 +30,7 @@ #include #include #include +#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 ContextSet; typedef std::map PageContextList; - typedef std::map PageGlobalContext; PageContextList m_pageContext; - PageGlobalContext m_pageGlobalContext; + PageGlobalContextContainer m_pageGlobalContext; DPL::String m_widgetTizenId; double m_scale; std::string m_encodedBundle; diff --git a/src/view/webkit/view_logic.cpp b/src/view/webkit/view_logic.cpp old mode 100644 new mode 100755 index 1e4c7ff..f9a48bf --- a/src/view/webkit/view_logic.cpp +++ b/src/view/webkit/view_logic.cpp @@ -1250,7 +1250,7 @@ void ViewLogic::geolocationPermissionRequestCallback( static_cast(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(data); if (This->m_securityOriginSupport->isNeedPermissionCheck( - SecurityOriginDB::FEATURE_WEB_NOTIFICATION) + WrtDB::FEATURE_WEB_NOTIFICATION) == WrtDB::SETTINGS_TYPE_OFF) { Ewk_Notification_Permission_Request* request = diff --git a/src/view/webkit/view_logic_geolocation_support_webkit2.cpp b/src/view/webkit/view_logic_geolocation_support_webkit2.cpp old mode 100644 new mode 100755 index 9729833..33251e1 --- a/src/view/webkit/view_logic_geolocation_support_webkit2.cpp +++ b/src/view/webkit/view_logic_geolocation_support_webkit2.cpp @@ -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)), diff --git a/src/view/webkit/view_logic_usermedia_support.cpp b/src/view/webkit/view_logic_usermedia_support.cpp old mode 100644 new mode 100755 index 15516ea..f3260ee --- a/src/view/webkit/view_logic_usermedia_support.cpp +++ b/src/view/webkit/view_logic_usermedia_support.cpp @@ -107,7 +107,7 @@ void UsermediaSupport::usermediaPermissionRequest(Evas_Object* window, static_cast(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 diff --git a/src/view/webkit/view_logic_web_notification_support.cpp b/src/view/webkit/view_logic_web_notification_support.cpp old mode 100644 new mode 100755 index 2284dbe..cf93a39 --- a/src/view/webkit/view_logic_web_notification_support.cpp +++ b/src/view/webkit/view_logic_web_notification_support.cpp @@ -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)),