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 {
26 * synchronously checks access status and throws JS Security exception if
29 #define SYNC_ACCESS_STATUS_HANDLER(status, context, exception) \
33 case AceSecurityStatus::InternalError: \
34 return JSDOMExceptionFactory::UnknownException.make( \
35 context, exception); \
38 case AceSecurityStatus::AccessDenied: \
39 return JSDOMExceptionFactory::SecurityException.make( \
40 context, exception); \
49 * checks access status and returns an error through JSCallbackManager if
52 #define ASYNC_CBM_ACCESS_STATUS_HANDLER(status, context, cbm) \
56 case AceSecurityStatus::InternalError: \
57 cbm->callOnError(JSDOMExceptionFactory::UnknownException.make( \
59 return JSValueMakeNull(context); \
61 case AceSecurityStatus::AccessDenied: \
62 cbm->callOnError(JSDOMExceptionFactory::SecurityException.make( \
64 return JSValueMakeNull(context); \
72 #endif /*WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_SECURITYEXCEPTIONS_H_ */