2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
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.
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.
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.
23 #if ENABLE(Condition1) || ENABLE(Condition2)
25 #include "JSTestInterface.h"
27 #include "ExceptionCode.h"
28 #include "JSDOMBinding.h"
29 #include "JSTestInterfaceCustom.h"
30 #include "JSTestObj.h"
31 #include "TestInterface.h"
33 #include "TestSupplemental.h"
34 #include <runtime/Error.h>
35 #include <wtf/GetPtr.h>
37 #if ENABLE(Condition11) || ENABLE(Condition12)
40 #include <runtime/JSString.h>
43 #if ENABLE(Condition11) || ENABLE(Condition12)
51 ASSERT_CLASS_FITS_IN_CELL(JSTestInterface);
54 static const HashTableValue JSTestInterfaceTableValues[] =
56 #if ENABLE(Condition11) || ENABLE(Condition12)
57 { "supplementalStr1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalStr1), (intptr_t)0, NoIntrinsic },
59 #if ENABLE(Condition11) || ENABLE(Condition12)
60 { "supplementalStr2", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalStr2), (intptr_t)setJSTestInterfaceSupplementalStr2, NoIntrinsic },
62 #if ENABLE(Condition11) || ENABLE(Condition12)
63 { "supplementalStr3", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalStr3), (intptr_t)setJSTestInterfaceSupplementalStr3, NoIntrinsic },
65 #if ENABLE(Condition11) || ENABLE(Condition12)
66 { "supplementalNode", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSupplementalNode), (intptr_t)setJSTestInterfaceSupplementalNode, NoIntrinsic },
68 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceConstructor), (intptr_t)0, NoIntrinsic },
69 { 0, 0, 0, 0, NoIntrinsic }
72 static const HashTable JSTestInterfaceTable = { 16, 15, JSTestInterfaceTableValues, 0 };
73 /* Hash table for constructor */
75 static const HashTableValue JSTestInterfaceConstructorTableValues[] =
77 #if ENABLE(Condition11) || ENABLE(Condition12)
78 { "SUPPLEMENTALCONSTANT1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT1), (intptr_t)0, NoIntrinsic },
80 #if ENABLE(Condition11) || ENABLE(Condition12)
81 { "SUPPLEMENTALCONSTANT2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT2), (intptr_t)0, NoIntrinsic },
83 #if ENABLE(Condition11) || ENABLE(Condition12)
84 { "supplementalMethod4", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfaceConstructorFunctionSupplementalMethod4), (intptr_t)0, NoIntrinsic },
86 { 0, 0, 0, 0, NoIntrinsic }
89 static const HashTable JSTestInterfaceConstructorTable = { 4, 3, JSTestInterfaceConstructorTableValues, 0 };
91 #if ENABLE(Condition11) || ENABLE(Condition12)
92 COMPILE_ASSERT(1 == TestSupplemental::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDoNotCheckConstants);
94 #if ENABLE(Condition11) || ENABLE(Condition12)
95 COMPILE_ASSERT(2 == TestSupplemental::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDoNotCheckConstants);
98 const ClassInfo JSTestInterfaceConstructor::s_info = { "TestInterfaceConstructor", &Base::s_info, &JSTestInterfaceConstructorTable, 0, CREATE_METHOD_TABLE(JSTestInterfaceConstructor) };
100 JSTestInterfaceConstructor::JSTestInterfaceConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
101 : DOMConstructorObject(structure, globalObject)
105 void JSTestInterfaceConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
107 Base::finishCreation(exec->globalData());
108 ASSERT(inherits(&s_info));
109 putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly);
110 putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
113 bool JSTestInterfaceConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
115 return getStaticPropertySlot<JSTestInterfaceConstructor, JSDOMWrapper>(exec, &JSTestInterfaceConstructorTable, jsCast<JSTestInterfaceConstructor*>(cell), propertyName, slot);
118 bool JSTestInterfaceConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
120 return getStaticPropertyDescriptor<JSTestInterfaceConstructor, JSDOMWrapper>(exec, &JSTestInterfaceConstructorTable, jsCast<JSTestInterfaceConstructor*>(object), propertyName, descriptor);
123 EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::constructJSTestInterface(ExecState* exec)
125 JSTestInterfaceConstructor* castedThis = jsCast<JSTestInterfaceConstructor*>(exec->callee());
126 if (exec->argumentCount() < 1)
127 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
128 ExceptionCode ec = 0;
129 const String& str1(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toString(exec)->value(exec)));
130 if (exec->hadException())
131 return JSValue::encode(jsUndefined());
132 const String& str2(ustringToString(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined).toString(exec)->value(exec)));
133 if (exec->hadException())
134 return JSValue::encode(jsUndefined());
135 ScriptExecutionContext* context = castedThis->scriptExecutionContext();
137 return throwVMError(exec, createReferenceError(exec, "TestInterface constructor associated document is unavailable"));
138 RefPtr<TestInterface> object = TestInterface::create(context, str1, str2, ec);
140 setDOMException(exec, ec);
141 return JSValue::encode(JSValue());
143 return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
146 ConstructType JSTestInterfaceConstructor::getConstructData(JSCell*, ConstructData& constructData)
148 constructData.native.function = constructJSTestInterface;
149 return ConstructTypeHost;
152 /* Hash table for prototype */
154 static const HashTableValue JSTestInterfacePrototypeTableValues[] =
156 #if ENABLE(Condition11) || ENABLE(Condition12)
157 { "SUPPLEMENTALCONSTANT1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT1), (intptr_t)0, NoIntrinsic },
159 #if ENABLE(Condition11) || ENABLE(Condition12)
160 { "SUPPLEMENTALCONSTANT2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestInterfaceSUPPLEMENTALCONSTANT2), (intptr_t)0, NoIntrinsic },
162 #if ENABLE(Condition11) || ENABLE(Condition12)
163 { "supplementalMethod1", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod1), (intptr_t)0, NoIntrinsic },
165 #if ENABLE(Condition11) || ENABLE(Condition12)
166 { "supplementalMethod2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod2), (intptr_t)2, NoIntrinsic },
168 #if ENABLE(Condition11) || ENABLE(Condition12)
169 { "supplementalMethod3", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestInterfacePrototypeFunctionSupplementalMethod3), (intptr_t)0, NoIntrinsic },
171 { 0, 0, 0, 0, NoIntrinsic }
174 static const HashTable JSTestInterfacePrototypeTable = { 17, 15, JSTestInterfacePrototypeTableValues, 0 };
175 const ClassInfo JSTestInterfacePrototype::s_info = { "TestInterfacePrototype", &Base::s_info, &JSTestInterfacePrototypeTable, 0, CREATE_METHOD_TABLE(JSTestInterfacePrototype) };
177 JSObject* JSTestInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
179 return getDOMPrototype<JSTestInterface>(exec, globalObject);
182 bool JSTestInterfacePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
184 JSTestInterfacePrototype* thisObject = jsCast<JSTestInterfacePrototype*>(cell);
185 return getStaticPropertySlot<JSTestInterfacePrototype, JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, slot);
188 bool JSTestInterfacePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
190 JSTestInterfacePrototype* thisObject = jsCast<JSTestInterfacePrototype*>(object);
191 return getStaticPropertyDescriptor<JSTestInterfacePrototype, JSObject>(exec, &JSTestInterfacePrototypeTable, thisObject, propertyName, descriptor);
194 const ClassInfo JSTestInterface::s_info = { "TestInterface", &Base::s_info, &JSTestInterfaceTable, 0 , CREATE_METHOD_TABLE(JSTestInterface) };
196 JSTestInterface::JSTestInterface(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestInterface> impl)
197 : JSDOMWrapper(structure, globalObject)
198 , m_impl(impl.leakRef())
202 void JSTestInterface::finishCreation(JSGlobalData& globalData)
204 Base::finishCreation(globalData);
205 ASSERT(inherits(&s_info));
208 JSObject* JSTestInterface::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
210 return JSTestInterfacePrototype::create(exec->globalData(), globalObject, JSTestInterfacePrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
213 void JSTestInterface::destroy(JSC::JSCell* cell)
215 JSTestInterface* thisObject = jsCast<JSTestInterface*>(cell);
216 thisObject->JSTestInterface::~JSTestInterface();
219 JSTestInterface::~JSTestInterface()
221 releaseImplIfNotNull();
224 bool JSTestInterface::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
226 JSTestInterface* thisObject = jsCast<JSTestInterface*>(cell);
227 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
228 return getStaticValueSlot<JSTestInterface, Base>(exec, &JSTestInterfaceTable, thisObject, propertyName, slot);
231 bool JSTestInterface::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
233 JSTestInterface* thisObject = jsCast<JSTestInterface*>(object);
234 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
235 return getStaticValueDescriptor<JSTestInterface, Base>(exec, &JSTestInterfaceTable, thisObject, propertyName, descriptor);
238 #if ENABLE(Condition11) || ENABLE(Condition12)
239 JSValue jsTestInterfaceSupplementalStr1(ExecState* exec, JSValue slotBase, const Identifier&)
241 JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(slotBase));
243 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl());
244 JSValue result = jsString(exec, TestSupplemental::supplementalStr1(impl));
250 #if ENABLE(Condition11) || ENABLE(Condition12)
251 JSValue jsTestInterfaceSupplementalStr2(ExecState* exec, JSValue slotBase, const Identifier&)
253 JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(slotBase));
255 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl());
256 JSValue result = jsString(exec, TestSupplemental::supplementalStr2(impl));
262 #if ENABLE(Condition11) || ENABLE(Condition12)
263 JSValue jsTestInterfaceSupplementalStr3(ExecState* exec, JSValue slotBase, const Identifier&)
265 JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(slotBase));
266 return castedThis->supplementalStr3(exec);
271 #if ENABLE(Condition11) || ENABLE(Condition12)
272 JSValue jsTestInterfaceSupplementalNode(ExecState* exec, JSValue slotBase, const Identifier&)
274 JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(slotBase));
276 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl());
277 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(TestSupplemental::supplementalNode(impl)));
283 JSValue jsTestInterfaceConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
285 JSTestInterface* domObject = jsCast<JSTestInterface*>(asObject(slotBase));
286 return JSTestInterface::getConstructor(exec, domObject->globalObject());
289 void JSTestInterface::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
291 JSTestInterface* thisObject = jsCast<JSTestInterface*>(cell);
292 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
293 if (thisObject->putDelegate(exec, propertyName, value, slot))
295 lookupPut<JSTestInterface, Base>(exec, propertyName, value, &JSTestInterfaceTable, thisObject, slot);
298 #if ENABLE(Condition11) || ENABLE(Condition12)
299 void setJSTestInterfaceSupplementalStr2(ExecState* exec, JSObject* thisObject, JSValue value)
301 JSTestInterface* castedThis = jsCast<JSTestInterface*>(thisObject);
302 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl());
303 TestSupplemental::setSupplementalStr2(impl, ustringToString(value.isEmpty() ? UString() : value.toString(exec)->value(exec)));
308 #if ENABLE(Condition11) || ENABLE(Condition12)
309 void setJSTestInterfaceSupplementalStr3(ExecState* exec, JSObject* thisObject, JSValue value)
311 jsCast<JSTestInterface*>(thisObject)->setSupplementalStr3(exec, value);
316 #if ENABLE(Condition11) || ENABLE(Condition12)
317 void setJSTestInterfaceSupplementalNode(ExecState* exec, JSObject* thisObject, JSValue value)
319 JSTestInterface* castedThis = jsCast<JSTestInterface*>(thisObject);
320 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl());
321 TestSupplemental::setSupplementalNode(impl, toNode(value));
326 JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
328 return getDOMConstructor<JSTestInterfaceConstructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject));
331 #if ENABLE(Condition11) || ENABLE(Condition12)
332 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod1(ExecState* exec)
334 JSValue thisValue = exec->hostThisValue();
335 if (!thisValue.inherits(&JSTestInterface::s_info))
336 return throwVMTypeError(exec);
337 JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(thisValue));
338 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestInterface::s_info);
339 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl());
340 TestSupplemental::supplementalMethod1(impl);
341 return JSValue::encode(jsUndefined());
346 #if ENABLE(Condition11) || ENABLE(Condition12)
347 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod2(ExecState* exec)
349 JSValue thisValue = exec->hostThisValue();
350 if (!thisValue.inherits(&JSTestInterface::s_info))
351 return throwVMTypeError(exec);
352 JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(thisValue));
353 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestInterface::s_info);
354 TestInterface* impl = static_cast<TestInterface*>(castedThis->impl());
355 if (exec->argumentCount() < 2)
356 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
357 ExceptionCode ec = 0;
358 ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
360 return JSValue::encode(jsUndefined());
361 const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toString(exec)->value(exec)));
362 if (exec->hadException())
363 return JSValue::encode(jsUndefined());
364 TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined)));
365 if (exec->hadException())
366 return JSValue::encode(jsUndefined());
368 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(TestSupplemental::supplementalMethod2(impl, scriptContext, strArg, objArg, ec)));
369 setDOMException(exec, ec);
370 return JSValue::encode(result);
375 #if ENABLE(Condition11) || ENABLE(Condition12)
376 EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSupplementalMethod3(ExecState* exec)
378 JSValue thisValue = exec->hostThisValue();
379 if (!thisValue.inherits(&JSTestInterface::s_info))
380 return throwVMTypeError(exec);
381 JSTestInterface* castedThis = jsCast<JSTestInterface*>(asObject(thisValue));
382 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestInterface::s_info);
383 return JSValue::encode(castedThis->supplementalMethod3(exec));
388 #if ENABLE(Condition11) || ENABLE(Condition12)
389 EncodedJSValue JSC_HOST_CALL jsTestInterfaceConstructorFunctionSupplementalMethod4(ExecState* exec)
391 TestSupplemental::supplementalMethod4();
392 return JSValue::encode(jsUndefined());
399 #if ENABLE(Condition11) || ENABLE(Condition12)
400 JSValue jsTestInterfaceSUPPLEMENTALCONSTANT1(ExecState* exec, JSValue, const Identifier&)
403 return jsNumber(static_cast<int>(1));
407 #if ENABLE(Condition11) || ENABLE(Condition12)
408 JSValue jsTestInterfaceSUPPLEMENTALCONSTANT2(ExecState* exec, JSValue, const Identifier&)
411 return jsNumber(static_cast<int>(2));
415 static inline bool isObservable(JSTestInterface* jsTestInterface)
417 if (jsTestInterface->hasCustomProperties())
422 bool JSTestInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
424 JSTestInterface* jsTestInterface = jsCast<JSTestInterface*>(handle.get().asCell());
425 if (jsTestInterface->impl()->hasPendingActivity())
427 if (!isObservable(jsTestInterface))
429 UNUSED_PARAM(visitor);
433 void JSTestInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
435 JSTestInterface* jsTestInterface = jsCast<JSTestInterface*>(handle.get().asCell());
436 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
437 uncacheWrapper(world, jsTestInterface->impl(), jsTestInterface);
438 jsTestInterface->releaseImpl();
441 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestInterface* impl)
443 return wrap<JSTestInterface>(exec, globalObject, impl);
446 TestInterface* toTestInterface(JSC::JSValue value)
448 return value.inherits(&JSTestInterface::s_info) ? jsCast<JSTestInterface*>(asObject(value))->impl() : 0;
453 #endif // ENABLE(Condition1) || ENABLE(Condition2)