|
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 "JSPopStateEvent.h" |
|
23 |
|
24 #include "PopStateEvent.h" |
|
25 #include "SerializedScriptValue.h" |
|
26 #include <runtime/Error.h> |
|
27 #include <wtf/GetPtr.h> |
|
28 |
|
29 using namespace JSC; |
|
30 |
|
31 namespace WebCore { |
|
32 |
|
33 ASSERT_CLASS_FITS_IN_CELL(JSPopStateEvent); |
|
34 |
|
35 /* Hash table */ |
|
36 #if ENABLE(JIT) |
|
37 #define THUNK_GENERATOR(generator) , generator |
|
38 #else |
|
39 #define THUNK_GENERATOR(generator) |
|
40 #endif |
|
41 |
|
42 static const HashTableValue JSPopStateEventTableValues[3] = |
|
43 { |
|
44 { "state", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPopStateEventState), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
45 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPopStateEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
46 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
47 }; |
|
48 |
|
49 #undef THUNK_GENERATOR |
|
50 static JSC_CONST_HASHTABLE HashTable JSPopStateEventTable = { 5, 3, JSPopStateEventTableValues, 0 }; |
|
51 /* Hash table for constructor */ |
|
52 #if ENABLE(JIT) |
|
53 #define THUNK_GENERATOR(generator) , generator |
|
54 #else |
|
55 #define THUNK_GENERATOR(generator) |
|
56 #endif |
|
57 |
|
58 static const HashTableValue JSPopStateEventConstructorTableValues[1] = |
|
59 { |
|
60 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
61 }; |
|
62 |
|
63 #undef THUNK_GENERATOR |
|
64 static JSC_CONST_HASHTABLE HashTable JSPopStateEventConstructorTable = { 1, 0, JSPopStateEventConstructorTableValues, 0 }; |
|
65 class JSPopStateEventConstructor : public DOMConstructorObject { |
|
66 public: |
|
67 JSPopStateEventConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
68 |
|
69 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
70 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
71 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
72 static const JSC::ClassInfo s_info; |
|
73 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
74 { |
|
75 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
76 } |
|
77 protected: |
|
78 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
79 }; |
|
80 |
|
81 const ClassInfo JSPopStateEventConstructor::s_info = { "PopStateEventConstructor", 0, &JSPopStateEventConstructorTable, 0 }; |
|
82 |
|
83 JSPopStateEventConstructor::JSPopStateEventConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
84 : DOMConstructorObject(JSPopStateEventConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
85 { |
|
86 putDirect(exec->propertyNames().prototype, JSPopStateEventPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
87 } |
|
88 |
|
89 bool JSPopStateEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
90 { |
|
91 return getStaticValueSlot<JSPopStateEventConstructor, DOMObject>(exec, &JSPopStateEventConstructorTable, this, propertyName, slot); |
|
92 } |
|
93 |
|
94 bool JSPopStateEventConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
95 { |
|
96 return getStaticValueDescriptor<JSPopStateEventConstructor, DOMObject>(exec, &JSPopStateEventConstructorTable, this, propertyName, descriptor); |
|
97 } |
|
98 |
|
99 /* Hash table for prototype */ |
|
100 #if ENABLE(JIT) |
|
101 #define THUNK_GENERATOR(generator) , generator |
|
102 #else |
|
103 #define THUNK_GENERATOR(generator) |
|
104 #endif |
|
105 |
|
106 static const HashTableValue JSPopStateEventPrototypeTableValues[2] = |
|
107 { |
|
108 { "initPopStateEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsPopStateEventPrototypeFunctionInitPopStateEvent), (intptr_t)4 THUNK_GENERATOR(0) }, |
|
109 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
110 }; |
|
111 |
|
112 #undef THUNK_GENERATOR |
|
113 static JSC_CONST_HASHTABLE HashTable JSPopStateEventPrototypeTable = { 2, 1, JSPopStateEventPrototypeTableValues, 0 }; |
|
114 const ClassInfo JSPopStateEventPrototype::s_info = { "PopStateEventPrototype", 0, &JSPopStateEventPrototypeTable, 0 }; |
|
115 |
|
116 JSObject* JSPopStateEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
117 { |
|
118 return getDOMPrototype<JSPopStateEvent>(exec, globalObject); |
|
119 } |
|
120 |
|
121 bool JSPopStateEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
122 { |
|
123 return getStaticFunctionSlot<JSObject>(exec, &JSPopStateEventPrototypeTable, this, propertyName, slot); |
|
124 } |
|
125 |
|
126 bool JSPopStateEventPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
127 { |
|
128 return getStaticFunctionDescriptor<JSObject>(exec, &JSPopStateEventPrototypeTable, this, propertyName, descriptor); |
|
129 } |
|
130 |
|
131 const ClassInfo JSPopStateEvent::s_info = { "PopStateEvent", &JSEvent::s_info, &JSPopStateEventTable, 0 }; |
|
132 |
|
133 JSPopStateEvent::JSPopStateEvent(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<PopStateEvent> impl) |
|
134 : JSEvent(structure, globalObject, impl) |
|
135 { |
|
136 } |
|
137 |
|
138 JSObject* JSPopStateEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
139 { |
|
140 return new (exec) JSPopStateEventPrototype(globalObject, JSPopStateEventPrototype::createStructure(JSEventPrototype::self(exec, globalObject))); |
|
141 } |
|
142 |
|
143 bool JSPopStateEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
144 { |
|
145 return getStaticValueSlot<JSPopStateEvent, Base>(exec, &JSPopStateEventTable, this, propertyName, slot); |
|
146 } |
|
147 |
|
148 bool JSPopStateEvent::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
149 { |
|
150 return getStaticValueDescriptor<JSPopStateEvent, Base>(exec, &JSPopStateEventTable, this, propertyName, descriptor); |
|
151 } |
|
152 |
|
153 JSValue jsPopStateEventState(ExecState* exec, JSValue slotBase, const Identifier&) |
|
154 { |
|
155 JSPopStateEvent* castedThis = static_cast<JSPopStateEvent*>(asObject(slotBase)); |
|
156 UNUSED_PARAM(exec); |
|
157 PopStateEvent* imp = static_cast<PopStateEvent*>(castedThis->impl()); |
|
158 JSValue result = imp->state() ? imp->state()->deserialize(exec, castedThis->globalObject()) : jsNull(); |
|
159 return result; |
|
160 } |
|
161 |
|
162 JSValue jsPopStateEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
163 { |
|
164 JSPopStateEvent* domObject = static_cast<JSPopStateEvent*>(asObject(slotBase)); |
|
165 return JSPopStateEvent::getConstructor(exec, domObject->globalObject()); |
|
166 } |
|
167 JSValue JSPopStateEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
168 { |
|
169 return getDOMConstructor<JSPopStateEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
170 } |
|
171 |
|
172 EncodedJSValue JSC_HOST_CALL jsPopStateEventPrototypeFunctionInitPopStateEvent(ExecState* exec) |
|
173 { |
|
174 JSValue thisValue = exec->hostThisValue(); |
|
175 if (!thisValue.inherits(&JSPopStateEvent::s_info)) |
|
176 return throwVMTypeError(exec); |
|
177 JSPopStateEvent* castedThis = static_cast<JSPopStateEvent*>(asObject(thisValue)); |
|
178 PopStateEvent* imp = static_cast<PopStateEvent*>(castedThis->impl()); |
|
179 const String& typeArg = ustringToString(exec->argument(0).toString(exec)); |
|
180 bool canBubbleArg = exec->argument(1).toBoolean(exec); |
|
181 bool cancelableArg = exec->argument(2).toBoolean(exec); |
|
182 RefPtr<SerializedScriptValue> stateArg = SerializedScriptValue::create(exec, exec->argument(3)); |
|
183 |
|
184 imp->initPopStateEvent(typeArg, canBubbleArg, cancelableArg, stateArg); |
|
185 return JSValue::encode(jsUndefined()); |
|
186 } |
|
187 |
|
188 |
|
189 } |