| /* |
| This file is part of the WebKit open source project. |
| This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
| |
| This library is free software; you can redistribute it and/or |
| modify it under the terms of the GNU Library General Public |
| License as published by the Free Software Foundation; either |
| version 2 of the License, or (at your option) any later version. |
| |
| This library is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| Library General Public License for more details. |
| |
| You should have received a copy of the GNU Library General Public License |
| along with this library; see the file COPYING.LIB. If not, write to |
| the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| Boston, MA 02110-1301, USA. |
| */ |
| |
| #include "config.h" |
| |
| #if ENABLE(MEDIA_SESSION) |
| |
| #include "JSMediaRemoteControls.h" |
| |
| #include "EventNames.h" |
| #include "ExceptionCode.h" |
| #include "JSDOMBinding.h" |
| #include "JSDOMConstructor.h" |
| #include "JSEventListener.h" |
| #include <runtime/Error.h> |
| #include <wtf/GetPtr.h> |
| |
| using namespace JSC; |
| |
| namespace WebCore { |
| |
| // Attributes |
| |
| JSC::EncodedJSValue jsMediaRemoteControlsPreviousTrackEnabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSMediaRemoteControlsPreviousTrackEnabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsMediaRemoteControlsNextTrackEnabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSMediaRemoteControlsNextTrackEnabled(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsMediaRemoteControlsOnprevioustrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSMediaRemoteControlsOnprevioustrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsMediaRemoteControlsOnnexttrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSMediaRemoteControlsOnnexttrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| JSC::EncodedJSValue jsMediaRemoteControlsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| bool setJSMediaRemoteControlsConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| |
| class JSMediaRemoteControlsPrototype : public JSC::JSNonFinalObject { |
| public: |
| typedef JSC::JSNonFinalObject Base; |
| static JSMediaRemoteControlsPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) |
| { |
| JSMediaRemoteControlsPrototype* ptr = new (NotNull, JSC::allocateCell<JSMediaRemoteControlsPrototype>(vm.heap)) JSMediaRemoteControlsPrototype(vm, globalObject, structure); |
| ptr->finishCreation(vm); |
| return ptr; |
| } |
| |
| DECLARE_INFO; |
| static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| { |
| return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| } |
| |
| private: |
| JSMediaRemoteControlsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| : JSC::JSNonFinalObject(vm, structure) |
| { |
| } |
| |
| void finishCreation(JSC::VM&); |
| }; |
| |
| typedef JSDOMConstructor<JSMediaRemoteControls> JSMediaRemoteControlsConstructor; |
| |
| template<> EncodedJSValue JSC_HOST_CALL JSMediaRemoteControlsConstructor::construct(ExecState* state) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| auto* castedThis = jsCast<JSMediaRemoteControlsConstructor*>(state->callee()); |
| ASSERT(castedThis); |
| ScriptExecutionContext* context = castedThis->scriptExecutionContext(); |
| if (UNLIKELY(!context)) |
| return throwConstructorScriptExecutionContextUnavailableError(*state, throwScope, "MediaRemoteControls"); |
| auto object = MediaRemoteControls::create(*context); |
| return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))); |
| } |
| |
| template<> JSValue JSMediaRemoteControlsConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| { |
| return JSEventTarget::getConstructor(vm, &globalObject); |
| } |
| |
| template<> void JSMediaRemoteControlsConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| { |
| putDirect(vm, vm.propertyNames->prototype, JSMediaRemoteControls::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("MediaRemoteControls"))), ReadOnly | DontEnum); |
| putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum); |
| } |
| |
| template<> const ClassInfo JSMediaRemoteControlsConstructor::s_info = { "MediaRemoteControls", &Base::s_info, 0, CREATE_METHOD_TABLE(JSMediaRemoteControlsConstructor) }; |
| |
| /* Hash table for prototype */ |
| |
| static const HashTableValue JSMediaRemoteControlsPrototypeTableValues[] = |
| { |
| { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsConstructor) } }, |
| { "previousTrackEnabled", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsPreviousTrackEnabled), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsPreviousTrackEnabled) } }, |
| { "nextTrackEnabled", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsNextTrackEnabled), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsNextTrackEnabled) } }, |
| { "onprevioustrack", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsOnprevioustrack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsOnprevioustrack) } }, |
| { "onnexttrack", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMediaRemoteControlsOnnexttrack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSMediaRemoteControlsOnnexttrack) } }, |
| }; |
| |
| const ClassInfo JSMediaRemoteControlsPrototype::s_info = { "MediaRemoteControlsPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSMediaRemoteControlsPrototype) }; |
| |
| void JSMediaRemoteControlsPrototype::finishCreation(VM& vm) |
| { |
| Base::finishCreation(vm); |
| reifyStaticProperties(vm, JSMediaRemoteControlsPrototypeTableValues, *this); |
| } |
| |
| const ClassInfo JSMediaRemoteControls::s_info = { "MediaRemoteControls", &Base::s_info, 0, CREATE_METHOD_TABLE(JSMediaRemoteControls) }; |
| |
| JSMediaRemoteControls::JSMediaRemoteControls(Structure* structure, JSDOMGlobalObject& globalObject, Ref<MediaRemoteControls>&& impl) |
| : JSEventTarget(structure, globalObject, WTFMove(impl)) |
| { |
| } |
| |
| JSObject* JSMediaRemoteControls::createPrototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return JSMediaRemoteControlsPrototype::create(vm, globalObject, JSMediaRemoteControlsPrototype::createStructure(vm, globalObject, JSEventTarget::prototype(vm, globalObject))); |
| } |
| |
| JSObject* JSMediaRemoteControls::prototype(VM& vm, JSGlobalObject* globalObject) |
| { |
| return getDOMPrototype<JSMediaRemoteControls>(vm, globalObject); |
| } |
| |
| EncodedJSValue jsMediaRemoteControlsPreviousTrackEnabled(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSMediaRemoteControls*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "MediaRemoteControls", "previousTrackEnabled"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsBoolean(impl.previousTrackEnabled()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsMediaRemoteControlsNextTrackEnabled(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSMediaRemoteControls*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "MediaRemoteControls", "nextTrackEnabled"); |
| } |
| auto& impl = castedThis->wrapped(); |
| JSValue result = jsBoolean(impl.nextTrackEnabled()); |
| return JSValue::encode(result); |
| } |
| |
| |
| EncodedJSValue jsMediaRemoteControlsOnprevioustrack(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSMediaRemoteControls*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "MediaRemoteControls", "onprevioustrack"); |
| } |
| UNUSED_PARAM(state); |
| return JSValue::encode(eventHandlerAttribute(castedThis->wrapped(), eventNames().previoustrackEvent)); |
| } |
| |
| |
| EncodedJSValue jsMediaRemoteControlsOnnexttrack(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| UNUSED_PARAM(thisValue); |
| JSValue decodedThisValue = JSValue::decode(thisValue); |
| auto* castedThis = jsDynamicCast<JSMediaRemoteControls*>(decodedThisValue); |
| if (UNLIKELY(!castedThis)) { |
| return throwGetterTypeError(*state, throwScope, "MediaRemoteControls", "onnexttrack"); |
| } |
| UNUSED_PARAM(state); |
| return JSValue::encode(eventHandlerAttribute(castedThis->wrapped(), eventNames().nexttrackEvent)); |
| } |
| |
| |
| EncodedJSValue jsMediaRemoteControlsConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSMediaRemoteControlsPrototype* domObject = jsDynamicCast<JSMediaRemoteControlsPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) |
| return throwVMTypeError(state, throwScope); |
| return JSValue::encode(JSMediaRemoteControls::getConstructor(state->vm(), domObject->globalObject())); |
| } |
| |
| bool setJSMediaRemoteControlsConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| JSValue value = JSValue::decode(encodedValue); |
| JSMediaRemoteControlsPrototype* domObject = jsDynamicCast<JSMediaRemoteControlsPrototype*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!domObject)) { |
| throwVMTypeError(state, throwScope); |
| return false; |
| } |
| // Shadowing a built-in constructor |
| return domObject->putDirect(state->vm(), state->propertyNames().constructor, value); |
| } |
| |
| bool setJSMediaRemoteControlsPreviousTrackEnabled(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue value = JSValue::decode(encodedValue); |
| UNUSED_PARAM(thisValue); |
| JSMediaRemoteControls* castedThis = jsDynamicCast<JSMediaRemoteControls*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "MediaRemoteControls", "previousTrackEnabled"); |
| } |
| auto& impl = castedThis->wrapped(); |
| auto nativeValue = value.toBoolean(state); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setPreviousTrackEnabled(WTFMove(nativeValue)); |
| return true; |
| } |
| |
| |
| bool setJSMediaRemoteControlsNextTrackEnabled(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue value = JSValue::decode(encodedValue); |
| UNUSED_PARAM(thisValue); |
| JSMediaRemoteControls* castedThis = jsDynamicCast<JSMediaRemoteControls*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "MediaRemoteControls", "nextTrackEnabled"); |
| } |
| auto& impl = castedThis->wrapped(); |
| auto nativeValue = value.toBoolean(state); |
| RETURN_IF_EXCEPTION(throwScope, false); |
| impl.setNextTrackEnabled(WTFMove(nativeValue)); |
| return true; |
| } |
| |
| |
| bool setJSMediaRemoteControlsOnprevioustrack(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue value = JSValue::decode(encodedValue); |
| UNUSED_PARAM(thisValue); |
| JSMediaRemoteControls* castedThis = jsDynamicCast<JSMediaRemoteControls*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "MediaRemoteControls", "onprevioustrack"); |
| } |
| setEventHandlerAttribute(*state, *castedThis, castedThis->wrapped(), eventNames().previoustrackEvent, value); |
| return true; |
| } |
| |
| |
| bool setJSMediaRemoteControlsOnnexttrack(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| { |
| VM& vm = state->vm(); |
| auto throwScope = DECLARE_THROW_SCOPE(vm); |
| UNUSED_PARAM(throwScope); |
| JSValue value = JSValue::decode(encodedValue); |
| UNUSED_PARAM(thisValue); |
| JSMediaRemoteControls* castedThis = jsDynamicCast<JSMediaRemoteControls*>(JSValue::decode(thisValue)); |
| if (UNLIKELY(!castedThis)) { |
| return throwSetterTypeError(*state, throwScope, "MediaRemoteControls", "onnexttrack"); |
| } |
| setEventHandlerAttribute(*state, *castedThis, castedThis->wrapped(), eventNames().nexttrackEvent, value); |
| return true; |
| } |
| |
| |
| JSValue JSMediaRemoteControls::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| { |
| return getDOMConstructor<JSMediaRemoteControlsConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| } |
| |
| void JSMediaRemoteControls::visitChildren(JSCell* cell, SlotVisitor& visitor) |
| { |
| auto* thisObject = jsCast<JSMediaRemoteControls*>(cell); |
| ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
| Base::visitChildren(thisObject, visitor); |
| thisObject->wrapped().visitJSEventListeners(visitor); |
| } |
| |
| #if ENABLE(BINDING_INTEGRITY) |
| #if PLATFORM(WIN) |
| #pragma warning(disable: 4483) |
| extern "C" { extern void (*const __identifier("??_7MediaRemoteControls@WebCore@@6B@")[])(); } |
| #else |
| extern "C" { extern void* _ZTVN7WebCore19MediaRemoteControlsE[]; } |
| #endif |
| #endif |
| |
| JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<MediaRemoteControls>&& impl) |
| { |
| |
| #if ENABLE(BINDING_INTEGRITY) |
| void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| #if PLATFORM(WIN) |
| void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7MediaRemoteControls@WebCore@@6B@")); |
| #else |
| void* expectedVTablePointer = &_ZTVN7WebCore19MediaRemoteControlsE[2]; |
| #if COMPILER(CLANG) |
| // If this fails MediaRemoteControls does not have a vtable, so you need to add the |
| // ImplementationLacksVTable attribute to the interface definition |
| static_assert(__is_polymorphic(MediaRemoteControls), "MediaRemoteControls is not polymorphic"); |
| #endif |
| #endif |
| // If you hit this assertion you either have a use after free bug, or |
| // MediaRemoteControls has subclasses. If MediaRemoteControls has subclasses that get passed |
| // to toJS() we currently require MediaRemoteControls you to opt out of binding hardening |
| // by adding the SkipVTableValidation attribute to the interface IDL definition |
| RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| #endif |
| return createWrapper<MediaRemoteControls>(globalObject, WTFMove(impl)); |
| } |
| |
| JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, MediaRemoteControls& impl) |
| { |
| return wrap(state, globalObject, impl); |
| } |
| |
| MediaRemoteControls* JSMediaRemoteControls::toWrapped(JSC::JSValue value) |
| { |
| if (auto* wrapper = jsDynamicCast<JSMediaRemoteControls*>(value)) |
| return &wrapper->wrapped(); |
| return nullptr; |
| } |
| |
| } |
| |
| #endif // ENABLE(MEDIA_SESSION) |