#include <set>
#include <memory>
-#include <dpl/log/log.h>
#include <dpl/foreach.h>
#include <dpl/assert.h>
#include <dpl/wrt-dao-ro/WrtDatabase.h>
#include <dpl/localization/LanguageTagsProvider.h>
#include <dpl/event/main_event_dispatcher.h>
+#include <wrt_log.h>
#include <wrt_plugin_module.h>
#include <profiling_util.h>
WrtDB::WrtDatabase::attachToThreadRO();
LOG_PROFILE_STOP("Bundle attachToThread");
} Catch (DPL::DB::SqlConnection::Exception::Base) {
- LogError("## Db attach was failed! Terminate WebProcess by force. ##");
+ _E("## Db attach was failed! Terminate WebProcess by force. ##");
exit(-1);
}
WrtDB::WrtDatabase::detachFromThread();
if (!m_pagesList.empty()) {
- LogError("There are not closed pages!");
+ _E("There are not closed pages!");
}
WKRelease(m_bundle);
}
const void* clientInfo)
{
LOG_PROFILE_START("didCreatePageCallback");
- LogDebug("didCreatePageCallback called");
Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
This->didCreatePage(page);
LOG_PROFILE_STOP("didCreatePageCallback");
WKTypeRef messageBody,
const void *clientInfo)
{
- LogDebug("didReceiveMessageCallback called");
Bundle* bundle = static_cast<Bundle*>(const_cast<void*>(clientInfo));
bundle->didReceiveMessage(messageName, messageBody);
}
WKBundlePageRef page,
const void* clientInfo)
{
- LogDebug("willDestroyPageCallback called");
- Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
+ Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
This->willDestroyPage(page);
}
{
if (!m_initialized)
{
- LogError("## Injected-bundle was not initialized! Terminate WebProcess by force. ##");
+ _E("## Injected-bundle was not initialized! Terminate WebProcess by force. ##");
exit(-1);
}
auto context = WKBundleFrameGetJavaScriptContext(mainFrame);
m_pagesList.push_back(page);
m_pageGlobalContext.insertContextForPage(page, context);
- LogDebug("created Page : " << page << " created JSContext : " << context);
+ _D("created Page : %p created JSContext : %p", page, context);
m_viewmodesSupport->initialize(page);
WKBundlePageResourceLoadClient resourceLoadClient = {
void Bundle::willDestroyPage(WKBundlePageRef page)
{
- LogDebug("Destroyed page : " << page);
+ _D("Destroyed page : %p", page);
auto context = m_pageGlobalContext.getContextForPage(page);
m_pagesList.remove(page);
std::string source = DPL::ToUTF8String(dao.getFullPath());
#endif
- LogDebug("WARP to WK whitelist position: " << source << " for "
- << access.strIRI << " subDomains: " << access.bSubDomains);
+ _D("WARP to WK whitelist position: %s for %s subDomains: %d",
+ source.c_str(),
+ DPL::ToUTF8String(access.strIRI).c_str(),
+ access.bSubDomains);
WKStringRef wkSource = WKStringCreateWithUTF8CString(source.c_str());
WKStringRef wkHost;
void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
{
- LogDebug("got message type: " << toString(messageName).c_str());
+ _D("message name: %s", toString(messageName).c_str());
if (WKStringIsEqualToUTF8CString(messageName,
Message::ToInjectedBundle::START))
{
if (!messageBody || WKStringGetTypeID() != WKGetTypeID(messageBody)) {
- LogError("Wrong message format received, ignoring");
+ _E("Wrong message format received, ignoring");
return;
}
std::string msgString =
toString(static_cast<WKStringRef>(messageBody));
- LogDebug("Got message text: " << msgString);
- LogDebug("loading Page : " << m_pagesList.back() <<
- " loading JSContext : " <<
- m_pageGlobalContext.getContextForPage(m_pagesList.back()));
+ _D("message body: %s", msgString.c_str());
// set information from ui process
std::stringstream ssMsg(msgString);
std::string argScale;
} else if (WKStringIsEqualToUTF8CString(messageName,
Message::ToInjectedBundle::SHUTDOWN))
{
- LogDebug("shutdown plugins");
-
if (m_pagesList.empty()) {
+ _D("shutdown plugins");
PluginModule::shutdown();
} else {
- LogInfo(
- "PluginModule shutdown ignored, there are still alive pages!");
+ _D("PluginModule shutdown ignored, there are still alive pages!");
}
}
else if (WKStringIsEqualToUTF8CString(messageName,
Message::ToInjectedBundle::SET_CUSTOM_PROPERTIES))
{
- LogDebug("reset custom properties of window objects");
// set information from ui process
std::string msgString =
toString(static_cast<WKStringRef>(messageBody));
-
+ _D("message body: %s", msgString.c_str());
std::string argScale;
std::string argEncodedBundle;
std::string argTheme;
messageName,
Message::ToInjectedBundle::DISPATCH_JS_EVENT))
{
- LogDebug("dispatch javascript event to created frames");
+ _D("dispatch javascript event to created frames");
using namespace WrtPlugins::W3C;
// set information from ui process
messageName,
Message::ToInjectedBundle::INIT))
{
- LogDebug("initialize");
-
if (!m_initialized) {
+ _D("initialize");
std::string msgString = toString(static_cast<WKStringRef>(messageBody));
m_widgetTizenId = DPL::FromASCIIString(msgString);
WrtDB::WidgetDAOReadOnly dao(m_widgetTizenId);
GetUserWidgetExecPath() + "/" + tzAppId;
}
- LogDebug("set_app_smack_label(" << appPath << ")");
- if (set_app_smack_label(appPath.c_str()) != 0)
- {
- LogError("set_app_smack_label() failed");
+ _D("set_app_smack_label(%s)", appPath.c_str());
+ if (set_app_smack_label(appPath.c_str()) != 0) {
+ _E("set_app_smack_label() failed");
}
- LogDebug("set_app_privilege(" << appPath << ")");
+ _D("set_app_privilege(%s)", appPath.c_str());
set_app_privilege(tzPkgId.c_str(), PRIVILEGE_APP_TYPE, appPath.c_str());
}
}
LanguageTags tags =
LanguageTagsProviderSingleton::Instance().getLanguageTags();
- LogDebug("Current widget locales (language tags):");
+ _D("Current widget locales (language tags):");
FOREACH(it, tags) {
- LogDebug("Locale: " << *it);
+ _D("Locale: %s", DPL::ToUTF8String(*it).c_str());
}
m_widgetType = dao.getWidgetType();
- LogDebug("m_widgetType : " << m_widgetType.getApptypeToString() <<
- "(m_widgetTizenId:" << m_widgetTizenId << ")");
- LogDebug("Preload PluginLogicSingleton");
+ _D("Preload PluginLogicSingleton");
PluginModule::init(WrtDB::WidgetDAOReadOnly::getHandle(m_widgetTizenId));
- LogDebug("Preload PluginLogicSingleton_end");
+ _D("Preload PluginLogicSingleton_end");
m_securityModelVersion = dao.getSecurityModelVersion();
#ifdef CORS_WHITELISTING_ENABLED
new InjectedBundle::ViewmodesSupport(m_widgetTizenId));
m_initialized = true;
} else {
- LogDebug("already initalized");
+ _D("already initalized");
}
} else if (WKStringIsEqualToUTF8CString(
messageName,
{
std::string msgString =
toString(static_cast<WKStringRef>(messageBody));
- LogDebug("set x window handle [" << msgString << "]");
+ _D("set x window handle [%s]", msgString.c_str());
IPCMessageSupport::setXwindowHandle(atoi(msgString.c_str()));
} else if (WKStringIsEqualToUTF8CString(
messageName,
{
std::string msgBody =
toString(static_cast<WKStringRef>(messageBody));
- LogDebug("set viewmode to [" << msgBody << "]");
+ _D("set viewmode to [%s]", msgBody.c_str());
if (msgBody == Message::ToInjectedBundle::SET_VIEWMODES_MSGBODY_EXIT) {
m_viewmodesSupport->exitViewmodesAllPages();
} else {
std::string msgBody = toString(static_cast<WKStringRef>(messageBody));
- if (msgBody.find_first_of('_') != std::string::npos)
- {
+ if (msgBody.find_first_of('_') != std::string::npos) {
std::string strHandle = msgBody.substr(0, msgBody.find_first_of('_'));
std::string strBody = msgBody.substr(msgBody.find_first_of('_')+1);
- LogDebug("handle: " << strHandle << ", Body:" << strBody);
+ _D("handle: %s, , Body: %s", strHandle.c_str(), strBody.c_str());
int handle = atoi(strHandle.c_str());
AsyncConnectionPtr connection = AsyncConnectionManager::instance().getConnection(handle);
- if (connection)
- {
- if (connection->replyCallback)
- {
- LogDebug("connection->replyCallback()");
+ if (connection) {
+ if (connection->replyCallback) {
+ _D("connection->replyCallback()");
(connection->replyCallback)(handle, connection->data, strBody.c_str());
}
AsyncConnectionManager::instance().removeConnection(handle);
- }
- else
- {
- LogDebug("Connection is not available. Ignored.");
+ } else {
+ _D("Connection is not available. Ignored.");
}
}
}
WKTypeRef* /*userData*/,
const void *clientInfo)
{
- LogDebug("didStartProvisionalLoadForFrameCallback called");
+ _D("called");
Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
if (This->m_pageGlobalContext.find(page) == This->m_pageGlobalContext.end()) {
ContextSet::iterator i = This->m_pageContext[page].find(context);
if (i == This->m_pageContext[page].end()) {
- LogDebug("Initially attached frame");
+ _D("Initially attached frame");
return;
}
WKTypeRef* /*userData*/,
const void *clientInfo)
{
- LogDebug("didRemoveFrameFromHierarchyCallback called");
+ _D("called");
Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
if (This->m_pageContext.count(page) == 0) {
- LogDebug("his->m_pageContext.count(page) == 0");
+ _D("his->m_pageContext.count(page) == 0");
return;
}
ContextSet::iterator i = This->m_pageContext[page].find(context);
if (i == This->m_pageContext[page].end()) {
- LogWarning("Tried to unload frame which has never been loaded");
+ _W("Tried to unload frame which has never been loaded");
return;
}
uint64_t /*resourceIdentifier*/,
const void* /*clientInfo*/)
{
- LogDebug("didFinishLoadForResourceCallback called");
+ _D("called");
}
void Bundle::didCommitLoadForFrameCallback(
WKTypeRef* /*userData*/,
const void *clientInfo)
{
- LogInfo("didCommitLoadForFrameCallback called");
+ _D("called");
LOG_PROFILE_START("didCommitLoadForFrameCallback");
Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
WKURLRef url = WKBundleFrameCopyURL(frame);
if (url == NULL) {
- LogInfo("url is NULL");
+ _W("url is NULL");
return;
}
This->m_pageContext[page].insert(context);
if (!WKBundleFrameIsMainFrame(frame)) {
- LogInfo("frame isn't main frame");
+ _D("frame isn't main frame");
PluginModule::start(
WrtDB::WidgetDAOReadOnly::getHandle(This->m_widgetTizenId),
context,
}
std::string urlStr = toString(url);
- if (InjectedBundleURIHandling::processURIForPlugin(urlStr.c_str(),
- This->m_widgetTizenId))
- {
- LogDebug("start plugin");
+
+ if (InjectedBundleURIHandling::processURIForPlugin(urlStr.c_str())) {
+ _D("start plugin");
if(This->m_pageGlobalContext.find(page) != This->m_pageGlobalContext.end())
{
- LogDebug("Previous context: " << This->m_pageGlobalContext.getContextForPage(page));
+ _D("Previous context: %p", This->m_pageGlobalContext.getContextForPage(page));
PluginModule::stop(This->m_pageGlobalContext.getContextForPage(page));
}
LogDebug("New context: " << context);
PluginModule::loadFrame(context);
} else {
- LogDebug("stop plugin");
+ _D("stop plugin");
if(This->m_pageGlobalContext.find(page) != This->m_pageGlobalContext.end())
{
- LogDebug("Previous context: " << This->m_pageGlobalContext.getContextForPage(page));
+ _D("Previous context: %p", This->m_pageGlobalContext.getContextForPage(page));
PluginModule::stop(This->m_pageGlobalContext.getContextForPage(page));
}
- LogDebug("New context: " << context);
+ _D("New context: %p", context);
This->m_pageGlobalContext.insertContextForPage(page, context);
}
LOG_PROFILE_STOP("didCommitLoadForFrameCallback");
WKTypeRef* userData,
const void* clientInfo)
{
- LogDebug("decidePolicyForNavigationActionCallback called");
-
+ _D("called");
Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
return This->decidePolicyForAction(false,
page,
WKTypeRef* userData,
const void* clientInfo)
{
- LogDebug("decidePolicyForNewWindowActionCallback called");
-
+ _D("called");
Bundle* This = static_cast<Bundle*>(const_cast<void*>(clientInfo));
return This->decidePolicyForAction(true,
page,
WKTypeRef* /* userData */,
const void* /* clientInfo */)
{
- LogDebug("decidePolicyForResponseCallback called");
-
+ _D("called");
Assert(response);
WKStringRef contentTypeRef = WKURLResponseEflCopyContentType(response);
std::string contentType = toString(contentTypeRef);
- LogDebug("contentTypeRef : " << contentType);
+ _D("contentTypeRef : %s", contentType.c_str());
WKRelease(contentTypeRef);
if (contentType == HTML_MIME) {
- LogDebug("Accepting HTML_MIME type");
+ _D("Accepting HTML_MIME type");
return WKBundlePagePolicyActionUse;
}
if (contentType == PHP_MIME) {
- LogDebug("Accepting php type");
+ _D("Accepting php type");
return WKBundlePagePolicyActionUse;
}
WKRelease(wkStr);
WKRelease(wkUrl);
- if (logEnable){ LogDebug("willSendRequestForFrame : " << stdUrl); }
+ if (logEnable){ _D("willSendRequestForFrame : %s", stdUrl.c_str()); }
localizedUrl = InjectedBundleURIHandling::localizeURI(stdUrl, DPL::ToUTF8String(m_widgetTizenId));
bool ret = InjectedBundleURIHandling::processURI(localizedUrl, m_widgetTizenId, m_securityModelVersion);
- if (!ret)
- {
- LogDebug("Not permitted resource: " << localizedUrl);
+ if (!ret) {
+ _D("Not permitted resource: %s", localizedUrl.c_str());
return NULL;
}
std::string scheme = localizedUrl.substr(0, localizedUrl.find_first_of(':'));
#ifdef APP_SCHEME_ENABLED
- if (scheme == SCHEME_FILE)
- {
- LogError("File schema blocked for: " << stdUrl);
+ if (scheme == SCHEME_FILE) {
+ _D("File schema blocked for: %s", stdUrl.c_str());
return NULL;
}
#endif
// external scheme also need to send message to UI process for
// checking roaming and security
- if (scheme == SCHEME_HTTP || scheme == SCHEME_HTTPS)
- {
- if (logEnable){ LogDebug("external scheme return original WKURLRequestRef"); }
+ if (scheme == SCHEME_HTTP || scheme == SCHEME_HTTPS) {
+ if (logEnable){ _D("external scheme return original WKURLRequestRef"); }
WKRetain(request);
return request;
- }
- else
- {
+ } else {
std::string checkUrl = localizedUrl;
- if (m_decryptionSupport->isNeedDecryption(checkUrl))
- {
+ if (m_decryptionSupport->isNeedDecryption(checkUrl)) {
std::string decryptString =
m_decryptionSupport->decryptResource(checkUrl);
- if (logEnable){ LogDebug("return value : " << decryptString ); }
+ if (logEnable){ _D("return value : %s", decryptString.c_str()); }
WKURLRef destUrl =
WKURLCreateWithUTF8CString(decryptString.c_str());
WKURLRequestRef req = WKURLRequestCreateWithWKURL(newUrl);
WKRelease(newUrl);
- if (logEnable){ LogDebug("return value : " << localizedUrl); }
+ if (logEnable){ _D("return value : %s", localizedUrl.c_str()); }
return req;
}
std::string request_uri = toString(request);
- LogInfo("Uri being checked: " << request_uri);
+ _D("request uri : %s", request_uri.c_str());
// exception uri
if (request_uri == BLANK_PAGE_URL) {
m_securityModelVersion);
if (!ret) {
std::string blockedUrl = DPL::ToUTF8String(dplUrl);
- LogDebug("URI is blocked: " << blockedUrl);
+ _D("URI is blocked: %s", blockedUrl.c_str());
// Send information about blocked URI to UIProcess
WKStringRef urlStr = WKStringCreateWithUTF8CString(blockedUrl.c_str());
// scheme action
Scheme scheme(request_scheme);
- LogDebug("Scheme: " << request_scheme);
-
Scheme::Type type = scheme.GetType();
if (type < Scheme::FILE || type >= Scheme::COUNT) {
- LogError("Invalid scheme: " << request_scheme);
+ _D("Unknown scheme : %s", request_scheme.c_str());
return WKBundlePagePolicyActionPassThrough;
}
ctx = NEW_WINDOW;
}
- LogDebug("Scheme type: " << type);
- LogDebug("Navigation context: " << ctx);
- LogDebug("Application type: " << m_widgetType.getApptypeToString());
-
UriAction action;
-
if (m_widgetType == WrtDB::APP_TYPE_TIZENWEBAPP) {
action = g_tizenActionMap[type][ctx];
} else {
- LogError("Unsupported application type: " << type);
+ _D("Unsupported application type: %d", type);
return WKBundlePagePolicyActionPassThrough;
}
- LogDebug("Uri action: " << action);
+ _D("Scheme type: %d, Navigation context: %d, Action: %d",
+ type,
+ ctx,
+ action);
if (action != URI_ACTION_WRT) {
return WKBundlePagePolicyActionPassThrough;
std::string Bundle::toString(WKStringRef str)
{
- if (WKStringIsEmpty(str))
- {
+ if (WKStringIsEmpty(str)) {
return "";
- }
- else
- {
+ } else {
size_t size = WKStringGetMaximumUTF8CStringSize(str);
char buffer[size + 1];
void WKBundleInitialize(WKBundleRef bundle,
WKTypeRef)
{
- DPL::Log::LogSystemSingleton::Instance().SetTag("WRT-BUNDLE");
- LogDebug("Bundle initialized");
+ _D("Bundle initialized");
DPL::Event::GetMainEventDispatcherInstance().ResetCrossEventCallHandler();
- LogDebug("ResetCrossEventCallHandler()");
+ _D("ResetCrossEventCallHandler()");
static Bundle s_bundle(bundle);
WKBundleSetClient(bundle, &client);
// process pool - restore process priority
- if (UID_ROOT == getuid())
- {
+ if (UID_ROOT == getuid()) {
setpriority(PRIO_PROCESS, 0, DEFAULT_PRIORITY);
}
IPCMessageSupport::setWKBundleRef(bundle);