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 #pragma warning(disable: 2466) // Disable 'cannot allocate an array of constant size 0' warning
41 static const struct CompactHashIndex JSTestCustomNamedGetterTableIndex[2] = {
47 static const HashTableValue JSTestCustomNamedGetterTableValues[1] =
49 { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCustomNamedGetterConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
52 static const HashTable JSTestCustomNamedGetterTable = { 1, 1, true, JSTestCustomNamedGetterTableValues, 0, JSTestCustomNamedGetterTableIndex };
58 #pragma warning(disable: 2466) // Disable 'cannot allocate an array of constant size 0' warning
60 /* Hash table for constructor */
62 static const struct CompactHashIndex JSTestCustomNamedGetterConstructorTableIndex[1] = {
67 static const HashTableValue JSTestCustomNamedGetterConstructorTableValues[0] =
71 static const HashTable JSTestCustomNamedGetterConstructorTable = { 0, 0, false, JSTestCustomNamedGetterConstructorTableValues, 0, JSTestCustomNamedGetterConstructorTableIndex };
75 const ClassInfo JSTestCustomNamedGetterConstructor::s_info = { "TestCustomNamedGetterConstructor", &Base::s_info, &JSTestCustomNamedGetterConstructorTable, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterConstructor) };
77 JSTestCustomNamedGetterConstructor::JSTestCustomNamedGetterConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
78 : DOMConstructorObject(structure, globalObject)
82 void JSTestCustomNamedGetterConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
84 Base::finishCreation(vm);
85 ASSERT(inherits(info()));
86 putDirect(vm, vm.propertyNames->prototype, JSTestCustomNamedGetterPrototype::self(vm, globalObject), DontDelete | ReadOnly);
87 putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontDelete | DontEnum);
90 bool JSTestCustomNamedGetterConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
92 return getStaticValueSlot<JSTestCustomNamedGetterConstructor, JSDOMWrapper>(exec, JSTestCustomNamedGetterConstructorTable, jsCast<JSTestCustomNamedGetterConstructor*>(object), propertyName, slot);
97 #pragma warning(disable: 2466) // Disable 'cannot allocate an array of constant size 0' warning
99 /* Hash table for prototype */
101 static const struct CompactHashIndex JSTestCustomNamedGetterPrototypeTableIndex[2] = {
107 static const HashTableValue JSTestCustomNamedGetterPrototypeTableValues[1] =
109 { "anotherFunction", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestCustomNamedGetterPrototypeFunctionAnotherFunction), (intptr_t) (1) },
112 static const HashTable JSTestCustomNamedGetterPrototypeTable = { 1, 1, false, JSTestCustomNamedGetterPrototypeTableValues, 0, JSTestCustomNamedGetterPrototypeTableIndex };
116 const ClassInfo JSTestCustomNamedGetterPrototype::s_info = { "TestCustomNamedGetterPrototype", &Base::s_info, &JSTestCustomNamedGetterPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterPrototype) };
118 JSObject* JSTestCustomNamedGetterPrototype::self(VM& vm, JSGlobalObject* globalObject)
120 return getDOMPrototype<JSTestCustomNamedGetter>(vm, globalObject);
123 bool JSTestCustomNamedGetterPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
125 JSTestCustomNamedGetterPrototype* thisObject = jsCast<JSTestCustomNamedGetterPrototype*>(object);
126 return getStaticFunctionSlot<JSObject>(exec, JSTestCustomNamedGetterPrototypeTable, thisObject, propertyName, slot);
129 const ClassInfo JSTestCustomNamedGetter::s_info = { "TestCustomNamedGetter", &Base::s_info, &JSTestCustomNamedGetterTable, 0 , CREATE_METHOD_TABLE(JSTestCustomNamedGetter) };
131 JSTestCustomNamedGetter::JSTestCustomNamedGetter(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestCustomNamedGetter> impl)
132 : JSDOMWrapper(structure, globalObject)
133 , m_impl(impl.leakRef())
137 void JSTestCustomNamedGetter::finishCreation(VM& vm)
139 Base::finishCreation(vm);
140 ASSERT(inherits(info()));
143 JSObject* JSTestCustomNamedGetter::createPrototype(VM& vm, JSGlobalObject* globalObject)
145 return JSTestCustomNamedGetterPrototype::create(vm, globalObject, JSTestCustomNamedGetterPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
148 void JSTestCustomNamedGetter::destroy(JSC::JSCell* cell)
150 JSTestCustomNamedGetter* thisObject = static_cast<JSTestCustomNamedGetter*>(cell);
151 thisObject->JSTestCustomNamedGetter::~JSTestCustomNamedGetter();
154 JSTestCustomNamedGetter::~JSTestCustomNamedGetter()
156 releaseImplIfNotNull();
159 bool JSTestCustomNamedGetter::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
161 JSTestCustomNamedGetter* thisObject = jsCast<JSTestCustomNamedGetter*>(object);
162 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
163 if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) {
164 slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, thisObject->nameGetter);
167 return getStaticValueSlot<JSTestCustomNamedGetter, Base>(exec, JSTestCustomNamedGetterTable, thisObject, propertyName, slot);
170 bool JSTestCustomNamedGetter::getOwnPropertySlotByIndex(JSObject* object, ExecState* exec, unsigned index, PropertySlot& slot)
172 JSTestCustomNamedGetter* thisObject = jsCast<JSTestCustomNamedGetter*>(object);
173 ASSERT_GC_OBJECT_INHERITS(thisObject, info());
174 PropertyName propertyName = Identifier::from(exec, index);
175 if (canGetItemsForName(exec, &thisObject->impl(), propertyName)) {
176 slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, thisObject->nameGetter);
179 return Base::getOwnPropertySlotByIndex(thisObject, exec, index, slot);
182 EncodedJSValue jsTestCustomNamedGetterConstructor(ExecState* exec, JSObject* baseValue, EncodedJSValue thisValue, PropertyName)
184 UNUSED_PARAM(baseValue);
185 UNUSED_PARAM(thisValue);
186 JSTestCustomNamedGetter* domObject = jsDynamicCast<JSTestCustomNamedGetter*>(JSValue::decode(thisValue));
188 return throwVMTypeError(exec);
189 return JSValue::encode(JSTestCustomNamedGetter::getConstructor(exec->vm(), domObject->globalObject()));
192 JSValue JSTestCustomNamedGetter::getConstructor(VM& vm, JSGlobalObject* globalObject)
194 return getDOMConstructor<JSTestCustomNamedGetterConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
197 EncodedJSValue JSC_HOST_CALL jsTestCustomNamedGetterPrototypeFunctionAnotherFunction(ExecState* exec)
199 JSValue thisValue = exec->hostThisValue();
200 JSTestCustomNamedGetter* castedThis = jsDynamicCast<JSTestCustomNamedGetter*>(thisValue);
201 if (UNLIKELY(!castedThis))
202 return throwVMTypeError(exec);
203 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestCustomNamedGetter::info());
204 TestCustomNamedGetter& impl = castedThis->impl();
205 if (exec->argumentCount() < 1)
206 return throwVMError(exec, createNotEnoughArgumentsError(exec));
207 const String& str(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
208 if (UNLIKELY(exec->hadException()))
209 return JSValue::encode(jsUndefined());
210 impl.anotherFunction(str);
211 return JSValue::encode(jsUndefined());
214 bool JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
216 UNUSED_PARAM(handle);
217 UNUSED_PARAM(visitor);
221 void JSTestCustomNamedGetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
223 JSTestCustomNamedGetter* jsTestCustomNamedGetter = jsCast<JSTestCustomNamedGetter*>(handle.get().asCell());
224 DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
225 uncacheWrapper(world, &jsTestCustomNamedGetter->impl(), jsTestCustomNamedGetter);
226 jsTestCustomNamedGetter->releaseImpl();
229 #if ENABLE(BINDING_INTEGRITY)
231 #pragma warning(disable: 4483)
232 extern "C" { extern void (*const __identifier("??_7TestCustomNamedGetter@WebCore@@6B@")[])(); }
234 extern "C" { extern void* _ZTVN7WebCore21TestCustomNamedGetterE[]; }
237 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestCustomNamedGetter* impl)
241 if (JSValue result = getExistingWrapper<JSTestCustomNamedGetter>(exec, impl))
244 #if ENABLE(BINDING_INTEGRITY)
245 void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
247 void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestCustomNamedGetter@WebCore@@6B@"));
249 void* expectedVTablePointer = &_ZTVN7WebCore21TestCustomNamedGetterE[2];
251 // If this fails TestCustomNamedGetter does not have a vtable, so you need to add the
252 // ImplementationLacksVTable attribute to the interface definition
253 COMPILE_ASSERT(__is_polymorphic(TestCustomNamedGetter), TestCustomNamedGetter_is_not_polymorphic);
256 // If you hit this assertion you either have a use after free bug, or
257 // TestCustomNamedGetter has subclasses. If TestCustomNamedGetter has subclasses that get passed
258 // to toJS() we currently require TestCustomNamedGetter you to opt out of binding hardening
259 // by adding the SkipVTableValidation attribute to the interface IDL definition
260 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
262 return createNewWrapper<JSTestCustomNamedGetter>(exec, globalObject, impl);
265 TestCustomNamedGetter* toTestCustomNamedGetter(JSC::JSValue value)
267 return value.inherits(JSTestCustomNamedGetter::info()) ? &jsCast<JSTestCustomNamedGetter*>(value)->impl() : 0;