2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_SECURITYEXCEPTIONS_H_
18 #define WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_SECURITYEXCEPTIONS_H_
20 #include <JavaScriptCore/JavaScript.h>
21 #include "JSDOMExceptionFactory.h"
23 namespace WrtDeviceApis {
24 namespace CommonsJavaScript {
27 * synchronously checks access status and throws JS Security exception if
30 #define SYNC_ACCESS_STATUS_HANDLER(status, context, exception) \
34 case AceSecurityStatus::InternalError: \
35 return JSDOMExceptionFactory::UnknownException.make( \
36 context, exception); \
39 case AceSecurityStatus::AccessDenied: \
40 return JSDOMExceptionFactory::SecurityException.make( \
41 context, exception); \
50 * checks access status and returns an error through JSCallbackManager if
53 #define ASYNC_CBM_ACCESS_STATUS_HANDLER(status, context, cbm) \
57 case AceSecurityStatus::InternalError: \
58 cbm->callOnError(JSDOMExceptionFactory::UnknownException.make( \
60 return JSValueMakeNull(context); \
62 case AceSecurityStatus::AccessDenied: \
63 cbm->callOnError(JSDOMExceptionFactory::SecurityException.make( \
65 return JSValueMakeNull(context); \
74 #endif /*WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_SECURITYEXCEPTIONS_H_ */