From: Jihoon Chung Date: Mon, 25 Mar 2013 11:32:23 +0000 (+0900) Subject: [Release] wrt_0.8.167 X-Git-Tag: 2.1b_release~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=369f6f4c36fd480a845cfde44674f792618b71f3;p=platform%2Fframework%2Fweb%2Fwrt.git [Release] wrt_0.8.167 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 993f380..c80552b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,9 +44,17 @@ OPTION(DPL_LOG "DPL logs status" ON) OPTION(WITH_TESTS "Build tests" OFF) #enable csp policy support OPTION(CSP_SUPPORT "Support for csp policy" OFF) +OPTION(APP_SCHEME_SUPPORT "Support for app:// scheme" OFF) +OPTION(CORS_WHITELISTING_SUPPORT "CORS white listing for access positions" OFF) IF(CSP_SUPPORT) ADD_DEFINITIONS("-DCSP_ENABLED") ENDIF(CSP_SUPPORT) +IF(APP_SCHEME_SUPPORT) + ADD_DEFINITIONS("-DAPP_SCHEME_ENABLED") +ENDIF(APP_SCHEME_SUPPORT) +IF(CORS_WHITELISTING_SUPPORT) + ADD_DEFINITIONS("-DCORS_WHITELISTING_ENABLED") +ENDIF(CORS_WHITELISTING_SUPPORT) # logs can be only enabled in debug mode IF(CMAKE_BUILD_TYPE MATCHES "Profiling" AND DPL_LOG) MESSAGE(STATUS "Logging disabled for DPL") diff --git a/debian/changelog b/debian/changelog index b553fe6..d70785f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,13 @@ -wrt (0.8.16) unstable; urgency=low +wrt (0.8.167) unstable; urgency=low + + * Force encoding as specified in config.xml + * Fixed inspector launch fail issue + * Replace window rotation API + * Remove unused source + + -- Jihoon Chung Mon, 25 Mar 2013 20:21:46 +0900 + +wrt (0.8.166) unstable; urgency=low * WRT Process Pool Model * Source clean up (case of launch browser) diff --git a/packaging/wrt.spec b/packaging/wrt.spec index 0faba51..518bc59 100644 --- a/packaging/wrt.spec +++ b/packaging/wrt.spec @@ -1,7 +1,7 @@ -#git:framework/web/wrt wrt_0.8.166 +#git:framework/web/wrt wrt_0.8.167 Name: wrt Summary: web runtime -Version: 0.8.166 +Version: 0.8.167 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 diff --git a/src/domain/widget_data_types.cpp b/src/domain/widget_data_types.cpp index 2fee42c..3a36be3 100644 --- a/src/domain/widget_data_types.cpp +++ b/src/domain/widget_data_types.cpp @@ -149,11 +149,7 @@ WidgetSettingList::WidgetSettingList(WidgetSettings &widgetSettings) value << "]"); m_BackButtonPresence = BackButton_Disable; } - } else if (name == SETTING_NAME_CONTEXT_MENU -#ifndef DEPRECATED_SETTING_STRING - || name == SETTING_NAME_CONTEXTMENU -#endif - ) + } else if (name == SETTING_NAME_CONTEXT_MENU) { if (value == SETTING_VALUE_ENABLE) { m_ContextMenu = ContextMenu_Enable; diff --git a/src/domain/widget_data_types.h b/src/domain/widget_data_types.h index 9d2e73a..101d9fc 100644 --- a/src/domain/widget_data_types.h +++ b/src/domain/widget_data_types.h @@ -101,11 +101,7 @@ static const DPL::String SETTING_NAME_INDICATOR_PRESENCE = L"indicator-presence"; static const DPL::String SETTING_NAME_BACKBUTTON_PRESENCE = L"backbutton-presence"; -#ifndef DEPRECATED_SETTING_STRING -static const DPL::String SETTING_NAME_CONTEXTMENU = - L"contextmenu"; -#endif -static const DPL::String SETTING_NAME_CONTEXT_MENU = + static const DPL::String SETTING_NAME_CONTEXT_MENU = L"context-menu"; static const DPL::String SETTING_NAME_BACKGROUND_SUPPORT = L"background-support"; diff --git a/src/domain/widget_model.cpp b/src/domain/widget_model.cpp index b378da4..023cf13 100644 --- a/src/domain/widget_model.cpp +++ b/src/domain/widget_model.cpp @@ -66,9 +66,13 @@ WidgetModel::WidgetModel(const std::string &tizenId) : StartURL(this), //localized, so not binded StartFileInfo(this), +#ifdef APP_SCHEME_ENABLED + PrefixURL(this, DPL::String(L"app://") + DPL::FromASCIIString(tizenId) + L"/"), +#else //localized, so not binded // file:// + / : without "/" path, webkit return security error PrefixURL(this, L"file:///"), +#endif InstallPath( this, &BindToWidgetDAO::Get), diff --git a/src/view/common/CMakeLists.txt b/src/view/common/CMakeLists.txt index 5eb7dcb..00a8db9 100755 --- a/src/view/common/CMakeLists.txt +++ b/src/view/common/CMakeLists.txt @@ -60,7 +60,6 @@ SET(VIEW_COMMON_SOURCES ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_apps_support.cpp ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_custom_header_support.cpp ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_support.cpp - ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_geolocation_support.cpp ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_password_support.cpp ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_support.cpp ${PROJECT_SOURCE_DIR}/src/view/common/view_logic_security_origin_support.cpp diff --git a/src/view/common/scheme.cpp b/src/view/common/scheme.cpp index 7539c10..618875f 100644 --- a/src/view/common/scheme.cpp +++ b/src/view/common/scheme.cpp @@ -35,6 +35,9 @@ const char * const type2name[Scheme::COUNT] = { "http", "https", "widget", +#ifdef APP_SCHEME_ENABLED + "app", +#endif "vnd.youtube", "rtsp" }; diff --git a/src/view/common/scheme.h b/src/view/common/scheme.h index e004efa..e55bcd8 100644 --- a/src/view/common/scheme.h +++ b/src/view/common/scheme.h @@ -39,6 +39,9 @@ class Scheme HTTP, HTTPS, WIDGET, +#ifdef APP_SCHEME_ENABLED + APP, +#endif YOUTUBE, RTSP, diff --git a/src/view/common/scheme_action_map_data.h b/src/view/common/scheme_action_map_data.h index 3a13f31..46415ea 100644 --- a/src/view/common/scheme_action_map_data.h +++ b/src/view/common/scheme_action_map_data.h @@ -69,6 +69,9 @@ const UriAction g_tizenActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = { { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT }, // HTTP { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT }, // HTTPS { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT }, // WIDGET +#ifdef APP_SCHEME_ENABLED + { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_WRT }, // APP +#endif { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO }, // YOUTUBE { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO } // RTSP }; @@ -85,6 +88,9 @@ const UriAction g_wacActionMap[Scheme::COUNT][SchemeActionMap::COUNT] = { { URI_ACTION_APPSVC, URI_ACTION_WRT, URI_ACTION_APPSVC }, // HTTP { URI_ACTION_APPSVC, URI_ACTION_WRT, URI_ACTION_APPSVC }, // HTTPS { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_APPSVC }, // WIDGET +#ifdef APP_SCHEME_ENABLED + { URI_ACTION_WRT, URI_ACTION_WRT, URI_ACTION_APPSVC }, // APP +#endif { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO }, // YOUTUBE { URI_ACTION_VIDEO, URI_ACTION_VIDEO, URI_ACTION_VIDEO } // RTSP }; diff --git a/src/view/common/view_logic_geolocation_support.cpp b/src/view/common/view_logic_geolocation_support.cpp deleted file mode 100644 index 0dad918..0000000 --- a/src/view/common/view_logic_geolocation_support.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2011 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 view_logic_geolocation_support.cpp - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - */ - -#include "view_logic_geolocation_support.h" - -#include -#include -#include -#include -#include -#include - -namespace { -const char * const GEOLOCATION_ASK_TITLE = "location info"; -const char * const GEOLOCATION_ASK_MSG = - "Application requests your current location. Do you allow it?"; -} - -namespace ViewModule { -namespace GeolocationSupport { -bool askUserForPermission() -{ - return Wrt::Popup::PopupInvoker().askYesNo( - GEOLOCATION_ASK_TITLE, - GEOLOCATION_ASK_MSG); -} - -bool checkRequestedStateOfGeolocationFeature(WrtDB::WidgetDAOReadOnlyPtr dao) -{ - WrtDB::DbWidgetFeature geolocationFeature; - geolocationFeature.name = DPL::FromASCIIString( - WrtDB::GlobalConfig::GetW3CGeolocationFeatureName() ); - - auto features = dao->getFeaturesList(); - - auto it = features.find(geolocationFeature); - - if (it != features.end() ) { - if (it->rejected) { - LogInfo("Feature rejected by ACE"); - return false; - } - return true; - } - - return false; -} - -bool getLocalizationState(const DPL::String& tizenId, bool enableHighAccuracy) -{ - LogDebug("Get localization state"); - - WrtDB::WidgetDAOReadOnlyPtr dao(new WrtDB::WidgetDAOReadOnly(tizenId)); - - if (dao->getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP) { - return askUserForPermission(); - } - - return checkRequestedStateOfGeolocationFeature(dao) && - ViewModule::SecuritySupport::geolocationACECheck(tizenId, - enableHighAccuracy); -} - -bool getGeolocationModuleState(const DPL::String& tizenId) -{ - LogDebug("Get geolocation state"); - - WrtDB::WidgetDAOReadOnlyPtr dao(new WrtDB::WidgetDAOReadOnly(tizenId)); - - if (dao->getWidgetType() == WrtDB::APP_TYPE_TIZENWEBAPP) { - LogInfo("Geolocation enable for tizen app"); - return true; - } - - return checkRequestedStateOfGeolocationFeature(dao); -} -} // namespace GeolocationSupport -} // namespace ViewModule diff --git a/src/view/common/view_logic_geolocation_support.h b/src/view/common/view_logic_geolocation_support.h deleted file mode 100644 index c290058..0000000 --- a/src/view/common/view_logic_geolocation_support.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2011 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 view_logic_geolocations_support.h - * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) - */ - -#ifndef VIEW_LOGIC_GEOLOCATION_SUPPORT_H_ -#define VIEW_LOGIC_GEOLOCATION_SUPPORT_H_ - -#include - -namespace ViewModule { -namespace GeolocationSupport { -/* - * @returns true if user allowed for share current position - * @returns false otherwise - */ -bool getLocalizationState(const DPL::String& tizenId, bool enableHighAccuracy); - -/* - * The function returns requested state of geolocation module - * - * @returns true if geolocation module(navigator.geolocation object) should be - * enabled - * false if geolocation module(navigator.geolocation object) should be - * disabled - */ -bool getGeolocationModuleState(const DPL::String& tizenId); -} -} // namespace ViewModule - -#endif /* VIEW_LOGIC_GEOLOCATION_SUPPORT_H_*/ diff --git a/src/view/common/view_logic_uri_support.cpp b/src/view/common/view_logic_uri_support.cpp index b636eea..6f09e5a 100644 --- a/src/view/common/view_logic_uri_support.cpp +++ b/src/view/common/view_logic_uri_support.cpp @@ -46,6 +46,9 @@ enum ServiceDataType SERVICE_DATA_TYPE_MIME }; +#ifdef APP_SCHEME_ENABLED +char const * const SCHEME_TYPE_APP = "app"; +#endif char const * const SCHEME_TYPE_FILE = "file"; char const * const SCHEME_TYPE_WIDGET = "widget"; @@ -294,7 +297,11 @@ DPL::OptionalString localizeURI(const DPL::String& inputURI, } std::string scheme(urlcstr, end); +#ifdef APP_SCHEME_ENABLED + if (scheme != SCHEME_TYPE_WIDGET && scheme != SCHEME_TYPE_FILE && scheme != SCHEME_TYPE_APP) { +#else if (scheme != SCHEME_TYPE_WIDGET && scheme != SCHEME_TYPE_FILE) { +#endif LogDebug("scheme doesn't need to localize"); return DPL::OptionalString(inputURI); } diff --git a/src/view/webkit/CMakeLists.txt b/src/view/webkit/CMakeLists.txt index 811c49e..6537d63 100644 --- a/src/view/webkit/CMakeLists.txt +++ b/src/view/webkit/CMakeLists.txt @@ -46,7 +46,7 @@ SET(VIEW_MODULE_SOURCES ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic.cpp ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_authentication_challenge_support.cpp ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_scheme_support.cpp - ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_geolocation_support_webkit2.cpp + ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_geolocation_support.cpp ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_usermedia_support.cpp ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_web_notification_support.cpp ${PROJECT_SOURCE_DIR}/src/view/webkit/bundles/plugin_module_support.cpp diff --git a/src/view/webkit/bundles/bundle_uri_handling.cpp b/src/view/webkit/bundles/bundle_uri_handling.cpp index 9a9792e..7e4cce0 100644 --- a/src/view/webkit/bundles/bundle_uri_handling.cpp +++ b/src/view/webkit/bundles/bundle_uri_handling.cpp @@ -22,6 +22,7 @@ #include "bundle_uri_handling.h" #include #include +#include #include // For dao creation (widget info fetching) #include @@ -42,12 +43,19 @@ namespace { char const * const SCHEME_TYPE_FILE = "file"; char const * const SCHEME_TYPE_WIDGET = "widget"; +char const * const SCHEME_TYPE_APP = "app"; char const * const WARP_ERROR_MSG = "file:///usr/etc/wrt/warp_security_error.msg"; char const * const PARAM_URL = "param:url"; +#ifdef APP_SCHEME_ENABLED +char const * const ACE_IGNORED_SCHEMA[] = { "file://", "widget://", "app://", + "data:", "tel:", "sms:", "mmsto:", + "mailto:", 0 }; +#else char const * const ACE_IGNORED_SCHEMA[] = { "file://", "widget://", "data:", "tel:", "sms:", "mmsto:", "mailto:", 0 }; +#endif bool checkWARP(const char *url, const DPL::String& tizenId) { @@ -69,6 +77,25 @@ bool checkWARP(const char *url, const DPL::String& tizenId) DPL::FromUTF8String(std::string(url))); } +bool preventSymlink(const std::string & url) +{ + if(0 != strncmp(url.c_str(), SCHEME_TYPE_FILE, strlen(SCHEME_TYPE_FILE))) + { + return true; + } + if(url.size() >= strlen(SCHEME_TYPE_FILE) + 3) + { + std::string file = url.substr(strlen(SCHEME_TYPE_FILE) + 3); + struct stat st; + if(0 != stat(file.c_str(), &st)) return true; + return !S_ISLNK(st.st_mode); + } + else + { + return true; + } +} + bool checkACE(const char* url, bool xhr, const DPL::String& tizenId) { if (url) { @@ -135,12 +162,17 @@ bool filterURIBySecurity(DPL::OptionalString &op_uri, auto uri = DPL::ToUTF8String(*op_uri); if (!checkWARP(uri.c_str(), tizenId)) { - LogDebug("Request was blocked by WARP: " << uri); + LogWarning("Request was blocked by WARP: " << uri); return false; } if (!checkACE(uri.c_str(), is_xhr, tizenId)) { - LogDebug("Request was blocked by ACE: " << uri); + LogWarning("Request was blocked by ACE: " << uri); + return false; + } + + if (!preventSymlink(uri)) { + LogWarning("Request for symlink is invalid: " << uri); return false; } @@ -171,20 +203,22 @@ bool processURI(const DPL::String& inputURI, DPL::OptionalString localizeURI(const DPL::String& inputURI, const DPL::String& tizenId) { - auto uri = DPL::ToUTF8String(inputURI); + std::string uri = DPL::ToUTF8String(inputURI); LogDebug("localizing url: " << uri); - auto urlcstr = uri.c_str(); - const char *end = strstr(urlcstr, ":"); if (!end) { LogDebug("no schema in link, return null"); // lack of schema return DPL::Optional::Null; } - std::string scheme(urlcstr, end); + +#ifdef APP_SCHEME_ENABLED + if (scheme != SCHEME_TYPE_WIDGET && scheme != SCHEME_TYPE_FILE && scheme != SCHEME_TYPE_APP) { +#else if (scheme != SCHEME_TYPE_WIDGET && scheme != SCHEME_TYPE_FILE) { +#endif LogDebug("scheme doesn't need to localize"); return DPL::OptionalString(inputURI); } diff --git a/src/view/webkit/bundles/page_global_context_container.cpp b/src/view/webkit/bundles/page_global_context_container.cpp index 11cbe98..343fb03 100644 --- a/src/view/webkit/bundles/page_global_context_container.cpp +++ b/src/view/webkit/bundles/page_global_context_container.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ /** - * @file wrt-wk2-PageGlobalContextContainer.cpp + * @file page_global_context_container.cpp * @author Tomasz Iwanek (t.iwanek@smasung.com) * @brief Declares container for global context that holds its references */ diff --git a/src/view/webkit/bundles/page_global_context_container.h b/src/view/webkit/bundles/page_global_context_container.h index e42c76b..1ef3499 100644 --- a/src/view/webkit/bundles/page_global_context_container.h +++ b/src/view/webkit/bundles/page_global_context_container.h @@ -14,7 +14,7 @@ * limitations under the License. */ /** - * @file wrt-wk2-PageGlobalContextContainer.h + * @file page_global_context_container.h * @author Tomasz Iwanek (t.iwanek@smasung.com) * @brief Declares container for global context that holds its references */ diff --git a/src/view/webkit/bundles/wrt-wk2-bundle.cpp b/src/view/webkit/bundles/wrt-wk2-bundle.cpp index ef9f90e..5267a4b 100644 --- a/src/view/webkit/bundles/wrt-wk2-bundle.cpp +++ b/src/view/webkit/bundles/wrt-wk2-bundle.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -90,7 +91,8 @@ const char * const URICHANGE_PLUGIN_NO_CHANGE = "plugin_no_change"; const char * const URICHANGE_BLOCKED_URL = "null"; const char * const SCHEME_HTTP = "http"; const char * const SCHEME_HTTPS = "https"; -const char * const SCHEME_FILE = "file://"; +const char * const SCHEME_FILE = "file"; +const char * const SCHEME_FILE_SLASH = "file://"; const char * const DATA_STRING = "data:"; const char * const BASE64_STRING = ";base64,"; const char * const BLANK_PAGE_URL = "about:blank"; @@ -103,6 +105,9 @@ const std::size_t PLAIN_CHUNK_SIZE = 1008; // bytes const unsigned int UID_ROOT = 0; const unsigned int DEFAULT_PRIORITY = 0; const char * const PRIVILEGE_APP_TYPE = "wgt"; +#ifdef CORS_WHITELISTING_ENABLED +const char * const warpAllowProtocolsForWildcard[] = { "http", "https" }; +#endif static bool m_initWebApp = false; @@ -135,6 +140,7 @@ Tizen::Base::ByteBuffer *DecryptChunkByTrustZone( ByteBuffer *getBuffer = pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf); return getBuffer; } + } Bundle::Bundle(WKBundleRef bundle) : @@ -305,6 +311,56 @@ void Bundle::fixWKMessageArgs(std::string & argScale, } } +#ifdef CORS_WHITELISTING_ENABLED +void Bundle::bypassCORSforWARPAccessList(WrtDB::WidgetDAOReadOnly & dao) +{ + // bypassing CORS using origin whitelist + WrtDB::WidgetAccessInfoList WAList; + dao.getWidgetAccessInfo(WAList); + FOREACH(it, WAList) + { + const WrtDB::WidgetAccessInfo & access = *it; + WKURLRef url = WKURLCreateWithUTF8CString(DPL::ToUTF8String(access.strIRI).c_str()); + +#ifdef APP_SCHEME_ENABLED + std::string source = std::string("app://") + DPL::ToUTF8String(m_widgetTizenId) + "/"; +#else + std::string source = DPL::ToUTF8String(dao.getFullPath()); +#endif + + LogDebug("WARP to WK whitelist position: " << source << " for " + << access.strIRI << " subDomains: " << access.bSubDomains); + + WKStringRef wkSource = WKStringCreateWithUTF8CString(source.c_str()); + WKStringRef wkHost; + WKStringRef wkProtocol; + if(access.strIRI == L"*") + { + //wildcard force to explicitly say which protocol is used + // passed wkHost if empty means wildcard -> allow everything but protocol has to be set. + for(unsigned i = 0; i < sizeof(warpAllowProtocolsForWildcard) / sizeof(char*); i++) + { + wkHost = WKStringCreateWithUTF8CString(""); + wkProtocol = WKStringCreateWithUTF8CString(warpAllowProtocolsForWildcard[i]); + WKBundleAddOriginAccessWhitelistEntry(m_bundle, + wkSource, wkProtocol, wkHost, access.bSubDomains); + } + } + else + { + wkHost = WKURLCopyHostName(url); + wkProtocol = WKURLCopyScheme(url); + WKBundleAddOriginAccessWhitelistEntry(m_bundle, + wkSource, wkProtocol, wkHost, access.bSubDomains); + } + + WKRelease(wkHost); + WKRelease(wkProtocol); + WKRelease(wkSource); + } +} +#endif + void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody) { LogDebug("got message type: " << toString(messageName).c_str()); @@ -335,6 +391,7 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody) ssMsg >> argEncodedBundle; ssMsg >> argTheme; ssMsg >> m_encrypted; + LogWarning("m_encrypted : " << m_encrypted); // ** Language tags setting completed ** fixWKMessageArgs(argScale, argEncodedBundle, argTheme); @@ -438,6 +495,9 @@ void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody) LogDebug("set_app_privilege(" << appPath << ")"); set_app_privilege(tzPkgId.c_str(), PRIVILEGE_APP_TYPE, appPath.c_str()); } +#ifdef CORS_WHITELISTING_ENABLED + bypassCORSforWARPAccessList(dao); +#endif /* This type of message is received when widget is restarting * (proably in other situation too). Widget restart can be @@ -731,8 +791,16 @@ WKURLRequestRef Bundle::willSendRequestForFrame(WKURLRequestRef request) LogDebug("URI processing result: " << *localizedUrl); std::string tmpUrlStr = DPL::ToUTF8String(*localizedUrl); WKURLRef tmpUrl = WKURLCreateWithUTF8CString(tmpUrlStr.c_str()); - std::string scheme = toString(WKURLCopyScheme(url)); + std::string scheme = toString(WKURLCopyScheme(url)); //scheme of original request WKRelease(url); + +#ifdef APP_SCHEME_ENABLED + if(scheme == SCHEME_FILE) { + LogError("File schema blocked for: " << dplurl); + return NULL; + } +#endif + // Return value must contain details information of input // WKURLRequestRef. Current webkit2 doesn't support api that // copy WKURLRequestRef or change url only. Before webkit2 @@ -932,11 +1000,11 @@ bool Bundle::isEncryptedResource(std::string Url, int &size) WrtDB::EncryptedFileInfo info; std::string filePath; - if (0 != strncmp(Url.c_str(), SCHEME_FILE, strlen(SCHEME_FILE))) { + if (0 != strncmp(Url.c_str(), SCHEME_FILE_SLASH, strlen(SCHEME_FILE_SLASH))) { return false; } - filePath = Url.substr(strlen(SCHEME_FILE)); + filePath = Url.substr(strlen(SCHEME_FILE_SLASH)); info.fileName = DPL::FromUTF8String(filePath); if (m_encryptedFiles.end() != (it = m_encryptedFiles.find(info))) @@ -953,7 +1021,7 @@ std::string Bundle::DecryptResource(std::string resource, int size) { std::string filePath; - size_t pos = resource.find_first_not_of(SCHEME_FILE); + size_t pos = resource.find_first_not_of(SCHEME_FILE_SLASH); if (std::string::npos != pos) { filePath = resource.substr(pos - 1); } diff --git a/src/view/webkit/bundles/wrt-wk2-bundle.h b/src/view/webkit/bundles/wrt-wk2-bundle.h index 6c64d65..a0db7cd 100644 --- a/src/view/webkit/bundles/wrt-wk2-bundle.h +++ b/src/view/webkit/bundles/wrt-wk2-bundle.h @@ -163,6 +163,9 @@ class Bundle void fixWKMessageArgs(std::string & argScale, std::string & argEncodedBundle, std::string & argTheme); +#ifdef CORS_WHITELISTING_ENABLED + void bypassCORSforWARPAccessList(WrtDB::WidgetDAOReadOnly &dao); +#endif }; #endif /* WRT_SRC_VIEW_WEBKIT2_WRT_WK2_BUNDLE_H_ */ diff --git a/src/view/webkit/view_logic.cpp b/src/view/webkit/view_logic.cpp index 4c5042e..1dad55c 100644 --- a/src/view/webkit/view_logic.cpp +++ b/src/view/webkit/view_logic.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -54,7 +55,7 @@ #include #include #include -#include +#include #include #include @@ -63,6 +64,7 @@ #include #include +#include #include #include #include @@ -73,15 +75,13 @@ #include namespace { -const char * const bundlePath = "/usr/lib/wrt-wk2-bundles/libwrt-wk2-bundle.so"; const char * const uriBlockedMessageName = "uri_blocked_msg"; const char * const uriChangedMessageName = "uri_changed_msg"; const char * const URICHANGE_PLUGIN_STOP_ONLY = "plugin_stop_only"; const char * const URICHANGE_PLUGIN_RESTART = "plugin_restart"; const char * const URICHANGE_PLUGIN_NO_CHANGE = "plugin_no_change"; -const char * const URICHANGE_BLOCKED_URL = "null"; const char* PATTERN_URI_CHANGE = "^(([^:/\\?#]+)://[^\\?#]*)"; -const int MAX_NUM_CONTEXT_MENU_ITEMS = 10; + // IME State value const char * const IME_STATE_ON = "on"; const char * const IME_STATE_OFF = "off"; @@ -92,12 +92,15 @@ const char PROTOCOL_HANDLER_ASK_REMEMBER[] = "Remember dicision"; const char CONTENT_HANDLER_ASK_MSG[] = "Add content?"; const char CONTENT_HANDLER_ASK_TITLE[] = "Add content"; const char CONTENT_HANDLER_AKS_REMEMBER[] = "Remember dicision"; -const char * const CERTIFICATE_CONFIRM_REQUEST_ASK_TITLE = - "Certification Info"; -const char * const CERTIFICATE_CONFIRM_REQUEST_ASK_BODY = - "This site's security certificate is not trusted! Do you acess this site?"; -const wchar_t* BACKGROUND_ENABLED = L"background_enabled"; +const int WIN_ORIENTATION_PORTRAIT_PRIMARY_ANGLE = 0; +const int WIN_ORIENTATION_PORTRAIT_SECONDARY_ANGLE = 180; +const int WIN_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE = 270; +const int WIN_ORIENTATION_LANDSCAPE_SECONDARY_ANGLE = 90; +const int W3C_ORIENTATION_PORTRAIT_PRIMARY_ANGLE = 0; +const int W3C_ORIENTATION_PORTRAIT_SECONDARY_ANGLE = 180; +const int W3C_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE = 90; +const int W3C_ORIENTATION_LANDSCAPE_SECONDARY_ANGLE = -90; } // anonymous namespace std::mapTizenId); - WrtDB::PropertyDAOReadOnly::WidgetPropertyValue bgEnableValue = - dao.getPropertyValue(DPL::String(BACKGROUND_ENABLED)); - - if (!bgEnableValue.IsNull() && !bgEnableValue->compare(L"true")) { - //skip suspendWidget - LogDebug("Background support enabled, set process active"); - pid_t pid = getpid(); - sysman_inform_active(pid); - m_isBackgroundSupport = true; - } - } -#endif - m_schemeSupport.reset(new SchemeSupport(m_model->Type.Get().appType)); ViewModule::StorageSupport::initializeStorage(m_model); m_appsSupport->initialize(m_model); @@ -707,6 +694,18 @@ void ViewLogic::prepareEwkView(Evas_Object *wkView) ewk_view_page_visibility_state_set(wkView, EWK_PAGE_VISIBILITY_STATE_VISIBLE, EINA_TRUE); + + std::string encoding="UTF-8"; + OptionalWidgetStartFileInfo fileInfo = W3CFileLocalization::getStartFileInfo(m_model->TizenId); + if(!fileInfo.IsNull()){ + encoding=DPL::ToUTF8String((*fileInfo).encoding); + LogInfo("Found custom encoding in DB: " << encoding); + } + LogInfo("Setting encoding: " << encoding); + if(ewk_settings_default_encoding_set(settings,encoding.c_str())) + LogInfo("Encoding set properly"); + else + LogInfo("Error while setting encoding"); } void ViewLogic::removeEwkView(Evas_Object *wkView) @@ -1252,7 +1251,7 @@ void ViewLogic::geolocationPermissionRequestCallback( ewk_geolocation_permission_request_set(permissionRequest, EINA_FALSE); return; } - ViewModule::GeolocationSupport::Webkit2::geolocationPermissionRequest( + ViewModule::GeolocationSupport::geolocationPermissionRequest( This->m_window, This->m_securityOriginSupport->getSecurityOriginDAO(), eventInfo); @@ -1349,20 +1348,34 @@ Eina_Bool ViewLogic::orientationLockCallback( if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) { LogDebug("orientation is portrait-primary"); - elm_win_rotation_with_resize_set(This->m_window, 0); - ewk_view_orientation_send(obj, 0); + elm_win_wm_rotation_preferred_rotation_set( + This->m_window, + WIN_ORIENTATION_PORTRAIT_PRIMARY_ANGLE); + ewk_view_orientation_send(obj, W3C_ORIENTATION_PORTRAIT_PRIMARY_ANGLE); } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) { LogDebug("orientation is landscape-primary"); - elm_win_rotation_with_resize_set(This->m_window, 270); - ewk_view_orientation_send(obj, 90); + elm_win_wm_rotation_preferred_rotation_set( + This->m_window, + WIN_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE); + ewk_view_orientation_send( + obj, + W3C_ORIENTATION_LANDSCAPE_PRIMARY_ANGLE); } else if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) { LogDebug("orientation is portrait-secondary"); - elm_win_rotation_with_resize_set(This->m_window, 180); - ewk_view_orientation_send(obj, 180); + elm_win_wm_rotation_preferred_rotation_set( + This->m_window, + WIN_ORIENTATION_PORTRAIT_SECONDARY_ANGLE); + ewk_view_orientation_send( + obj, + W3C_ORIENTATION_PORTRAIT_SECONDARY_ANGLE); } else if (orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) { LogDebug("orientation is landscape-secondary"); - elm_win_rotation_with_resize_set(This->m_window, 90); - ewk_view_orientation_send(obj, -90); + elm_win_wm_rotation_preferred_rotation_set( + This->m_window, + WIN_ORIENTATION_LANDSCAPE_SECONDARY_ANGLE); + ewk_view_orientation_send( + obj, + W3C_ORIENTATION_LANDSCAPE_SECONDARY_ANGLE); } else { LogDebug("Wrong orientation is set"); return EINA_FALSE; diff --git a/src/view/webkit/view_logic_geolocation_support_webkit2.cpp b/src/view/webkit/view_logic_geolocation_support.cpp similarity index 97% rename from src/view/webkit/view_logic_geolocation_support_webkit2.cpp rename to src/view/webkit/view_logic_geolocation_support.cpp index 33251e1..e1f2d24 100755 --- a/src/view/webkit/view_logic_geolocation_support_webkit2.cpp +++ b/src/view/webkit/view_logic_geolocation_support.cpp @@ -14,11 +14,11 @@ * limitations under the License. */ /** - * @file view_logic_geolocation_support_webkit2.cpp + * @file view_logic_geolocation_support.cpp * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) */ -#include "view_logic_geolocation_support_webkit2.h" +#include "view_logic_geolocation_support.h" #include #include @@ -32,7 +32,6 @@ namespace ViewModule { namespace GeolocationSupport { -namespace Webkit2 { using namespace SecurityOriginDB; using namespace ViewModule::SecurityOriginSupportUtil; @@ -136,6 +135,5 @@ void geolocationPermissionRequest( askUserForGeolocationPermission(window, permissionData); return; } -} } // namespace GeolocationSupport } // namespace ViewModule diff --git a/src/view/webkit/view_logic_geolocation_support_webkit2.h b/src/view/webkit/view_logic_geolocation_support.h similarity index 86% rename from src/view/webkit/view_logic_geolocation_support_webkit2.h rename to src/view/webkit/view_logic_geolocation_support.h index e1869b6..5384f8f 100644 --- a/src/view/webkit/view_logic_geolocation_support_webkit2.h +++ b/src/view/webkit/view_logic_geolocation_support.h @@ -14,12 +14,12 @@ * limitations under the License. */ /** - * @file view_logic_geolocation_support_webkit2.h + * @file view_logic_geolocation_support.h * @author Grzegorz Krawczyk (g.krawczyk@samsung.com) */ -#ifndef VIEW_LOGIC_GEOLOCATION_SUPPORT_WEBKIT2_H_ -#define VIEW_LOGIC_GEOLOCATION_SUPPORT_WEBKIT2_H_ +#ifndef VIEW_LOGIC_GEOLOCATION_SUPPORT_H_ +#define VIEW_LOGIC_GEOLOCATION_SUPPORT_H_ #include #include @@ -30,12 +30,10 @@ class SecurityOriginDAO; namespace ViewModule { namespace GeolocationSupport { -namespace Webkit2 { void geolocationPermissionRequest( Evas_Object* window, SecurityOriginDB::SecurityOriginDAO* securityOriginDAO, void* data); -} } // namespace GeolocationSupport } // namespace ViewModule diff --git a/src/view/webkit/view_logic_scheme_support.cpp b/src/view/webkit/view_logic_scheme_support.cpp index 74f79d8..21e0f90 100644 --- a/src/view/webkit/view_logic_scheme_support.cpp +++ b/src/view/webkit/view_logic_scheme_support.cpp @@ -31,18 +31,8 @@ namespace { char const * const TIZEN_SCHEME = "tizen"; char const * const TIZEN_EXIT = "tizen://exit"; char const * const TIZEN_HIDE = "tizen://hide"; -char const * const TIZEN_ORIENTATION_LANDSCAPE = - "tizen://orientation.landscape"; -char const * const TIZEN_ORIENTATION_PORTAIT = "tizen://orientation.portrait"; -char const * const TIZEN_ORIENTATION_RESET = "tizen://orientation.reset"; char const * const TIZEN_CHANGE_USERAGNET = "tizen://changeUA"; -const int ORIENTATION_LANDSCAPE_ANGLE = 270; -const int ORIENTATION_PORTAIT_ANGLE = 0; - -const int W3C_SCREEN_ORI_PORTRAIT_PRIMARY = 0; -const int W3C_SCREEN_ORI_LANDSCAPE_PRIMARY = 90; - static Eina_Bool exitAppIdlerCallback(void* /*data*/) { // webapp termination @@ -84,30 +74,6 @@ bool SchemeSupport::HandleTizenScheme(const char* uri, elm_win_lower(window); return true; } else if (strncmp(uri, - TIZEN_ORIENTATION_LANDSCAPE, - strlen(TIZEN_ORIENTATION_LANDSCAPE)) == 0) - { - LogInfo("Tizen scheme: " << uri << " orientation landscape"); - elm_win_rotation_with_resize_set(window, ORIENTATION_LANDSCAPE_ANGLE); - ewk_view_orientation_send(wkView, W3C_SCREEN_ORI_LANDSCAPE_PRIMARY); - return true; - } else if (strncmp(uri, - TIZEN_ORIENTATION_PORTAIT, - strlen(TIZEN_ORIENTATION_PORTAIT)) == 0) - { - LogInfo("Tizen scheme: " << uri << " orientation portait"); - elm_win_rotation_with_resize_set(window, ORIENTATION_PORTAIT_ANGLE); - ewk_view_orientation_send(wkView, W3C_SCREEN_ORI_PORTRAIT_PRIMARY); - return true; - } else if (strncmp(uri, - TIZEN_ORIENTATION_RESET, - strlen(TIZEN_ORIENTATION_RESET)) == 0) - { - LogInfo("Tizen scheme: " << uri << " reset"); - elm_win_rotation_with_resize_set(window, ORIENTATION_PORTAIT_ANGLE); - ewk_view_orientation_send(wkView, W3C_SCREEN_ORI_PORTRAIT_PRIMARY); - return true; - } else if (strncmp(uri, TIZEN_CHANGE_USERAGNET, strlen(TIZEN_CHANGE_USERAGNET)) == 0) { diff --git a/wrt.manifest b/wrt.manifest index 1babf21..03886d2 100644 --- a/wrt.manifest +++ b/wrt.manifest @@ -1,11 +1,10 @@ - - - + + + +