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.
16 #ifndef WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_DOM_EXCEPTION_H_
17 #define WRTDEVICEAPIS_COMMONSJAVASCRIPT_JS_DOM_EXCEPTION_H_
19 #include <JavaScriptCore/JavaScript.h>
20 #include <CommonsJavaScript/PrivateObject.h>
21 #include <CommonsJavaScript/DOMExceptionData.h>
23 namespace WrtDeviceApis {
24 namespace CommonsJavaScript {
28 typedef PrivateObjectT<DOMExceptionDataPtr>::Type PrivateObject;
31 static const unsigned short UNKNOWN_ERR = 0;
32 static const unsigned short INDEX_SIZE_ERR = 1;
33 static const unsigned short DOMSTRING_SIZE_ERR = 2;
34 static const unsigned short HIERARCHY_REQUEST_ERR = 3;
35 static const unsigned short WRONG_DOCUMENT_ERR = 4;
36 static const unsigned short INVALID_CHARACTER_ERR = 5;
37 static const unsigned short NO_DATA_ALLOWED_ERR = 6;
38 static const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
39 static const unsigned short NOT_FOUND_ERR = 8;
40 static const unsigned short NOT_SUPPORTED_ERR = 9;
41 static const unsigned short INUSE_ATTRIBUTE_ERR = 10;
42 static const unsigned short INVALID_STATE_ERR = 11;
43 static const unsigned short SYNTAX_ERR = 12;
44 static const unsigned short INVALID_MODIFICATION_ERR = 13;
45 static const unsigned short NAMESPACE_ERR = 14;
46 static const unsigned short INVALID_ACCESS_ERR = 15;
47 static const unsigned short VALIDATION_ERR = 16;
48 static const unsigned short TYPE_MISMATCH_ERR = 17;
49 static const unsigned short SECURITY_ERR = 18;
50 static const unsigned short NETWORK_ERR = 19;
51 static const unsigned short ABORT_ERR = 20;
52 static const unsigned short TIMEOUT_ERR = 21;
53 static const unsigned short INVALID_VALUES_ERR = 22;
54 static const unsigned short IO_ERR = 100;
56 //TODO INVALID_VALUES_ERR has the same error code ??
57 static const unsigned short QUOTA_EXCEEDED_ERR = 22;
60 static JSClassRef getClassRef();
62 * Gets object's class description.
64 static const JSClassDefinition* getClassInfo();
68 * The callback invoked when an object is first created.
70 static void initialize(JSContextRef context,
74 * The callback invoked when an object is finalized.
76 static void finalize(JSObjectRef object);
79 * The callback invoked when getting a property's value.
81 static bool hasProperty(JSContextRef context,
83 JSStringRef propertyName);
86 * The callback invoked when getting a property's value.
88 static JSValueRef getProperty(JSContextRef context,
90 JSStringRef propertyName,
91 JSValueRef* exception);
94 * The callback invoked when getting a property's value.
96 static JSValueRef getStaticProperty(JSContextRef context,
98 JSStringRef propertyName,
99 JSValueRef* exception);
101 static void getPropertyNames(JSContextRef context,
103 JSPropertyNameAccumulatorRef accumulator);
106 * The callback invoked when an object is used as the target of an
107 * 'instanceof' expression.
109 static bool hasInstance(JSContextRef context,
110 JSObjectRef constructor,
111 JSValueRef possibleInstance,
112 JSValueRef* exception);
115 * This structure contains properties and callbacks that define a type of
118 static JSClassDefinition m_classInfo;
121 * This structure describes a statically declared value property.
123 static JSStaticValue m_properties[];
125 static JSClassRef m_classRef;
127 } // CommonsJavaScript