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(MEDIA_SESSION) |
24 | |
25 | #include "JSMediaRemoteControls.h" |
26 | |
27 | #include "EventNames.h" |
28 | #include "JSDOMAttribute.h" |
29 | #include "JSDOMBinding.h" |
30 | #include "JSDOMConstructor.h" |
31 | #include "JSDOMConvertBoolean.h" |
32 | #include "JSDOMConvertInterface.h" |
33 | #include "JSDOMExceptionHandling.h" |
34 | #include "JSDOMWrapperCache.h" |
35 | #include "JSEventListener.h" |
36 | #include "ScriptExecutionContext.h" |
37 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
38 | #include <JavaScriptCore/JSCInlines.h> |
39 | #include <wtf/GetPtr.h> |
40 | #include <wtf/PointerPreparations.h> |
41 | #include <wtf/URL.h> |
42 | |
43 | |
44 | namespace WebCore { |
45 | using namespace JSC; |
46 | |
47 | // Attributes |
48 | |
49 | JSC::EncodedJSValue jsMediaRemoteControlsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
50 | bool setJSMediaRemoteControlsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
51 | JSC::EncodedJSValue jsMediaRemoteControlsPreviousTrackEnabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
52 | bool setJSMediaRemoteControlsPreviousTrackEnabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
53 | JSC::EncodedJSValue jsMediaRemoteControlsNextTrackEnabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
54 | bool setJSMediaRemoteControlsNextTrackEnabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
55 | JSC::EncodedJSValue jsMediaRemoteControlsOnprevioustrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
56 | bool setJSMediaRemoteControlsOnprevioustrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
57 | JSC::EncodedJSValue jsMediaRemoteControlsOnnexttrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
58 | bool setJSMediaRemoteControlsOnnexttrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
59 | |
60 | class JSMediaRemoteControlsPrototype : public JSC::JSNonFinalObject { |
61 | public: |
62 | using Base = JSC::JSNonFinalObject; |
63 | static JSMediaRemoteControlsPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
64 | { |
65 | JSMediaRemoteControlsPrototype* ptr = new (NotNull, JSC::allocateCell<JSMediaRemoteControlsPrototype>(vm.heap)) JSMediaRemoteControlsPrototype(vm, globalObject, structure); |
66 | ptr->finishCreation(vm); |
67 | return ptr; |
68 | } |
69 | |
70 | DECLARE_INFO; |
71 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
72 | { |
73 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
74 | } |
75 | |
76 | private: |
77 | JSMediaRemoteControlsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
78 | : JSC::JSNonFinalObject(vm, structure) |
79 | { |
80 | } |
81 | |
82 | void finishCreation(JSC::VM&); |
83 | }; |
84 | |
85 | using JSMediaRemoteControlsConstructor = JSDOMConstructor<JSMediaRemoteControls>; |
86 | |
87 | template<> EncodedJSValue JSC_HOST_CALL JSMediaRemoteControlsConstructor::construct(ExecState* state) |
88 | { |
89 | VM& vm = state->vm(); |
90 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
91 | UNUSED_PARAM(throwScope); |
92 | auto* castedThis = jsCast<JSMediaRemoteControlsConstructor*>(state->jsCallee()); |
93 | ASSERT(castedThis); |
94 | auto* context = castedThis->scriptExecutionContext(); |
95 | if (UNLIKELY(!context)) |
96 | return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "MediaRemoteControls" ); |
97 | auto object = MediaRemoteControls::create(*context); |
98 | return JSValue::encode(toJSNewlyCreated<IDLInterface<MediaRemoteControls>>(*state, *castedThis->globalObject(), WTFMove(object))); |
99 | } |
100 | |
101 | template<> JSValue JSMediaRemoteControlsConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
102 | { |
103 | return JSEventTarget::getConstructor(vm, &globalObject); |
104 | } |
105 | |
106 | template<> void JSMediaRemoteControlsConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
107 | { |
108 | putDirect(vm, vm.propertyNames->prototype, JSMediaRemoteControls::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
109 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("MediaRemoteControls"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
110 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
111 | } |
112 | |
113 | template<> const ClassInfo JSMediaRemoteControlsConstructor::s_info = { "MediaRemoteControls" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMediaRemoteControlsConstructor) }; |
114 | |
115 | /* Hash table for prototype */ |
116 | |
117 | static const HashTableValue JSMediaRemoteControlsPrototypeTableValues[] = |
118 | { |
119 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsConstructor) } }, |
120 | { "previousTrackEnabled" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsPreviousTrackEnabled), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsPreviousTrackEnabled) } }, |
121 | { "nextTrackEnabled" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsNextTrackEnabled), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsNextTrackEnabled) } }, |
122 | { "onprevioustrack" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsOnprevioustrack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsOnprevioustrack) } }, |
123 | { "onnexttrack" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsOnnexttrack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsOnnexttrack) } }, |
124 | }; |
125 | |
126 | const ClassInfo JSMediaRemoteControlsPrototype::s_info = { "MediaRemoteControlsPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMediaRemoteControlsPrototype) }; |
127 | |
128 | void JSMediaRemoteControlsPrototype::finishCreation(VM& vm) |
129 | { |
130 | Base::finishCreation(vm); |
131 | reifyStaticProperties(vm, JSMediaRemoteControls::info(), JSMediaRemoteControlsPrototypeTableValues, *this); |
132 | } |
133 | |
134 | const ClassInfo JSMediaRemoteControls::s_info = { "MediaRemoteControls" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMediaRemoteControls) }; |
135 | |
136 | JSMediaRemoteControls::JSMediaRemoteControls(Structure* structure, JSDOMGlobalObject& globalObject, Ref<MediaRemoteControls>&& impl) |
137 | : JSEventTarget(structure, globalObject, WTFMove(impl)) |
138 | { |
139 | } |
140 | |
141 | void JSMediaRemoteControls::finishCreation(VM& vm) |
142 | { |
143 | Base::finishCreation(vm); |
144 | ASSERT(inherits(vm, info())); |
145 | |
146 | } |
147 | |
148 | JSObject* JSMediaRemoteControls::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
149 | { |
150 | return JSMediaRemoteControlsPrototype::create(vm, &globalObject, JSMediaRemoteControlsPrototype::createStructure(vm, &globalObject, JSEventTarget::prototype(vm, globalObject))); |
151 | } |
152 | |
153 | JSObject* JSMediaRemoteControls::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
154 | { |
155 | return getDOMPrototype<JSMediaRemoteControls>(vm, globalObject); |
156 | } |
157 | |
158 | JSValue JSMediaRemoteControls::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
159 | { |
160 | return getDOMConstructor<JSMediaRemoteControlsConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
161 | } |
162 | |
163 | template<> inline JSMediaRemoteControls* IDLAttribute<JSMediaRemoteControls>::cast(ExecState& state, EncodedJSValue thisValue) |
164 | { |
165 | return jsDynamicCast<JSMediaRemoteControls*>(state.vm(), JSValue::decode(thisValue)); |
166 | } |
167 | |
168 | EncodedJSValue jsMediaRemoteControlsConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
169 | { |
170 | VM& vm = state->vm(); |
171 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
172 | auto* prototype = jsDynamicCast<JSMediaRemoteControlsPrototype*>(vm, JSValue::decode(thisValue)); |
173 | if (UNLIKELY(!prototype)) |
174 | return throwVMTypeError(state, throwScope); |
175 | return JSValue::encode(JSMediaRemoteControls::getConstructor(state->vm(), prototype->globalObject())); |
176 | } |
177 | |
178 | bool setJSMediaRemoteControlsConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
179 | { |
180 | VM& vm = state->vm(); |
181 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
182 | auto* prototype = jsDynamicCast<JSMediaRemoteControlsPrototype*>(vm, JSValue::decode(thisValue)); |
183 | if (UNLIKELY(!prototype)) { |
184 | throwVMTypeError(state, throwScope); |
185 | return false; |
186 | } |
187 | // Shadowing a built-in constructor |
188 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
189 | } |
190 | |
191 | static inline JSValue jsMediaRemoteControlsPreviousTrackEnabledGetter(ExecState& state, JSMediaRemoteControls& thisObject, ThrowScope& throwScope) |
192 | { |
193 | UNUSED_PARAM(throwScope); |
194 | UNUSED_PARAM(state); |
195 | auto& impl = thisObject.wrapped(); |
196 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.previousTrackEnabled()); |
197 | return result; |
198 | } |
199 | |
200 | EncodedJSValue jsMediaRemoteControlsPreviousTrackEnabled(ExecState* state, EncodedJSValue thisValue, PropertyName) |
201 | { |
202 | return IDLAttribute<JSMediaRemoteControls>::get<jsMediaRemoteControlsPreviousTrackEnabledGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "previousTrackEnabled" ); |
203 | } |
204 | |
205 | static inline bool setJSMediaRemoteControlsPreviousTrackEnabledSetter(ExecState& state, JSMediaRemoteControls& thisObject, JSValue value, ThrowScope& throwScope) |
206 | { |
207 | UNUSED_PARAM(throwScope); |
208 | auto& impl = thisObject.wrapped(); |
209 | auto nativeValue = convert<IDLBoolean>(state, value); |
210 | RETURN_IF_EXCEPTION(throwScope, false); |
211 | AttributeSetter::call(state, throwScope, [&] { |
212 | return impl.setPreviousTrackEnabled(WTFMove(nativeValue)); |
213 | }); |
214 | return true; |
215 | } |
216 | |
217 | bool setJSMediaRemoteControlsPreviousTrackEnabled(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
218 | { |
219 | return IDLAttribute<JSMediaRemoteControls>::set<setJSMediaRemoteControlsPreviousTrackEnabledSetter>(*state, thisValue, encodedValue, "previousTrackEnabled" ); |
220 | } |
221 | |
222 | static inline JSValue jsMediaRemoteControlsNextTrackEnabledGetter(ExecState& state, JSMediaRemoteControls& thisObject, ThrowScope& throwScope) |
223 | { |
224 | UNUSED_PARAM(throwScope); |
225 | UNUSED_PARAM(state); |
226 | auto& impl = thisObject.wrapped(); |
227 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.nextTrackEnabled()); |
228 | return result; |
229 | } |
230 | |
231 | EncodedJSValue jsMediaRemoteControlsNextTrackEnabled(ExecState* state, EncodedJSValue thisValue, PropertyName) |
232 | { |
233 | return IDLAttribute<JSMediaRemoteControls>::get<jsMediaRemoteControlsNextTrackEnabledGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "nextTrackEnabled" ); |
234 | } |
235 | |
236 | static inline bool setJSMediaRemoteControlsNextTrackEnabledSetter(ExecState& state, JSMediaRemoteControls& thisObject, JSValue value, ThrowScope& throwScope) |
237 | { |
238 | UNUSED_PARAM(throwScope); |
239 | auto& impl = thisObject.wrapped(); |
240 | auto nativeValue = convert<IDLBoolean>(state, value); |
241 | RETURN_IF_EXCEPTION(throwScope, false); |
242 | AttributeSetter::call(state, throwScope, [&] { |
243 | return impl.setNextTrackEnabled(WTFMove(nativeValue)); |
244 | }); |
245 | return true; |
246 | } |
247 | |
248 | bool setJSMediaRemoteControlsNextTrackEnabled(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
249 | { |
250 | return IDLAttribute<JSMediaRemoteControls>::set<setJSMediaRemoteControlsNextTrackEnabledSetter>(*state, thisValue, encodedValue, "nextTrackEnabled" ); |
251 | } |
252 | |
253 | static inline JSValue jsMediaRemoteControlsOnprevioustrackGetter(ExecState& state, JSMediaRemoteControls& thisObject, ThrowScope& throwScope) |
254 | { |
255 | UNUSED_PARAM(throwScope); |
256 | UNUSED_PARAM(state); |
257 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().previoustrackEvent, worldForDOMObject(thisObject)); |
258 | } |
259 | |
260 | EncodedJSValue jsMediaRemoteControlsOnprevioustrack(ExecState* state, EncodedJSValue thisValue, PropertyName) |
261 | { |
262 | return IDLAttribute<JSMediaRemoteControls>::get<jsMediaRemoteControlsOnprevioustrackGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onprevioustrack" ); |
263 | } |
264 | |
265 | static inline bool setJSMediaRemoteControlsOnprevioustrackSetter(ExecState& state, JSMediaRemoteControls& thisObject, JSValue value, ThrowScope& throwScope) |
266 | { |
267 | UNUSED_PARAM(throwScope); |
268 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().previoustrackEvent, value); |
269 | return true; |
270 | } |
271 | |
272 | bool setJSMediaRemoteControlsOnprevioustrack(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
273 | { |
274 | return IDLAttribute<JSMediaRemoteControls>::set<setJSMediaRemoteControlsOnprevioustrackSetter>(*state, thisValue, encodedValue, "onprevioustrack" ); |
275 | } |
276 | |
277 | static inline JSValue jsMediaRemoteControlsOnnexttrackGetter(ExecState& state, JSMediaRemoteControls& thisObject, ThrowScope& throwScope) |
278 | { |
279 | UNUSED_PARAM(throwScope); |
280 | UNUSED_PARAM(state); |
281 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().nexttrackEvent, worldForDOMObject(thisObject)); |
282 | } |
283 | |
284 | EncodedJSValue jsMediaRemoteControlsOnnexttrack(ExecState* state, EncodedJSValue thisValue, PropertyName) |
285 | { |
286 | return IDLAttribute<JSMediaRemoteControls>::get<jsMediaRemoteControlsOnnexttrackGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onnexttrack" ); |
287 | } |
288 | |
289 | static inline bool setJSMediaRemoteControlsOnnexttrackSetter(ExecState& state, JSMediaRemoteControls& thisObject, JSValue value, ThrowScope& throwScope) |
290 | { |
291 | UNUSED_PARAM(throwScope); |
292 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().nexttrackEvent, value); |
293 | return true; |
294 | } |
295 | |
296 | bool setJSMediaRemoteControlsOnnexttrack(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
297 | { |
298 | return IDLAttribute<JSMediaRemoteControls>::set<setJSMediaRemoteControlsOnnexttrackSetter>(*state, thisValue, encodedValue, "onnexttrack" ); |
299 | } |
300 | |
301 | void JSMediaRemoteControls::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
302 | { |
303 | auto* thisObject = jsCast<JSMediaRemoteControls*>(cell); |
304 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
305 | if (thisObject->scriptExecutionContext()) |
306 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
307 | Base::heapSnapshot(cell, builder); |
308 | } |
309 | |
310 | #if ENABLE(BINDING_INTEGRITY) |
311 | #if PLATFORM(WIN) |
312 | #pragma warning(disable: 4483) |
313 | extern "C" { extern void (*const __identifier("??_7MediaRemoteControls@WebCore@@6B@" )[])(); } |
314 | #else |
315 | extern "C" { extern void* _ZTVN7WebCore19MediaRemoteControlsE[]; } |
316 | #endif |
317 | #endif |
318 | |
319 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<MediaRemoteControls>&& impl) |
320 | { |
321 | |
322 | #if ENABLE(BINDING_INTEGRITY) |
323 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
324 | #if PLATFORM(WIN) |
325 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7MediaRemoteControls@WebCore@@6B@" )); |
326 | #else |
327 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore19MediaRemoteControlsE[2]); |
328 | #endif |
329 | |
330 | // If this fails MediaRemoteControls does not have a vtable, so you need to add the |
331 | // ImplementationLacksVTable attribute to the interface definition |
332 | static_assert(std::is_polymorphic<MediaRemoteControls>::value, "MediaRemoteControls is not polymorphic" ); |
333 | |
334 | // If you hit this assertion you either have a use after free bug, or |
335 | // MediaRemoteControls has subclasses. If MediaRemoteControls has subclasses that get passed |
336 | // to toJS() we currently require MediaRemoteControls you to opt out of binding hardening |
337 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
338 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
339 | #endif |
340 | return createWrapper<MediaRemoteControls>(globalObject, WTFMove(impl)); |
341 | } |
342 | |
343 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, MediaRemoteControls& impl) |
344 | { |
345 | return wrap(state, globalObject, impl); |
346 | } |
347 | |
348 | MediaRemoteControls* JSMediaRemoteControls::toWrapped(JSC::VM& vm, JSC::JSValue value) |
349 | { |
350 | if (auto* wrapper = jsDynamicCast<JSMediaRemoteControls*>(vm, value)) |
351 | return &wrapper->wrapped(); |
352 | return nullptr; |
353 | } |
354 | |
355 | } |
356 | |
357 | #endif // ENABLE(MEDIA_SESSION) |
358 | |