/src/qt/qtwebkit/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
C++ | 286 lines | 218 code | 40 blank | 28 comment | 28 complexity | 20e09c26f8282c2c48d3653d0d1a1f8c MD5 | raw file
- /*
- This file is part of the WebKit open source project.
- This file has been generated by generate-bindings.pl. DO NOT MODIFY!
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
- */
- #include "config.h"
- #include "JSTestOverloadedConstructors.h"
- #include "ExceptionCode.h"
- #include "JSArrayBuffer.h"
- #include "JSArrayBufferView.h"
- #include "JSBlob.h"
- #include "JSDOMBinding.h"
- #include "TestOverloadedConstructors.h"
- #include <runtime/Error.h>
- #include <wtf/GetPtr.h>
- using namespace JSC;
- namespace WebCore {
- /* Hash table for constructor */
- static const HashTableValue JSTestOverloadedConstructorsTableValues[] =
- {
- { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestOverloadedConstructorsConstructor), (intptr_t)0, NoIntrinsic },
- { 0, 0, 0, 0, NoIntrinsic }
- };
- static const HashTable JSTestOverloadedConstructorsTable = { 2, 1, JSTestOverloadedConstructorsTableValues, 0 };
- /* Hash table for constructor */
- static const HashTableValue JSTestOverloadedConstructorsConstructorTableValues[] =
- {
- { 0, 0, 0, 0, NoIntrinsic }
- };
- static const HashTable JSTestOverloadedConstructorsConstructorTable = { 1, 0, JSTestOverloadedConstructorsConstructorTableValues, 0 };
- EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors1(ExecState* exec)
- {
- JSTestOverloadedConstructorsConstructor* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(exec->callee());
- if (exec->argumentCount() < 1)
- return throwVMError(exec, createNotEnoughArgumentsError(exec));
- ArrayBuffer* arrayBuffer(toArrayBuffer(exec->argument(0)));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
- RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(arrayBuffer);
- return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
- }
- EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors2(ExecState* exec)
- {
- JSTestOverloadedConstructorsConstructor* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(exec->callee());
- if (exec->argumentCount() < 1)
- return throwVMError(exec, createNotEnoughArgumentsError(exec));
- ArrayBufferView* arrayBufferView(toArrayBufferView(exec->argument(0)));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
- RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(arrayBufferView);
- return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
- }
- EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors3(ExecState* exec)
- {
- JSTestOverloadedConstructorsConstructor* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(exec->callee());
- if (exec->argumentCount() < 1)
- return throwVMError(exec, createNotEnoughArgumentsError(exec));
- Blob* blob(toBlob(exec->argument(0)));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
- RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(blob);
- return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
- }
- EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors4(ExecState* exec)
- {
- JSTestOverloadedConstructorsConstructor* castedThis = jsCast<JSTestOverloadedConstructorsConstructor*>(exec->callee());
- if (exec->argumentCount() < 1)
- return throwVMError(exec, createNotEnoughArgumentsError(exec));
- const String& string(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
- RefPtr<TestOverloadedConstructors> object = TestOverloadedConstructors::create(string);
- return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
- }
- EncodedJSValue JSC_HOST_CALL JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors(ExecState* exec)
- {
- size_t argsCount = exec->argumentCount();
- JSValue arg0(exec->argument(0));
- if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(&JSArrayBuffer::s_info))))
- return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors1(exec);
- if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(&JSArrayBufferView::s_info))))
- return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors2(exec);
- if ((argsCount == 1 && (arg0.isObject() && asObject(arg0)->inherits(&JSBlob::s_info))))
- return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors3(exec);
- if (argsCount == 1)
- return JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors4(exec);
- if (argsCount < 1)
- return throwVMError(exec, createNotEnoughArgumentsError(exec));
- return throwVMTypeError(exec);
- }
- const ClassInfo JSTestOverloadedConstructorsConstructor::s_info = { "TestOverloadedConstructorsConstructor", &Base::s_info, &JSTestOverloadedConstructorsConstructorTable, 0, CREATE_METHOD_TABLE(JSTestOverloadedConstructorsConstructor) };
- JSTestOverloadedConstructorsConstructor::JSTestOverloadedConstructorsConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
- : DOMConstructorObject(structure, globalObject)
- {
- }
- void JSTestOverloadedConstructorsConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
- {
- Base::finishCreation(exec->vm());
- ASSERT(inherits(&s_info));
- putDirect(exec->vm(), exec->propertyNames().prototype, JSTestOverloadedConstructorsPrototype::self(exec, globalObject), DontDelete | ReadOnly);
- putDirect(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
- }
- bool JSTestOverloadedConstructorsConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
- {
- return getStaticValueSlot<JSTestOverloadedConstructorsConstructor, JSDOMWrapper>(exec, &JSTestOverloadedConstructorsConstructorTable, jsCast<JSTestOverloadedConstructorsConstructor*>(cell), propertyName, slot);
- }
- bool JSTestOverloadedConstructorsConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
- {
- return getStaticValueDescriptor<JSTestOverloadedConstructorsConstructor, JSDOMWrapper>(exec, &JSTestOverloadedConstructorsConstructorTable, jsCast<JSTestOverloadedConstructorsConstructor*>(object), propertyName, descriptor);
- }
- ConstructType JSTestOverloadedConstructorsConstructor::getConstructData(JSCell*, ConstructData& constructData)
- {
- constructData.native.function = constructJSTestOverloadedConstructors;
- return ConstructTypeHost;
- }
- /* Hash table for prototype */
- static const HashTableValue JSTestOverloadedConstructorsPrototypeTableValues[] =
- {
- { 0, 0, 0, 0, NoIntrinsic }
- };
- static const HashTable JSTestOverloadedConstructorsPrototypeTable = { 1, 0, JSTestOverloadedConstructorsPrototypeTableValues, 0 };
- const ClassInfo JSTestOverloadedConstructorsPrototype::s_info = { "TestOverloadedConstructorsPrototype", &Base::s_info, &JSTestOverloadedConstructorsPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestOverloadedConstructorsPrototype) };
- JSObject* JSTestOverloadedConstructorsPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
- {
- return getDOMPrototype<JSTestOverloadedConstructors>(exec, globalObject);
- }
- const ClassInfo JSTestOverloadedConstructors::s_info = { "TestOverloadedConstructors", &Base::s_info, &JSTestOverloadedConstructorsTable, 0 , CREATE_METHOD_TABLE(JSTestOverloadedConstructors) };
- JSTestOverloadedConstructors::JSTestOverloadedConstructors(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestOverloadedConstructors> impl)
- : JSDOMWrapper(structure, globalObject)
- , m_impl(impl.leakRef())
- {
- }
- void JSTestOverloadedConstructors::finishCreation(VM& vm)
- {
- Base::finishCreation(vm);
- ASSERT(inherits(&s_info));
- }
- JSObject* JSTestOverloadedConstructors::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
- {
- return JSTestOverloadedConstructorsPrototype::create(exec->vm(), globalObject, JSTestOverloadedConstructorsPrototype::createStructure(globalObject->vm(), globalObject, globalObject->objectPrototype()));
- }
- void JSTestOverloadedConstructors::destroy(JSC::JSCell* cell)
- {
- JSTestOverloadedConstructors* thisObject = static_cast<JSTestOverloadedConstructors*>(cell);
- thisObject->JSTestOverloadedConstructors::~JSTestOverloadedConstructors();
- }
- JSTestOverloadedConstructors::~JSTestOverloadedConstructors()
- {
- releaseImplIfNotNull();
- }
- bool JSTestOverloadedConstructors::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
- {
- JSTestOverloadedConstructors* thisObject = jsCast<JSTestOverloadedConstructors*>(cell);
- ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
- return getStaticValueSlot<JSTestOverloadedConstructors, Base>(exec, &JSTestOverloadedConstructorsTable, thisObject, propertyName, slot);
- }
- bool JSTestOverloadedConstructors::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
- {
- JSTestOverloadedConstructors* thisObject = jsCast<JSTestOverloadedConstructors*>(object);
- ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
- return getStaticValueDescriptor<JSTestOverloadedConstructors, Base>(exec, &JSTestOverloadedConstructorsTable, thisObject, propertyName, descriptor);
- }
- JSValue jsTestOverloadedConstructorsConstructor(ExecState* exec, JSValue slotBase, PropertyName)
- {
- JSTestOverloadedConstructors* domObject = jsCast<JSTestOverloadedConstructors*>(asObject(slotBase));
- return JSTestOverloadedConstructors::getConstructor(exec, domObject->globalObject());
- }
- JSValue JSTestOverloadedConstructors::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
- {
- return getDOMConstructor<JSTestOverloadedConstructorsConstructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject));
- }
- static inline bool isObservable(JSTestOverloadedConstructors* jsTestOverloadedConstructors)
- {
- if (jsTestOverloadedConstructors->hasCustomProperties())
- return true;
- return false;
- }
- bool JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
- {
- JSTestOverloadedConstructors* jsTestOverloadedConstructors = jsCast<JSTestOverloadedConstructors*>(handle.get().asCell());
- if (!isObservable(jsTestOverloadedConstructors))
- return false;
- UNUSED_PARAM(visitor);
- return false;
- }
- void JSTestOverloadedConstructorsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
- {
- JSTestOverloadedConstructors* jsTestOverloadedConstructors = jsCast<JSTestOverloadedConstructors*>(handle.get().asCell());
- DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
- uncacheWrapper(world, jsTestOverloadedConstructors->impl(), jsTestOverloadedConstructors);
- jsTestOverloadedConstructors->releaseImpl();
- }
- #if ENABLE(BINDING_INTEGRITY)
- #if PLATFORM(WIN)
- #pragma warning(disable: 4483)
- extern "C" { extern void (*const __identifier("??_7TestOverloadedConstructors@WebCore@@6B@")[])(); }
- #else
- extern "C" { extern void* _ZTVN7WebCore26TestOverloadedConstructorsE[]; }
- #endif
- #endif
- JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestOverloadedConstructors* impl)
- {
- if (!impl)
- return jsNull();
- if (JSValue result = getExistingWrapper<JSTestOverloadedConstructors>(exec, impl))
- return result;
- #if ENABLE(BINDING_INTEGRITY)
- void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
- #if PLATFORM(WIN)
- void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestOverloadedConstructors@WebCore@@6B@"));
- #else
- void* expectedVTablePointer = &_ZTVN7WebCore26TestOverloadedConstructorsE[2];
- #if COMPILER(CLANG)
- // If this fails TestOverloadedConstructors does not have a vtable, so you need to add the
- // ImplementationLacksVTable attribute to the interface definition
- COMPILE_ASSERT(__is_polymorphic(TestOverloadedConstructors), TestOverloadedConstructors_is_not_polymorphic);
- #endif
- #endif
- // If you hit this assertion you either have a use after free bug, or
- // TestOverloadedConstructors has subclasses. If TestOverloadedConstructors has subclasses that get passed
- // to toJS() we currently require TestOverloadedConstructors you to opt out of binding hardening
- // by adding the SkipVTableValidation attribute to the interface IDL definition
- RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
- #endif
- ReportMemoryCost<TestOverloadedConstructors>::reportMemoryCost(exec, impl);
- return createNewWrapper<JSTestOverloadedConstructors>(exec, globalObject, impl);
- }
- TestOverloadedConstructors* toTestOverloadedConstructors(JSC::JSValue value)
- {
- return value.inherits(&JSTestOverloadedConstructors::s_info) ? jsCast<JSTestOverloadedConstructors*>(asObject(value))->impl() : 0;
- }
- }