#include <ArgumentValidator.h>
#include <JSUtil.h>
+#include <Security.h>
#include <SecurityExceptions.h>
#include <Commons/Exception.h>
#include <ail.h>
-#include "plugin_config.h"
+#include "plugin_config_impl.h"
#include "AlarmConverter.h"
#include "JSAlarmAbsolute.h"
#include "AlarmAbsolute.h"
void JSAlarmManager::initialize(JSContextRef ctx, JSObjectRef object)
{
gContext = ctx;
+
+ SecurityAccessor *priv = new SecurityAccessor();
+ JSObjectSetPrivate(object, static_cast<void*>(priv));
}
void JSAlarmManager::finalize(JSObjectRef object)
{
+ SecurityAccessor *priv = static_cast<SecurityAccessor*>(JSObjectGetPrivate(object));
+ delete priv;
}
JSValueRef JSAlarmManager::add(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
std::string applicationId;
std::string page;
+ SecurityAccessor *thisPriv = static_cast<SecurityAccessor*>(JSObjectGetPrivate(thisObject));
+ if (!thisPriv) {
+ LoggerE("private object is null");
+ return JSWebAPIErrorFactory::postException(ctx, exception,
+ JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
+ }
TIME_TRACER_ITEM_BEGIN("(add)ace_check", 0);
- AceSecurityStatus status = ALARM_CHECK_ACCESS(ALARM_FUNCTION_API_ADD);
- TIZEN_SYNC_ACCESS_HANDLER(status, ctx, exception);
+ TIZEN_CHECK_ACCESS(ctx, exception, thisPriv, ALARM_FUNCTION_API_ADD);
TIME_TRACER_ITEM_END("(add)ace_check", 0);
try {
JSValueRef JSAlarmManager::remove(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ SecurityAccessor *thisPriv = static_cast<SecurityAccessor*>(JSObjectGetPrivate(thisObject));
+ if (!thisPriv) {
+ LoggerE("private object is null");
+ return JSWebAPIErrorFactory::postException(ctx, exception,
+ JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
+ }
TIME_TRACER_ITEM_BEGIN("(add)ace_check", 0);
- AceSecurityStatus status = ALARM_CHECK_ACCESS(ALARM_FUNCTION_API_REMOVE);
- TIZEN_SYNC_ACCESS_HANDLER(status, ctx, exception);
+ TIZEN_CHECK_ACCESS(ctx, exception, thisPriv, ALARM_FUNCTION_API_REMOVE);
TIME_TRACER_ITEM_END("(add)ace_check", 0);
try {
JSValueRef JSAlarmManager::removeAll(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
TIME_TRACER_ITEM_BEGIN(__FUNCTION__, 0);
+ SecurityAccessor *thisPriv = static_cast<SecurityAccessor*>(JSObjectGetPrivate(thisObject));
+ if (!thisPriv) {
+ LoggerE("private object is null");
+ return JSWebAPIErrorFactory::postException(ctx, exception,
+ JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "Wrong object");
+ }
TIME_TRACER_ITEM_BEGIN("(add)ace_check", 0);
- AceSecurityStatus status = ALARM_CHECK_ACCESS(ALARM_FUNCTION_API_REMOVE_ALL);
- TIZEN_SYNC_ACCESS_HANDLER(status, ctx, exception);
+ TIZEN_CHECK_ACCESS(ctx, exception, thisPriv, ALARM_FUNCTION_API_REMOVE_ALL);
TIME_TRACER_ITEM_END("(add)ace_check", 0);
TIME_TRACER_ITEM_BEGIN("(removeAll)alarm_cancel_all", 0);