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.
22 #include "JSTestOverloadedConstructors.h"
24 #include "ExceptionCode.h"
26 #include "JSDOMBinding.h"
27 #include "TestOverloadedConstructors.h"
28 #include <runtime/Error.h>
29 #include <wtf/GetPtr.h>
35 /* Hash table for constructor */
37 static const struct CompactHashIndex JSTestOverloadedConstructorsConstructorTableIndex[1] = {
42 static const HashTableValue JSTestOverloadedConstructorsConstructorTableValues[] =
44 { 0, 0, NoIntrinsic, 0, 0 }
47 static const HashTable JSTestOverloadedConstructorsConstructorTable = { 0, 0, false, JSTestOverloadedConstructorsConstructorTableValues, 0, JSTestOverloadedConstructorsConstructorTableIndex };
48 EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors1(ExecState* exec)
50 JSTestOverloadedConstructorsConstructor* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(exec->callee());
51 if (exec->argumentCount() < 1)
52 return throwVMError(exec, createNotEnoughArgumentsError(exec));
53 ArrayBuffer* arrayBuffer(toArrayBuffer(exec->argument(0)));
54 if (UNLIKELY(exec->hadException()))
55 return JSValue::encode(jsUndefined());
56 RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(arrayBuffer);
57 return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
60 EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors2(ExecState* exec)
62 JSTestOverloadedConstructorsConstructor* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(exec->callee());
63 if (exec->argumentCount() < 1)
64 return throwVMError(exec, createNotEnoughArgumentsError(exec));
65 RefPtr<ArrayBufferView> arrayBufferView(toArrayBufferView(exec->argument(0)));
66 if (UNLIKELY(exec->hadException()))
67 return JSValue::encode(jsUndefined());
68 RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(arrayBufferView);
69 return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
72 EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors3(ExecState* exec)
74 JSTestOverloadedConstructorsConstructor* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(exec->callee());
75 if (exec->argumentCount() < 1)
76 return throwVMError(exec, createNotEnoughArgumentsError(exec));
77 Blob* blob(toBlob(exec->argument(0)));
78 if (UNLIKELY(exec->hadException()))
79 return JSValue::encode(jsUndefined());
80 RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(blob);
81 return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
84 EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors4(ExecState* exec)
86 JSTestOverloadedConstructorsConstructor* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(exec->callee());
87 if (exec->argumentCount() < 1)
88 return throwVMError(exec, createNotEnoughArgumentsError(exec));
89 const String& string(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
90 if (UNLIKELY(exec->hadException()))
91 return JSValue::encode(jsUndefined());
92 RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(string);
93 return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
96 EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors(ExecState* exec)
98 size_t argsCount = exec->argumentCount();
99 JSValue arg0(exec->argument(0));
100 if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(JSArrayBuffer::info()))))
101 return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors1(exec);
102 if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(JSArrayBufferView::info()))))
103 return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors2(exec);
104 if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(JSBlob::info()))))
105 return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors3(exec);
107 return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors4(exec);
109 return throwVMError(exec, createNotEnoughArgumentsError(exec));
110 return throwVMTypeError(exec);
113 const ClassInfo JSTestOverloadedConstructorsConstructor::s_info = { "TestOverloadedConstructorsConstructor", &Base::s_info, &JSTestOverloadedConstructorsConstructorTable, 0, CREATE_METHOD_TABLE(JSTestOverloadedConstructorsConstructor) };
115 JSTestOverloadedConstructorsConstructor::JSTestOverloadedConstructorsConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
116 : DOMConstructorObject(structure, globalObject)
120 void JSTestOverloadedConstructorsConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
122 Base::finishCreation(vm);
123 ASSERT(inherits(info()));
124 putDirect(vm, vm.propertyNames->prototype, JSTestOverloadedConstructorsPrototype::self(vm, globalObject), DontDelete | ReadOnly);
125 putDirect(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
128 bool JSTestOverloadedConstructorsConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
130 return getStaticValueSlot<JSTestOverloadedConstructorsConstructor, JSDOMWrapper>(exec, JSTestOverloadedConstructorsConstructorTable, jsCast<JSTestOverloadedConstructorsConstructor*>(object), propertyName, slot);
133 ConstructType JSTestOverloadedConstructorsConstructor::getConstructData(JSCell*, ConstructData& constructData)
135 constructData.native.function = constructJSTestOverloadedConstructors;
136 return ConstructTypeHost;
139 /* Hash table for prototype */
141 static const struct CompactHashIndex JSTestOverloadedConstructorsPrototypeTableIndex[2] = {
147 static const HashTableValue JSTestOverloadedConstructorsPrototypeTableValues[] =
149 { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestOverloadedConstructorsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
152 static const HashTable JSTestOverloadedConstructorsPrototypeTable = { 1, 1, true, JSTestOverloadedConstructorsPrototypeTableValues, 0, JSTestOverloadedConstructorsPrototypeTableIndex };
153 const ClassInfo JSTestOverloadedConstructorsPrototype::s_info = { "TestOverloadedConstructorsPrototype", &Base::s_info, &JSTestOverloadedConstructorsPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestOverloadedConstructorsPrototype) };
155 JSObject* JSTestOverloadedConstructorsPrototype::self(VM& vm, JSGlobalObject* globalObject)
157 return getDOMPrototype<JSTestOverloadedConstructors>(vm, globalObject);
160 bool JSTestOverloadedConstructorsPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
162 JSTestOverloadedConstructorsPrototype* thisObject = jsCast<JSTestOverloadedConstructorsPrototype*>(object);
163 return getStaticPropertySlot<JSTestOverloadedConstructorsPrototype, JSObject>(exec, JSTestOverloadedConstructorsPrototypeTable, thisObject, propertyName, slot);
166 const ClassInfo JSTestOverloadedConstructors::s_info = { "TestOverloadedConstructors", &Base::s_info, 0, 0 , CREATE_METHOD_TABLE(JSTestOverloadedConstructors) };
168 JSTestOverloadedConstructors::JSTestOverloadedConstructors(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestOverloadedConstructors> impl)
169 : JSDOMWrapper(structure, globalObject)
170 , m_impl(impl.leakRef())
174 void JSTestOverloadedConstructors::finishCreation(VM& vm)
176 Base::finishCreation(vm);
177 ASSERT(inherits(info()));
180 JSObject* JSTestOverloadedConstructors::createPrototype(VM& vm, JSGlobalObject* globalObject)
182 return JSTestOverloadedConstructorsPrototype::create(vm, globalObject, JSTestOverloadedConstructorsPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
185 void JSTestOverloadedConstructors::destroy(JSC::JSCell* cell)
187 JSTestOverloadedConstructors* thisObject = static_cast<JSTestOverloadedConstructors*>(cell);
188 thisObject->JSTestOverloadedConstructors::~JSTestOverloadedConstructors();
191 JSTestOverloadedConstructors::~JSTestOverloadedConstructors()
193 releaseImplIfNotNull();
196 bool JSTestOverloadedConstructors::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
198 JSTestOverloadedConstructors* thisObject = jsCast<JSTestOverloadedConstructors*>(object);
199 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
200 return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
203 EncodedJSValue jsTestOverloadedConstructorsConstructor(ExecState* exec, JSObject* baseValue, EncodedJSValue thisValue, PropertyName)
205 UNUSED_PARAM(baseValue);
206 UNUSED_PARAM(thisValue);
207 JSTestOverloadedConstructorsPrototype* domObject = jsDynamicCast<JSTestOverloadedConstructorsPrototype*>(baseValue);
209 return throwVMTypeError(exec);
210 return JSValue::encode(JSTestOverloadedConstructors::getConstructor(exec->vm(), domObject->globalObject()));
213 JSValue JSTestOverloadedConstructors::getConstructor(VM& vm, JSGlobalObject* globalObject)
215 return getDOMConstructor<JSTestOverloadedConstructorsConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
218 bool JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
220 UNUSED_PARAM(handle);
221 UNUSED_PARAM(visitor);
225 void JSTestOverloadedConstructorsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
227 JSTestOverloadedConstructors* jsTestOverloadedConstructors = jsCast<JSTestOverloadedConstructors*>(handle.slot()->asCell());
228 DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
229 uncacheWrapper(world, &jsTestOverloadedConstructors->impl(), jsTestOverloadedConstructors);
230 jsTestOverloadedConstructors->releaseImpl();
233 #if ENABLE(BINDING_INTEGRITY)
235 #pragma warning(disable: 4483)
236 extern "C" { extern void (*const __identifier("??_7TestOverloadedConstructors@WebCore@@6B@")[])(); }
238 extern "C" { extern void* _ZTVN7WebCore26TestOverloadedConstructorsE[]; }
241 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestOverloadedConstructors* impl)
245 if (JSValue result = getExistingWrapper<JSTestOverloadedConstructors>(exec, impl))
248 #if ENABLE(BINDING_INTEGRITY)
249 void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
251 void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestOverloadedConstructors@WebCore@@6B@"));
253 void* expectedVTablePointer = &_ZTVN7WebCore26TestOverloadedConstructorsE[2];
255 // If this fails TestOverloadedConstructors does not have a vtable, so you need to add the
256 // ImplementationLacksVTable attribute to the interface definition
257 COMPILE_ASSERT(__is_polymorphic(TestOverloadedConstructors), TestOverloadedConstructors_is_not_polymorphic);
260 // If you hit this assertion you either have a use after free bug, or
261 // TestOverloadedConstructors has subclasses. If TestOverloadedConstructors has subclasses that get passed
262 // to toJS() we currently require TestOverloadedConstructors you to opt out of binding hardening
263 // by adding the SkipVTableValidation attribute to the interface IDL definition
264 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
266 return createNewWrapper<JSTestOverloadedConstructors>(exec, globalObject, impl);
269 TestOverloadedConstructors* toTestOverloadedConstructors(JSC::JSValue value)
271 return value.inherits(JSTestOverloadedConstructors::info()) ? &jsCast<JSTestOverloadedConstructors*>(value)->impl() : 0;