+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
-#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
#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"
static_cast<WrtDB::SettingsType>(result) ==
WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
+ setAutoFullscreenMode();
+ setBackgroundSupport();
+
m_initialized = true;
return true;
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) {
bool initialize();
void destroy();
void setCallbacks();
+ void setAutoFullscreenMode();
void unsetCallbacks();
-
+ void setBackgroundSupport();
// ewk context callback functions
static void messageFromInjectedBundleCallback(
const char* name,
}
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(
}
WrtDB::SettingsType SecurityOriginSupport::isNeedPermissionCheck(
- SecurityOriginDB::Feature feature)
+ WrtDB::Feature feature)
{
return m_impl->isNeedPermissionCheck(feature);
}
virtual ~SecurityOriginSupport();
SecurityOriginDB::SecurityOriginDAO* getSecurityOriginDAO();
WrtDB::SettingsType isNeedPermissionCheck(
- SecurityOriginDB::Feature feature);
+ WrtDB::Feature feature);
private:
std::unique_ptr<SecurityOriginSupportImplementation> m_impl;
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
)
--- /dev/null
+/*
+ * 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();
+}
--- /dev/null
+/*
+ * 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
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 = {
{
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);
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;
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,
}
//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,
}
}
- 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) {
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),
DPL::Event::GetMainEventDispatcherInstance().ResetCrossEventCallHandler();
LogDebug("ResetCrossEventCallHandler()");
- static Bundle s_bundle = Bundle(bundle);
+ static Bundle s_bundle(bundle);
WKBundleClient client = {
kWKBundleClientCurrentVersion,
#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>
#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);
Bundle(WKBundleRef bundle);
~Bundle();
+ Bundle(const Bundle&) = delete;
+ Bundle& operator=(const Bundle&) = delete;
+
// WKBundleClient callback
static void didCreatePageCallback(
WKBundleRef 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;
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);
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 =
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)),
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
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)),