From 0d928c4f22d5f152338375ccfc2d12b47329caf3 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Tue, 30 Apr 2013 11:52:54 +0900 Subject: [PATCH] [Release] wrt-commons 0.2.115 --- modules/localization/src/w3c_file_localization.cpp | 17 +++++- modules/widget_dao/dao/widget_dao.cpp | 21 ++++++++ modules/widget_dao/dao/widget_dao_read_only.cpp | 26 ++++++++++ .../include/dpl/wrt-dao-ro/common_dao_types.h | 16 +++++- .../include/dpl/wrt-dao-ro/config_parser_data.h | 30 +++++++++-- .../include/dpl/wrt-dao-ro/widget_dao_read_only.h | 4 ++ .../widget_dao/include/dpl/wrt-dao-rw/widget_dao.h | 3 ++ modules/widget_dao/orm/wrt_db | 60 +++++++++++++--------- packaging/wrt-commons.spec | 4 +- 9 files changed, 148 insertions(+), 33 deletions(-) mode change 100755 => 100644 modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h mode change 100755 => 100644 modules/widget_dao/orm/wrt_db diff --git a/modules/localization/src/w3c_file_localization.cpp b/modules/localization/src/w3c_file_localization.cpp index 85ac27e..152440e 100644 --- a/modules/localization/src/w3c_file_localization.cpp +++ b/modules/localization/src/w3c_file_localization.cpp @@ -141,6 +141,21 @@ DPL::Optional getFilePathInWidgetPackageFromUrl( { DPL::String req = url; + DPL::String suffix; + DPL::String::size_type pos = req.find_first_of('#'); + if(pos != DPL::String::npos) + { + suffix = req.substr(pos) + suffix; + req.resize(pos); //truncate fragment identifier + } + + pos = req.find_first_of('?'); + if(pos != DPL::String::npos) + { + suffix = req.substr(pos) + suffix; + req.resize(pos); //truncate query string + } + if (req.find(WIDGET_URI_BEGIN) == 0) { req.erase(0, WIDGET_URI_BEGIN.length()); } else if (req.find(FILE_URI_BEGIN) == 0) { @@ -182,7 +197,7 @@ DPL::Optional getFilePathInWidgetPackageFromUrl( return DPL::Optional::Null; } - found = widgetPath + *found; + found = widgetPath + *found + suffix; return found; } diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index 553028f..53a340b 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -296,6 +296,8 @@ void WidgetDAO::registerWidgetInternal( registerWidgetWarpInfo(widgetHandle, widgetRegInfo); + registerWidgetAllowNavigationInfo(widgetHandle, widgetRegInfo); + registerWidgetCertificates(widgetHandle, wacSecurity); CertificateChainList list; @@ -407,6 +409,8 @@ DbWidgetHandle WidgetDAO::registerWidgetInfo( row.Set_back_supported(widgetConfigurationInfo.backSupported); row.Set_access_network(widgetConfigurationInfo.accessNetwork); row.Set_pkg_type(regInfo.packagingType.pkgType); + row.Set_security_model_version( + static_cast(widgetConfigurationInfo.securityModelVersion)); Try { @@ -615,6 +619,23 @@ void WidgetDAO::registerWidgetWarpInfo(DbWidgetHandle widgetHandle, } } +void WidgetDAO::registerWidgetAllowNavigationInfo(DbWidgetHandle widgetHandle, + const WidgetRegisterInfo ®Info) +{ + using namespace DPL::DB::ORM; + using namespace DPL::DB::ORM::wrt; + const ConfigParserData& widgetConfigurationInfo = regInfo.configInfo; + + FOREACH(allowNaviIt, widgetConfigurationInfo.allowNavigationInfoList) + { + WidgetAllowNavigation::Row row; + row.Set_app_id(widgetHandle); + row.Set_scheme(allowNaviIt->m_scheme); + row.Set_host(allowNaviIt->m_host); + DO_INSERT(row, WidgetAllowNavigation) + } +} + void WidgetDAO::registerWidgetCertificates(DbWidgetHandle widgetHandle, const IWacSecurity &wacSecurity) { diff --git a/modules/widget_dao/dao/widget_dao_read_only.cpp b/modules/widget_dao/dao/widget_dao_read_only.cpp index ae57410..194c1ac 100644 --- a/modules/widget_dao/dao/widget_dao_read_only.cpp +++ b/modules/widget_dao/dao/widget_dao_read_only.cpp @@ -998,6 +998,25 @@ void WidgetDAOReadOnly::getWidgetAccessInfo( SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get accessinfo list") } +void WidgetDAOReadOnly::getWidgetAllowNavigationInfo( + WidgetAllowNavigationInfoList& allowNavigationList) const +{ + SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN + { + WRT_DB_SELECT(select, WidgetAllowNavigation, &WrtDatabase::interface()) + select->Where(Equals(m_widgetHandle)); + WidgetAllowNavigation::Select::RowList rows = select->GetRowList(); + + FOREACH(it, rows) { + WidgetAllowNavigationInfo info; + info.scheme = it->Get_scheme(); + info.host = it->Get_host(); + allowNavigationList.push_back(info); + } + } + SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get allow-navigation info list") +} + LanguageTags WidgetDAOReadOnly::getLanguageTags() const { //TODO check widget existance @@ -1238,6 +1257,13 @@ PrivilegeList WidgetDAOReadOnly::getWidgetPrivilege() const SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to get PrivilegeList") } +WidgetSecurityModelVersion WidgetDAOReadOnly::getSecurityModelVersion() const +{ + WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle); + DPL::OptionalInt result = row.Get_security_model_version(); + return static_cast(*result); +} + #undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN #undef SQL_CONNECTION_EXCEPTION_HANDLER_END #undef CHECK_WIDGET_EXISTENCE diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h index 1529d03..3c3c943 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h @@ -130,6 +130,14 @@ struct WidgetAccessInfo info.bSubDomains == bSubDomains; } }; +typedef std::list WidgetAccessInfoList; + +struct WidgetAllowNavigationInfo +{ + DPL::String scheme; + DPL::String host; +}; +typedef std::list WidgetAllowNavigationInfoList; struct EncryptedFileInfo { @@ -152,8 +160,6 @@ struct EncryptedFileInfo } }; -typedef std::list WidgetAccessInfoList; - typedef std::list WindowModeList; typedef std::list PrivilegeList; @@ -376,5 +382,11 @@ struct WidgetAppControl }; typedef std::list WidgetAppControlList; + +enum class WidgetSecurityModelVersion +{ + WIDGET_SECURITY_MODEL_V1 = 0, // WARP + WIDGET_SECURITY_MODEL_V2 // CSP, allow-navigation +}; } // namespace WrtDB #endif /* WRT_WIDGET_DAO_COMMON_DAO_TYPES_H_ */ diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h index aa0c6b9..2a85422 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h @@ -195,6 +195,7 @@ class ConfigParserData DPL::String m_pdSrc; DPL::String m_pdWidth; DPL::String m_pdHeight; + DPL::String m_pdFastOpen; }; typedef BoxContent BoxContentInfo; @@ -238,12 +239,27 @@ class ConfigParserData CapabilityList m_capabilityList; }; - LiveboxList m_livebox; - typedef std::list DependsPkgList; - typedef std::set CategoryList; + struct AllowNavigationInfo + { + AllowNavigationInfo(DPL::String scheme, + DPL::String host) : + m_scheme(scheme), + m_host(host) + { } + DPL::String m_scheme; + DPL::String m_host; + }; + typedef std::list AllowNavigationInfoList; + + enum class SecurityModelVersion { + SECURITY_MODEL_V1 = 0, // WARP + SECURITY_MODEL_V2 // CSP, allow-navigation + }; + + LiveboxList m_livebox; StringsList nameSpaces; LocalizedDataSet localizedDataSet; @@ -289,6 +305,9 @@ class ConfigParserData DPL::OptionalString tizenPkgId; DPL::OptionalString tizenAppId; + // allow-navigation + AllowNavigationInfoList allowNavigationInfoList; + //csp polic for widget DPL::OptionalString cspPolicy; DPL::OptionalString cspPolicyReportOnly; @@ -306,13 +325,16 @@ class ConfigParserData CategoryList categoryList; // For Account AccountProvider accountProvider; + // security model version + SecurityModelVersion securityModelVersion; ConfigParserData() : flashNeeded(false), minVersionRequired(), backSupported(false), accessNetwork(false), - startFileEncountered(false) + startFileEncountered(false), + securityModelVersion(SecurityModelVersion::SECURITY_MODEL_V1) {} }; } // namespace WrtDB diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h old mode 100755 new mode 100644 index b92cb38..1ae5364 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h @@ -443,6 +443,8 @@ class WidgetDAOReadOnly * @param[out] outAccessInfoList list filled with access info structures */ void getWidgetAccessInfo(WidgetAccessInfoList& outAccessInfoList) const; + void getWidgetAllowNavigationInfo( + WidgetAllowNavigationInfoList& allowNavigationInfoList) const; /** * WAC 2.0 extension @@ -819,6 +821,8 @@ class WidgetDAOReadOnly */ TizenPkgId getTizenPkgId() const; PrivilegeList getWidgetPrivilege() const; + WidgetSecurityModelVersion getSecurityModelVersion() const; + }; } // namespace WrtDB diff --git a/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h b/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h index b3c276a..3647d4e 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h +++ b/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h @@ -186,6 +186,9 @@ class WidgetDAO : public WidgetDAOReadOnly static void registerWidgetWarpInfo( DbWidgetHandle widgetHandle, const WidgetRegisterInfo ®Info); + static void registerWidgetAllowNavigationInfo( + DbWidgetHandle widgetHandle, + const WidgetRegisterInfo ®Info); static void registerWidgetCertificates( DbWidgetHandle widgetHandle, const IWacSecurity &wacSecurity); diff --git a/modules/widget_dao/orm/wrt_db b/modules/widget_dao/orm/wrt_db old mode 100755 new mode 100644 index 3a16855..607ec23 --- a/modules/widget_dao/orm/wrt_db +++ b/modules/widget_dao/orm/wrt_db @@ -19,30 +19,31 @@ SQL( ) CREATE_TABLE(WidgetInfo) - COLUMN_NOT_NULL(app_id, INTEGER, PRIMARY KEY AUTOINCREMENT) - COLUMN(widget_type, INT, DEFAULT 1) - COLUMN(widget_id, TEXT, DEFAULT '') - COLUMN(widget_version, TEXT, DEFAULT '') - COLUMN(widget_width, INT, DEFAULT 0) - COLUMN(widget_height, INT, DEFAULT 0) - COLUMN(author_name, TEXT, DEFAULT '') - COLUMN(author_email, TEXT, DEFAULT '') - COLUMN(author_href, TEXT, DEFAULT '') - COLUMN(base_folder, TEXT, DEFAULT '') - COLUMN(webkit_plugins_required, TINYINT, DEFAULT 0) - COLUMN(security_domain, INT, DEFAULT 0) - COLUMN(csp_policy, TEXT, DEFAULT '') - COLUMN(csp_policy_report_only, TEXT, DEFAULT '') - COLUMN(recognized, INT, DEFAULT 0) - COLUMN(wac_signed, INT, DEFAULT 0) - COLUMN(distributor_signed, INT, DEFAULT 0) - COLUMN(min_version, TEXT, DEFAULT '1.0') - COLUMN_NOT_NULL(back_supported, TINYINT, DEFAULT 0) - COLUMN(access_network, TINYINT, DEFAULT 0) - COLUMN(defaultlocale, TEXT, DEFAULT 0) - COLUMN_NOT_NULL(tizen_pkgid, TEXT, DEFAULT '') - COLUMN_NOT_NULL(tizen_appid, TEXT, DEFAULT 0 UNIQUE) - COLUMN(pkg_type, INT, DEFAULT 0) + COLUMN_NOT_NULL(app_id, INTEGER, PRIMARY KEY AUTOINCREMENT) + COLUMN(widget_type, INT, DEFAULT 1) + COLUMN(widget_id, TEXT, DEFAULT '') + COLUMN(widget_version, TEXT, DEFAULT '') + COLUMN(widget_width, INT, DEFAULT 0) + COLUMN(widget_height, INT, DEFAULT 0) + COLUMN(author_name, TEXT, DEFAULT '') + COLUMN(author_email, TEXT, DEFAULT '') + COLUMN(author_href, TEXT, DEFAULT '') + COLUMN(base_folder, TEXT, DEFAULT '') + COLUMN(webkit_plugins_required, TINYINT, DEFAULT 0) + COLUMN(security_domain, INT, DEFAULT 0) + COLUMN(csp_policy, TEXT, DEFAULT '') + COLUMN(csp_policy_report_only, TEXT, DEFAULT '') + COLUMN(recognized, INT, DEFAULT 0) + COLUMN(wac_signed, INT, DEFAULT 0) + COLUMN(distributor_signed, INT, DEFAULT 0) + COLUMN(min_version, TEXT, DEFAULT '1.0') + COLUMN_NOT_NULL(back_supported, TINYINT, DEFAULT 0) + COLUMN(access_network, TINYINT, DEFAULT 0) + COLUMN(defaultlocale, TEXT, DEFAULT 0) + COLUMN_NOT_NULL(tizen_pkgid, TEXT, DEFAULT '') + COLUMN_NOT_NULL(tizen_appid, TEXT, DEFAULT 0 UNIQUE) + COLUMN(pkg_type, INT, DEFAULT 0) + COLUMN(security_model_version, INT, DEFAULT 0) CREATE_TABLE_END() SQL( @@ -217,6 +218,17 @@ CREATE_TABLE(WidgetWARPInfo) ) CREATE_TABLE_END() +CREATE_TABLE(WidgetAllowNavigation) + COLUMN_NOT_NULL(app_id, INT,) + COLUMN_NOT_NULL(scheme, TEXT,) + COLUMN_NOT_NULL(host, TEXT,) + + TABLE_CONSTRAINTS( + PRIMARY KEY(app_id, scheme, host) + FOREIGN KEY (app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE + ) +CREATE_TABLE_END() + CREATE_TABLE(WidgetSecuritySettings) COLUMN_NOT_NULL(app_id, INT,) COLUMN_NOT_NULL(security_popup_usage, INT, DEFAULT 1) diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index 77ab118..a5f6436 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -1,7 +1,7 @@ -#git:framework/web/wrt-commons wrt-commons 0.2.113 +#git:framework/web/wrt-commons wrt-commons 0.2.115 Name: wrt-commons Summary: Wrt common library -Version: 0.2.113 +Version: 0.2.115 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 -- 2.7.4