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 "JSTestActiveDOMObject.h"
24 #include "ExceptionCode.h"
25 #include "JSDOMBinding.h"
27 #include "TestActiveDOMObject.h"
28 #include <runtime/Error.h>
29 #include <wtf/GetPtr.h>
35 ASSERT_CLASS_FITS_IN_CELL(JSTestActiveDOMObject);
38 static const HashTableValue JSTestActiveDOMObjectTableValues[] =
40 { "excitingAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestActiveDOMObjectExcitingAttr), (intptr_t)0, NoIntrinsic },
41 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestActiveDOMObjectConstructor), (intptr_t)0, NoIntrinsic },
42 { 0, 0, 0, 0, NoIntrinsic }
45 static const HashTable JSTestActiveDOMObjectTable = { 4, 3, JSTestActiveDOMObjectTableValues, 0 };
46 /* Hash table for constructor */
48 static const HashTableValue JSTestActiveDOMObjectConstructorTableValues[] =
50 { 0, 0, 0, 0, NoIntrinsic }
53 static const HashTable JSTestActiveDOMObjectConstructorTable = { 1, 0, JSTestActiveDOMObjectConstructorTableValues, 0 };
54 const ClassInfo JSTestActiveDOMObjectConstructor::s_info = { "TestActiveDOMObjectConstructor", &Base::s_info, &JSTestActiveDOMObjectConstructorTable, 0, CREATE_METHOD_TABLE(JSTestActiveDOMObjectConstructor) };
56 JSTestActiveDOMObjectConstructor::JSTestActiveDOMObjectConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
57 : DOMConstructorObject(structure, globalObject)
61 void JSTestActiveDOMObjectConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
63 Base::finishCreation(exec->globalData());
64 ASSERT(inherits(&s_info));
65 putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestActiveDOMObjectPrototype::self(exec, globalObject), DontDelete | ReadOnly);
68 bool JSTestActiveDOMObjectConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
70 return getStaticValueSlot<JSTestActiveDOMObjectConstructor, JSDOMWrapper>(exec, &JSTestActiveDOMObjectConstructorTable, jsCast<JSTestActiveDOMObjectConstructor*>(cell), propertyName, slot);
73 bool JSTestActiveDOMObjectConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
75 return getStaticValueDescriptor<JSTestActiveDOMObjectConstructor, JSDOMWrapper>(exec, &JSTestActiveDOMObjectConstructorTable, jsCast<JSTestActiveDOMObjectConstructor*>(object), propertyName, descriptor);
78 /* Hash table for prototype */
80 static const HashTableValue JSTestActiveDOMObjectPrototypeTableValues[] =
82 { "excitingFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestActiveDOMObjectPrototypeFunctionExcitingFunction), (intptr_t)1, NoIntrinsic },
83 { "postMessage", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestActiveDOMObjectPrototypeFunctionPostMessage), (intptr_t)1, NoIntrinsic },
84 { 0, 0, 0, 0, NoIntrinsic }
87 static const HashTable JSTestActiveDOMObjectPrototypeTable = { 4, 3, JSTestActiveDOMObjectPrototypeTableValues, 0 };
88 const ClassInfo JSTestActiveDOMObjectPrototype::s_info = { "TestActiveDOMObjectPrototype", &Base::s_info, &JSTestActiveDOMObjectPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestActiveDOMObjectPrototype) };
90 JSObject* JSTestActiveDOMObjectPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
92 return getDOMPrototype<JSTestActiveDOMObject>(exec, globalObject);
95 bool JSTestActiveDOMObjectPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
97 JSTestActiveDOMObjectPrototype* thisObject = jsCast<JSTestActiveDOMObjectPrototype*>(cell);
98 return getStaticFunctionSlot<JSObject>(exec, &JSTestActiveDOMObjectPrototypeTable, thisObject, propertyName, slot);
101 bool JSTestActiveDOMObjectPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
103 JSTestActiveDOMObjectPrototype* thisObject = jsCast<JSTestActiveDOMObjectPrototype*>(object);
104 return getStaticFunctionDescriptor<JSObject>(exec, &JSTestActiveDOMObjectPrototypeTable, thisObject, propertyName, descriptor);
107 const ClassInfo JSTestActiveDOMObject::s_info = { "TestActiveDOMObject", &Base::s_info, &JSTestActiveDOMObjectTable, 0 , CREATE_METHOD_TABLE(JSTestActiveDOMObject) };
109 JSTestActiveDOMObject::JSTestActiveDOMObject(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestActiveDOMObject> impl)
110 : JSDOMWrapper(structure, globalObject)
111 , m_impl(impl.leakRef())
115 void JSTestActiveDOMObject::finishCreation(JSGlobalData& globalData)
117 Base::finishCreation(globalData);
118 ASSERT(inherits(&s_info));
121 JSObject* JSTestActiveDOMObject::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
123 return JSTestActiveDOMObjectPrototype::create(exec->globalData(), globalObject, JSTestActiveDOMObjectPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
126 void JSTestActiveDOMObject::destroy(JSC::JSCell* cell)
128 JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(cell);
129 thisObject->JSTestActiveDOMObject::~JSTestActiveDOMObject();
132 JSTestActiveDOMObject::~JSTestActiveDOMObject()
134 releaseImplIfNotNull();
137 bool JSTestActiveDOMObject::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
139 JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(cell);
140 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
141 return getStaticValueSlot<JSTestActiveDOMObject, Base>(exec, &JSTestActiveDOMObjectTable, thisObject, propertyName, slot);
144 bool JSTestActiveDOMObject::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
146 JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(object);
147 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
148 if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame()))
150 return getStaticValueDescriptor<JSTestActiveDOMObject, Base>(exec, &JSTestActiveDOMObjectTable, thisObject, propertyName, descriptor);
153 JSValue jsTestActiveDOMObjectExcitingAttr(ExecState* exec, JSValue slotBase, const Identifier&)
155 JSTestActiveDOMObject* castedThis = jsCast<JSTestActiveDOMObject*>(asObject(slotBase));
156 if (!castedThis->allowsAccessFrom(exec))
157 return jsUndefined();
159 TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl());
160 JSValue result = jsNumber(impl->excitingAttr());
165 JSValue jsTestActiveDOMObjectConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
167 JSTestActiveDOMObject* domObject = jsCast<JSTestActiveDOMObject*>(asObject(slotBase));
168 if (!domObject->allowsAccessFrom(exec))
169 return jsUndefined();
170 return JSTestActiveDOMObject::getConstructor(exec, domObject->globalObject());
173 JSValue JSTestActiveDOMObject::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
175 return getDOMConstructor<JSTestActiveDOMObjectConstructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject));
178 EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionExcitingFunction(ExecState* exec)
180 JSValue thisValue = exec->hostThisValue();
181 if (!thisValue.inherits(&JSTestActiveDOMObject::s_info))
182 return throwVMTypeError(exec);
183 JSTestActiveDOMObject* castedThis = jsCast<JSTestActiveDOMObject*>(asObject(thisValue));
184 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestActiveDOMObject::s_info);
185 if (!castedThis->allowsAccessFrom(exec))
186 return JSValue::encode(jsUndefined());
187 TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl());
188 if (exec->argumentCount() < 1)
189 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
190 Node* nextChild(toNode(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
191 if (exec->hadException())
192 return JSValue::encode(jsUndefined());
193 impl->excitingFunction(nextChild);
194 return JSValue::encode(jsUndefined());
197 EncodedJSValue JSC_HOST_CALL jsTestActiveDOMObjectPrototypeFunctionPostMessage(ExecState* exec)
199 JSValue thisValue = exec->hostThisValue();
200 if (!thisValue.inherits(&JSTestActiveDOMObject::s_info))
201 return throwVMTypeError(exec);
202 JSTestActiveDOMObject* castedThis = jsCast<JSTestActiveDOMObject*>(asObject(thisValue));
203 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestActiveDOMObject::s_info);
204 TestActiveDOMObject* impl = static_cast<TestActiveDOMObject*>(castedThis->impl());
205 if (exec->argumentCount() < 1)
206 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
207 const String& message(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toString(exec)->value(exec)));
208 if (exec->hadException())
209 return JSValue::encode(jsUndefined());
210 impl->postMessage(message);
211 return JSValue::encode(jsUndefined());
214 static inline bool isObservable(JSTestActiveDOMObject* jsTestActiveDOMObject)
216 if (jsTestActiveDOMObject->hasCustomProperties())
221 bool JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
223 JSTestActiveDOMObject* jsTestActiveDOMObject = jsCast<JSTestActiveDOMObject*>(handle.get().asCell());
224 if (!isObservable(jsTestActiveDOMObject))
226 UNUSED_PARAM(visitor);
230 void JSTestActiveDOMObjectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
232 JSTestActiveDOMObject* jsTestActiveDOMObject = jsCast<JSTestActiveDOMObject*>(handle.get().asCell());
233 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
234 uncacheWrapper(world, jsTestActiveDOMObject->impl(), jsTestActiveDOMObject);
235 jsTestActiveDOMObject->releaseImpl();
238 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestActiveDOMObject* impl)
240 return wrap<JSTestActiveDOMObject>(exec, globalObject, impl);
243 TestActiveDOMObject* toTestActiveDOMObject(JSC::JSValue value)
245 return value.inherits(&JSTestActiveDOMObject::s_info) ? jsCast<JSTestActiveDOMObject*>(asObject(value))->impl() : 0;