|
1 /* |
|
2 This file is part of the WebKit open source project. |
|
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Library General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2 of the License, or (at your option) any later version. |
|
9 |
|
10 This library is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 Library General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Library General Public License |
|
16 along with this library; see the file COPYING.LIB. If not, write to |
|
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
18 Boston, MA 02110-1301, USA. |
|
19 */ |
|
20 |
|
21 #include "config.h" |
|
22 |
|
23 #if ENABLE(XPATH) |
|
24 |
|
25 #include "JSXPathException.h" |
|
26 |
|
27 #include "KURL.h" |
|
28 #include "XPathException.h" |
|
29 #include <runtime/Error.h> |
|
30 #include <runtime/JSNumberCell.h> |
|
31 #include <runtime/JSString.h> |
|
32 #include <wtf/GetPtr.h> |
|
33 |
|
34 using namespace JSC; |
|
35 |
|
36 namespace WebCore { |
|
37 |
|
38 ASSERT_CLASS_FITS_IN_CELL(JSXPathException); |
|
39 |
|
40 /* Hash table */ |
|
41 #if ENABLE(JIT) |
|
42 #define THUNK_GENERATOR(generator) , generator |
|
43 #else |
|
44 #define THUNK_GENERATOR(generator) |
|
45 #endif |
|
46 |
|
47 static const HashTableValue JSXPathExceptionTableValues[5] = |
|
48 { |
|
49 { "code", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathExceptionCode), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "name", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathExceptionName), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "message", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathExceptionMessage), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathExceptionConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
54 }; |
|
55 |
|
56 #undef THUNK_GENERATOR |
|
57 static JSC_CONST_HASHTABLE HashTable JSXPathExceptionTable = { 10, 7, JSXPathExceptionTableValues, 0 }; |
|
58 /* Hash table for constructor */ |
|
59 #if ENABLE(JIT) |
|
60 #define THUNK_GENERATOR(generator) , generator |
|
61 #else |
|
62 #define THUNK_GENERATOR(generator) |
|
63 #endif |
|
64 |
|
65 static const HashTableValue JSXPathExceptionConstructorTableValues[3] = |
|
66 { |
|
67 { "INVALID_EXPRESSION_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathExceptionINVALID_EXPRESSION_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
68 { "TYPE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathExceptionTYPE_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
69 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
70 }; |
|
71 |
|
72 #undef THUNK_GENERATOR |
|
73 static JSC_CONST_HASHTABLE HashTable JSXPathExceptionConstructorTable = { 4, 3, JSXPathExceptionConstructorTableValues, 0 }; |
|
74 class JSXPathExceptionConstructor : public DOMConstructorObject { |
|
75 public: |
|
76 JSXPathExceptionConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
77 |
|
78 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
79 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
80 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
81 static const JSC::ClassInfo s_info; |
|
82 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
83 { |
|
84 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
85 } |
|
86 protected: |
|
87 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
88 }; |
|
89 |
|
90 const ClassInfo JSXPathExceptionConstructor::s_info = { "XPathExceptionConstructor", 0, &JSXPathExceptionConstructorTable, 0 }; |
|
91 |
|
92 JSXPathExceptionConstructor::JSXPathExceptionConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
93 : DOMConstructorObject(JSXPathExceptionConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
94 { |
|
95 putDirect(exec->propertyNames().prototype, JSXPathExceptionPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
96 } |
|
97 |
|
98 bool JSXPathExceptionConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
99 { |
|
100 return getStaticValueSlot<JSXPathExceptionConstructor, DOMObject>(exec, &JSXPathExceptionConstructorTable, this, propertyName, slot); |
|
101 } |
|
102 |
|
103 bool JSXPathExceptionConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
104 { |
|
105 return getStaticValueDescriptor<JSXPathExceptionConstructor, DOMObject>(exec, &JSXPathExceptionConstructorTable, this, propertyName, descriptor); |
|
106 } |
|
107 |
|
108 /* Hash table for prototype */ |
|
109 #if ENABLE(JIT) |
|
110 #define THUNK_GENERATOR(generator) , generator |
|
111 #else |
|
112 #define THUNK_GENERATOR(generator) |
|
113 #endif |
|
114 |
|
115 static const HashTableValue JSXPathExceptionPrototypeTableValues[4] = |
|
116 { |
|
117 { "INVALID_EXPRESSION_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathExceptionINVALID_EXPRESSION_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
118 { "TYPE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsXPathExceptionTYPE_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
119 { "toString", DontDelete | DontEnum | Function, (intptr_t)static_cast<NativeFunction>(jsXPathExceptionPrototypeFunctionToString), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
120 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
121 }; |
|
122 |
|
123 #undef THUNK_GENERATOR |
|
124 static JSC_CONST_HASHTABLE HashTable JSXPathExceptionPrototypeTable = { 8, 7, JSXPathExceptionPrototypeTableValues, 0 }; |
|
125 const ClassInfo JSXPathExceptionPrototype::s_info = { "XPathExceptionPrototype", 0, &JSXPathExceptionPrototypeTable, 0 }; |
|
126 |
|
127 JSObject* JSXPathExceptionPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
128 { |
|
129 return getDOMPrototype<JSXPathException>(exec, globalObject); |
|
130 } |
|
131 |
|
132 bool JSXPathExceptionPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
133 { |
|
134 return getStaticPropertySlot<JSXPathExceptionPrototype, JSObject>(exec, &JSXPathExceptionPrototypeTable, this, propertyName, slot); |
|
135 } |
|
136 |
|
137 bool JSXPathExceptionPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
138 { |
|
139 return getStaticPropertyDescriptor<JSXPathExceptionPrototype, JSObject>(exec, &JSXPathExceptionPrototypeTable, this, propertyName, descriptor); |
|
140 } |
|
141 |
|
142 const ClassInfo JSXPathException::s_info = { "XPathException", 0, &JSXPathExceptionTable, 0 }; |
|
143 |
|
144 JSXPathException::JSXPathException(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<XPathException> impl) |
|
145 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
146 , m_impl(impl) |
|
147 { |
|
148 } |
|
149 |
|
150 JSXPathException::~JSXPathException() |
|
151 { |
|
152 forgetDOMObject(this, impl()); |
|
153 } |
|
154 |
|
155 JSObject* JSXPathException::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
156 { |
|
157 return new (exec) JSXPathExceptionPrototype(globalObject, JSXPathExceptionPrototype::createStructure(globalObject->objectPrototype())); |
|
158 } |
|
159 |
|
160 bool JSXPathException::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
161 { |
|
162 return getStaticValueSlot<JSXPathException, Base>(exec, &JSXPathExceptionTable, this, propertyName, slot); |
|
163 } |
|
164 |
|
165 bool JSXPathException::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
166 { |
|
167 return getStaticValueDescriptor<JSXPathException, Base>(exec, &JSXPathExceptionTable, this, propertyName, descriptor); |
|
168 } |
|
169 |
|
170 JSValue jsXPathExceptionCode(ExecState* exec, JSValue slotBase, const Identifier&) |
|
171 { |
|
172 JSXPathException* castedThis = static_cast<JSXPathException*>(asObject(slotBase)); |
|
173 UNUSED_PARAM(exec); |
|
174 XPathException* imp = static_cast<XPathException*>(castedThis->impl()); |
|
175 JSValue result = jsNumber(exec, imp->code()); |
|
176 return result; |
|
177 } |
|
178 |
|
179 JSValue jsXPathExceptionName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
180 { |
|
181 JSXPathException* castedThis = static_cast<JSXPathException*>(asObject(slotBase)); |
|
182 UNUSED_PARAM(exec); |
|
183 XPathException* imp = static_cast<XPathException*>(castedThis->impl()); |
|
184 JSValue result = jsString(exec, imp->name()); |
|
185 return result; |
|
186 } |
|
187 |
|
188 JSValue jsXPathExceptionMessage(ExecState* exec, JSValue slotBase, const Identifier&) |
|
189 { |
|
190 JSXPathException* castedThis = static_cast<JSXPathException*>(asObject(slotBase)); |
|
191 UNUSED_PARAM(exec); |
|
192 XPathException* imp = static_cast<XPathException*>(castedThis->impl()); |
|
193 JSValue result = jsString(exec, imp->message()); |
|
194 return result; |
|
195 } |
|
196 |
|
197 JSValue jsXPathExceptionConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
198 { |
|
199 JSXPathException* domObject = static_cast<JSXPathException*>(asObject(slotBase)); |
|
200 return JSXPathException::getConstructor(exec, domObject->globalObject()); |
|
201 } |
|
202 JSValue JSXPathException::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
203 { |
|
204 return getDOMConstructor<JSXPathExceptionConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
205 } |
|
206 |
|
207 EncodedJSValue JSC_HOST_CALL jsXPathExceptionPrototypeFunctionToString(ExecState* exec) |
|
208 { |
|
209 JSValue thisValue = exec->hostThisValue(); |
|
210 if (!thisValue.inherits(&JSXPathException::s_info)) |
|
211 return throwVMTypeError(exec); |
|
212 JSXPathException* castedThis = static_cast<JSXPathException*>(asObject(thisValue)); |
|
213 XPathException* imp = static_cast<XPathException*>(castedThis->impl()); |
|
214 |
|
215 |
|
216 JSC::JSValue result = jsString(exec, imp->toString()); |
|
217 return JSValue::encode(result); |
|
218 } |
|
219 |
|
220 // Constant getters |
|
221 |
|
222 JSValue jsXPathExceptionINVALID_EXPRESSION_ERR(ExecState* exec, JSValue, const Identifier&) |
|
223 { |
|
224 return jsNumber(exec, static_cast<int>(51)); |
|
225 } |
|
226 |
|
227 JSValue jsXPathExceptionTYPE_ERR(ExecState* exec, JSValue, const Identifier&) |
|
228 { |
|
229 return jsNumber(exec, static_cast<int>(52)); |
|
230 } |
|
231 |
|
232 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, XPathException* object) |
|
233 { |
|
234 return getDOMObjectWrapper<JSXPathException>(exec, globalObject, object); |
|
235 } |
|
236 XPathException* toXPathException(JSC::JSValue value) |
|
237 { |
|
238 return value.inherits(&JSXPathException::s_info) ? static_cast<JSXPathException*>(asObject(value))->impl() : 0; |
|
239 } |
|
240 |
|
241 } |
|
242 |
|
243 #endif // ENABLE(XPATH) |