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 "JSAnimationPlaybackEvent.h"
23
24#include "JSAnimationPlaybackEventInit.h"
25#include "JSDOMAttribute.h"
26#include "JSDOMBinding.h"
27#include "JSDOMConstructor.h"
28#include "JSDOMConvertDictionary.h"
29#include "JSDOMConvertInterface.h"
30#include "JSDOMConvertNullable.h"
31#include "JSDOMConvertNumbers.h"
32#include "JSDOMConvertStrings.h"
33#include "JSDOMExceptionHandling.h"
34#include "JSDOMWrapperCache.h"
35#include "ScriptExecutionContext.h"
36#include <JavaScriptCore/HeapSnapshotBuilder.h>
37#include <JavaScriptCore/JSCInlines.h>
38#include <wtf/GetPtr.h>
39#include <wtf/PointerPreparations.h>
40#include <wtf/URL.h>
41
42
43namespace WebCore {
44using namespace JSC;
45
46// Attributes
47
48JSC::EncodedJSValue jsAnimationPlaybackEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
49bool setJSAnimationPlaybackEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
50JSC::EncodedJSValue jsAnimationPlaybackEventCurrentTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51JSC::EncodedJSValue jsAnimationPlaybackEventTimelineTime(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52
53class JSAnimationPlaybackEventPrototype : public JSC::JSNonFinalObject {
54public:
55 using Base = JSC::JSNonFinalObject;
56 static JSAnimationPlaybackEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
57 {
58 JSAnimationPlaybackEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSAnimationPlaybackEventPrototype>(vm.heap)) JSAnimationPlaybackEventPrototype(vm, globalObject, structure);
59 ptr->finishCreation(vm);
60 return ptr;
61 }
62
63 DECLARE_INFO;
64 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
65 {
66 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
67 }
68
69private:
70 JSAnimationPlaybackEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
71 : JSC::JSNonFinalObject(vm, structure)
72 {
73 }
74
75 void finishCreation(JSC::VM&);
76};
77
78using JSAnimationPlaybackEventConstructor = JSDOMConstructor<JSAnimationPlaybackEvent>;
79
80template<> EncodedJSValue JSC_HOST_CALL JSAnimationPlaybackEventConstructor::construct(ExecState* state)
81{
82 VM& vm = state->vm();
83 auto throwScope = DECLARE_THROW_SCOPE(vm);
84 UNUSED_PARAM(throwScope);
85 auto* castedThis = jsCast<JSAnimationPlaybackEventConstructor*>(state->jsCallee());
86 ASSERT(castedThis);
87 if (UNLIKELY(state->argumentCount() < 1))
88 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
89 auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
90 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
91 auto eventInitDict = convert<IDLDictionary<AnimationPlaybackEventInit>>(*state, state->argument(1));
92 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
93 auto object = AnimationPlaybackEvent::create(WTFMove(type), WTFMove(eventInitDict));
94 return JSValue::encode(toJSNewlyCreated<IDLInterface<AnimationPlaybackEvent>>(*state, *castedThis->globalObject(), WTFMove(object)));
95}
96
97template<> JSValue JSAnimationPlaybackEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
98{
99 return JSEvent::getConstructor(vm, &globalObject);
100}
101
102template<> void JSAnimationPlaybackEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
103{
104 putDirect(vm, vm.propertyNames->prototype, JSAnimationPlaybackEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
105 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("AnimationPlaybackEvent"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
106 putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
107}
108
109template<> const ClassInfo JSAnimationPlaybackEventConstructor::s_info = { "AnimationPlaybackEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAnimationPlaybackEventConstructor) };
110
111/* Hash table for prototype */
112
113static const HashTableValue JSAnimationPlaybackEventPrototypeTableValues[] =
114{
115 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnimationPlaybackEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSAnimationPlaybackEventConstructor) } },
116 { "currentTime", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnimationPlaybackEventCurrentTime), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
117 { "timelineTime", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsAnimationPlaybackEventTimelineTime), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
118};
119
120const ClassInfo JSAnimationPlaybackEventPrototype::s_info = { "AnimationPlaybackEventPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAnimationPlaybackEventPrototype) };
121
122void JSAnimationPlaybackEventPrototype::finishCreation(VM& vm)
123{
124 Base::finishCreation(vm);
125 reifyStaticProperties(vm, JSAnimationPlaybackEvent::info(), JSAnimationPlaybackEventPrototypeTableValues, *this);
126}
127
128const ClassInfo JSAnimationPlaybackEvent::s_info = { "AnimationPlaybackEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSAnimationPlaybackEvent) };
129
130JSAnimationPlaybackEvent::JSAnimationPlaybackEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<AnimationPlaybackEvent>&& impl)
131 : JSEvent(structure, globalObject, WTFMove(impl))
132{
133}
134
135void JSAnimationPlaybackEvent::finishCreation(VM& vm)
136{
137 Base::finishCreation(vm);
138 ASSERT(inherits(vm, info()));
139
140}
141
142JSObject* JSAnimationPlaybackEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
143{
144 return JSAnimationPlaybackEventPrototype::create(vm, &globalObject, JSAnimationPlaybackEventPrototype::createStructure(vm, &globalObject, JSEvent::prototype(vm, globalObject)));
145}
146
147JSObject* JSAnimationPlaybackEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject)
148{
149 return getDOMPrototype<JSAnimationPlaybackEvent>(vm, globalObject);
150}
151
152JSValue JSAnimationPlaybackEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
153{
154 return getDOMConstructor<JSAnimationPlaybackEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
155}
156
157template<> inline JSAnimationPlaybackEvent* IDLAttribute<JSAnimationPlaybackEvent>::cast(ExecState& state, EncodedJSValue thisValue)
158{
159 return jsDynamicCast<JSAnimationPlaybackEvent*>(state.vm(), JSValue::decode(thisValue));
160}
161
162EncodedJSValue jsAnimationPlaybackEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
163{
164 VM& vm = state->vm();
165 auto throwScope = DECLARE_THROW_SCOPE(vm);
166 auto* prototype = jsDynamicCast<JSAnimationPlaybackEventPrototype*>(vm, JSValue::decode(thisValue));
167 if (UNLIKELY(!prototype))
168 return throwVMTypeError(state, throwScope);
169 return JSValue::encode(JSAnimationPlaybackEvent::getConstructor(state->vm(), prototype->globalObject()));
170}
171
172bool setJSAnimationPlaybackEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
173{
174 VM& vm = state->vm();
175 auto throwScope = DECLARE_THROW_SCOPE(vm);
176 auto* prototype = jsDynamicCast<JSAnimationPlaybackEventPrototype*>(vm, JSValue::decode(thisValue));
177 if (UNLIKELY(!prototype)) {
178 throwVMTypeError(state, throwScope);
179 return false;
180 }
181 // Shadowing a built-in constructor
182 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
183}
184
185static inline JSValue jsAnimationPlaybackEventCurrentTimeGetter(ExecState& state, JSAnimationPlaybackEvent& thisObject, ThrowScope& throwScope)
186{
187 UNUSED_PARAM(throwScope);
188 UNUSED_PARAM(state);
189 auto& impl = thisObject.wrapped();
190 JSValue result = toJS<IDLNullable<IDLDouble>>(state, throwScope, impl.bindingsCurrentTime());
191 return result;
192}
193
194EncodedJSValue jsAnimationPlaybackEventCurrentTime(ExecState* state, EncodedJSValue thisValue, PropertyName)
195{
196 return IDLAttribute<JSAnimationPlaybackEvent>::get<jsAnimationPlaybackEventCurrentTimeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "currentTime");
197}
198
199static inline JSValue jsAnimationPlaybackEventTimelineTimeGetter(ExecState& state, JSAnimationPlaybackEvent& thisObject, ThrowScope& throwScope)
200{
201 UNUSED_PARAM(throwScope);
202 UNUSED_PARAM(state);
203 auto& impl = thisObject.wrapped();
204 JSValue result = toJS<IDLNullable<IDLDouble>>(state, throwScope, impl.bindingsTimelineTime());
205 return result;
206}
207
208EncodedJSValue jsAnimationPlaybackEventTimelineTime(ExecState* state, EncodedJSValue thisValue, PropertyName)
209{
210 return IDLAttribute<JSAnimationPlaybackEvent>::get<jsAnimationPlaybackEventTimelineTimeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "timelineTime");
211}
212
213void JSAnimationPlaybackEvent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
214{
215 auto* thisObject = jsCast<JSAnimationPlaybackEvent*>(cell);
216 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
217 if (thisObject->scriptExecutionContext())
218 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
219 Base::heapSnapshot(cell, builder);
220}
221
222#if ENABLE(BINDING_INTEGRITY)
223#if PLATFORM(WIN)
224#pragma warning(disable: 4483)
225extern "C" { extern void (*const __identifier("??_7AnimationPlaybackEvent@WebCore@@6B@")[])(); }
226#else
227extern "C" { extern void* _ZTVN7WebCore22AnimationPlaybackEventE[]; }
228#endif
229#endif
230
231JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<AnimationPlaybackEvent>&& impl)
232{
233
234#if ENABLE(BINDING_INTEGRITY)
235 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
236#if PLATFORM(WIN)
237 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7AnimationPlaybackEvent@WebCore@@6B@"));
238#else
239 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore22AnimationPlaybackEventE[2]);
240#endif
241
242 // If this fails AnimationPlaybackEvent does not have a vtable, so you need to add the
243 // ImplementationLacksVTable attribute to the interface definition
244 static_assert(std::is_polymorphic<AnimationPlaybackEvent>::value, "AnimationPlaybackEvent is not polymorphic");
245
246 // If you hit this assertion you either have a use after free bug, or
247 // AnimationPlaybackEvent has subclasses. If AnimationPlaybackEvent has subclasses that get passed
248 // to toJS() we currently require AnimationPlaybackEvent you to opt out of binding hardening
249 // by adding the SkipVTableValidation attribute to the interface IDL definition
250 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
251#endif
252 return createWrapper<AnimationPlaybackEvent>(globalObject, WTFMove(impl));
253}
254
255JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, AnimationPlaybackEvent& impl)
256{
257 return wrap(state, globalObject, impl);
258}
259
260
261}
262