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 "JSTestCustomNamedGetter.h"
24 #include "ExceptionCode.h"
25 #include "JSDOMBinding.h"
26 #include "TestCustomNamedGetter.h"
27 #include "wtf/text/AtomicString.h"
28 #include <runtime/Error.h>
29 #include <wtf/GetPtr.h>
37 static const HashTableValue JSTestCustomNamedGetterTableValues[] =
39 { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCustomNamedGetterConstructor), (intptr_t)0 },
40 { 0, 0, NoIntrinsic, 0, 0 }
43 static const HashTable JSTestCustomNamedGetterTable = { 2, 1, JSTestCustomNamedGetterTableValues, 0 };
44 /* Hash table for constructor */
46 static const HashTableValue JSTestCustomNamedGetterConstructorTableValues[] =
48 { 0, 0, NoIntrinsic, 0, 0 }
51 static const HashTable JSTestCustomNamedGetterConstructorTable = { 1, 0, JSTestCustomNamedGetterConstructorTableValues, 0 };
52 const ClassInfo JSTestCustomNamedGetterConstructor::s_info = { "TestCustomNamedGetterConstructor", &Base::s_info, &JSTestCustomNamedGetterConstructorTable, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterConstructor) };
54 JSTestCustomNamedGetterConstructor::JSTestCustomNamedGetterConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
55 : DOMConstructorObject(structure, globalObject)
59 void JSTestCustomNamedGetterConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
61 Base::finishCreation(vm);
62 ASSERT(inherits(info()));
63 putDirect(vm, vm.propertyNames->prototype, JSTestCustomNamedGetterPrototype::self(vm, globalObject), DontDelete | ReadOnly);
64 putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontDelete | DontEnum);
67 bool JSTestCustomNamedGetterConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
69 return getStaticValueSlot<JSTestCustomNamedGetterConstructor, JSDOMWrapper>(exec, JSTestCustomNamedGetterConstructorTable, jsCast<JSTestCustomNamedGetterConstructor*>(object), propertyName, slot);
72 /* Hash table for prototype */
74 static const HashTableValue JSTestCustomNamedGetterPrototypeTableValues[] =
76 { "anotherFunction", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestCustomNamedGetterPrototypeFunctionAnotherFunction), (intptr_t)1 },
77 { 0, 0, NoIntrinsic, 0, 0 }
80 static const HashTable JSTestCustomNamedGetterPrototypeTable = { 2, 1, JSTestCustomNamedGetterPrototypeTableValues, 0 };
81 const ClassInfo JSTestCustomNamedGetterPrototype::s_info = { "TestCustomNamedGetterPrototype", &Base::s_info, &JSTestCustomNamedGetterPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterPrototype) };
83 JSObject* JSTestCustomNamedGetterPrototype::self(VM& vm, JSGlobalObject* globalObject)
85 return getDOMPrototype<JSTestCustomNamedGetter>(vm, globalObject);
88 bool JSTestCustomNamedGetterPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
90 JSTestCustomNamedGetterPrototype* thisObject = jsCast<JSTestCustomNamedGetterPrototype*>(object);
91 return getStaticFunctionSlot<JSObject>(exec, JSTestCustomNamedGetterPrototypeTable, thisObject, propertyName, slot);
94 const ClassInfo JSTestCustomNamedGetter::s_info = { "TestCustomNamedGetter", &Base::s_info, &JSTestCustomNamedGetterTable, 0 , CREATE_METHOD_TABLE(JSTestCustomNamedGetter) };
96 JSTestCustomNamedGetter::JSTestCustomNamedGetter(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestCustomNamedGetter> impl)
97 : JSDOMWrapper(structure, globalObject)
98 , m_impl(impl.leakRef())
102 void JSTestCustomNamedGetter::finishCreation(VM& vm)
104 Base::finishCreation(vm);
105 ASSERT(inherits(info()));
108 JSObject* JSTestCustomNamedGetter::createPrototype(VM& vm, JSGlobalObject* globalObject)
110 return JSTestCustomNamedGetterPrototype::create(vm, globalObject, JSTestCustomNamedGetterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
113 void JSTestCustomNamedGetter::destroy(JSC::JSCell* cell)
115 JSTestCustomNamedGetter* thisObject = static_cast<JSTestCustomNamedGetter*>(cell);
116 thisObject->JSTestCustomNamedGetter::~JSTestCustomNamedGetter();
119 JSTestCustomNamedGetter::~JSTestCustomNamedGetter()
121 releaseImplIfNotNull();
124 bool JSTestCustomNamedGetter::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
126 JSTestCustomNamedGetter* thisObject = jsCast<JSTestCustomNamedGetter*>(object);
127 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
128 if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) {
129 slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, thisObject->nameGetter);
132 return getStaticValueSlot<JSTestCustomNamedGetter, Base>(exec, JSTestCustomNamedGetterTable, thisObject, propertyName, slot);
135 bool JSTestCustomNamedGetter::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned index, PropertySlot& slot)
137 JSTestCustomNamedGetter* thisObject = jsCast<JSTestCustomNamedGetter*>(object);
138 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
139 PropertyName propertyName = Identifier::from(exec, index);
140 if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) {
141 slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, thisObject->nameGetter);
144 return Base::getOwnPropertySlotByIndex(thisObject, exec, index, slot);
147 EncodedJSValue jsTestCustomNamedGetterConstructor(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
149 JSTestCustomNamedGetter* domObject = jsDynamicCast<JSTestCustomNamedGetter*>(JSValue::decode(slotBase));
150 return JSValue::encode(JSTestCustomNamedGetter::getConstructor(exec->vm(), domObject->globalObject()));
153 JSValue JSTestCustomNamedGetter::getConstructor(VM& vm, JSGlobalObject* globalObject)
155 return getDOMConstructor<JSTestCustomNamedGetterConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
158 EncodedJSValue JSC_HOST_CALL jsTestCustomNamedGetterPrototypeFunctionAnotherFunction(ExecState* exec)
160 JSValue thisValue = exec->hostThisValue();
161 JSTestCustomNamedGetter* castedThis = jsDynamicCast<JSTestCustomNamedGetter*>(thisValue);
163 return throwVMTypeError(exec);
164 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestCustomNamedGetter::info());
165 TestCustomNamedGetter& impl = castedThis->impl();
166 if (exec->argumentCount() < 1)
167 return throwVMError(exec, createNotEnoughArgumentsError(exec));
168 const String& str(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
169 if (exec->hadException())
170 return JSValue::encode(jsUndefined());
171 impl.anotherFunction(str);
172 return JSValue::encode(jsUndefined());
175 bool JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
177 UNUSED_PARAM(handle);
178 UNUSED_PARAM(visitor);
182 void JSTestCustomNamedGetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
184 JSTestCustomNamedGetter* jsTestCustomNamedGetter = jsCast<JSTestCustomNamedGetter*>(handle.get().asCell());
185 DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
186 uncacheWrapper(world, &jsTestCustomNamedGetter->impl(), jsTestCustomNamedGetter);
187 jsTestCustomNamedGetter->releaseImpl();
190 #if ENABLE(BINDING_INTEGRITY)
192 #pragma warning(disable: 4483)
193 extern "C" { extern void (*const __identifier("??_7TestCustomNamedGetter@WebCore@@6B@")[])(); }
195 extern "C" { extern void* _ZTVN7WebCore21TestCustomNamedGetterE[]; }
198 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestCustomNamedGetter* impl)
202 if (JSValue result = getExistingWrapper<JSTestCustomNamedGetter>(exec, impl))
205 #if ENABLE(BINDING_INTEGRITY)
206 void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
208 void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestCustomNamedGetter@WebCore@@6B@"));
210 void* expectedVTablePointer = &_ZTVN7WebCore21TestCustomNamedGetterE[2];
212 // If this fails TestCustomNamedGetter does not have a vtable, so you need to add the
213 // ImplementationLacksVTable attribute to the interface definition
214 COMPILE_ASSERT(__is_polymorphic(TestCustomNamedGetter), TestCustomNamedGetter_is_not_polymorphic);
217 // If you hit this assertion you either have a use after free bug, or
218 // TestCustomNamedGetter has subclasses. If TestCustomNamedGetter has subclasses that get passed
219 // to toJS() we currently require TestCustomNamedGetter you to opt out of binding hardening
220 // by adding the SkipVTableValidation attribute to the interface IDL definition
221 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
223 ReportMemoryCost<TestCustomNamedGetter>::reportMemoryCost(exec, impl);
224 return createNewWrapper<JSTestCustomNamedGetter>(exec, globalObject, impl);
227 TestCustomNamedGetter* toTestCustomNamedGetter(JSC::JSValue value)
229 return value.inherits(JSTestCustomNamedGetter::info()) ? &jsCast<JSTestCustomNamedGetter*>(value)->impl() : 0;