############################# compilation defines #############################
-
-#csp from .xml parsing enabled
-OPTION(CSP_SUPPORT "Support for csp policy" OFF)
-
-IF(CSP_SUPPORT)
- ADD_DEFINITIONS("-DCSP_ENABLED")
-ENDIF(CSP_SUPPORT)
+OPTION(DPL_LOG "DPL logs status" ON)
+OPTION(WITH_TESTS "Build tests" OFF)
+OPTION(MULTIPROCESS_SERVICE_SUPPORT "Process per service" OFF)
+OPTION(MULTIPROCESS_SERVICE_SUPPORT_INLINE "Process per service - inline mode support" OFF)
+OPTION(CSP_SUPPORT "Support for csp policy" ON)
+OPTION(ALLOW_NAVIGATION_SUPPORT "Support for allow-navigation" ON)
############################# compiler flags ##################################
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++0x -g")
SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++0x -g --coverage")
-OPTION(DPL_LOG "DPL logs status" ON)
-OPTION(WITH_TESTS "Build tests" OFF)
-OPTION(MULTIPROCESS_SERVICE_SUPPORT "Process per service" OFF)
-OPTION(MULTIPROCESS_SERVICE_SUPPORT_INLINE "Process per service - inline mode support" OFF)
IF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
MESSAGE(STATUS "Logging enabled for DPL")
ADD_DEFINITIONS("-DDPL_LOGS_ENABLED")
ADD_DEFINITIONS("-DMULTIPROCESS_SERVICE_SUPPORT_INLINE")
ENDIF(MULTIPROCESS_SERVICE_SUPPORT_INLINE)
ENDIF(MULTIPROCESS_SERVICE_SUPPORT)
+IF(CSP_SUPPORT)
+ ADD_DEFINITIONS("-DCSP_ENABLED")
+ENDIF(CSP_SUPPORT)
+IF(ALLOW_NAVIGATION_SUPPORT)
+ ADD_DEFINITIONS("-DALLOW_NAVIGATION_ENABLED")
+ENDIF(CSP_SUPPORT)
# If supported for the target machine, emit position-independent code,suitable
# for dynamic linking and avoiding any limit on the size of the global offset
-#git:framework/web/wrt-installer wrt-installer 0.1.41
+#git:framework/web/wrt-installer wrt-installer 0.1.47
Name: wrt-installer
Summary: Installer for tizen Webruntime
-Version: 0.1.41
+Version: 0.1.47
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
#include <dpl/log/log.h>
#include <dpl/fast_delegate.h>
#include <dpl/foreach.h>
+#include <dpl/scoped_ptr.h>
#include <pcrecpp.h>
#include <algorithm>
#include <string>
m_width = attribute.value;
} else if (attribute.name == L"height") {
m_height = attribute.value;
+ } else if (attribute.name == L"fast-open") {
+ m_fastOpen= attribute.value;
}
}
}
m_data.m_pdSrc = m_src;
m_data.m_pdWidth = m_width;
m_data.m_pdHeight = m_height;
+ m_data.m_pdFastOpen = m_fastOpen;
}
explicit PdParser(
DPL::String m_src;
DPL::String m_width;
DPL::String m_height;
+ DPL::String m_fastOpen;
bool m_properNamespace;
ConfigParserData::LiveboxInfo::BoxContentInfo& m_data;
bool m_properNamespace;
};
+class AllowNavigationParser : public ElementParser
+{
+ public:
+ AllowNavigationParser(ConfigParserData& data) :
+ ElementParser(),
+ m_data(data),
+ m_properNamespace(false)
+ {}
+
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const Text& text)
+ {
+ if (m_properNamespace) {
+ m_origin = text.value;
+ }
+ }
+
+ virtual void Accept(const XmlAttribute& /*attribute*/)
+ {
+ }
+
+ virtual void Verify()
+ {
+ if (m_origin.IsNull()) {
+ LogWarning("data is empty");
+ return;
+ }
+
+ char* data = strdup(DPL::ToUTF8String(*m_origin).c_str());
+ char* ptr = strtok(data," ");
+ while (ptr != NULL) {
+ std::string origin = ptr;
+ ptr = strtok(NULL," ");
+ if(origin == "*") {
+ ConfigParserData::AllowNavigationInfo info(L"*", L"*");
+ m_data.allowNavigationInfoList.push_back(info);
+ continue;
+ }
+
+ DPL::ScopedPtr<iri_t> iri(iri_parse(origin.c_str()));
+ if (!iri->host || strlen(iri->host) == 0) {
+ // input origin should has schem and host
+ // in case of file scheme path is filled
+ // "http://"
+ LogWarning("input origin isn't verified");
+ continue;
+ }
+ DPL::String scheme = L"*";
+ if (iri->scheme && strlen(iri->scheme) != 0) {
+ scheme = DPL::FromUTF8String(iri->scheme);
+ }
+ ConfigParserData::AllowNavigationInfo info(
+ scheme,
+ DPL::FromUTF8String(iri->host));
+ m_data.allowNavigationInfoList.push_back(info);
+ }
+ }
+
+ private:
+ DPL::OptionalString m_origin;
+ ConfigParserData& m_data;
+ bool m_properNamespace;
+};
+
class CspParser : public ElementParser
{
public:
&WidgetParser::
OnCspReportOnlyElement);
#endif
+#ifdef ALLOW_NAVIGATION_ENABLED
+ m_map[L"allow-navigation"] =
+ DPL::MakeDelegate(this, &WidgetParser::OnAllowNavigationElement);
+#endif
m_map[L"account"] = DPL::MakeDelegate(this, &WidgetParser::OnAccountElement);
}
return ElementParserPtr(new CspReportOnlyParser(m_data));
}
+ElementParserPtr WidgetParser::OnAllowNavigationElement()
+{
+ return ElementParserPtr(new AllowNavigationParser(m_data));
+}
+
ElementParserPtr WidgetParser::OnAccountElement()
{
return ElementParserPtr(new AccountParser(m_data));
ElementParserPtr OnAppWidgetElement();
ElementParserPtr OnCspElement();
ElementParserPtr OnCspReportOnlyElement();
+ ElementParserPtr OnAllowNavigationElement();
ElementParserPtr OnAccountElement();
virtual ActionFunc GetElementParser(const DPL::String& ns,
std::string tizenId = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
+ // insert specific information to web livebox db
for (auto it = m_context.widgetConfig.configInfo.m_livebox.begin();
it != m_context.widgetConfig.configInfo.m_livebox.end(); ++it)
{
std::string boxId = DPL::ToUTF8String((**it).m_liveboxId);
std::string boxType;
- if ((**it).m_type == L"") {
+ if ((**it).m_type.empty()) {
boxType = web_provider_livebox_get_default_type();
} else {
boxType = DPL::ToUTF8String((**it).m_type);
LogInfo("livebox id: " << boxId);
LogInfo("livebox type: " << boxType);
- int autoLaunch;
- if ((**it).m_autoLaunch == L"true") {
- autoLaunch = 1;
- } else {
- autoLaunch = 0;
- }
+ int autoLaunch = (**it).m_autoLaunch == L"true" ? 1 : 0;
LogInfo("livebox auto-launch: " << autoLaunch);
- int mouseEvent;
- if ((**it).m_boxInfo.m_boxMouseEvent == L"true") {
- mouseEvent = 1;
- } else {
- mouseEvent = 0;
- }
+ int mouseEvent = (**it).m_boxInfo.m_boxMouseEvent == L"true" ? 1 : 0;
LogInfo("livebox mouse-event: " << mouseEvent);
- int ret =
- web_provider_livebox_insert_box_info(
- boxId.c_str(), tizenId.c_str(), boxType.c_str(), autoLaunch, mouseEvent);
+ int pdFastOpen = (**it).m_boxInfo.m_pdFastOpen == L"true" ? 1 : 0;
+ LogInfo("livebox pd fast-open: " << pdFastOpen);
- if (ret < 0) {
- LogDebug("failed to set type of livebox: " << boxId);
- }
+ web_provider_livebox_insert_box_info(
+ boxId.c_str(), tizenId.c_str(), boxType.c_str(),
+ autoLaunch, mouseEvent, pdFastOpen);
}
}
} //namespace WidgetInstall
ThrowMsg(Exceptions::RemovingFolderFailure,
"Error occurs during removing existing folder");
}
+ // Remove user data directory if preload web app.
+ std::string userData = m_context.locations->getUserDataRootDir();
+ if (0 == access(userData.c_str(), F_OK)) {
+ WrtUtilRemove(userData);
+ }
+
}
LogDebug("Rename widget path sucessful!");
}
AddStep(&TaskSmack::SmackFolderLabelingStep);
AddStep(&TaskSmack::SmackPrivilegeStep);
AddStep(&TaskSmack::SmackTemporaryStep);
+ AddStep(&TaskSmack::SetEndofInstallation);
}
void TaskSmack::SmackFolderLabelingStep()
#endif
}
+void TaskSmack::SetEndofInstallation()
+{
+ m_context.job->UpdateProgress(
+ InstallerContext::INSTALL_END,
+ "End installation");
+}
} //namespace WidgetInstall
} //namespace Jobs
void SmackFolderLabelingStep();
void SmackPrivilegeStep();
void SmackTemporaryStep();
+ void SetEndofInstallation();
public:
TaskSmack(InstallerContext& context);
AddStep(&TaskWidgetConfig::ProcessLocalizedIcons);
AddStep(&TaskWidgetConfig::ProcessWidgetInstalledPath);
AddStep(&TaskWidgetConfig::ProcessAppControlInfo);
+ AddStep(&TaskWidgetConfig::ProcessSecurityModel);
AddStep(&TaskWidgetConfig::StepVerifyFeatures);
AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
}
}
}
+void TaskWidgetConfig::ProcessSecurityModel()
+{
+ bool isSecurityModelV1 = false;
+ bool isSecurityModelV2 = false;
+ WrtDB::ConfigParserData &data = m_installContext.widgetConfig.configInfo;
+
+ // WARP is V1
+ if (!data.accessInfoSet.empty()) {
+ isSecurityModelV1 = true;
+ }
+
+ // CSP is V2
+ if (!data.cspPolicy.IsNull() || !data.cspPolicyReportOnly.IsNull()) {
+ isSecurityModelV2 = true;
+ }
+
+ // allow-navigation is V2
+ if (!data.allowNavigationInfoList.empty()) {
+ isSecurityModelV2 = true;
+ }
+
+ if (isSecurityModelV1 && isSecurityModelV2) {
+ LogError("Security model is conflict");
+ ThrowMsg(Exceptions::NotAllowed, "Security model is conflict");
+ } else if (isSecurityModelV1) {
+ data.securityModelVersion =
+ WrtDB::ConfigParserData::SecurityModelVersion::SECURITY_MODEL_V1;
+ } else if (isSecurityModelV2) {
+ data.securityModelVersion =
+ WrtDB::ConfigParserData::SecurityModelVersion::SECURITY_MODEL_V2;
+ } else {
+ data.securityModelVersion =
+ WrtDB::ConfigParserData::SecurityModelVersion::SECURITY_MODEL_V1;
+ }
+
+ m_installContext.job->UpdateProgress(
+ InstallerContext::INSTALL_WIDGET_CONFIG2,
+ "Finished process security model");
+}
+
void TaskWidgetConfig::StepCheckMinVersionInfo()
{
if (!isMinVersionCompatible(
void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
void ProcessWidgetInstalledPath();
void ProcessAppControlInfo();
+ void ProcessSecurityModel();
void StepVerifyFeatures();
void StepCheckMinVersionInfo();
m_context.tzPkgid = DPL::ToUTF8String(dao.getTizenPkgId());
m_context.locations = WidgetLocation(m_context.tzPkgid);
m_context.locations->registerAppid(m_context.tzAppid);
+ m_context.installedPath =
+ DPL::ToUTF8String(*dao.getWidgetInstalledPath());
LogInfo("Widget model exists. App id : " << m_context.tzAppid);
if (0 == installPath.compare(0, PRELOAD_INSTALLED_PATH.length(),
PRELOAD_INSTALLED_PATH)) {
- LogError("This widget is prealoaded. So it cann't be removed");
- return WidgetStatus::PREALOAD;
+ LogDebug("This widget is prealoded.");
}
} Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
LogDebug("package id : " << pkgId);
{
LogDebug("Removing directory");
m_context.removeStarted = true;
- std::string widgetDir =
- m_context.locations->getPackageInstallationDir();
- if (!WrtUtilRemove(widgetDir)) {
- LogError("Removing widget installation directory failed");
+ if (!WrtUtilRemove(m_context.installedPath)) {
+ LogError("Removing widget installation directory failed : " <<
+ m_context.installedPath);
}
std::string dataDir = m_context.locations->getUserDataRootDir();
if (!WrtUtilRemove(dataDir)) {
std::string tzAppid;
std::string tzPkgid;
bool removeAbnormal;
+ std::string installedPath;
};
#endif // WRT_SRC_INSTALLER_CORE_UNINSTALLER_TASKS_UNINSTALLER_CONTEXT_H_
const char* ptr = strtok(buf,":");
while (ptr != NULL) {
std::string string = ptr;
+ ptr = strtok (NULL, ":");
size_t pos = string.find('=');
if (pos == std::string::npos) {
continue;
}
result.insert(
CSCConfiguration::dataPair(string.substr(0, pos),
- string.substr(pos+1)));
- ptr = strtok (NULL, ":");
+ string.substr(pos+1)));
}
return result;
}