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(WEB_RTC)
24
25#include "JSRTCIceTransport.h"
26
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructorNotConstructable.h"
30#include "JSDOMConvertEnumeration.h"
31#include "JSDOMExceptionHandling.h"
32#include "JSDOMWrapperCache.h"
33#include "JSRTCIceGatheringState.h"
34#include "JSRTCIceTransportState.h"
35#include "ScriptExecutionContext.h"
36#include <JavaScriptCore/FunctionPrototype.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
44namespace WebCore {
45using namespace JSC;
46
47// Attributes
48
49JSC::EncodedJSValue jsRTCIceTransportConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
50bool setJSRTCIceTransportConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
51JSC::EncodedJSValue jsRTCIceTransportState(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52JSC::EncodedJSValue jsRTCIceTransportGatheringState(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53
54class JSRTCIceTransportPrototype : public JSC::JSNonFinalObject {
55public:
56 using Base = JSC::JSNonFinalObject;
57 static JSRTCIceTransportPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
58 {
59 JSRTCIceTransportPrototype* ptr = new (NotNull, JSC::allocateCell<JSRTCIceTransportPrototype>(vm.heap)) JSRTCIceTransportPrototype(vm, globalObject, structure);
60 ptr->finishCreation(vm);
61 return ptr;
62 }
63
64 DECLARE_INFO;
65 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
66 {
67 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
68 }
69
70private:
71 JSRTCIceTransportPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
72 : JSC::JSNonFinalObject(vm, structure)
73 {
74 }
75
76 void finishCreation(JSC::VM&);
77};
78
79using JSRTCIceTransportConstructor = JSDOMConstructorNotConstructable<JSRTCIceTransport>;
80
81template<> JSValue JSRTCIceTransportConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
82{
83 UNUSED_PARAM(vm);
84 return globalObject.functionPrototype();
85}
86
87template<> void JSRTCIceTransportConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
88{
89 putDirect(vm, vm.propertyNames->prototype, JSRTCIceTransport::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
90 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("RTCIceTransport"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
91 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
92}
93
94template<> const ClassInfo JSRTCIceTransportConstructor::s_info = { "RTCIceTransport", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRTCIceTransportConstructor) };
95
96/* Hash table for prototype */
97
98static const HashTableValue JSRTCIceTransportPrototypeTableValues[] =
99{
100 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCIceTransportConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSRTCIceTransportConstructor) } },
101 { "state", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCIceTransportState), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
102 { "gatheringState", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRTCIceTransportGatheringState), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
103};
104
105const ClassInfo JSRTCIceTransportPrototype::s_info = { "RTCIceTransportPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRTCIceTransportPrototype) };
106
107void JSRTCIceTransportPrototype::finishCreation(VM& vm)
108{
109 Base::finishCreation(vm);
110 reifyStaticProperties(vm, JSRTCIceTransport::info(), JSRTCIceTransportPrototypeTableValues, *this);
111}
112
113const ClassInfo JSRTCIceTransport::s_info = { "RTCIceTransport", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSRTCIceTransport) };
114
115JSRTCIceTransport::JSRTCIceTransport(Structure* structure, JSDOMGlobalObject& globalObject, Ref<RTCIceTransport>&& impl)
116 : JSDOMWrapper<RTCIceTransport>(structure, globalObject, WTFMove(impl))
117{
118}
119
120void JSRTCIceTransport::finishCreation(VM& vm)
121{
122 Base::finishCreation(vm);
123 ASSERT(inherits(vm, info()));
124
125}
126
127JSObject* JSRTCIceTransport::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
128{
129 return JSRTCIceTransportPrototype::create(vm, &globalObject, JSRTCIceTransportPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
130}
131
132JSObject* JSRTCIceTransport::prototype(VM& vm, JSDOMGlobalObject& globalObject)
133{
134 return getDOMPrototype<JSRTCIceTransport>(vm, globalObject);
135}
136
137JSValue JSRTCIceTransport::getConstructor(VM& vm, const JSGlobalObject* globalObject)
138{
139 return getDOMConstructor<JSRTCIceTransportConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
140}
141
142void JSRTCIceTransport::destroy(JSC::JSCell* cell)
143{
144 JSRTCIceTransport* thisObject = static_cast<JSRTCIceTransport*>(cell);
145 thisObject->JSRTCIceTransport::~JSRTCIceTransport();
146}
147
148template<> inline JSRTCIceTransport* IDLAttribute<JSRTCIceTransport>::cast(ExecState& state, EncodedJSValue thisValue)
149{
150 return jsDynamicCast<JSRTCIceTransport*>(state.vm(), JSValue::decode(thisValue));
151}
152
153EncodedJSValue jsRTCIceTransportConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
154{
155 VM& vm = state->vm();
156 auto throwScope = DECLARE_THROW_SCOPE(vm);
157 auto* prototype = jsDynamicCast<JSRTCIceTransportPrototype*>(vm, JSValue::decode(thisValue));
158 if (UNLIKELY(!prototype))
159 return throwVMTypeError(state, throwScope);
160 return JSValue::encode(JSRTCIceTransport::getConstructor(state->vm(), prototype->globalObject()));
161}
162
163bool setJSRTCIceTransportConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
164{
165 VM& vm = state->vm();
166 auto throwScope = DECLARE_THROW_SCOPE(vm);
167 auto* prototype = jsDynamicCast<JSRTCIceTransportPrototype*>(vm, JSValue::decode(thisValue));
168 if (UNLIKELY(!prototype)) {
169 throwVMTypeError(state, throwScope);
170 return false;
171 }
172 // Shadowing a built-in constructor
173 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
174}
175
176static inline JSValue jsRTCIceTransportStateGetter(ExecState& state, JSRTCIceTransport& thisObject, ThrowScope& throwScope)
177{
178 UNUSED_PARAM(throwScope);
179 UNUSED_PARAM(state);
180 auto& impl = thisObject.wrapped();
181 JSValue result = toJS<IDLEnumeration<RTCIceTransportState>>(state, throwScope, impl.state());
182 return result;
183}
184
185EncodedJSValue jsRTCIceTransportState(ExecState* state, EncodedJSValue thisValue, PropertyName)
186{
187 return IDLAttribute<JSRTCIceTransport>::get<jsRTCIceTransportStateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "state");
188}
189
190static inline JSValue jsRTCIceTransportGatheringStateGetter(ExecState& state, JSRTCIceTransport& thisObject, ThrowScope& throwScope)
191{
192 UNUSED_PARAM(throwScope);
193 UNUSED_PARAM(state);
194 auto& impl = thisObject.wrapped();
195 JSValue result = toJS<IDLEnumeration<RTCIceGatheringState>>(state, throwScope, impl.gatheringState());
196 return result;
197}
198
199EncodedJSValue jsRTCIceTransportGatheringState(ExecState* state, EncodedJSValue thisValue, PropertyName)
200{
201 return IDLAttribute<JSRTCIceTransport>::get<jsRTCIceTransportGatheringStateGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "gatheringState");
202}
203
204void JSRTCIceTransport::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
205{
206 auto* thisObject = jsCast<JSRTCIceTransport*>(cell);
207 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
208 if (thisObject->scriptExecutionContext())
209 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
210 Base::heapSnapshot(cell, builder);
211}
212
213bool JSRTCIceTransportOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
214{
215 UNUSED_PARAM(handle);
216 UNUSED_PARAM(visitor);
217 UNUSED_PARAM(reason);
218 return false;
219}
220
221void JSRTCIceTransportOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
222{
223 auto* jsRTCIceTransport = static_cast<JSRTCIceTransport*>(handle.slot()->asCell());
224 auto& world = *static_cast<DOMWrapperWorld*>(context);
225 uncacheWrapper(world, &jsRTCIceTransport->wrapped(), jsRTCIceTransport);
226}
227
228#if ENABLE(BINDING_INTEGRITY)
229#if PLATFORM(WIN)
230#pragma warning(disable: 4483)
231extern "C" { extern void (*const __identifier("??_7RTCIceTransport@WebCore@@6B@")[])(); }
232#else
233extern "C" { extern void* _ZTVN7WebCore15RTCIceTransportE[]; }
234#endif
235#endif
236
237JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<RTCIceTransport>&& impl)
238{
239
240#if ENABLE(BINDING_INTEGRITY)
241 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
242#if PLATFORM(WIN)
243 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7RTCIceTransport@WebCore@@6B@"));
244#else
245 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore15RTCIceTransportE[2]);
246#endif
247
248 // If this fails RTCIceTransport does not have a vtable, so you need to add the
249 // ImplementationLacksVTable attribute to the interface definition
250 static_assert(std::is_polymorphic<RTCIceTransport>::value, "RTCIceTransport is not polymorphic");
251
252 // If you hit this assertion you either have a use after free bug, or
253 // RTCIceTransport has subclasses. If RTCIceTransport has subclasses that get passed
254 // to toJS() we currently require RTCIceTransport you to opt out of binding hardening
255 // by adding the SkipVTableValidation attribute to the interface IDL definition
256 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
257#endif
258 return createWrapper<RTCIceTransport>(globalObject, WTFMove(impl));
259}
260
261JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RTCIceTransport& impl)
262{
263 return wrap(state, globalObject, impl);
264}
265
266RTCIceTransport* JSRTCIceTransport::toWrapped(JSC::VM& vm, JSC::JSValue value)
267{
268 if (auto* wrapper = jsDynamicCast<JSRTCIceTransport*>(vm, value))
269 return &wrapper->wrapped();
270 return nullptr;
271}
272
273}
274
275#endif // ENABLE(WEB_RTC)
276