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 "JSDOMApplicationCache.h"
23
24#include "EventNames.h"
25#include "JSDOMAttribute.h"
26#include "JSDOMBinding.h"
27#include "JSDOMConstructorNotConstructable.h"
28#include "JSDOMConvertNumbers.h"
29#include "JSDOMExceptionHandling.h"
30#include "JSDOMOperation.h"
31#include "JSDOMWrapperCache.h"
32#include "JSEventListener.h"
33#include "ScriptExecutionContext.h"
34#include <JavaScriptCore/HeapSnapshotBuilder.h>
35#include <JavaScriptCore/JSCInlines.h>
36#include <wtf/GetPtr.h>
37#include <wtf/PointerPreparations.h>
38#include <wtf/URL.h>
39
40
41namespace WebCore {
42using namespace JSC;
43
44// Functions
45
46JSC::EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionUpdate(JSC::ExecState*);
47JSC::EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionSwapCache(JSC::ExecState*);
48JSC::EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionAbort(JSC::ExecState*);
49
50// Attributes
51
52JSC::EncodedJSValue jsDOMApplicationCacheConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53bool setJSDOMApplicationCacheConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
54JSC::EncodedJSValue jsDOMApplicationCacheStatus(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
55JSC::EncodedJSValue jsDOMApplicationCacheOnchecking(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56bool setJSDOMApplicationCacheOnchecking(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
57JSC::EncodedJSValue jsDOMApplicationCacheOnerror(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
58bool setJSDOMApplicationCacheOnerror(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
59JSC::EncodedJSValue jsDOMApplicationCacheOnnoupdate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
60bool setJSDOMApplicationCacheOnnoupdate(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
61JSC::EncodedJSValue jsDOMApplicationCacheOndownloading(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
62bool setJSDOMApplicationCacheOndownloading(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
63JSC::EncodedJSValue jsDOMApplicationCacheOnprogress(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
64bool setJSDOMApplicationCacheOnprogress(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
65JSC::EncodedJSValue jsDOMApplicationCacheOnupdateready(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
66bool setJSDOMApplicationCacheOnupdateready(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
67JSC::EncodedJSValue jsDOMApplicationCacheOncached(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
68bool setJSDOMApplicationCacheOncached(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
69JSC::EncodedJSValue jsDOMApplicationCacheOnobsolete(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
70bool setJSDOMApplicationCacheOnobsolete(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
71
72class JSDOMApplicationCachePrototype : public JSC::JSNonFinalObject {
73public:
74 using Base = JSC::JSNonFinalObject;
75 static JSDOMApplicationCachePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
76 {
77 JSDOMApplicationCachePrototype* ptr = new (NotNull, JSC::allocateCell<JSDOMApplicationCachePrototype>(vm.heap)) JSDOMApplicationCachePrototype(vm, globalObject, structure);
78 ptr->finishCreation(vm);
79 return ptr;
80 }
81
82 DECLARE_INFO;
83 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
84 {
85 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
86 }
87
88private:
89 JSDOMApplicationCachePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
90 : JSC::JSNonFinalObject(vm, structure)
91 {
92 }
93
94 void finishCreation(JSC::VM&);
95};
96
97using JSDOMApplicationCacheConstructor = JSDOMConstructorNotConstructable<JSDOMApplicationCache>;
98
99/* Hash table for constructor */
100
101static const HashTableValue JSDOMApplicationCacheConstructorTableValues[] =
102{
103 { "UNCACHED", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
104 { "IDLE", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
105 { "CHECKING", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
106 { "DOWNLOADING", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } },
107 { "UPDATEREADY", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(4) } },
108 { "OBSOLETE", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(5) } },
109};
110
111template<> JSValue JSDOMApplicationCacheConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
112{
113 return JSEventTarget::getConstructor(vm, &globalObject);
114}
115
116template<> void JSDOMApplicationCacheConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
117{
118 putDirect(vm, vm.propertyNames->prototype, JSDOMApplicationCache::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
119 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("ApplicationCache"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
120 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
121 reifyStaticProperties(vm, JSDOMApplicationCache::info(), JSDOMApplicationCacheConstructorTableValues, *this);
122}
123
124template<> const ClassInfo JSDOMApplicationCacheConstructor::s_info = { "ApplicationCache", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMApplicationCacheConstructor) };
125
126/* Hash table for prototype */
127
128static const HashTableValue JSDOMApplicationCachePrototypeTableValues[] =
129{
130 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMApplicationCacheConstructor) } },
131 { "status", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheStatus), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
132 { "onchecking", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnchecking), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMApplicationCacheOnchecking) } },
133 { "onerror", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnerror), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMApplicationCacheOnerror) } },
134 { "onnoupdate", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnnoupdate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMApplicationCacheOnnoupdate) } },
135 { "ondownloading", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOndownloading), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMApplicationCacheOndownloading) } },
136 { "onprogress", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnprogress), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMApplicationCacheOnprogress) } },
137 { "onupdateready", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnupdateready), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMApplicationCacheOnupdateready) } },
138 { "oncached", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOncached), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMApplicationCacheOncached) } },
139 { "onobsolete", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMApplicationCacheOnobsolete), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSDOMApplicationCacheOnobsolete) } },
140 { "update", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDOMApplicationCachePrototypeFunctionUpdate), (intptr_t) (0) } },
141 { "swapCache", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDOMApplicationCachePrototypeFunctionSwapCache), (intptr_t) (0) } },
142 { "abort", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsDOMApplicationCachePrototypeFunctionAbort), (intptr_t) (0) } },
143 { "UNCACHED", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
144 { "IDLE", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
145 { "CHECKING", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(2) } },
146 { "DOWNLOADING", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(3) } },
147 { "UPDATEREADY", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(4) } },
148 { "OBSOLETE", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(5) } },
149};
150
151const ClassInfo JSDOMApplicationCachePrototype::s_info = { "ApplicationCachePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMApplicationCachePrototype) };
152
153void JSDOMApplicationCachePrototype::finishCreation(VM& vm)
154{
155 Base::finishCreation(vm);
156 reifyStaticProperties(vm, JSDOMApplicationCache::info(), JSDOMApplicationCachePrototypeTableValues, *this);
157}
158
159const ClassInfo JSDOMApplicationCache::s_info = { "ApplicationCache", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSDOMApplicationCache) };
160
161JSDOMApplicationCache::JSDOMApplicationCache(Structure* structure, JSDOMGlobalObject& globalObject, Ref<DOMApplicationCache>&& impl)
162 : JSEventTarget(structure, globalObject, WTFMove(impl))
163{
164}
165
166void JSDOMApplicationCache::finishCreation(VM& vm)
167{
168 Base::finishCreation(vm);
169 ASSERT(inherits(vm, info()));
170
171}
172
173JSObject* JSDOMApplicationCache::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
174{
175 return JSDOMApplicationCachePrototype::create(vm, &globalObject, JSDOMApplicationCachePrototype::createStructure(vm, &globalObject, JSEventTarget::prototype(vm, globalObject)));
176}
177
178JSObject* JSDOMApplicationCache::prototype(VM& vm, JSDOMGlobalObject& globalObject)
179{
180 return getDOMPrototype<JSDOMApplicationCache>(vm, globalObject);
181}
182
183JSValue JSDOMApplicationCache::getConstructor(VM& vm, const JSGlobalObject* globalObject)
184{
185 return getDOMConstructor<JSDOMApplicationCacheConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
186}
187
188template<> inline JSDOMApplicationCache* IDLAttribute<JSDOMApplicationCache>::cast(ExecState& state, EncodedJSValue thisValue)
189{
190 return jsDynamicCast<JSDOMApplicationCache*>(state.vm(), JSValue::decode(thisValue));
191}
192
193template<> inline JSDOMApplicationCache* IDLOperation<JSDOMApplicationCache>::cast(ExecState& state)
194{
195 return jsDynamicCast<JSDOMApplicationCache*>(state.vm(), state.thisValue());
196}
197
198EncodedJSValue jsDOMApplicationCacheConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
199{
200 VM& vm = state->vm();
201 auto throwScope = DECLARE_THROW_SCOPE(vm);
202 auto* prototype = jsDynamicCast<JSDOMApplicationCachePrototype*>(vm, JSValue::decode(thisValue));
203 if (UNLIKELY(!prototype))
204 return throwVMTypeError(state, throwScope);
205 return JSValue::encode(JSDOMApplicationCache::getConstructor(state->vm(), prototype->globalObject()));
206}
207
208bool setJSDOMApplicationCacheConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
209{
210 VM& vm = state->vm();
211 auto throwScope = DECLARE_THROW_SCOPE(vm);
212 auto* prototype = jsDynamicCast<JSDOMApplicationCachePrototype*>(vm, JSValue::decode(thisValue));
213 if (UNLIKELY(!prototype)) {
214 throwVMTypeError(state, throwScope);
215 return false;
216 }
217 // Shadowing a built-in constructor
218 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
219}
220
221static inline JSValue jsDOMApplicationCacheStatusGetter(ExecState& state, JSDOMApplicationCache& thisObject, ThrowScope& throwScope)
222{
223 UNUSED_PARAM(throwScope);
224 UNUSED_PARAM(state);
225 auto& impl = thisObject.wrapped();
226 JSValue result = toJS<IDLUnsignedShort>(state, throwScope, impl.status());
227 return result;
228}
229
230EncodedJSValue jsDOMApplicationCacheStatus(ExecState* state, EncodedJSValue thisValue, PropertyName)
231{
232 return IDLAttribute<JSDOMApplicationCache>::get<jsDOMApplicationCacheStatusGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "status");
233}
234
235static inline JSValue jsDOMApplicationCacheOncheckingGetter(ExecState& state, JSDOMApplicationCache& thisObject, ThrowScope& throwScope)
236{
237 UNUSED_PARAM(throwScope);
238 UNUSED_PARAM(state);
239 return eventHandlerAttribute(thisObject.wrapped(), eventNames().checkingEvent, worldForDOMObject(thisObject));
240}
241
242EncodedJSValue jsDOMApplicationCacheOnchecking(ExecState* state, EncodedJSValue thisValue, PropertyName)
243{
244 return IDLAttribute<JSDOMApplicationCache>::get<jsDOMApplicationCacheOncheckingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onchecking");
245}
246
247static inline bool setJSDOMApplicationCacheOncheckingSetter(ExecState& state, JSDOMApplicationCache& thisObject, JSValue value, ThrowScope& throwScope)
248{
249 UNUSED_PARAM(throwScope);
250 setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().checkingEvent, value);
251 return true;
252}
253
254bool setJSDOMApplicationCacheOnchecking(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
255{
256 return IDLAttribute<JSDOMApplicationCache>::set<setJSDOMApplicationCacheOncheckingSetter>(*state, thisValue, encodedValue, "onchecking");
257}
258
259static inline JSValue jsDOMApplicationCacheOnerrorGetter(ExecState& state, JSDOMApplicationCache& thisObject, ThrowScope& throwScope)
260{
261 UNUSED_PARAM(throwScope);
262 UNUSED_PARAM(state);
263 return eventHandlerAttribute(thisObject.wrapped(), eventNames().errorEvent, worldForDOMObject(thisObject));
264}
265
266EncodedJSValue jsDOMApplicationCacheOnerror(ExecState* state, EncodedJSValue thisValue, PropertyName)
267{
268 return IDLAttribute<JSDOMApplicationCache>::get<jsDOMApplicationCacheOnerrorGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onerror");
269}
270
271static inline bool setJSDOMApplicationCacheOnerrorSetter(ExecState& state, JSDOMApplicationCache& thisObject, JSValue value, ThrowScope& throwScope)
272{
273 UNUSED_PARAM(throwScope);
274 setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().errorEvent, value);
275 return true;
276}
277
278bool setJSDOMApplicationCacheOnerror(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
279{
280 return IDLAttribute<JSDOMApplicationCache>::set<setJSDOMApplicationCacheOnerrorSetter>(*state, thisValue, encodedValue, "onerror");
281}
282
283static inline JSValue jsDOMApplicationCacheOnnoupdateGetter(ExecState& state, JSDOMApplicationCache& thisObject, ThrowScope& throwScope)
284{
285 UNUSED_PARAM(throwScope);
286 UNUSED_PARAM(state);
287 return eventHandlerAttribute(thisObject.wrapped(), eventNames().noupdateEvent, worldForDOMObject(thisObject));
288}
289
290EncodedJSValue jsDOMApplicationCacheOnnoupdate(ExecState* state, EncodedJSValue thisValue, PropertyName)
291{
292 return IDLAttribute<JSDOMApplicationCache>::get<jsDOMApplicationCacheOnnoupdateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onnoupdate");
293}
294
295static inline bool setJSDOMApplicationCacheOnnoupdateSetter(ExecState& state, JSDOMApplicationCache& thisObject, JSValue value, ThrowScope& throwScope)
296{
297 UNUSED_PARAM(throwScope);
298 setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().noupdateEvent, value);
299 return true;
300}
301
302bool setJSDOMApplicationCacheOnnoupdate(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
303{
304 return IDLAttribute<JSDOMApplicationCache>::set<setJSDOMApplicationCacheOnnoupdateSetter>(*state, thisValue, encodedValue, "onnoupdate");
305}
306
307static inline JSValue jsDOMApplicationCacheOndownloadingGetter(ExecState& state, JSDOMApplicationCache& thisObject, ThrowScope& throwScope)
308{
309 UNUSED_PARAM(throwScope);
310 UNUSED_PARAM(state);
311 return eventHandlerAttribute(thisObject.wrapped(), eventNames().downloadingEvent, worldForDOMObject(thisObject));
312}
313
314EncodedJSValue jsDOMApplicationCacheOndownloading(ExecState* state, EncodedJSValue thisValue, PropertyName)
315{
316 return IDLAttribute<JSDOMApplicationCache>::get<jsDOMApplicationCacheOndownloadingGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "ondownloading");
317}
318
319static inline bool setJSDOMApplicationCacheOndownloadingSetter(ExecState& state, JSDOMApplicationCache& thisObject, JSValue value, ThrowScope& throwScope)
320{
321 UNUSED_PARAM(throwScope);
322 setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().downloadingEvent, value);
323 return true;
324}
325
326bool setJSDOMApplicationCacheOndownloading(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
327{
328 return IDLAttribute<JSDOMApplicationCache>::set<setJSDOMApplicationCacheOndownloadingSetter>(*state, thisValue, encodedValue, "ondownloading");
329}
330
331static inline JSValue jsDOMApplicationCacheOnprogressGetter(ExecState& state, JSDOMApplicationCache& thisObject, ThrowScope& throwScope)
332{
333 UNUSED_PARAM(throwScope);
334 UNUSED_PARAM(state);
335 return eventHandlerAttribute(thisObject.wrapped(), eventNames().progressEvent, worldForDOMObject(thisObject));
336}
337
338EncodedJSValue jsDOMApplicationCacheOnprogress(ExecState* state, EncodedJSValue thisValue, PropertyName)
339{
340 return IDLAttribute<JSDOMApplicationCache>::get<jsDOMApplicationCacheOnprogressGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onprogress");
341}
342
343static inline bool setJSDOMApplicationCacheOnprogressSetter(ExecState& state, JSDOMApplicationCache& thisObject, JSValue value, ThrowScope& throwScope)
344{
345 UNUSED_PARAM(throwScope);
346 setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().progressEvent, value);
347 return true;
348}
349
350bool setJSDOMApplicationCacheOnprogress(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
351{
352 return IDLAttribute<JSDOMApplicationCache>::set<setJSDOMApplicationCacheOnprogressSetter>(*state, thisValue, encodedValue, "onprogress");
353}
354
355static inline JSValue jsDOMApplicationCacheOnupdatereadyGetter(ExecState& state, JSDOMApplicationCache& thisObject, ThrowScope& throwScope)
356{
357 UNUSED_PARAM(throwScope);
358 UNUSED_PARAM(state);
359 return eventHandlerAttribute(thisObject.wrapped(), eventNames().updatereadyEvent, worldForDOMObject(thisObject));
360}
361
362EncodedJSValue jsDOMApplicationCacheOnupdateready(ExecState* state, EncodedJSValue thisValue, PropertyName)
363{
364 return IDLAttribute<JSDOMApplicationCache>::get<jsDOMApplicationCacheOnupdatereadyGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onupdateready");
365}
366
367static inline bool setJSDOMApplicationCacheOnupdatereadySetter(ExecState& state, JSDOMApplicationCache& thisObject, JSValue value, ThrowScope& throwScope)
368{
369 UNUSED_PARAM(throwScope);
370 setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().updatereadyEvent, value);
371 return true;
372}
373
374bool setJSDOMApplicationCacheOnupdateready(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
375{
376 return IDLAttribute<JSDOMApplicationCache>::set<setJSDOMApplicationCacheOnupdatereadySetter>(*state, thisValue, encodedValue, "onupdateready");
377}
378
379static inline JSValue jsDOMApplicationCacheOncachedGetter(ExecState& state, JSDOMApplicationCache& thisObject, ThrowScope& throwScope)
380{
381 UNUSED_PARAM(throwScope);
382 UNUSED_PARAM(state);
383 return eventHandlerAttribute(thisObject.wrapped(), eventNames().cachedEvent, worldForDOMObject(thisObject));
384}
385
386EncodedJSValue jsDOMApplicationCacheOncached(ExecState* state, EncodedJSValue thisValue, PropertyName)
387{
388 return IDLAttribute<JSDOMApplicationCache>::get<jsDOMApplicationCacheOncachedGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "oncached");
389}
390
391static inline bool setJSDOMApplicationCacheOncachedSetter(ExecState& state, JSDOMApplicationCache& thisObject, JSValue value, ThrowScope& throwScope)
392{
393 UNUSED_PARAM(throwScope);
394 setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().cachedEvent, value);
395 return true;
396}
397
398bool setJSDOMApplicationCacheOncached(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
399{
400 return IDLAttribute<JSDOMApplicationCache>::set<setJSDOMApplicationCacheOncachedSetter>(*state, thisValue, encodedValue, "oncached");
401}
402
403static inline JSValue jsDOMApplicationCacheOnobsoleteGetter(ExecState& state, JSDOMApplicationCache& thisObject, ThrowScope& throwScope)
404{
405 UNUSED_PARAM(throwScope);
406 UNUSED_PARAM(state);
407 return eventHandlerAttribute(thisObject.wrapped(), eventNames().obsoleteEvent, worldForDOMObject(thisObject));
408}
409
410EncodedJSValue jsDOMApplicationCacheOnobsolete(ExecState* state, EncodedJSValue thisValue, PropertyName)
411{
412 return IDLAttribute<JSDOMApplicationCache>::get<jsDOMApplicationCacheOnobsoleteGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onobsolete");
413}
414
415static inline bool setJSDOMApplicationCacheOnobsoleteSetter(ExecState& state, JSDOMApplicationCache& thisObject, JSValue value, ThrowScope& throwScope)
416{
417 UNUSED_PARAM(throwScope);
418 setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().obsoleteEvent, value);
419 return true;
420}
421
422bool setJSDOMApplicationCacheOnobsolete(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
423{
424 return IDLAttribute<JSDOMApplicationCache>::set<setJSDOMApplicationCacheOnobsoleteSetter>(*state, thisValue, encodedValue, "onobsolete");
425}
426
427static inline JSC::EncodedJSValue jsDOMApplicationCachePrototypeFunctionUpdateBody(JSC::ExecState* state, typename IDLOperation<JSDOMApplicationCache>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
428{
429 UNUSED_PARAM(state);
430 UNUSED_PARAM(throwScope);
431 auto& impl = castedThis->wrapped();
432 propagateException(*state, throwScope, impl.update());
433 return JSValue::encode(jsUndefined());
434}
435
436EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionUpdate(ExecState* state)
437{
438 return IDLOperation<JSDOMApplicationCache>::call<jsDOMApplicationCachePrototypeFunctionUpdateBody>(*state, "update");
439}
440
441static inline JSC::EncodedJSValue jsDOMApplicationCachePrototypeFunctionSwapCacheBody(JSC::ExecState* state, typename IDLOperation<JSDOMApplicationCache>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
442{
443 UNUSED_PARAM(state);
444 UNUSED_PARAM(throwScope);
445 auto& impl = castedThis->wrapped();
446 propagateException(*state, throwScope, impl.swapCache());
447 return JSValue::encode(jsUndefined());
448}
449
450EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionSwapCache(ExecState* state)
451{
452 return IDLOperation<JSDOMApplicationCache>::call<jsDOMApplicationCachePrototypeFunctionSwapCacheBody>(*state, "swapCache");
453}
454
455static inline JSC::EncodedJSValue jsDOMApplicationCachePrototypeFunctionAbortBody(JSC::ExecState* state, typename IDLOperation<JSDOMApplicationCache>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
456{
457 UNUSED_PARAM(state);
458 UNUSED_PARAM(throwScope);
459 auto& impl = castedThis->wrapped();
460 impl.abort();
461 return JSValue::encode(jsUndefined());
462}
463
464EncodedJSValue JSC_HOST_CALL jsDOMApplicationCachePrototypeFunctionAbort(ExecState* state)
465{
466 return IDLOperation<JSDOMApplicationCache>::call<jsDOMApplicationCachePrototypeFunctionAbortBody>(*state, "abort");
467}
468
469void JSDOMApplicationCache::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
470{
471 auto* thisObject = jsCast<JSDOMApplicationCache*>(cell);
472 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
473 if (thisObject->scriptExecutionContext())
474 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
475 Base::heapSnapshot(cell, builder);
476}
477
478bool JSDOMApplicationCacheOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
479{
480 auto* jsDOMApplicationCache = jsCast<JSDOMApplicationCache*>(handle.slot()->asCell());
481 if (jsDOMApplicationCache->wrapped().isFiringEventListeners()) {
482 if (UNLIKELY(reason))
483 *reason = "EventTarget firing event listeners";
484 return true;
485 }
486 Frame* root = WTF::getPtr(jsDOMApplicationCache->wrapped().frame());
487 if (!root)
488 return false;
489 if (UNLIKELY(reason))
490 *reason = "Reachable from Frame";
491 return visitor.containsOpaqueRoot(root);
492}
493
494void JSDOMApplicationCacheOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
495{
496 auto* jsDOMApplicationCache = static_cast<JSDOMApplicationCache*>(handle.slot()->asCell());
497 auto& world = *static_cast<DOMWrapperWorld*>(context);
498 uncacheWrapper(world, &jsDOMApplicationCache->wrapped(), jsDOMApplicationCache);
499}
500
501#if ENABLE(BINDING_INTEGRITY)
502#if PLATFORM(WIN)
503#pragma warning(disable: 4483)
504extern "C" { extern void (*const __identifier("??_7DOMApplicationCache@WebCore@@6B@")[])(); }
505#else
506extern "C" { extern void* _ZTVN7WebCore19DOMApplicationCacheE[]; }
507#endif
508#endif
509
510JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<DOMApplicationCache>&& impl)
511{
512
513#if ENABLE(BINDING_INTEGRITY)
514 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
515#if PLATFORM(WIN)
516 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7DOMApplicationCache@WebCore@@6B@"));
517#else
518 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore19DOMApplicationCacheE[2]);
519#endif
520
521 // If this fails DOMApplicationCache does not have a vtable, so you need to add the
522 // ImplementationLacksVTable attribute to the interface definition
523 static_assert(std::is_polymorphic<DOMApplicationCache>::value, "DOMApplicationCache is not polymorphic");
524
525 // If you hit this assertion you either have a use after free bug, or
526 // DOMApplicationCache has subclasses. If DOMApplicationCache has subclasses that get passed
527 // to toJS() we currently require DOMApplicationCache you to opt out of binding hardening
528 // by adding the SkipVTableValidation attribute to the interface IDL definition
529 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
530#endif
531 return createWrapper<DOMApplicationCache>(globalObject, WTFMove(impl));
532}
533
534JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, DOMApplicationCache& impl)
535{
536 return wrap(state, globalObject, impl);
537}
538
539DOMApplicationCache* JSDOMApplicationCache::toWrapped(JSC::VM& vm, JSC::JSValue value)
540{
541 if (auto* wrapper = jsDynamicCast<JSDOMApplicationCache*>(vm, value))
542 return &wrapper->wrapped();
543 return nullptr;
544}
545
546}
547