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(ENCRYPTED_MEDIA) |
24 | |
25 | #include "JSMockCDMFactory.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConvertBoolean.h" |
30 | #include "JSDOMConvertEnumeration.h" |
31 | #include "JSDOMConvertSequences.h" |
32 | #include "JSDOMConvertStrings.h" |
33 | #include "JSDOMExceptionHandling.h" |
34 | #include "JSDOMGlobalObject.h" |
35 | #include "JSDOMOperation.h" |
36 | #include "JSDOMWrapperCache.h" |
37 | #include "JSMediaKeyEncryptionScheme.h" |
38 | #include "JSMediaKeySessionType.h" |
39 | #include "JSMediaKeysRequirement.h" |
40 | #include "ScriptExecutionContext.h" |
41 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
42 | #include <JavaScriptCore/JSArray.h> |
43 | #include <JavaScriptCore/JSCInlines.h> |
44 | #include <wtf/GetPtr.h> |
45 | #include <wtf/PointerPreparations.h> |
46 | #include <wtf/URL.h> |
47 | |
48 | |
49 | namespace WebCore { |
50 | using namespace JSC; |
51 | |
52 | // Functions |
53 | |
54 | JSC::EncodedJSValue JSC_HOST_CALL jsMockCDMFactoryPrototypeFunctionUnregister(JSC::ExecState*); |
55 | |
56 | // Attributes |
57 | |
58 | JSC::EncodedJSValue jsMockCDMFactorySupportedDataTypes(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
59 | bool setJSMockCDMFactorySupportedDataTypes(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
60 | JSC::EncodedJSValue jsMockCDMFactorySupportedRobustness(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
61 | bool setJSMockCDMFactorySupportedRobustness(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
62 | JSC::EncodedJSValue jsMockCDMFactorySupportedSessionTypes(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
63 | bool setJSMockCDMFactorySupportedSessionTypes(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
64 | JSC::EncodedJSValue jsMockCDMFactoryDistinctiveIdentifiersRequirement(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
65 | bool setJSMockCDMFactoryDistinctiveIdentifiersRequirement(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
66 | JSC::EncodedJSValue jsMockCDMFactoryPersistentStateRequirement(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
67 | bool setJSMockCDMFactoryPersistentStateRequirement(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
68 | JSC::EncodedJSValue jsMockCDMFactoryCanCreateInstances(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
69 | bool setJSMockCDMFactoryCanCreateInstances(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
70 | JSC::EncodedJSValue jsMockCDMFactorySupportsServerCertificates(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
71 | bool setJSMockCDMFactorySupportsServerCertificates(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
72 | JSC::EncodedJSValue jsMockCDMFactorySupportsSessions(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
73 | bool setJSMockCDMFactorySupportsSessions(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
74 | JSC::EncodedJSValue jsMockCDMFactorySupportedEncryptionSchemes(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
75 | bool setJSMockCDMFactorySupportedEncryptionSchemes(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
76 | |
77 | class JSMockCDMFactoryPrototype : public JSC::JSNonFinalObject { |
78 | public: |
79 | using Base = JSC::JSNonFinalObject; |
80 | static JSMockCDMFactoryPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
81 | { |
82 | JSMockCDMFactoryPrototype* ptr = new (NotNull, JSC::allocateCell<JSMockCDMFactoryPrototype>(vm.heap)) JSMockCDMFactoryPrototype(vm, globalObject, structure); |
83 | ptr->finishCreation(vm); |
84 | return ptr; |
85 | } |
86 | |
87 | DECLARE_INFO; |
88 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
89 | { |
90 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
91 | } |
92 | |
93 | private: |
94 | JSMockCDMFactoryPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
95 | : JSC::JSNonFinalObject(vm, structure) |
96 | { |
97 | } |
98 | |
99 | void finishCreation(JSC::VM&); |
100 | }; |
101 | |
102 | /* Hash table for prototype */ |
103 | |
104 | static const HashTableValue JSMockCDMFactoryPrototypeTableValues[] = |
105 | { |
106 | { "supportedDataTypes" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMockCDMFactorySupportedDataTypes), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMockCDMFactorySupportedDataTypes) } }, |
107 | { "supportedRobustness" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMockCDMFactorySupportedRobustness), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMockCDMFactorySupportedRobustness) } }, |
108 | { "supportedSessionTypes" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMockCDMFactorySupportedSessionTypes), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMockCDMFactorySupportedSessionTypes) } }, |
109 | { "distinctiveIdentifiersRequirement" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMockCDMFactoryDistinctiveIdentifiersRequirement), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMockCDMFactoryDistinctiveIdentifiersRequirement) } }, |
110 | { "persistentStateRequirement" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMockCDMFactoryPersistentStateRequirement), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMockCDMFactoryPersistentStateRequirement) } }, |
111 | { "canCreateInstances" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMockCDMFactoryCanCreateInstances), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMockCDMFactoryCanCreateInstances) } }, |
112 | { "supportsServerCertificates" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMockCDMFactorySupportsServerCertificates), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMockCDMFactorySupportsServerCertificates) } }, |
113 | { "supportsSessions" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMockCDMFactorySupportsSessions), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMockCDMFactorySupportsSessions) } }, |
114 | { "supportedEncryptionSchemes" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMockCDMFactorySupportedEncryptionSchemes), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMockCDMFactorySupportedEncryptionSchemes) } }, |
115 | { "unregister" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsMockCDMFactoryPrototypeFunctionUnregister), (intptr_t) (0) } }, |
116 | }; |
117 | |
118 | const ClassInfo JSMockCDMFactoryPrototype::s_info = { "MockCDMFactoryPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMockCDMFactoryPrototype) }; |
119 | |
120 | void JSMockCDMFactoryPrototype::finishCreation(VM& vm) |
121 | { |
122 | Base::finishCreation(vm); |
123 | reifyStaticProperties(vm, JSMockCDMFactory::info(), JSMockCDMFactoryPrototypeTableValues, *this); |
124 | } |
125 | |
126 | const ClassInfo JSMockCDMFactory::s_info = { "MockCDMFactory" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSMockCDMFactory) }; |
127 | |
128 | JSMockCDMFactory::JSMockCDMFactory(Structure* structure, JSDOMGlobalObject& globalObject, Ref<MockCDMFactory>&& impl) |
129 | : JSDOMWrapper<MockCDMFactory>(structure, globalObject, WTFMove(impl)) |
130 | { |
131 | } |
132 | |
133 | void JSMockCDMFactory::finishCreation(VM& vm) |
134 | { |
135 | Base::finishCreation(vm); |
136 | ASSERT(inherits(vm, info())); |
137 | |
138 | } |
139 | |
140 | JSObject* JSMockCDMFactory::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
141 | { |
142 | return JSMockCDMFactoryPrototype::create(vm, &globalObject, JSMockCDMFactoryPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
143 | } |
144 | |
145 | JSObject* JSMockCDMFactory::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
146 | { |
147 | return getDOMPrototype<JSMockCDMFactory>(vm, globalObject); |
148 | } |
149 | |
150 | void JSMockCDMFactory::destroy(JSC::JSCell* cell) |
151 | { |
152 | JSMockCDMFactory* thisObject = static_cast<JSMockCDMFactory*>(cell); |
153 | thisObject->JSMockCDMFactory::~JSMockCDMFactory(); |
154 | } |
155 | |
156 | template<> inline JSMockCDMFactory* IDLAttribute<JSMockCDMFactory>::cast(ExecState& state, EncodedJSValue thisValue) |
157 | { |
158 | return jsDynamicCast<JSMockCDMFactory*>(state.vm(), JSValue::decode(thisValue)); |
159 | } |
160 | |
161 | template<> inline JSMockCDMFactory* IDLOperation<JSMockCDMFactory>::cast(ExecState& state) |
162 | { |
163 | return jsDynamicCast<JSMockCDMFactory*>(state.vm(), state.thisValue()); |
164 | } |
165 | |
166 | static inline JSValue jsMockCDMFactorySupportedDataTypesGetter(ExecState& state, JSMockCDMFactory& thisObject, ThrowScope& throwScope) |
167 | { |
168 | UNUSED_PARAM(throwScope); |
169 | UNUSED_PARAM(state); |
170 | auto& impl = thisObject.wrapped(); |
171 | JSValue result = toJS<IDLSequence<IDLDOMString>>(state, *thisObject.globalObject(), throwScope, impl.supportedDataTypes()); |
172 | return result; |
173 | } |
174 | |
175 | EncodedJSValue jsMockCDMFactorySupportedDataTypes(ExecState* state, EncodedJSValue thisValue, PropertyName) |
176 | { |
177 | return IDLAttribute<JSMockCDMFactory>::get<jsMockCDMFactorySupportedDataTypesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supportedDataTypes" ); |
178 | } |
179 | |
180 | static inline bool setJSMockCDMFactorySupportedDataTypesSetter(ExecState& state, JSMockCDMFactory& thisObject, JSValue value, ThrowScope& throwScope) |
181 | { |
182 | UNUSED_PARAM(throwScope); |
183 | auto& impl = thisObject.wrapped(); |
184 | auto nativeValue = convert<IDLSequence<IDLDOMString>>(state, value); |
185 | RETURN_IF_EXCEPTION(throwScope, false); |
186 | AttributeSetter::call(state, throwScope, [&] { |
187 | return impl.setSupportedDataTypes(WTFMove(nativeValue)); |
188 | }); |
189 | return true; |
190 | } |
191 | |
192 | bool setJSMockCDMFactorySupportedDataTypes(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
193 | { |
194 | return IDLAttribute<JSMockCDMFactory>::set<setJSMockCDMFactorySupportedDataTypesSetter>(*state, thisValue, encodedValue, "supportedDataTypes" ); |
195 | } |
196 | |
197 | static inline JSValue jsMockCDMFactorySupportedRobustnessGetter(ExecState& state, JSMockCDMFactory& thisObject, ThrowScope& throwScope) |
198 | { |
199 | UNUSED_PARAM(throwScope); |
200 | UNUSED_PARAM(state); |
201 | auto& impl = thisObject.wrapped(); |
202 | JSValue result = toJS<IDLSequence<IDLDOMString>>(state, *thisObject.globalObject(), throwScope, impl.supportedRobustness()); |
203 | return result; |
204 | } |
205 | |
206 | EncodedJSValue jsMockCDMFactorySupportedRobustness(ExecState* state, EncodedJSValue thisValue, PropertyName) |
207 | { |
208 | return IDLAttribute<JSMockCDMFactory>::get<jsMockCDMFactorySupportedRobustnessGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supportedRobustness" ); |
209 | } |
210 | |
211 | static inline bool setJSMockCDMFactorySupportedRobustnessSetter(ExecState& state, JSMockCDMFactory& thisObject, JSValue value, ThrowScope& throwScope) |
212 | { |
213 | UNUSED_PARAM(throwScope); |
214 | auto& impl = thisObject.wrapped(); |
215 | auto nativeValue = convert<IDLSequence<IDLDOMString>>(state, value); |
216 | RETURN_IF_EXCEPTION(throwScope, false); |
217 | AttributeSetter::call(state, throwScope, [&] { |
218 | return impl.setSupportedRobustness(WTFMove(nativeValue)); |
219 | }); |
220 | return true; |
221 | } |
222 | |
223 | bool setJSMockCDMFactorySupportedRobustness(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
224 | { |
225 | return IDLAttribute<JSMockCDMFactory>::set<setJSMockCDMFactorySupportedRobustnessSetter>(*state, thisValue, encodedValue, "supportedRobustness" ); |
226 | } |
227 | |
228 | static inline JSValue jsMockCDMFactorySupportedSessionTypesGetter(ExecState& state, JSMockCDMFactory& thisObject, ThrowScope& throwScope) |
229 | { |
230 | UNUSED_PARAM(throwScope); |
231 | UNUSED_PARAM(state); |
232 | auto& impl = thisObject.wrapped(); |
233 | JSValue result = toJS<IDLSequence<IDLEnumeration<MediaKeySessionType>>>(state, *thisObject.globalObject(), throwScope, impl.supportedSessionTypes()); |
234 | return result; |
235 | } |
236 | |
237 | EncodedJSValue jsMockCDMFactorySupportedSessionTypes(ExecState* state, EncodedJSValue thisValue, PropertyName) |
238 | { |
239 | return IDLAttribute<JSMockCDMFactory>::get<jsMockCDMFactorySupportedSessionTypesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supportedSessionTypes" ); |
240 | } |
241 | |
242 | static inline bool setJSMockCDMFactorySupportedSessionTypesSetter(ExecState& state, JSMockCDMFactory& thisObject, JSValue value, ThrowScope& throwScope) |
243 | { |
244 | UNUSED_PARAM(throwScope); |
245 | auto& impl = thisObject.wrapped(); |
246 | auto nativeValue = convert<IDLSequence<IDLEnumeration<MediaKeySessionType>>>(state, value); |
247 | RETURN_IF_EXCEPTION(throwScope, false); |
248 | AttributeSetter::call(state, throwScope, [&] { |
249 | return impl.setSupportedSessionTypes(WTFMove(nativeValue)); |
250 | }); |
251 | return true; |
252 | } |
253 | |
254 | bool setJSMockCDMFactorySupportedSessionTypes(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
255 | { |
256 | return IDLAttribute<JSMockCDMFactory>::set<setJSMockCDMFactorySupportedSessionTypesSetter>(*state, thisValue, encodedValue, "supportedSessionTypes" ); |
257 | } |
258 | |
259 | static inline JSValue jsMockCDMFactoryDistinctiveIdentifiersRequirementGetter(ExecState& state, JSMockCDMFactory& thisObject, ThrowScope& throwScope) |
260 | { |
261 | UNUSED_PARAM(throwScope); |
262 | UNUSED_PARAM(state); |
263 | auto& impl = thisObject.wrapped(); |
264 | JSValue result = toJS<IDLEnumeration<MediaKeysRequirement>>(state, throwScope, impl.distinctiveIdentifiersRequirement()); |
265 | return result; |
266 | } |
267 | |
268 | EncodedJSValue jsMockCDMFactoryDistinctiveIdentifiersRequirement(ExecState* state, EncodedJSValue thisValue, PropertyName) |
269 | { |
270 | return IDLAttribute<JSMockCDMFactory>::get<jsMockCDMFactoryDistinctiveIdentifiersRequirementGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "distinctiveIdentifiersRequirement" ); |
271 | } |
272 | |
273 | static inline bool setJSMockCDMFactoryDistinctiveIdentifiersRequirementSetter(ExecState& state, JSMockCDMFactory& thisObject, JSValue value, ThrowScope& throwScope) |
274 | { |
275 | UNUSED_PARAM(throwScope); |
276 | auto& impl = thisObject.wrapped(); |
277 | auto optionalNativeValue = parseEnumeration<MediaKeysRequirement>(state, value); |
278 | RETURN_IF_EXCEPTION(throwScope, false); |
279 | if (UNLIKELY(!optionalNativeValue)) |
280 | return false; |
281 | auto nativeValue = optionalNativeValue.value(); |
282 | AttributeSetter::call(state, throwScope, [&] { |
283 | return impl.setDistinctiveIdentifiersRequirement(WTFMove(nativeValue)); |
284 | }); |
285 | return true; |
286 | } |
287 | |
288 | bool setJSMockCDMFactoryDistinctiveIdentifiersRequirement(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
289 | { |
290 | return IDLAttribute<JSMockCDMFactory>::set<setJSMockCDMFactoryDistinctiveIdentifiersRequirementSetter>(*state, thisValue, encodedValue, "distinctiveIdentifiersRequirement" ); |
291 | } |
292 | |
293 | static inline JSValue jsMockCDMFactoryPersistentStateRequirementGetter(ExecState& state, JSMockCDMFactory& thisObject, ThrowScope& throwScope) |
294 | { |
295 | UNUSED_PARAM(throwScope); |
296 | UNUSED_PARAM(state); |
297 | auto& impl = thisObject.wrapped(); |
298 | JSValue result = toJS<IDLEnumeration<MediaKeysRequirement>>(state, throwScope, impl.persistentStateRequirement()); |
299 | return result; |
300 | } |
301 | |
302 | EncodedJSValue jsMockCDMFactoryPersistentStateRequirement(ExecState* state, EncodedJSValue thisValue, PropertyName) |
303 | { |
304 | return IDLAttribute<JSMockCDMFactory>::get<jsMockCDMFactoryPersistentStateRequirementGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "persistentStateRequirement" ); |
305 | } |
306 | |
307 | static inline bool setJSMockCDMFactoryPersistentStateRequirementSetter(ExecState& state, JSMockCDMFactory& thisObject, JSValue value, ThrowScope& throwScope) |
308 | { |
309 | UNUSED_PARAM(throwScope); |
310 | auto& impl = thisObject.wrapped(); |
311 | auto optionalNativeValue = parseEnumeration<MediaKeysRequirement>(state, value); |
312 | RETURN_IF_EXCEPTION(throwScope, false); |
313 | if (UNLIKELY(!optionalNativeValue)) |
314 | return false; |
315 | auto nativeValue = optionalNativeValue.value(); |
316 | AttributeSetter::call(state, throwScope, [&] { |
317 | return impl.setPersistentStateRequirement(WTFMove(nativeValue)); |
318 | }); |
319 | return true; |
320 | } |
321 | |
322 | bool setJSMockCDMFactoryPersistentStateRequirement(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
323 | { |
324 | return IDLAttribute<JSMockCDMFactory>::set<setJSMockCDMFactoryPersistentStateRequirementSetter>(*state, thisValue, encodedValue, "persistentStateRequirement" ); |
325 | } |
326 | |
327 | static inline JSValue jsMockCDMFactoryCanCreateInstancesGetter(ExecState& state, JSMockCDMFactory& thisObject, ThrowScope& throwScope) |
328 | { |
329 | UNUSED_PARAM(throwScope); |
330 | UNUSED_PARAM(state); |
331 | auto& impl = thisObject.wrapped(); |
332 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.canCreateInstances()); |
333 | return result; |
334 | } |
335 | |
336 | EncodedJSValue jsMockCDMFactoryCanCreateInstances(ExecState* state, EncodedJSValue thisValue, PropertyName) |
337 | { |
338 | return IDLAttribute<JSMockCDMFactory>::get<jsMockCDMFactoryCanCreateInstancesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "canCreateInstances" ); |
339 | } |
340 | |
341 | static inline bool setJSMockCDMFactoryCanCreateInstancesSetter(ExecState& state, JSMockCDMFactory& thisObject, JSValue value, ThrowScope& throwScope) |
342 | { |
343 | UNUSED_PARAM(throwScope); |
344 | auto& impl = thisObject.wrapped(); |
345 | auto nativeValue = convert<IDLBoolean>(state, value); |
346 | RETURN_IF_EXCEPTION(throwScope, false); |
347 | AttributeSetter::call(state, throwScope, [&] { |
348 | return impl.setCanCreateInstances(WTFMove(nativeValue)); |
349 | }); |
350 | return true; |
351 | } |
352 | |
353 | bool setJSMockCDMFactoryCanCreateInstances(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
354 | { |
355 | return IDLAttribute<JSMockCDMFactory>::set<setJSMockCDMFactoryCanCreateInstancesSetter>(*state, thisValue, encodedValue, "canCreateInstances" ); |
356 | } |
357 | |
358 | static inline JSValue jsMockCDMFactorySupportsServerCertificatesGetter(ExecState& state, JSMockCDMFactory& thisObject, ThrowScope& throwScope) |
359 | { |
360 | UNUSED_PARAM(throwScope); |
361 | UNUSED_PARAM(state); |
362 | auto& impl = thisObject.wrapped(); |
363 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.supportsServerCertificates()); |
364 | return result; |
365 | } |
366 | |
367 | EncodedJSValue jsMockCDMFactorySupportsServerCertificates(ExecState* state, EncodedJSValue thisValue, PropertyName) |
368 | { |
369 | return IDLAttribute<JSMockCDMFactory>::get<jsMockCDMFactorySupportsServerCertificatesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supportsServerCertificates" ); |
370 | } |
371 | |
372 | static inline bool setJSMockCDMFactorySupportsServerCertificatesSetter(ExecState& state, JSMockCDMFactory& thisObject, JSValue value, ThrowScope& throwScope) |
373 | { |
374 | UNUSED_PARAM(throwScope); |
375 | auto& impl = thisObject.wrapped(); |
376 | auto nativeValue = convert<IDLBoolean>(state, value); |
377 | RETURN_IF_EXCEPTION(throwScope, false); |
378 | AttributeSetter::call(state, throwScope, [&] { |
379 | return impl.setSupportsServerCertificates(WTFMove(nativeValue)); |
380 | }); |
381 | return true; |
382 | } |
383 | |
384 | bool setJSMockCDMFactorySupportsServerCertificates(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
385 | { |
386 | return IDLAttribute<JSMockCDMFactory>::set<setJSMockCDMFactorySupportsServerCertificatesSetter>(*state, thisValue, encodedValue, "supportsServerCertificates" ); |
387 | } |
388 | |
389 | static inline JSValue jsMockCDMFactorySupportsSessionsGetter(ExecState& state, JSMockCDMFactory& thisObject, ThrowScope& throwScope) |
390 | { |
391 | UNUSED_PARAM(throwScope); |
392 | UNUSED_PARAM(state); |
393 | auto& impl = thisObject.wrapped(); |
394 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.supportsSessions()); |
395 | return result; |
396 | } |
397 | |
398 | EncodedJSValue jsMockCDMFactorySupportsSessions(ExecState* state, EncodedJSValue thisValue, PropertyName) |
399 | { |
400 | return IDLAttribute<JSMockCDMFactory>::get<jsMockCDMFactorySupportsSessionsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supportsSessions" ); |
401 | } |
402 | |
403 | static inline bool setJSMockCDMFactorySupportsSessionsSetter(ExecState& state, JSMockCDMFactory& thisObject, JSValue value, ThrowScope& throwScope) |
404 | { |
405 | UNUSED_PARAM(throwScope); |
406 | auto& impl = thisObject.wrapped(); |
407 | auto nativeValue = convert<IDLBoolean>(state, value); |
408 | RETURN_IF_EXCEPTION(throwScope, false); |
409 | AttributeSetter::call(state, throwScope, [&] { |
410 | return impl.setSupportsSessions(WTFMove(nativeValue)); |
411 | }); |
412 | return true; |
413 | } |
414 | |
415 | bool setJSMockCDMFactorySupportsSessions(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
416 | { |
417 | return IDLAttribute<JSMockCDMFactory>::set<setJSMockCDMFactorySupportsSessionsSetter>(*state, thisValue, encodedValue, "supportsSessions" ); |
418 | } |
419 | |
420 | static inline JSValue jsMockCDMFactorySupportedEncryptionSchemesGetter(ExecState& state, JSMockCDMFactory& thisObject, ThrowScope& throwScope) |
421 | { |
422 | UNUSED_PARAM(throwScope); |
423 | UNUSED_PARAM(state); |
424 | auto& impl = thisObject.wrapped(); |
425 | JSValue result = toJS<IDLSequence<IDLEnumeration<MediaKeyEncryptionScheme>>>(state, *thisObject.globalObject(), throwScope, impl.supportedEncryptionSchemes()); |
426 | return result; |
427 | } |
428 | |
429 | EncodedJSValue jsMockCDMFactorySupportedEncryptionSchemes(ExecState* state, EncodedJSValue thisValue, PropertyName) |
430 | { |
431 | return IDLAttribute<JSMockCDMFactory>::get<jsMockCDMFactorySupportedEncryptionSchemesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "supportedEncryptionSchemes" ); |
432 | } |
433 | |
434 | static inline bool setJSMockCDMFactorySupportedEncryptionSchemesSetter(ExecState& state, JSMockCDMFactory& thisObject, JSValue value, ThrowScope& throwScope) |
435 | { |
436 | UNUSED_PARAM(throwScope); |
437 | auto& impl = thisObject.wrapped(); |
438 | auto nativeValue = convert<IDLSequence<IDLEnumeration<MediaKeyEncryptionScheme>>>(state, value); |
439 | RETURN_IF_EXCEPTION(throwScope, false); |
440 | AttributeSetter::call(state, throwScope, [&] { |
441 | return impl.setSupportedEncryptionSchemes(WTFMove(nativeValue)); |
442 | }); |
443 | return true; |
444 | } |
445 | |
446 | bool setJSMockCDMFactorySupportedEncryptionSchemes(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
447 | { |
448 | return IDLAttribute<JSMockCDMFactory>::set<setJSMockCDMFactorySupportedEncryptionSchemesSetter>(*state, thisValue, encodedValue, "supportedEncryptionSchemes" ); |
449 | } |
450 | |
451 | static inline JSC::EncodedJSValue jsMockCDMFactoryPrototypeFunctionUnregisterBody(JSC::ExecState* state, typename IDLOperation<JSMockCDMFactory>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
452 | { |
453 | UNUSED_PARAM(state); |
454 | UNUSED_PARAM(throwScope); |
455 | auto& impl = castedThis->wrapped(); |
456 | impl.unregister(); |
457 | return JSValue::encode(jsUndefined()); |
458 | } |
459 | |
460 | EncodedJSValue JSC_HOST_CALL jsMockCDMFactoryPrototypeFunctionUnregister(ExecState* state) |
461 | { |
462 | return IDLOperation<JSMockCDMFactory>::call<jsMockCDMFactoryPrototypeFunctionUnregisterBody>(*state, "unregister" ); |
463 | } |
464 | |
465 | void JSMockCDMFactory::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
466 | { |
467 | auto* thisObject = jsCast<JSMockCDMFactory*>(cell); |
468 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
469 | if (thisObject->scriptExecutionContext()) |
470 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
471 | Base::heapSnapshot(cell, builder); |
472 | } |
473 | |
474 | bool JSMockCDMFactoryOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
475 | { |
476 | UNUSED_PARAM(handle); |
477 | UNUSED_PARAM(visitor); |
478 | UNUSED_PARAM(reason); |
479 | return false; |
480 | } |
481 | |
482 | void JSMockCDMFactoryOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
483 | { |
484 | auto* jsMockCDMFactory = static_cast<JSMockCDMFactory*>(handle.slot()->asCell()); |
485 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
486 | uncacheWrapper(world, &jsMockCDMFactory->wrapped(), jsMockCDMFactory); |
487 | } |
488 | |
489 | #if ENABLE(BINDING_INTEGRITY) |
490 | #if PLATFORM(WIN) |
491 | #pragma warning(disable: 4483) |
492 | extern "C" { extern void (*const __identifier("??_7MockCDMFactory@WebCore@@6B@" )[])(); } |
493 | #else |
494 | extern "C" { extern void* _ZTVN7WebCore14MockCDMFactoryE[]; } |
495 | #endif |
496 | #endif |
497 | |
498 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<MockCDMFactory>&& impl) |
499 | { |
500 | |
501 | #if ENABLE(BINDING_INTEGRITY) |
502 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
503 | #if PLATFORM(WIN) |
504 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7MockCDMFactory@WebCore@@6B@" )); |
505 | #else |
506 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore14MockCDMFactoryE[2]); |
507 | #endif |
508 | |
509 | // If this fails MockCDMFactory does not have a vtable, so you need to add the |
510 | // ImplementationLacksVTable attribute to the interface definition |
511 | static_assert(std::is_polymorphic<MockCDMFactory>::value, "MockCDMFactory is not polymorphic" ); |
512 | |
513 | // If you hit this assertion you either have a use after free bug, or |
514 | // MockCDMFactory has subclasses. If MockCDMFactory has subclasses that get passed |
515 | // to toJS() we currently require MockCDMFactory you to opt out of binding hardening |
516 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
517 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
518 | #endif |
519 | return createWrapper<MockCDMFactory>(globalObject, WTFMove(impl)); |
520 | } |
521 | |
522 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, MockCDMFactory& impl) |
523 | { |
524 | return wrap(state, globalObject, impl); |
525 | } |
526 | |
527 | MockCDMFactory* JSMockCDMFactory::toWrapped(JSC::VM& vm, JSC::JSValue value) |
528 | { |
529 | if (auto* wrapper = jsDynamicCast<JSMockCDMFactory*>(vm, value)) |
530 | return &wrapper->wrapped(); |
531 | return nullptr; |
532 | } |
533 | |
534 | } |
535 | |
536 | #endif // ENABLE(ENCRYPTED_MEDIA) |
537 | |