|
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(OFFLINE_WEB_APPLICATIONS) |
|
24 |
|
25 #include "JSDOMApplicationCache.h" |
|
26 |
|
27 #include "DOMApplicationCache.h" |
|
28 #include "Event.h" |
|
29 #include "EventListener.h" |
|
30 #include "JSEvent.h" |
|
31 #include "JSEventListener.h" |
|
32 #include "RegisteredEventListener.h" |
|
33 #include <runtime/Error.h> |
|
34 #include <runtime/JSNumberCell.h> |
|
35 #include <wtf/GetPtr.h> |
|
36 |
|
37 using namespace JSC; |
|
38 |
|
39 namespace WebCore { |
|
40 |
|
41 ASSERT_CLASS_FITS_IN_CELL(JSDOMApplicationCache); |
|
42 |
|
43 /* Hash table */ |
|
44 #if ENABLE(JIT) |
|
45 #define THUNK_GENERATOR(generator) , generator |
|
46 #else |
|
47 #define THUNK_GENERATOR(generator) |
|
48 #endif |
|
49 |
|
50 static const HashTableValue JSDOMApplicationCacheTableValues[10] = |
|
51 { |
|
52 { "status", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheStatus), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { "onchecking", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnchecking), (intptr_t)setJSDOMApplicationCacheOnchecking THUNK_GENERATOR(0) }, |
|
54 { "onerror", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnerror), (intptr_t)setJSDOMApplicationCacheOnerror THUNK_GENERATOR(0) }, |
|
55 { "onnoupdate", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnnoupdate), (intptr_t)setJSDOMApplicationCacheOnnoupdate THUNK_GENERATOR(0) }, |
|
56 { "ondownloading", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOndownloading), (intptr_t)setJSDOMApplicationCacheOndownloading THUNK_GENERATOR(0) }, |
|
57 { "onprogress", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnprogress), (intptr_t)setJSDOMApplicationCacheOnprogress THUNK_GENERATOR(0) }, |
|
58 { "onupdateready", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnupdateready), (intptr_t)setJSDOMApplicationCacheOnupdateready THUNK_GENERATOR(0) }, |
|
59 { "oncached", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOncached), (intptr_t)setJSDOMApplicationCacheOncached THUNK_GENERATOR(0) }, |
|
60 { "onobsolete", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnobsolete), (intptr_t)setJSDOMApplicationCacheOnobsolete THUNK_GENERATOR(0) }, |
|
61 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
62 }; |
|
63 |
|
64 #undef THUNK_GENERATOR |
|
65 static JSC_CONST_HASHTABLE HashTable JSDOMApplicationCacheTable = { 33, 31, JSDOMApplicationCacheTableValues, 0 }; |
|
66 /* Hash table for prototype */ |
|
67 #if ENABLE(JIT) |
|
68 #define THUNK_GENERATOR(generator) , generator |
|
69 #else |
|
70 #define THUNK_GENERATOR(generator) |
|
71 #endif |
|
72 |
|
73 static const HashTableValue JSDOMApplicationCachePrototypeTableValues[12] = |
|
74 { |
|
75 { "UNCACHED", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheUNCACHED), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
76 { "IDLE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheIDLE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
77 { "CHECKING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheCHECKING), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
78 { "DOWNLOADING", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheDOWNLOADING), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
79 { "UPDATEREADY", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheUPDATEREADY), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
80 { "OBSOLETE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOBSOLETE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
81 { "update", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMApplicationCachePrototypeFunctionUpdate), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
82 { "swapCache", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMApplicationCachePrototypeFunctionSwapCache), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
83 { "addEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMApplicationCachePrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, |
|
84 { "removeEventListener", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMApplicationCachePrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, |
|
85 { "dispatchEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMApplicationCachePrototypeFunctionDispatchEvent), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
86 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
87 }; |
|
88 |
|
89 #undef THUNK_GENERATOR |
|
90 static JSC_CONST_HASHTABLE HashTable JSDOMApplicationCachePrototypeTable = { 33, 31, JSDOMApplicationCachePrototypeTableValues, 0 }; |
|
91 const ClassInfo JSDOMApplicationCachePrototype::s_info = { "DOMApplicationCachePrototype", 0, &JSDOMApplicationCachePrototypeTable, 0 }; |
|
92 |
|
93 JSObject* JSDOMApplicationCachePrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
94 { |
|
95 return getDOMPrototype<JSDOMApplicationCache>(exec, globalObject); |
|
96 } |
|
97 |
|
98 bool JSDOMApplicationCachePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
99 { |
|
100 return getStaticPropertySlot<JSDOMApplicationCachePrototype, JSObject>(exec, &JSDOMApplicationCachePrototypeTable, this, propertyName, slot); |
|
101 } |
|
102 |
|
103 bool JSDOMApplicationCachePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
104 { |
|
105 return getStaticPropertyDescriptor<JSDOMApplicationCachePrototype, JSObject>(exec, &JSDOMApplicationCachePrototypeTable, this, propertyName, descriptor); |
|
106 } |
|
107 |
|
108 const ClassInfo JSDOMApplicationCache::s_info = { "DOMApplicationCache", 0, &JSDOMApplicationCacheTable, 0 }; |
|
109 |
|
110 JSDOMApplicationCache::JSDOMApplicationCache(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<DOMApplicationCache> impl) |
|
111 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
112 , m_impl(impl) |
|
113 { |
|
114 } |
|
115 |
|
116 JSDOMApplicationCache::~JSDOMApplicationCache() |
|
117 { |
|
118 impl()->invalidateJSEventListeners(this); |
|
119 forgetDOMObject(this, impl()); |
|
120 } |
|
121 |
|
122 void JSDOMApplicationCache::markChildren(MarkStack& markStack) |
|
123 { |
|
124 Base::markChildren(markStack); |
|
125 impl()->markJSEventListeners(markStack); |
|
126 } |
|
127 |
|
128 JSObject* JSDOMApplicationCache::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
129 { |
|
130 return new (exec) JSDOMApplicationCachePrototype(globalObject, JSDOMApplicationCachePrototype::createStructure(globalObject->objectPrototype())); |
|
131 } |
|
132 |
|
133 bool JSDOMApplicationCache::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
134 { |
|
135 return getStaticValueSlot<JSDOMApplicationCache, Base>(exec, &JSDOMApplicationCacheTable, this, propertyName, slot); |
|
136 } |
|
137 |
|
138 bool JSDOMApplicationCache::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
139 { |
|
140 return getStaticValueDescriptor<JSDOMApplicationCache, Base>(exec, &JSDOMApplicationCacheTable, this, propertyName, descriptor); |
|
141 } |
|
142 |
|
143 JSValue jsDOMApplicationCacheStatus(ExecState* exec, JSValue slotBase, const Identifier&) |
|
144 { |
|
145 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(slotBase)); |
|
146 UNUSED_PARAM(exec); |
|
147 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
148 JSValue result = jsNumber(exec, imp->status()); |
|
149 return result; |
|
150 } |
|
151 |
|
152 JSValue jsDOMApplicationCacheOnchecking(ExecState* exec, JSValue slotBase, const Identifier&) |
|
153 { |
|
154 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(slotBase)); |
|
155 UNUSED_PARAM(exec); |
|
156 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
157 if (EventListener* listener = imp->onchecking()) { |
|
158 if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { |
|
159 if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) |
|
160 return jsFunction; |
|
161 } |
|
162 } |
|
163 return jsNull(); |
|
164 } |
|
165 |
|
166 JSValue jsDOMApplicationCacheOnerror(ExecState* exec, JSValue slotBase, const Identifier&) |
|
167 { |
|
168 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(slotBase)); |
|
169 UNUSED_PARAM(exec); |
|
170 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
171 if (EventListener* listener = imp->onerror()) { |
|
172 if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { |
|
173 if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) |
|
174 return jsFunction; |
|
175 } |
|
176 } |
|
177 return jsNull(); |
|
178 } |
|
179 |
|
180 JSValue jsDOMApplicationCacheOnnoupdate(ExecState* exec, JSValue slotBase, const Identifier&) |
|
181 { |
|
182 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(slotBase)); |
|
183 UNUSED_PARAM(exec); |
|
184 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
185 if (EventListener* listener = imp->onnoupdate()) { |
|
186 if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { |
|
187 if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) |
|
188 return jsFunction; |
|
189 } |
|
190 } |
|
191 return jsNull(); |
|
192 } |
|
193 |
|
194 JSValue jsDOMApplicationCacheOndownloading(ExecState* exec, JSValue slotBase, const Identifier&) |
|
195 { |
|
196 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(slotBase)); |
|
197 UNUSED_PARAM(exec); |
|
198 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
199 if (EventListener* listener = imp->ondownloading()) { |
|
200 if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { |
|
201 if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) |
|
202 return jsFunction; |
|
203 } |
|
204 } |
|
205 return jsNull(); |
|
206 } |
|
207 |
|
208 JSValue jsDOMApplicationCacheOnprogress(ExecState* exec, JSValue slotBase, const Identifier&) |
|
209 { |
|
210 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(slotBase)); |
|
211 UNUSED_PARAM(exec); |
|
212 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
213 if (EventListener* listener = imp->onprogress()) { |
|
214 if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { |
|
215 if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) |
|
216 return jsFunction; |
|
217 } |
|
218 } |
|
219 return jsNull(); |
|
220 } |
|
221 |
|
222 JSValue jsDOMApplicationCacheOnupdateready(ExecState* exec, JSValue slotBase, const Identifier&) |
|
223 { |
|
224 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(slotBase)); |
|
225 UNUSED_PARAM(exec); |
|
226 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
227 if (EventListener* listener = imp->onupdateready()) { |
|
228 if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { |
|
229 if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) |
|
230 return jsFunction; |
|
231 } |
|
232 } |
|
233 return jsNull(); |
|
234 } |
|
235 |
|
236 JSValue jsDOMApplicationCacheOncached(ExecState* exec, JSValue slotBase, const Identifier&) |
|
237 { |
|
238 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(slotBase)); |
|
239 UNUSED_PARAM(exec); |
|
240 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
241 if (EventListener* listener = imp->oncached()) { |
|
242 if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { |
|
243 if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) |
|
244 return jsFunction; |
|
245 } |
|
246 } |
|
247 return jsNull(); |
|
248 } |
|
249 |
|
250 JSValue jsDOMApplicationCacheOnobsolete(ExecState* exec, JSValue slotBase, const Identifier&) |
|
251 { |
|
252 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(slotBase)); |
|
253 UNUSED_PARAM(exec); |
|
254 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
255 if (EventListener* listener = imp->onobsolete()) { |
|
256 if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { |
|
257 if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext())) |
|
258 return jsFunction; |
|
259 } |
|
260 } |
|
261 return jsNull(); |
|
262 } |
|
263 |
|
264 void JSDOMApplicationCache::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
265 { |
|
266 lookupPut<JSDOMApplicationCache, Base>(exec, propertyName, value, &JSDOMApplicationCacheTable, this, slot); |
|
267 } |
|
268 |
|
269 void setJSDOMApplicationCacheOnchecking(ExecState* exec, JSObject* thisObject, JSValue value) |
|
270 { |
|
271 UNUSED_PARAM(exec); |
|
272 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); |
|
273 imp->setOnchecking(createJSAttributeEventListener(exec, value, thisObject)); |
|
274 } |
|
275 |
|
276 void setJSDOMApplicationCacheOnerror(ExecState* exec, JSObject* thisObject, JSValue value) |
|
277 { |
|
278 UNUSED_PARAM(exec); |
|
279 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); |
|
280 imp->setOnerror(createJSAttributeEventListener(exec, value, thisObject)); |
|
281 } |
|
282 |
|
283 void setJSDOMApplicationCacheOnnoupdate(ExecState* exec, JSObject* thisObject, JSValue value) |
|
284 { |
|
285 UNUSED_PARAM(exec); |
|
286 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); |
|
287 imp->setOnnoupdate(createJSAttributeEventListener(exec, value, thisObject)); |
|
288 } |
|
289 |
|
290 void setJSDOMApplicationCacheOndownloading(ExecState* exec, JSObject* thisObject, JSValue value) |
|
291 { |
|
292 UNUSED_PARAM(exec); |
|
293 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); |
|
294 imp->setOndownloading(createJSAttributeEventListener(exec, value, thisObject)); |
|
295 } |
|
296 |
|
297 void setJSDOMApplicationCacheOnprogress(ExecState* exec, JSObject* thisObject, JSValue value) |
|
298 { |
|
299 UNUSED_PARAM(exec); |
|
300 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); |
|
301 imp->setOnprogress(createJSAttributeEventListener(exec, value, thisObject)); |
|
302 } |
|
303 |
|
304 void setJSDOMApplicationCacheOnupdateready(ExecState* exec, JSObject* thisObject, JSValue value) |
|
305 { |
|
306 UNUSED_PARAM(exec); |
|
307 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); |
|
308 imp->setOnupdateready(createJSAttributeEventListener(exec, value, thisObject)); |
|
309 } |
|
310 |
|
311 void setJSDOMApplicationCacheOncached(ExecState* exec, JSObject* thisObject, JSValue value) |
|
312 { |
|
313 UNUSED_PARAM(exec); |
|
314 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); |
|
315 imp->setOncached(createJSAttributeEventListener(exec, value, thisObject)); |
|
316 } |
|
317 |
|
318 void setJSDOMApplicationCacheOnobsolete(ExecState* exec, JSObject* thisObject, JSValue value) |
|
319 { |
|
320 UNUSED_PARAM(exec); |
|
321 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(static_cast<JSDOMApplicationCache*>(thisObject)->impl()); |
|
322 imp->setOnobsolete(createJSAttributeEventListener(exec, value, thisObject)); |
|
323 } |
|
324 |
|
325 EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionUpdate(ExecState* exec) |
|
326 { |
|
327 JSValue thisValue = exec->hostThisValue(); |
|
328 if (!thisValue.inherits(&JSDOMApplicationCache::s_info)) |
|
329 return throwVMTypeError(exec); |
|
330 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(thisValue)); |
|
331 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
332 ExceptionCode ec = 0; |
|
333 |
|
334 imp->update(ec); |
|
335 setDOMException(exec, ec); |
|
336 return JSValue::encode(jsUndefined()); |
|
337 } |
|
338 |
|
339 EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionSwapCache(ExecState* exec) |
|
340 { |
|
341 JSValue thisValue = exec->hostThisValue(); |
|
342 if (!thisValue.inherits(&JSDOMApplicationCache::s_info)) |
|
343 return throwVMTypeError(exec); |
|
344 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(thisValue)); |
|
345 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
346 ExceptionCode ec = 0; |
|
347 |
|
348 imp->swapCache(ec); |
|
349 setDOMException(exec, ec); |
|
350 return JSValue::encode(jsUndefined()); |
|
351 } |
|
352 |
|
353 EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionAddEventListener(ExecState* exec) |
|
354 { |
|
355 JSValue thisValue = exec->hostThisValue(); |
|
356 if (!thisValue.inherits(&JSDOMApplicationCache::s_info)) |
|
357 return throwVMTypeError(exec); |
|
358 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(thisValue)); |
|
359 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
360 JSValue listener = exec->argument(1); |
|
361 if (!listener.isObject()) |
|
362 return JSValue::encode(jsUndefined()); |
|
363 imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); |
|
364 return JSValue::encode(jsUndefined()); |
|
365 } |
|
366 |
|
367 EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionRemoveEventListener(ExecState* exec) |
|
368 { |
|
369 JSValue thisValue = exec->hostThisValue(); |
|
370 if (!thisValue.inherits(&JSDOMApplicationCache::s_info)) |
|
371 return throwVMTypeError(exec); |
|
372 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(thisValue)); |
|
373 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
374 JSValue listener = exec->argument(1); |
|
375 if (!listener.isObject()) |
|
376 return JSValue::encode(jsUndefined()); |
|
377 imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); |
|
378 return JSValue::encode(jsUndefined()); |
|
379 } |
|
380 |
|
381 EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionDispatchEvent(ExecState* exec) |
|
382 { |
|
383 JSValue thisValue = exec->hostThisValue(); |
|
384 if (!thisValue.inherits(&JSDOMApplicationCache::s_info)) |
|
385 return throwVMTypeError(exec); |
|
386 JSDOMApplicationCache* castedThis = static_cast<JSDOMApplicationCache*>(asObject(thisValue)); |
|
387 DOMApplicationCache* imp = static_cast<DOMApplicationCache*>(castedThis->impl()); |
|
388 ExceptionCode ec = 0; |
|
389 Event* evt = toEvent(exec->argument(0)); |
|
390 |
|
391 |
|
392 JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec)); |
|
393 setDOMException(exec, ec); |
|
394 return JSValue::encode(result); |
|
395 } |
|
396 |
|
397 // Constant getters |
|
398 |
|
399 JSValue jsDOMApplicationCacheUNCACHED(ExecState* exec, JSValue, const Identifier&) |
|
400 { |
|
401 return jsNumber(exec, static_cast<int>(0)); |
|
402 } |
|
403 |
|
404 JSValue jsDOMApplicationCacheIDLE(ExecState* exec, JSValue, const Identifier&) |
|
405 { |
|
406 return jsNumber(exec, static_cast<int>(1)); |
|
407 } |
|
408 |
|
409 JSValue jsDOMApplicationCacheCHECKING(ExecState* exec, JSValue, const Identifier&) |
|
410 { |
|
411 return jsNumber(exec, static_cast<int>(2)); |
|
412 } |
|
413 |
|
414 JSValue jsDOMApplicationCacheDOWNLOADING(ExecState* exec, JSValue, const Identifier&) |
|
415 { |
|
416 return jsNumber(exec, static_cast<int>(3)); |
|
417 } |
|
418 |
|
419 JSValue jsDOMApplicationCacheUPDATEREADY(ExecState* exec, JSValue, const Identifier&) |
|
420 { |
|
421 return jsNumber(exec, static_cast<int>(4)); |
|
422 } |
|
423 |
|
424 JSValue jsDOMApplicationCacheOBSOLETE(ExecState* exec, JSValue, const Identifier&) |
|
425 { |
|
426 return jsNumber(exec, static_cast<int>(5)); |
|
427 } |
|
428 |
|
429 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMApplicationCache* object) |
|
430 { |
|
431 return getDOMObjectWrapper<JSDOMApplicationCache>(exec, globalObject, object); |
|
432 } |
|
433 DOMApplicationCache* toDOMApplicationCache(JSC::JSValue value) |
|
434 { |
|
435 return value.inherits(&JSDOMApplicationCache::s_info) ? static_cast<JSDOMApplicationCache*>(asObject(value))->impl() : 0; |
|
436 } |
|
437 |
|
438 } |
|
439 |
|
440 #endif // ENABLE(OFFLINE_WEB_APPLICATIONS) |