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(WIRELESS_PLAYBACK_TARGET)
24
25#include "JSWebKitPlaybackTargetAvailabilityEvent.h"
26
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructor.h"
30#include "JSDOMConvertBoolean.h"
31#include "JSDOMConvertInterface.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
46template<> WebKitPlaybackTargetAvailabilityEvent::Init convertDictionary<WebKitPlaybackTargetAvailabilityEvent::Init>(ExecState& state, JSValue value)
47{
48 VM& vm = state.vm();
49 auto throwScope = DECLARE_THROW_SCOPE(vm);
50 bool isNullOrUndefined = value.isUndefinedOrNull();
51 auto* object = isNullOrUndefined ? nullptr : value.getObject();
52 if (UNLIKELY(!isNullOrUndefined && !object)) {
53 throwTypeError(&state, throwScope);
54 return { };
55 }
56 WebKitPlaybackTargetAvailabilityEvent::Init result;
57 JSValue bubblesValue;
58 if (isNullOrUndefined)
59 bubblesValue = jsUndefined();
60 else {
61 bubblesValue = object->get(&state, Identifier::fromString(&state, "bubbles"));
62 RETURN_IF_EXCEPTION(throwScope, { });
63 }
64 if (!bubblesValue.isUndefined()) {
65 result.bubbles = convert<IDLBoolean>(state, bubblesValue);
66 RETURN_IF_EXCEPTION(throwScope, { });
67 } else
68 result.bubbles = false;
69 JSValue cancelableValue;
70 if (isNullOrUndefined)
71 cancelableValue = jsUndefined();
72 else {
73 cancelableValue = object->get(&state, Identifier::fromString(&state, "cancelable"));
74 RETURN_IF_EXCEPTION(throwScope, { });
75 }
76 if (!cancelableValue.isUndefined()) {
77 result.cancelable = convert<IDLBoolean>(state, cancelableValue);
78 RETURN_IF_EXCEPTION(throwScope, { });
79 } else
80 result.cancelable = false;
81 JSValue composedValue;
82 if (isNullOrUndefined)
83 composedValue = jsUndefined();
84 else {
85 composedValue = object->get(&state, Identifier::fromString(&state, "composed"));
86 RETURN_IF_EXCEPTION(throwScope, { });
87 }
88 if (!composedValue.isUndefined()) {
89 result.composed = convert<IDLBoolean>(state, composedValue);
90 RETURN_IF_EXCEPTION(throwScope, { });
91 } else
92 result.composed = false;
93 JSValue availabilityValue;
94 if (isNullOrUndefined)
95 availabilityValue = jsUndefined();
96 else {
97 availabilityValue = object->get(&state, Identifier::fromString(&state, "availability"));
98 RETURN_IF_EXCEPTION(throwScope, { });
99 }
100 if (!availabilityValue.isUndefined()) {
101 result.availability = convert<IDLDOMString>(state, availabilityValue);
102 RETURN_IF_EXCEPTION(throwScope, { });
103 } else
104 result.availability = emptyString();
105 return result;
106}
107
108// Attributes
109
110JSC::EncodedJSValue jsWebKitPlaybackTargetAvailabilityEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
111bool setJSWebKitPlaybackTargetAvailabilityEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
112JSC::EncodedJSValue jsWebKitPlaybackTargetAvailabilityEventAvailability(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
113
114class JSWebKitPlaybackTargetAvailabilityEventPrototype : public JSC::JSNonFinalObject {
115public:
116 using Base = JSC::JSNonFinalObject;
117 static JSWebKitPlaybackTargetAvailabilityEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
118 {
119 JSWebKitPlaybackTargetAvailabilityEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSWebKitPlaybackTargetAvailabilityEventPrototype>(vm.heap)) JSWebKitPlaybackTargetAvailabilityEventPrototype(vm, globalObject, structure);
120 ptr->finishCreation(vm);
121 return ptr;
122 }
123
124 DECLARE_INFO;
125 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
126 {
127 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
128 }
129
130private:
131 JSWebKitPlaybackTargetAvailabilityEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
132 : JSC::JSNonFinalObject(vm, structure)
133 {
134 }
135
136 void finishCreation(JSC::VM&);
137};
138
139using JSWebKitPlaybackTargetAvailabilityEventConstructor = JSDOMConstructor<JSWebKitPlaybackTargetAvailabilityEvent>;
140
141template<> EncodedJSValue JSC_HOST_CALL JSWebKitPlaybackTargetAvailabilityEventConstructor::construct(ExecState* state)
142{
143 VM& vm = state->vm();
144 auto throwScope = DECLARE_THROW_SCOPE(vm);
145 UNUSED_PARAM(throwScope);
146 auto* castedThis = jsCast<JSWebKitPlaybackTargetAvailabilityEventConstructor*>(state->jsCallee());
147 ASSERT(castedThis);
148 if (UNLIKELY(state->argumentCount() < 1))
149 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
150 auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
151 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
152 auto eventInitDict = convert<IDLDictionary<WebKitPlaybackTargetAvailabilityEvent::Init>>(*state, state->argument(1));
153 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
154 auto object = WebKitPlaybackTargetAvailabilityEvent::create(WTFMove(type), WTFMove(eventInitDict));
155 return JSValue::encode(toJSNewlyCreated<IDLInterface<WebKitPlaybackTargetAvailabilityEvent>>(*state, *castedThis->globalObject(), WTFMove(object)));
156}
157
158template<> JSValue JSWebKitPlaybackTargetAvailabilityEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
159{
160 return JSEvent::getConstructor(vm, &globalObject);
161}
162
163template<> void JSWebKitPlaybackTargetAvailabilityEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
164{
165 putDirect(vm, vm.propertyNames->prototype, JSWebKitPlaybackTargetAvailabilityEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
166 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("WebKitPlaybackTargetAvailabilityEvent"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
167 putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
168}
169
170template<> const ClassInfo JSWebKitPlaybackTargetAvailabilityEventConstructor::s_info = { "WebKitPlaybackTargetAvailabilityEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebKitPlaybackTargetAvailabilityEventConstructor) };
171
172/* Hash table for prototype */
173
174static const HashTableValue JSWebKitPlaybackTargetAvailabilityEventPrototypeTableValues[] =
175{
176 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitPlaybackTargetAvailabilityEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWebKitPlaybackTargetAvailabilityEventConstructor) } },
177 { "availability", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWebKitPlaybackTargetAvailabilityEventAvailability), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
178};
179
180const ClassInfo JSWebKitPlaybackTargetAvailabilityEventPrototype::s_info = { "WebKitPlaybackTargetAvailabilityEventPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebKitPlaybackTargetAvailabilityEventPrototype) };
181
182void JSWebKitPlaybackTargetAvailabilityEventPrototype::finishCreation(VM& vm)
183{
184 Base::finishCreation(vm);
185 reifyStaticProperties(vm, JSWebKitPlaybackTargetAvailabilityEvent::info(), JSWebKitPlaybackTargetAvailabilityEventPrototypeTableValues, *this);
186}
187
188const ClassInfo JSWebKitPlaybackTargetAvailabilityEvent::s_info = { "WebKitPlaybackTargetAvailabilityEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSWebKitPlaybackTargetAvailabilityEvent) };
189
190JSWebKitPlaybackTargetAvailabilityEvent::JSWebKitPlaybackTargetAvailabilityEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WebKitPlaybackTargetAvailabilityEvent>&& impl)
191 : JSEvent(structure, globalObject, WTFMove(impl))
192{
193}
194
195void JSWebKitPlaybackTargetAvailabilityEvent::finishCreation(VM& vm)
196{
197 Base::finishCreation(vm);
198 ASSERT(inherits(vm, info()));
199
200}
201
202JSObject* JSWebKitPlaybackTargetAvailabilityEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
203{
204 return JSWebKitPlaybackTargetAvailabilityEventPrototype::create(vm, &globalObject, JSWebKitPlaybackTargetAvailabilityEventPrototype::createStructure(vm, &globalObject, JSEvent::prototype(vm, globalObject)));
205}
206
207JSObject* JSWebKitPlaybackTargetAvailabilityEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject)
208{
209 return getDOMPrototype<JSWebKitPlaybackTargetAvailabilityEvent>(vm, globalObject);
210}
211
212JSValue JSWebKitPlaybackTargetAvailabilityEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
213{
214 return getDOMConstructor<JSWebKitPlaybackTargetAvailabilityEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
215}
216
217template<> inline JSWebKitPlaybackTargetAvailabilityEvent* IDLAttribute<JSWebKitPlaybackTargetAvailabilityEvent>::cast(ExecState& state, EncodedJSValue thisValue)
218{
219 return jsDynamicCast<JSWebKitPlaybackTargetAvailabilityEvent*>(state.vm(), JSValue::decode(thisValue));
220}
221
222EncodedJSValue jsWebKitPlaybackTargetAvailabilityEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
223{
224 VM& vm = state->vm();
225 auto throwScope = DECLARE_THROW_SCOPE(vm);
226 auto* prototype = jsDynamicCast<JSWebKitPlaybackTargetAvailabilityEventPrototype*>(vm, JSValue::decode(thisValue));
227 if (UNLIKELY(!prototype))
228 return throwVMTypeError(state, throwScope);
229 return JSValue::encode(JSWebKitPlaybackTargetAvailabilityEvent::getConstructor(state->vm(), prototype->globalObject()));
230}
231
232bool setJSWebKitPlaybackTargetAvailabilityEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
233{
234 VM& vm = state->vm();
235 auto throwScope = DECLARE_THROW_SCOPE(vm);
236 auto* prototype = jsDynamicCast<JSWebKitPlaybackTargetAvailabilityEventPrototype*>(vm, JSValue::decode(thisValue));
237 if (UNLIKELY(!prototype)) {
238 throwVMTypeError(state, throwScope);
239 return false;
240 }
241 // Shadowing a built-in constructor
242 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
243}
244
245static inline JSValue jsWebKitPlaybackTargetAvailabilityEventAvailabilityGetter(ExecState& state, JSWebKitPlaybackTargetAvailabilityEvent& thisObject, ThrowScope& throwScope)
246{
247 UNUSED_PARAM(throwScope);
248 UNUSED_PARAM(state);
249 auto& impl = thisObject.wrapped();
250 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.availability());
251 return result;
252}
253
254EncodedJSValue jsWebKitPlaybackTargetAvailabilityEventAvailability(ExecState* state, EncodedJSValue thisValue, PropertyName)
255{
256 return IDLAttribute<JSWebKitPlaybackTargetAvailabilityEvent>::get<jsWebKitPlaybackTargetAvailabilityEventAvailabilityGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "availability");
257}
258
259void JSWebKitPlaybackTargetAvailabilityEvent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
260{
261 auto* thisObject = jsCast<JSWebKitPlaybackTargetAvailabilityEvent*>(cell);
262 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
263 if (thisObject->scriptExecutionContext())
264 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
265 Base::heapSnapshot(cell, builder);
266}
267
268#if ENABLE(BINDING_INTEGRITY)
269#if PLATFORM(WIN)
270#pragma warning(disable: 4483)
271extern "C" { extern void (*const __identifier("??_7WebKitPlaybackTargetAvailabilityEvent@WebCore@@6B@")[])(); }
272#else
273extern "C" { extern void* _ZTVN7WebCore37WebKitPlaybackTargetAvailabilityEventE[]; }
274#endif
275#endif
276
277JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<WebKitPlaybackTargetAvailabilityEvent>&& impl)
278{
279
280#if ENABLE(BINDING_INTEGRITY)
281 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
282#if PLATFORM(WIN)
283 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7WebKitPlaybackTargetAvailabilityEvent@WebCore@@6B@"));
284#else
285 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore37WebKitPlaybackTargetAvailabilityEventE[2]);
286#endif
287
288 // If this fails WebKitPlaybackTargetAvailabilityEvent does not have a vtable, so you need to add the
289 // ImplementationLacksVTable attribute to the interface definition
290 static_assert(std::is_polymorphic<WebKitPlaybackTargetAvailabilityEvent>::value, "WebKitPlaybackTargetAvailabilityEvent is not polymorphic");
291
292 // If you hit this assertion you either have a use after free bug, or
293 // WebKitPlaybackTargetAvailabilityEvent has subclasses. If WebKitPlaybackTargetAvailabilityEvent has subclasses that get passed
294 // to toJS() we currently require WebKitPlaybackTargetAvailabilityEvent you to opt out of binding hardening
295 // by adding the SkipVTableValidation attribute to the interface IDL definition
296 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
297#endif
298 return createWrapper<WebKitPlaybackTargetAvailabilityEvent>(globalObject, WTFMove(impl));
299}
300
301JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, WebKitPlaybackTargetAvailabilityEvent& impl)
302{
303 return wrap(state, globalObject, impl);
304}
305
306
307}
308
309#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
310