blob: d1643b2f14f6837ac74e9447d37ffa294d69fbf7 [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 "JSRTCIceCandidate.h"
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "URL.h"
#include <runtime/Error.h>
#include <runtime/FunctionPrototype.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
#if ENABLE(WEB_RTC)
#include "Dictionary.h"
#endif
using namespace JSC;
namespace WebCore {
// Attributes
JSC::EncodedJSValue jsRTCIceCandidateCandidate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCIceCandidateSdpMid(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCIceCandidateSdpMLineIndex(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsRTCIceCandidateConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSRTCIceCandidateConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSRTCIceCandidatePrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSRTCIceCandidatePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSRTCIceCandidatePrototype* ptr = new (NotNull, JSC::allocateCell<JSRTCIceCandidatePrototype>(vm.heap)) JSRTCIceCandidatePrototype(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:
JSRTCIceCandidatePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructor<JSRTCIceCandidate> JSRTCIceCandidateConstructor;
template<> EncodedJSValue JSC_HOST_CALL JSRTCIceCandidateConstructor::construct(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
auto* castedThis = jsCast<JSRTCIceCandidateConstructor*>(state->callee());
ASSERT(castedThis);
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto dictionary = Dictionary(state, state->uncheckedArgument(0));
auto object = RTCIceCandidate::create(WTFMove(dictionary), ec);
if (UNLIKELY(ec)) {
setDOMException(state, throwScope, ec);
return JSValue::encode(JSValue());
}
return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
}
template<> JSValue JSRTCIceCandidateConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
UNUSED_PARAM(vm);
return globalObject.functionPrototype();
}
template<> void JSRTCIceCandidateConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSRTCIceCandidate::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("RTCIceCandidate"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
}
template<> const ClassInfo JSRTCIceCandidateConstructor::s_info = { "RTCIceCandidate", &Base::s_info, 0, CREATE_METHOD_TABLE(JSRTCIceCandidateConstructor) };
/* Hash table for prototype */
static const HashTableValue JSRTCIceCandidatePrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCIceCandidateConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRTCIceCandidateConstructor) } },
{ "candidate", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCIceCandidateCandidate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "sdpMid", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCIceCandidateSdpMid), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "sdpMLineIndex", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCIceCandidateSdpMLineIndex), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
};
const ClassInfo JSRTCIceCandidatePrototype::s_info = { "RTCIceCandidatePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSRTCIceCandidatePrototype) };
void JSRTCIceCandidatePrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSRTCIceCandidatePrototypeTableValues, *this);
}
const ClassInfo JSRTCIceCandidate::s_info = { "RTCIceCandidate", &Base::s_info, 0, CREATE_METHOD_TABLE(JSRTCIceCandidate) };
JSRTCIceCandidate::JSRTCIceCandidate(Structure* structure, JSDOMGlobalObject& globalObject, Ref<RTCIceCandidate>&& impl)
: JSDOMWrapper<RTCIceCandidate>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSRTCIceCandidate::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSRTCIceCandidatePrototype::create(vm, globalObject, JSRTCIceCandidatePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSRTCIceCandidate::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSRTCIceCandidate>(vm, globalObject);
}
void JSRTCIceCandidate::destroy(JSC::JSCell* cell)
{
JSRTCIceCandidate* thisObject = static_cast<JSRTCIceCandidate*>(cell);
thisObject->JSRTCIceCandidate::~JSRTCIceCandidate();
}
EncodedJSValue jsRTCIceCandidateCandidate(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<JSRTCIceCandidate*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCIceCandidate", "candidate");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.candidate());
return JSValue::encode(result);
}
EncodedJSValue jsRTCIceCandidateSdpMid(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<JSRTCIceCandidate*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCIceCandidate", "sdpMid");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringOrNull(state, impl.sdpMid());
return JSValue::encode(result);
}
EncodedJSValue jsRTCIceCandidateSdpMLineIndex(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<JSRTCIceCandidate*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "RTCIceCandidate", "sdpMLineIndex");
}
auto& impl = castedThis->wrapped();
JSValue result = toNullableJSNumber(impl.sdpMLineIndex());
return JSValue::encode(result);
}
EncodedJSValue jsRTCIceCandidateConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSRTCIceCandidatePrototype* domObject = jsDynamicCast<JSRTCIceCandidatePrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSRTCIceCandidate::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSRTCIceCandidateConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSRTCIceCandidatePrototype* domObject = jsDynamicCast<JSRTCIceCandidatePrototype*>(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);
}
JSValue JSRTCIceCandidate::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSRTCIceCandidateConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
bool JSRTCIceCandidateOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
UNUSED_PARAM(handle);
UNUSED_PARAM(visitor);
return false;
}
void JSRTCIceCandidateOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsRTCIceCandidate = jsCast<JSRTCIceCandidate*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsRTCIceCandidate->wrapped(), jsRTCIceCandidate);
}
#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7RTCIceCandidate@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore15RTCIceCandidateE[]; }
#endif
#endif
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<RTCIceCandidate>&& impl)
{
#if ENABLE(BINDING_INTEGRITY)
void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
#if PLATFORM(WIN)
void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7RTCIceCandidate@WebCore@@6B@"));
#else
void* expectedVTablePointer = &_ZTVN7WebCore15RTCIceCandidateE[2];
#if COMPILER(CLANG)
// If this fails RTCIceCandidate does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
static_assert(__is_polymorphic(RTCIceCandidate), "RTCIceCandidate is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
// RTCIceCandidate has subclasses. If RTCIceCandidate has subclasses that get passed
// to toJS() we currently require RTCIceCandidate you to opt out of binding hardening
// by adding the SkipVTableValidation attribute to the interface IDL definition
RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
return createWrapper<RTCIceCandidate>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RTCIceCandidate& impl)
{
return wrap(state, globalObject, impl);
}
RTCIceCandidate* JSRTCIceCandidate::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSRTCIceCandidate*>(value))
return &wrapper->wrapped();
return nullptr;
}
}
#endif // ENABLE(WEB_RTC)