#include <algorithm>
#include <dpl/foreach.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
#include "explorer.h"
#include "plugin_property_support.h"
m_context(context)
{
if (!context) {
- LogError("Context is NULL");
+ _W("Context is NULL");
return;
}
const string& requestedProperty,
JSObjectPtr providedObject)
{
- LogDebug("Requested Property: " << requestedProperty);
+ _D("Requested Property: %s", requestedProperty.c_str());
if (!providedObject) {
- LogError("Provided object is empty");
+ _W("Provided object is empty");
return JSObjectPtr();
}
currentObjectName = currentPropertyRequested.substr(0, pos);
if (currentPropertyRequested.size() <= pos + 1) {
- LogError("Wrong name of requested property");
+ _W("Wrong name of requested property");
return JSObjectPtr();
}
currentPropertyRequested = currentPropertyRequested.substr(pos + 1);
currentObject = getJSObjectProperty(currentObjectName, currentObject);
if (!currentObject) {
- LogError("Failed to get property: " << currentObjectName);
+ _W("Failed to get property: %s", currentObjectName.c_str());
return JSObjectPtr();
}
}
string masterName = declaration->getParentName();
auto pos = masterName.find(".");
if (string::npos != pos) {
- LogError("ParentName not allowed");
+ _W("ParentName not allowed");
return false;
}
auto masterObject = getJSObjectProperty(masterName, m_globalObject);
JSObjectPtr providedObject,
JSGlobalContextRef context)
{
- LogDebug("'" << providedObjectName << "' <- '" << declaration->getName() << "'");
-
+ _D("%s <- %s", providedObjectName.c_str(), declaration->getName().c_str());
std::string fullParentName = declaration->getParentName();
if (fullParentName == providedObjectName) {
+ \r_D("Provided object was matched!!");
return register_(declaration, providedObject, context);
}
- LogDebug("Provided object was not matched!!");
-
//check if object exists in fullParentName
auto pos = fullParentName.find(providedObjectName);
if (pos == string::npos) {
- LogError(
- "Object: " << declaration->getName()
- << " should be child of: " <<
- declaration->getParentName()
- << " but you provided object: " <<
- providedObjectName);
-
+ _W("Object: %s should be child of: %s but you provided object: %s",
+ declaration->getName().c_str(),
+ declaration->getParentName().c_str(),
+ providedObjectName.c_str());
return false;
}
if (fullParentName.size() <= pos + providedObjectName.size() + 1) {
- LogError("Invalid object name");
+ _W("Invalid object name");
return false;
}
currentRequesteProperty, providedObject);
if (!jsObject->getObject()) {
- LogError(
- "Object: '" << declaration->getName()
- << "' should be child of: '" <<
- declaration->getParentName()
- << "'. you provided object: '" <<
- providedObjectName
- << "' but object is null");
-
+ _W("Object: %s should be child of: %s. you provided object: %s but object is null",
+ declaration->getName().c_str(),
+ declaration->getParentName().c_str(),
+ providedObjectName.c_str());
return false;
}
JSObjectPtr parent,
JSGlobalContextRef context)
{
- LogDebug("Registration object: " << declaration->getParentName() <<
- "<-" << declaration->getName());
-
+ _D("Registration object: %s <- %s",
+ declaration->getParentName().c_str(),
+ declaration->getName().c_str());
Assert(parent && "parent object is NULL");
typedef JSObjectDeclaration::Options JO;
JSGlobalContextRef context)
{
if (declaration->getParentName() == GLOBAL_OBJECT_NAME) {
- LogDebug("Connect to Global object of IFRAME");
+ _D("Connect to Global object of IFRAME");
register_(declaration, frameObject, context);
return;
}
//PIM SUPPORT
{
- LogWarning("Connect to NOT global object of IFRAME");
+ _D("Connect to NOT global object of IFRAME");
//it should be master object name
string masterName = declaration->getParentName();
auto pos = masterName.find(".");
if (string::npos != pos) {
- LogError("ParentName not allowed");
+ _W("ParentName not allowed");
return;
}
auto masterObject = getJSObjectProperty(masterName, frameObject);
if (!masterObject->getObject()) {
- LogError("Object not exist in frame");
+ _W("Object not exist in frame");
return;
}
register_(declaration, masterObject, context);
void Explorer::loadFrame(JSGlobalContextRef context)
{
- LogDebug("Frame attached");
-
JSObjectPtr frameObject =
JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
- LogDebug("Register main frame");
- //register main frame;
-
if (frameObject->getObject() == m_globalObject->getObject()) {
// Main page was already loaded from constructor
- LogDebug("Main page loaded");
+ _W("Main page loaded");
return;
}
FOREACH(object, iframeObjects)
{
- LogDebug("Register object: " << (*object)->getName() );
-
+ _D("Register object: %s", (*object)->getName().c_str());
registerObjectIntoIframe(*object, frameObject, context);
}
}
void Explorer::unloadFrame(JSGlobalContextRef context)
{
- LogDebug("Frame detached");
-
JSObjectPtr frameObject =
JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
-
m_iframeSupport.unregisterIframe(frameObject);
}
void Explorer::removePluginsFromIframes()
{
- LogDebug("Remove plugins from iframes");
-
if (m_iframeSupport.hasIframes()) {
- LogDebug("Removing iframes");
JavaScriptInterfaceSingleton::Instance().removeIframes(m_context);
}
}
void Explorer::deregisterObject(const JSObjectDeclarationPtr& declaration)
{
- LogDebug("Deregister object " << declaration->getName());
-
if (GLOBAL_OBJECT_NAME != declaration->getParentName()) {
- LogWarning("Ignored remove property " << declaration->getName());
+ _W("Ignored remove property %s", declaration->getName().c_str());
return;
}
void Explorer::cleanIframesData()
{
- LogDebug("Clean iframes data");
m_iframeSupport.clean();
}