tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSHashChangeEvent.cpp
1 /*
2     This file is part of the WebKit open source project.
3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
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.
9
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.
14
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.
19 */
20
21 #include "config.h"
22 #include "JSHashChangeEvent.h"
23
24 #include "ExceptionCode.h"
25 #include "HashChangeEvent.h"
26 #include "JSDOMBinding.h"
27 #include "JSDictionary.h"
28 #include "KURL.h"
29 #include <runtime/Error.h>
30 #include <runtime/JSString.h>
31 #include <wtf/GetPtr.h>
32
33 using namespace JSC;
34
35 namespace WebCore {
36
37 ASSERT_CLASS_FITS_IN_CELL(JSHashChangeEvent);
38
39 /* Hash table */
40 #if ENABLE(JIT)
41 #define THUNK_GENERATOR(generator) , generator
42 #else
43 #define THUNK_GENERATOR(generator)
44 #endif
45 #if ENABLE(DFG_JIT)
46 #define INTRINSIC(intrinsic) , intrinsic
47 #else
48 #define INTRINSIC(intrinsic)
49 #endif
50
51 static const HashTableValue JSHashChangeEventTableValues[] =
52 {
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) }
57 };
58
59 #undef THUNK_GENERATOR
60 static const HashTable JSHashChangeEventTable = { 8, 7, JSHashChangeEventTableValues, 0 };
61 /* Hash table for constructor */
62 #if ENABLE(JIT)
63 #define THUNK_GENERATOR(generator) , generator
64 #else
65 #define THUNK_GENERATOR(generator)
66 #endif
67 #if ENABLE(DFG_JIT)
68 #define INTRINSIC(intrinsic) , intrinsic
69 #else
70 #define INTRINSIC(intrinsic)
71 #endif
72
73 static const HashTableValue JSHashChangeEventConstructorTableValues[] =
74 {
75     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
76 };
77
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) };
81
82 JSHashChangeEventConstructor::JSHashChangeEventConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
83     : DOMConstructorObject(structure, globalObject)
84 {
85 }
86
87 void JSHashChangeEventConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
88 {
89     Base::finishCreation(exec->globalData());
90     ASSERT(inherits(&s_info));
91     putDirect(exec->globalData(), exec->propertyNames().prototype, JSHashChangeEventPrototype::self(exec, globalObject), DontDelete | ReadOnly);
92 }
93
94 bool JSHashChangeEventConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
95 {
96     return getStaticValueSlot<JSHashChangeEventConstructor, JSDOMWrapper>(exec, &JSHashChangeEventConstructorTable, static_cast<JSHashChangeEventConstructor*>(cell), propertyName, slot);
97 }
98
99 bool JSHashChangeEventConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
100 {
101     return getStaticValueDescriptor<JSHashChangeEventConstructor, JSDOMWrapper>(exec, &JSHashChangeEventConstructorTable, static_cast<JSHashChangeEventConstructor*>(object), propertyName, descriptor);
102 }
103
104 EncodedJSValue JSC_HOST_CALL JSHashChangeEventConstructor::constructJSHashChangeEvent(ExecState* exec)
105 {
106     JSHashChangeEventConstructor* jsConstructor = static_cast<JSHashChangeEventConstructor*>(exec->callee());
107
108     ScriptExecutionContext* executionContext = jsConstructor->scriptExecutionContext();
109     if (!executionContext)
110         return throwVMError(exec, createReferenceError(exec, "Constructor associated execution context is unavailable"));
111
112     AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec));
113     if (exec->hadException())
114         return JSValue::encode(jsUndefined());
115
116     HashChangeEventInit eventInit;
117
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);
122
123         // Create the dictionary wrapper from the initializer object.
124         JSDictionary dictionary(exec, initializerObject);
125
126         // Attempt to fill in the EventInit.
127         if (!fillHashChangeEventInit(eventInit, dictionary))
128             return JSValue::encode(jsUndefined());
129     }
130
131     RefPtr<HashChangeEvent> event = HashChangeEvent::create(eventType, eventInit);
132     return JSValue::encode(toJS(exec, jsConstructor->globalObject(), event.get()));
133 }
134
135 bool fillHashChangeEventInit(HashChangeEventInit& eventInit, JSDictionary& dictionary)
136 {
137     if (!fillEventInit(eventInit, dictionary))
138         return false;
139
140     if (!dictionary.tryGetProperty("oldURL", eventInit.oldURL))
141         return false;
142     if (!dictionary.tryGetProperty("newURL", eventInit.newURL))
143         return false;
144     return true;
145 }
146
147 ConstructType JSHashChangeEventConstructor::getConstructData(JSCell*, ConstructData& constructData)
148 {
149     constructData.native.function = constructJSHashChangeEvent;
150     return ConstructTypeHost;
151 }
152
153 /* Hash table for prototype */
154 #if ENABLE(JIT)
155 #define THUNK_GENERATOR(generator) , generator
156 #else
157 #define THUNK_GENERATOR(generator)
158 #endif
159 #if ENABLE(DFG_JIT)
160 #define INTRINSIC(intrinsic) , intrinsic
161 #else
162 #define INTRINSIC(intrinsic)
163 #endif
164
165 static const HashTableValue JSHashChangeEventPrototypeTableValues[] =
166 {
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) }
169 };
170
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) };
174
175 JSObject* JSHashChangeEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
176 {
177     return getDOMPrototype<JSHashChangeEvent>(exec, globalObject);
178 }
179
180 bool JSHashChangeEventPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
181 {
182     JSHashChangeEventPrototype* thisObject = jsCast<JSHashChangeEventPrototype*>(cell);
183     return getStaticFunctionSlot<JSObject>(exec, &JSHashChangeEventPrototypeTable, thisObject, propertyName, slot);
184 }
185
186 bool JSHashChangeEventPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
187 {
188     JSHashChangeEventPrototype* thisObject = jsCast<JSHashChangeEventPrototype*>(object);
189     return getStaticFunctionDescriptor<JSObject>(exec, &JSHashChangeEventPrototypeTable, thisObject, propertyName, descriptor);
190 }
191
192 const ClassInfo JSHashChangeEvent::s_info = { "HashChangeEvent", &JSEvent::s_info, &JSHashChangeEventTable, 0 , CREATE_METHOD_TABLE(JSHashChangeEvent) };
193
194 JSHashChangeEvent::JSHashChangeEvent(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<HashChangeEvent> impl)
195     : JSEvent(structure, globalObject, impl)
196 {
197 }
198
199 void JSHashChangeEvent::finishCreation(JSGlobalData& globalData)
200 {
201     Base::finishCreation(globalData);
202     ASSERT(inherits(&s_info));
203 }
204
205 JSObject* JSHashChangeEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
206 {
207     return JSHashChangeEventPrototype::create(exec->globalData(), globalObject, JSHashChangeEventPrototype::createStructure(exec->globalData(), globalObject, JSEventPrototype::self(exec, globalObject)));
208 }
209
210 bool JSHashChangeEvent::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
211 {
212     JSHashChangeEvent* thisObject = jsCast<JSHashChangeEvent*>(cell);
213     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
214     return getStaticValueSlot<JSHashChangeEvent, Base>(exec, &JSHashChangeEventTable, thisObject, propertyName, slot);
215 }
216
217 bool JSHashChangeEvent::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
218 {
219     JSHashChangeEvent* thisObject = jsCast<JSHashChangeEvent*>(object);
220     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
221     return getStaticValueDescriptor<JSHashChangeEvent, Base>(exec, &JSHashChangeEventTable, thisObject, propertyName, descriptor);
222 }
223
224 JSValue jsHashChangeEventOldURL(ExecState* exec, JSValue slotBase, const Identifier&)
225 {
226     JSHashChangeEvent* castedThis = static_cast<JSHashChangeEvent*>(asObject(slotBase));
227     UNUSED_PARAM(exec);
228     HashChangeEvent* imp = static_cast<HashChangeEvent*>(castedThis->impl());
229     JSValue result = jsString(exec, imp->oldURL());
230     return result;
231 }
232
233
234 JSValue jsHashChangeEventNewURL(ExecState* exec, JSValue slotBase, const Identifier&)
235 {
236     JSHashChangeEvent* castedThis = static_cast<JSHashChangeEvent*>(asObject(slotBase));
237     UNUSED_PARAM(exec);
238     HashChangeEvent* imp = static_cast<HashChangeEvent*>(castedThis->impl());
239     JSValue result = jsString(exec, imp->newURL());
240     return result;
241 }
242
243
244 JSValue jsHashChangeEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
245 {
246     JSHashChangeEvent* domObject = static_cast<JSHashChangeEvent*>(asObject(slotBase));
247     return JSHashChangeEvent::getConstructor(exec, domObject->globalObject());
248 }
249
250 JSValue JSHashChangeEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
251 {
252     return getDOMConstructor<JSHashChangeEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
253 }
254
255 EncodedJSValue JSC_HOST_CALL jsHashChangeEventPrototypeFunctionInitHashChangeEvent(ExecState* exec)
256 {
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());
280 }
281
282
283 }