[Release] wrt-commons 0.2.115
authorJihoon Chung <jihoon.chung@samsung.com>
Tue, 30 Apr 2013 02:52:54 +0000 (11:52 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Tue, 30 Apr 2013 02:53:28 +0000 (11:53 +0900)
modules/localization/src/w3c_file_localization.cpp
modules/widget_dao/dao/widget_dao.cpp
modules/widget_dao/dao/widget_dao_read_only.cpp
modules/widget_dao/include/dpl/wrt-dao-ro/common_dao_types.h
modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h
modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h [changed mode: 0755->0644]
modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h
modules/widget_dao/orm/wrt_db [changed mode: 0755->0644]
packaging/wrt-commons.spec

index 85ac27e..152440e 100644 (file)
@@ -141,6 +141,21 @@ DPL::Optional<DPL::String> 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<DPL::String> getFilePathInWidgetPackageFromUrl(
         return DPL::Optional<DPL::String>::Null;
     }
 
-    found = widgetPath + *found;
+    found = widgetPath + *found + suffix;
 
     return found;
 }
index 553028f..53a340b 100644 (file)
@@ -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<int>(widgetConfigurationInfo.securityModelVersion));
 
     Try
     {
@@ -615,6 +619,23 @@ void WidgetDAO::registerWidgetWarpInfo(DbWidgetHandle widgetHandle,
     }
 }
 
+void WidgetDAO::registerWidgetAllowNavigationInfo(DbWidgetHandle widgetHandle,
+                                                  const WidgetRegisterInfo &regInfo)
+{
+    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)
 {
index ae57410..194c1ac 100644 (file)
@@ -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<WidgetAllowNavigation::app_id>(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<WidgetSecurityModelVersion>(*result);
+}
+
 #undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
 #undef SQL_CONNECTION_EXCEPTION_HANDLER_END
 #undef CHECK_WIDGET_EXISTENCE
index 1529d03..3c3c943 100644 (file)
@@ -130,6 +130,14 @@ struct WidgetAccessInfo
                info.bSubDomains == bSubDomains;
     }
 };
+typedef std::list<WidgetAccessInfo> WidgetAccessInfoList;
+
+struct WidgetAllowNavigationInfo
+{
+    DPL::String scheme;
+    DPL::String host;
+};
+typedef std::list<WidgetAllowNavigationInfo> WidgetAllowNavigationInfoList;
 
 struct EncryptedFileInfo
 {
@@ -152,8 +160,6 @@ struct EncryptedFileInfo
     }
 };
 
-typedef std::list<WidgetAccessInfo> WidgetAccessInfoList;
-
 typedef std::list<DPL::String> WindowModeList;
 
 typedef std::list<DPL::String> PrivilegeList;
@@ -376,5 +382,11 @@ struct WidgetAppControl
 };
 
 typedef std::list<WidgetAppControl> 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_ */
index aa0c6b9..2a85422 100644 (file)
@@ -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<DPL::OptionalString> DependsPkgList;
-
     typedef std::set<DPL::String> 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<AllowNavigationInfo> 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
old mode 100755 (executable)
new mode 100644 (file)
index b92cb38..1ae5364
@@ -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
 
index b3c276a..3647d4e 100644 (file)
@@ -186,6 +186,9 @@ class WidgetDAO : public WidgetDAOReadOnly
     static void registerWidgetWarpInfo(
         DbWidgetHandle widgetHandle,
         const WidgetRegisterInfo &regInfo);
+    static void registerWidgetAllowNavigationInfo(
+        DbWidgetHandle widgetHandle,
+        const WidgetRegisterInfo &regInfo);
     static void registerWidgetCertificates(
         DbWidgetHandle widgetHandle,
         const IWacSecurity &wacSecurity);
old mode 100755 (executable)
new mode 100644 (file)
index 3a16855..607ec23
@@ -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)
index 77ab118..a5f6436 100644 (file)
@@ -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