#include <dpl/exception.h>
#include <dpl/log/secure_log.h>
#include <dpl/foreach.h>
+#include <CommonsJavaScript/JSLifeManager.h>
using namespace std;
namespace WrtDeviceApis {
namespace PluginManager {
-PluginManager::PluginManager(int widgetHandle,
+PluginManager::PluginManager(WidgetHandle widgetHandle,
const string &objectUri,
JSObjectRef object,
JSContextRef context) :
{
ObjectList::iterator it = m_objectList.begin();
for (; it != m_objectList.end(); ++it) {
- JSValueUnprotect(m_context, it->second);
+ JSValueSafeUnprotect(m_context, it->second);
}
WrtDB::WrtDatabase::detachFromThread();
}
return it->second;
}
+ if( !hasChild(name) )
+ return JSValueMakeUndefined(m_context);
+
+
if (!loadChild(name)) {
ThrowMsg(Commons::PlatformException, "Cannot load plugin");
}
JSValueRef value)
{
_D("setProperty %s", name.c_str());
+ if( !hasChild(name) ){
+ return false;
+ }
+
if (m_objectList.count(name) > 0) {
- JSValueUnprotect(m_context, m_objectList[name]);
+ JSValueSafeUnprotect(m_context, m_objectList[name]);
}
- JSValueProtect(m_context, value);
+ JSValueSafeProtect(m_context, value);
m_objectList[name] = value;
return true;
}
{
if (m_objectList.count(name) > 0) {
_D("deleteProperty %s", name.c_str());
- JSValueUnprotect(m_context, m_objectList[name]);
+ JSValueSafeUnprotect(m_context, m_objectList[name]);
m_objectList.erase(name);
return true;
}