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 "JSHashChangeEvent.h"
24 #include "ExceptionCode.h"
25 #include "HashChangeEvent.h"
26 #include "JSDOMBinding.h"
27 #include "JSDictionary.h"
29 #include <runtime/Error.h>
30 #include <runtime/JSString.h>
31 #include <wtf/GetPtr.h>
37 ASSERT_CLASS_FITS_IN_CELL(JSHashChangeEvent);
41 #define THUNK_GENERATOR(generator) , generator
43 #define THUNK_GENERATOR(generator)
46 #define INTRINSIC(intrinsic) , intrinsic
48 #define INTRINSIC(intrinsic)
51 static const HashTableValue JSHashChangeEventTableValues[] =
53 { "oldURL", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHashChangeEventOldURL), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54 { "newURL", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHashChangeEventNewURL), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHashChangeEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
59 #undef THUNK_GENERATOR
60 static const HashTable JSHashChangeEventTable = { 8, 7, JSHashChangeEventTableValues, 0 };
61 /* Hash table for constructor */
63 #define THUNK_GENERATOR(generator) , generator
65 #define THUNK_GENERATOR(generator)
68 #define INTRINSIC(intrinsic) , intrinsic
70 #define INTRINSIC(intrinsic)
73 static const HashTableValue JSHashChangeEventConstructorTableValues[] =
75 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
78 #undef THUNK_GENERATOR
79 static const HashTable JSHashChangeEventConstructorTable = { 1, 0, JSHashChangeEventConstructorTableValues, 0 };
80 const ClassInfo JSHashChangeEventConstructor::s_info = { "HashChangeEventConstructor", &DOMConstructorObject::s_info, &JSHashChangeEventConstructorTable, 0, CREATE_METHOD_TABLE(JSHashChangeEventConstructor) };
82 JSHashChangeEventConstructor::JSHashChangeEventConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
83 : DOMConstructorObject(structure, globalObject)
87 void JSHashChangeEventConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
89 Base::finishCreation(exec->globalData());
90 ASSERT(inherits(&s_info));
91 putDirect(exec->globalData(), exec->propertyNames().prototype, JSHashChangeEventPrototype::self(exec, globalObject), DontDelete | ReadOnly);
94 bool JSHashChangeEventConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
96 return getStaticValueSlot<JSHashChangeEventConstructor, JSDOMWrapper>(exec, &JSHashChangeEventConstructorTable, static_cast<JSHashChangeEventConstructor*>(cell), propertyName, slot);
99 bool JSHashChangeEventConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
101 return getStaticValueDescriptor<JSHashChangeEventConstructor, JSDOMWrapper>(exec, &JSHashChangeEventConstructorTable, static_cast<JSHashChangeEventConstructor*>(object), propertyName, descriptor);
104 EncodedJSValue JSC_HOST_CALL JSHashChangeEventConstructor::constructJSHashChangeEvent(ExecState* exec)
106 JSHashChangeEventConstructor* jsConstructor = static_cast<JSHashChangeEventConstructor*>(exec->callee());
108 ScriptExecutionContext* executionContext = jsConstructor->scriptExecutionContext();
109 if (!executionContext)
110 return throwVMError(exec, createReferenceError(exec, "Constructor associated execution context is unavailable"));
112 AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec));
113 if (exec->hadException())
114 return JSValue::encode(jsUndefined());
116 HashChangeEventInit eventInit;
118 JSValue initializerValue = exec->argument(1);
119 if (!initializerValue.isUndefinedOrNull()) {
120 // Given the above test, this will always yield an object.
121 JSObject* initializerObject = initializerValue.toObject(exec);
123 // Create the dictionary wrapper from the initializer object.
124 JSDictionary dictionary(exec, initializerObject);
126 // Attempt to fill in the EventInit.
127 if (!fillHashChangeEventInit(eventInit, dictionary))
128 return JSValue::encode(jsUndefined());
131 RefPtr<HashChangeEvent> event = HashChangeEvent::create(eventType, eventInit);
132 return JSValue::encode(toJS(exec, jsConstructor->globalObject(), event.get()));
135 bool fillHashChangeEventInit(HashChangeEventInit& eventInit, JSDictionary& dictionary)
137 if (!fillEventInit(eventInit, dictionary))
140 if (!dictionary.tryGetProperty("oldURL", eventInit.oldURL))
142 if (!dictionary.tryGetProperty("newURL", eventInit.newURL))
147 ConstructType JSHashChangeEventConstructor::getConstructData(JSCell*, ConstructData& constructData)
149 constructData.native.function = constructJSHashChangeEvent;
150 return ConstructTypeHost;
153 /* Hash table for prototype */
155 #define THUNK_GENERATOR(generator) , generator
157 #define THUNK_GENERATOR(generator)
160 #define INTRINSIC(intrinsic) , intrinsic
162 #define INTRINSIC(intrinsic)
165 static const HashTableValue JSHashChangeEventPrototypeTableValues[] =
167 { "initHashChangeEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsHashChangeEventPrototypeFunctionInitHashChangeEvent), (intptr_t)5 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
168 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
171 #undef THUNK_GENERATOR
172 static const HashTable JSHashChangeEventPrototypeTable = { 2, 1, JSHashChangeEventPrototypeTableValues, 0 };
173 const ClassInfo JSHashChangeEventPrototype::s_info = { "HashChangeEventPrototype", &JSC::JSNonFinalObject::s_info, &JSHashChangeEventPrototypeTable, 0, CREATE_METHOD_TABLE(JSHashChangeEventPrototype) };
175 JSObject* JSHashChangeEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
177 return getDOMPrototype<JSHashChangeEvent>(exec, globalObject);
180 bool JSHashChangeEventPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
182 JSHashChangeEventPrototype* thisObject = jsCast<JSHashChangeEventPrototype*>(cell);
183 return getStaticFunctionSlot<JSObject>(exec, &JSHashChangeEventPrototypeTable, thisObject, propertyName, slot);
186 bool JSHashChangeEventPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
188 JSHashChangeEventPrototype* thisObject = jsCast<JSHashChangeEventPrototype*>(object);
189 return getStaticFunctionDescriptor<JSObject>(exec, &JSHashChangeEventPrototypeTable, thisObject, propertyName, descriptor);
192 const ClassInfo JSHashChangeEvent::s_info = { "HashChangeEvent", &JSEvent::s_info, &JSHashChangeEventTable, 0 , CREATE_METHOD_TABLE(JSHashChangeEvent) };
194 JSHashChangeEvent::JSHashChangeEvent(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<HashChangeEvent> impl)
195 : JSEvent(structure, globalObject, impl)
199 void JSHashChangeEvent::finishCreation(JSGlobalData& globalData)
201 Base::finishCreation(globalData);
202 ASSERT(inherits(&s_info));
205 JSObject* JSHashChangeEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
207 return JSHashChangeEventPrototype::create(exec->globalData(), globalObject, JSHashChangeEventPrototype::createStructure(exec->globalData(), globalObject, JSEventPrototype::self(exec, globalObject)));
210 bool JSHashChangeEvent::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
212 JSHashChangeEvent* thisObject = jsCast<JSHashChangeEvent*>(cell);
213 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
214 return getStaticValueSlot<JSHashChangeEvent, Base>(exec, &JSHashChangeEventTable, thisObject, propertyName, slot);
217 bool JSHashChangeEvent::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
219 JSHashChangeEvent* thisObject = jsCast<JSHashChangeEvent*>(object);
220 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
221 return getStaticValueDescriptor<JSHashChangeEvent, Base>(exec, &JSHashChangeEventTable, thisObject, propertyName, descriptor);
224 JSValue jsHashChangeEventOldURL(ExecState* exec, JSValue slotBase, const Identifier&)
226 JSHashChangeEvent* castedThis = static_cast<JSHashChangeEvent*>(asObject(slotBase));
228 HashChangeEvent* imp = static_cast<HashChangeEvent*>(castedThis->impl());
229 JSValue result = jsString(exec, imp->oldURL());
234 JSValue jsHashChangeEventNewURL(ExecState* exec, JSValue slotBase, const Identifier&)
236 JSHashChangeEvent* castedThis = static_cast<JSHashChangeEvent*>(asObject(slotBase));
238 HashChangeEvent* imp = static_cast<HashChangeEvent*>(castedThis->impl());
239 JSValue result = jsString(exec, imp->newURL());
244 JSValue jsHashChangeEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
246 JSHashChangeEvent* domObject = static_cast<JSHashChangeEvent*>(asObject(slotBase));
247 return JSHashChangeEvent::getConstructor(exec, domObject->globalObject());
250 JSValue JSHashChangeEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
252 return getDOMConstructor<JSHashChangeEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
255 EncodedJSValue JSC_HOST_CALL jsHashChangeEventPrototypeFunctionInitHashChangeEvent(ExecState* exec)
257 JSValue thisValue = exec->hostThisValue();
258 if (!thisValue.inherits(&JSHashChangeEvent::s_info))
259 return throwVMTypeError(exec);
260 JSHashChangeEvent* castedThis = static_cast<JSHashChangeEvent*>(asObject(thisValue));
261 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSHashChangeEvent::s_info);
262 HashChangeEvent* imp = static_cast<HashChangeEvent*>(castedThis->impl());
263 const String& type(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)));
264 if (exec->hadException())
265 return JSValue::encode(jsUndefined());
266 bool canBubble(MAYBE_MISSING_PARAMETER(exec, 1, MissingIsUndefined).toBoolean(exec));
267 if (exec->hadException())
268 return JSValue::encode(jsUndefined());
269 bool cancelable(MAYBE_MISSING_PARAMETER(exec, 2, MissingIsUndefined).toBoolean(exec));
270 if (exec->hadException())
271 return JSValue::encode(jsUndefined());
272 const String& oldURL(ustringToString(MAYBE_MISSING_PARAMETER(exec, 3, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 3, MissingIsUndefined).toString(exec)));
273 if (exec->hadException())
274 return JSValue::encode(jsUndefined());
275 const String& newURL(ustringToString(MAYBE_MISSING_PARAMETER(exec, 4, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 4, MissingIsUndefined).toString(exec)));
276 if (exec->hadException())
277 return JSValue::encode(jsUndefined());
278 imp->initHashChangeEvent(type, canBubble, cancelable, oldURL, newURL);
279 return JSValue::encode(jsUndefined());