|
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 |
|
23 #if ENABLE(DOM_STORAGE) |
|
24 |
|
25 #include "JSStorageEvent.h" |
|
26 |
|
27 #include "JSStorage.h" |
|
28 #include "KURL.h" |
|
29 #include "Storage.h" |
|
30 #include "StorageEvent.h" |
|
31 #include <runtime/Error.h> |
|
32 #include <runtime/JSString.h> |
|
33 #include <wtf/GetPtr.h> |
|
34 |
|
35 using namespace JSC; |
|
36 |
|
37 namespace WebCore { |
|
38 |
|
39 ASSERT_CLASS_FITS_IN_CELL(JSStorageEvent); |
|
40 |
|
41 /* Hash table */ |
|
42 #if ENABLE(JIT) |
|
43 #define THUNK_GENERATOR(generator) , generator |
|
44 #else |
|
45 #define THUNK_GENERATOR(generator) |
|
46 #endif |
|
47 |
|
48 static const HashTableValue JSStorageEventTableValues[7] = |
|
49 { |
|
50 { "key", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventKey), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "oldValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventOldValue), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "newValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventNewValue), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { "url", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventUrl), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
54 { "storageArea", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventStorageArea), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
55 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsStorageEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
56 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
57 }; |
|
58 |
|
59 #undef THUNK_GENERATOR |
|
60 static JSC_CONST_HASHTABLE HashTable JSStorageEventTable = { 16, 15, JSStorageEventTableValues, 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 |
|
68 static const HashTableValue JSStorageEventConstructorTableValues[1] = |
|
69 { |
|
70 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
71 }; |
|
72 |
|
73 #undef THUNK_GENERATOR |
|
74 static JSC_CONST_HASHTABLE HashTable JSStorageEventConstructorTable = { 1, 0, JSStorageEventConstructorTableValues, 0 }; |
|
75 class JSStorageEventConstructor : public DOMConstructorObject { |
|
76 public: |
|
77 JSStorageEventConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
78 |
|
79 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
80 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
81 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
82 static const JSC::ClassInfo s_info; |
|
83 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
84 { |
|
85 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
86 } |
|
87 protected: |
|
88 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
89 }; |
|
90 |
|
91 const ClassInfo JSStorageEventConstructor::s_info = { "StorageEventConstructor", 0, &JSStorageEventConstructorTable, 0 }; |
|
92 |
|
93 JSStorageEventConstructor::JSStorageEventConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
94 : DOMConstructorObject(JSStorageEventConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
95 { |
|
96 putDirect(exec->propertyNames().prototype, JSStorageEventPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
97 } |
|
98 |
|
99 bool JSStorageEventConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
100 { |
|
101 return getStaticValueSlot<JSStorageEventConstructor, DOMObject>(exec, &JSStorageEventConstructorTable, this, propertyName, slot); |
|
102 } |
|
103 |
|
104 bool JSStorageEventConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
105 { |
|
106 return getStaticValueDescriptor<JSStorageEventConstructor, DOMObject>(exec, &JSStorageEventConstructorTable, this, propertyName, descriptor); |
|
107 } |
|
108 |
|
109 /* Hash table for prototype */ |
|
110 #if ENABLE(JIT) |
|
111 #define THUNK_GENERATOR(generator) , generator |
|
112 #else |
|
113 #define THUNK_GENERATOR(generator) |
|
114 #endif |
|
115 |
|
116 static const HashTableValue JSStorageEventPrototypeTableValues[2] = |
|
117 { |
|
118 { "initStorageEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsStorageEventPrototypeFunctionInitStorageEvent), (intptr_t)8 THUNK_GENERATOR(0) }, |
|
119 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
120 }; |
|
121 |
|
122 #undef THUNK_GENERATOR |
|
123 static JSC_CONST_HASHTABLE HashTable JSStorageEventPrototypeTable = { 2, 1, JSStorageEventPrototypeTableValues, 0 }; |
|
124 const ClassInfo JSStorageEventPrototype::s_info = { "StorageEventPrototype", 0, &JSStorageEventPrototypeTable, 0 }; |
|
125 |
|
126 JSObject* JSStorageEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
127 { |
|
128 return getDOMPrototype<JSStorageEvent>(exec, globalObject); |
|
129 } |
|
130 |
|
131 bool JSStorageEventPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
132 { |
|
133 return getStaticFunctionSlot<JSObject>(exec, &JSStorageEventPrototypeTable, this, propertyName, slot); |
|
134 } |
|
135 |
|
136 bool JSStorageEventPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
137 { |
|
138 return getStaticFunctionDescriptor<JSObject>(exec, &JSStorageEventPrototypeTable, this, propertyName, descriptor); |
|
139 } |
|
140 |
|
141 const ClassInfo JSStorageEvent::s_info = { "StorageEvent", &JSEvent::s_info, &JSStorageEventTable, 0 }; |
|
142 |
|
143 JSStorageEvent::JSStorageEvent(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<StorageEvent> impl) |
|
144 : JSEvent(structure, globalObject, impl) |
|
145 { |
|
146 } |
|
147 |
|
148 JSObject* JSStorageEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
149 { |
|
150 return new (exec) JSStorageEventPrototype(globalObject, JSStorageEventPrototype::createStructure(JSEventPrototype::self(exec, globalObject))); |
|
151 } |
|
152 |
|
153 bool JSStorageEvent::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
154 { |
|
155 return getStaticValueSlot<JSStorageEvent, Base>(exec, &JSStorageEventTable, this, propertyName, slot); |
|
156 } |
|
157 |
|
158 bool JSStorageEvent::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
159 { |
|
160 return getStaticValueDescriptor<JSStorageEvent, Base>(exec, &JSStorageEventTable, this, propertyName, descriptor); |
|
161 } |
|
162 |
|
163 JSValue jsStorageEventKey(ExecState* exec, JSValue slotBase, const Identifier&) |
|
164 { |
|
165 JSStorageEvent* castedThis = static_cast<JSStorageEvent*>(asObject(slotBase)); |
|
166 UNUSED_PARAM(exec); |
|
167 StorageEvent* imp = static_cast<StorageEvent*>(castedThis->impl()); |
|
168 JSValue result = jsStringOrNull(exec, imp->key()); |
|
169 return result; |
|
170 } |
|
171 |
|
172 JSValue jsStorageEventOldValue(ExecState* exec, JSValue slotBase, const Identifier&) |
|
173 { |
|
174 JSStorageEvent* castedThis = static_cast<JSStorageEvent*>(asObject(slotBase)); |
|
175 UNUSED_PARAM(exec); |
|
176 StorageEvent* imp = static_cast<StorageEvent*>(castedThis->impl()); |
|
177 JSValue result = jsStringOrNull(exec, imp->oldValue()); |
|
178 return result; |
|
179 } |
|
180 |
|
181 JSValue jsStorageEventNewValue(ExecState* exec, JSValue slotBase, const Identifier&) |
|
182 { |
|
183 JSStorageEvent* castedThis = static_cast<JSStorageEvent*>(asObject(slotBase)); |
|
184 UNUSED_PARAM(exec); |
|
185 StorageEvent* imp = static_cast<StorageEvent*>(castedThis->impl()); |
|
186 JSValue result = jsStringOrNull(exec, imp->newValue()); |
|
187 return result; |
|
188 } |
|
189 |
|
190 JSValue jsStorageEventUrl(ExecState* exec, JSValue slotBase, const Identifier&) |
|
191 { |
|
192 JSStorageEvent* castedThis = static_cast<JSStorageEvent*>(asObject(slotBase)); |
|
193 UNUSED_PARAM(exec); |
|
194 StorageEvent* imp = static_cast<StorageEvent*>(castedThis->impl()); |
|
195 JSValue result = jsString(exec, imp->url()); |
|
196 return result; |
|
197 } |
|
198 |
|
199 JSValue jsStorageEventStorageArea(ExecState* exec, JSValue slotBase, const Identifier&) |
|
200 { |
|
201 JSStorageEvent* castedThis = static_cast<JSStorageEvent*>(asObject(slotBase)); |
|
202 UNUSED_PARAM(exec); |
|
203 StorageEvent* imp = static_cast<StorageEvent*>(castedThis->impl()); |
|
204 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->storageArea())); |
|
205 return result; |
|
206 } |
|
207 |
|
208 JSValue jsStorageEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
209 { |
|
210 JSStorageEvent* domObject = static_cast<JSStorageEvent*>(asObject(slotBase)); |
|
211 return JSStorageEvent::getConstructor(exec, domObject->globalObject()); |
|
212 } |
|
213 JSValue JSStorageEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
214 { |
|
215 return getDOMConstructor<JSStorageEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
216 } |
|
217 |
|
218 EncodedJSValue JSC_HOST_CALL jsStorageEventPrototypeFunctionInitStorageEvent(ExecState* exec) |
|
219 { |
|
220 JSValue thisValue = exec->hostThisValue(); |
|
221 if (!thisValue.inherits(&JSStorageEvent::s_info)) |
|
222 return throwVMTypeError(exec); |
|
223 JSStorageEvent* castedThis = static_cast<JSStorageEvent*>(asObject(thisValue)); |
|
224 StorageEvent* imp = static_cast<StorageEvent*>(castedThis->impl()); |
|
225 const String& typeArg = ustringToString(exec->argument(0).toString(exec)); |
|
226 bool canBubbleArg = exec->argument(1).toBoolean(exec); |
|
227 bool cancelableArg = exec->argument(2).toBoolean(exec); |
|
228 const String& keyArg = ustringToString(exec->argument(3).toString(exec)); |
|
229 const String& oldValueArg = valueToStringWithNullCheck(exec, exec->argument(4)); |
|
230 const String& newValueArg = valueToStringWithNullCheck(exec, exec->argument(5)); |
|
231 const String& urlArg = ustringToString(exec->argument(6).toString(exec)); |
|
232 Storage* storageAreaArg = toStorage(exec->argument(7)); |
|
233 |
|
234 imp->initStorageEvent(typeArg, canBubbleArg, cancelableArg, keyArg, oldValueArg, newValueArg, urlArg, storageAreaArg); |
|
235 return JSValue::encode(jsUndefined()); |
|
236 } |
|
237 |
|
238 |
|
239 } |
|
240 |
|
241 #endif // ENABLE(DOM_STORAGE) |