blob: 574dd607f410b7be8e9cbd0400ceb8b9c53fd122 [file] [log] [blame]
/*
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(WEB_RTC)
#include "JSRTCDTMFSender.h"
#include "EventNames.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConvert.h"
#include "JSEventListener.h"
#include "JSMediaStreamTrack.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsRTCDTMFSenderPrototypeFunctionInsertDTMF(JSC::ExecState*);
// Attributes
JSC::EncodedJSValue jsRTCDTMFSenderCanInsertDTMF(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCDTMFSenderTrack(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCDTMFSenderToneBuffer(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCDTMFSenderDuration(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCDTMFSenderInterToneGap(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCDTMFSenderOntonechange(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSRTCDTMFSenderOntonechange(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
bool setJSRTCDTMFSenderConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSRTCDTMFSenderPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSRTCDTMFSenderPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSRTCDTMFSenderPrototype* ptr = new (NotNull, JSC::allocateCell<JSRTCDTMFSenderPrototype>(vm.heap)) JSRTCDTMFSenderPrototype(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:
JSRTCDTMFSenderPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
/* Hash table for prototype */
static const HashTableValue JSRTCDTMFSenderPrototypeTableValues[] =
{
{ "canInsertDTMF", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderCanInsertDTMF), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "track", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderTrack), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "toneBuffer", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderToneBuffer), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "duration", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderDuration), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "interToneGap", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderInterToneGap), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "ontonechange", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCDTMFSenderOntonechange), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRTCDTMFSenderOntonechange) } },
{ "insertDTMF", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsRTCDTMFSenderPrototypeFunctionInsertDTMF), (intptr_t) (1) } },
};
const ClassInfo JSRTCDTMFSenderPrototype::s_info = { "RTCDTMFSenderPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSRTCDTMFSenderPrototype) };
void JSRTCDTMFSenderPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSRTCDTMFSenderPrototypeTableValues, *this);
}
const ClassInfo JSRTCDTMFSender::s_info = { "RTCDTMFSender", &Base::s_info, 0, CREATE_METHOD_TABLE(JSRTCDTMFSender) };
JSRTCDTMFSender::JSRTCDTMFSender(Structure* structure, JSDOMGlobalObject& globalObject, Ref<RTCDTMFSender>&& impl)
: JSEventTarget(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSRTCDTMFSender::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSRTCDTMFSenderPrototype::create(vm, globalObject, JSRTCDTMFSenderPrototype::createStructure(vm, globalObject, JSEventTarget::prototype(vm, globalObject)));
}
JSObject* JSRTCDTMFSender::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSRTCDTMFSender>(vm, globalObject);
}
EncodedJSValue jsRTCDTMFSenderCanInsertDTMF(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<JSRTCDTMFSender*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCDTMFSender", "canInsertDTMF");
}
auto& impl = castedThis->wrapped();
JSValue result = jsBoolean(impl.canInsertDTMF());
return JSValue::encode(result);
}
EncodedJSValue jsRTCDTMFSenderTrack(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<JSRTCDTMFSender*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCDTMFSender", "track");
}
auto& impl = castedThis->wrapped();
JSValue result = toJS(state, castedThis->globalObject(), impl.track());
return JSValue::encode(result);
}
EncodedJSValue jsRTCDTMFSenderToneBuffer(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<JSRTCDTMFSender*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCDTMFSender", "toneBuffer");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.toneBuffer());
return JSValue::encode(result);
}
EncodedJSValue jsRTCDTMFSenderDuration(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<JSRTCDTMFSender*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCDTMFSender", "duration");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.duration());
return JSValue::encode(result);
}
EncodedJSValue jsRTCDTMFSenderInterToneGap(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<JSRTCDTMFSender*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCDTMFSender", "interToneGap");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.interToneGap());
return JSValue::encode(result);
}
EncodedJSValue jsRTCDTMFSenderOntonechange(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<JSRTCDTMFSender*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCDTMFSender", "ontonechange");
}
UNUSED_PARAM(state);
return JSValue::encode(eventHandlerAttribute(castedThis->wrapped(), eventNames().tonechangeEvent));
}
bool setJSRTCDTMFSenderConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSRTCDTMFSenderPrototype* domObject = jsDynamicCast<JSRTCDTMFSenderPrototype*>(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 setJSRTCDTMFSenderOntonechange(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);
JSRTCDTMFSender* castedThis = jsDynamicCast<JSRTCDTMFSender*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, throwScope, "RTCDTMFSender", "ontonechange");
}
setEventHandlerAttribute(*state, *castedThis, castedThis->wrapped(), eventNames().tonechangeEvent, value);
return true;
}
EncodedJSValue JSC_HOST_CALL jsRTCDTMFSenderPrototypeFunctionInsertDTMF(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
JSValue thisValue = state->thisValue();
auto castedThis = jsDynamicCast<JSRTCDTMFSender*>(thisValue);
if (UNLIKELY(!castedThis))
return throwThisTypeError(*state, throwScope, "RTCDTMFSender", "insertDTMF");
ASSERT_GC_OBJECT_INHERITS(castedThis, JSRTCDTMFSender::info());
auto& impl = castedThis->wrapped();
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto tones = state->uncheckedArgument(0).toWTFString(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto duration = state->argument(1).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(1), NormalConversion);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto interToneGap = state->argument(2).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(2), NormalConversion);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
impl.insertDTMF(WTFMove(tones), WTFMove(duration), WTFMove(interToneGap), ec);
setDOMException(state, throwScope, ec);
return JSValue::encode(jsUndefined());
}
void JSRTCDTMFSender::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
auto* thisObject = jsCast<JSRTCDTMFSender*>(cell);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
Base::visitChildren(thisObject, visitor);
thisObject->wrapped().visitJSEventListeners(visitor);
}
bool JSRTCDTMFSenderOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
auto* jsRTCDTMFSender = jsCast<JSRTCDTMFSender*>(handle.slot()->asCell());
if (jsRTCDTMFSender->wrapped().hasPendingActivity())
return true;
if (jsRTCDTMFSender->wrapped().isFiringEventListeners())
return true;
UNUSED_PARAM(visitor);
return false;
}
void JSRTCDTMFSenderOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsRTCDTMFSender = jsCast<JSRTCDTMFSender*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsRTCDTMFSender->wrapped(), jsRTCDTMFSender);
}
#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7RTCDTMFSender@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore13RTCDTMFSenderE[]; }
#endif
#endif
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<RTCDTMFSender>&& impl)
{
#if ENABLE(BINDING_INTEGRITY)
void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
#if PLATFORM(WIN)
void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7RTCDTMFSender@WebCore@@6B@"));
#else
void* expectedVTablePointer = &_ZTVN7WebCore13RTCDTMFSenderE[2];
#if COMPILER(CLANG)
// If this fails RTCDTMFSender does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
static_assert(__is_polymorphic(RTCDTMFSender), "RTCDTMFSender is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
// RTCDTMFSender has subclasses. If RTCDTMFSender has subclasses that get passed
// to toJS() we currently require RTCDTMFSender you to opt out of binding hardening
// by adding the SkipVTableValidation attribute to the interface IDL definition
RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
return createWrapper<RTCDTMFSender>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RTCDTMFSender& impl)
{
return wrap(state, globalObject, impl);
}
RTCDTMFSender* JSRTCDTMFSender::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSRTCDTMFSender*>(value))
return &wrapper->wrapped();
return nullptr;
}
}
#endif // ENABLE(WEB_RTC)