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(MEDIA_STREAM) |
24 | |
25 | #include "JSOverconstrainedErrorEvent.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructor.h" |
30 | #include "JSDOMConvertBoolean.h" |
31 | #include "JSDOMConvertInterface.h" |
32 | #include "JSDOMConvertNullable.h" |
33 | #include "JSDOMExceptionHandling.h" |
34 | #include "JSDOMGlobalObject.h" |
35 | #include "JSDOMWrapperCache.h" |
36 | #include "JSOverconstrainedError.h" |
37 | #include "ScriptExecutionContext.h" |
38 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
39 | #include <JavaScriptCore/JSCInlines.h> |
40 | #include <wtf/GetPtr.h> |
41 | #include <wtf/PointerPreparations.h> |
42 | #include <wtf/URL.h> |
43 | |
44 | #if ENABLE(MEDIA_STREAM) |
45 | #include "JSDOMConvertStrings.h" |
46 | #endif |
47 | |
48 | |
49 | namespace WebCore { |
50 | using namespace JSC; |
51 | |
52 | template<> OverconstrainedErrorEvent::Init convertDictionary<OverconstrainedErrorEvent::Init>(ExecState& state, JSValue value) |
53 | { |
54 | VM& vm = state.vm(); |
55 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
56 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
57 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
58 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
59 | throwTypeError(&state, throwScope); |
60 | return { }; |
61 | } |
62 | OverconstrainedErrorEvent::Init result; |
63 | JSValue bubblesValue; |
64 | if (isNullOrUndefined) |
65 | bubblesValue = jsUndefined(); |
66 | else { |
67 | bubblesValue = object->get(&state, Identifier::fromString(&state, "bubbles" )); |
68 | RETURN_IF_EXCEPTION(throwScope, { }); |
69 | } |
70 | if (!bubblesValue.isUndefined()) { |
71 | result.bubbles = convert<IDLBoolean>(state, bubblesValue); |
72 | RETURN_IF_EXCEPTION(throwScope, { }); |
73 | } else |
74 | result.bubbles = false; |
75 | JSValue cancelableValue; |
76 | if (isNullOrUndefined) |
77 | cancelableValue = jsUndefined(); |
78 | else { |
79 | cancelableValue = object->get(&state, Identifier::fromString(&state, "cancelable" )); |
80 | RETURN_IF_EXCEPTION(throwScope, { }); |
81 | } |
82 | if (!cancelableValue.isUndefined()) { |
83 | result.cancelable = convert<IDLBoolean>(state, cancelableValue); |
84 | RETURN_IF_EXCEPTION(throwScope, { }); |
85 | } else |
86 | result.cancelable = false; |
87 | JSValue composedValue; |
88 | if (isNullOrUndefined) |
89 | composedValue = jsUndefined(); |
90 | else { |
91 | composedValue = object->get(&state, Identifier::fromString(&state, "composed" )); |
92 | RETURN_IF_EXCEPTION(throwScope, { }); |
93 | } |
94 | if (!composedValue.isUndefined()) { |
95 | result.composed = convert<IDLBoolean>(state, composedValue); |
96 | RETURN_IF_EXCEPTION(throwScope, { }); |
97 | } else |
98 | result.composed = false; |
99 | JSValue errorValue; |
100 | if (isNullOrUndefined) |
101 | errorValue = jsUndefined(); |
102 | else { |
103 | errorValue = object->get(&state, Identifier::fromString(&state, "error" )); |
104 | RETURN_IF_EXCEPTION(throwScope, { }); |
105 | } |
106 | if (!errorValue.isUndefined()) { |
107 | result.error = convert<IDLNullable<IDLInterface<OverconstrainedError>>>(state, errorValue); |
108 | RETURN_IF_EXCEPTION(throwScope, { }); |
109 | } else |
110 | result.error = nullptr; |
111 | return result; |
112 | } |
113 | |
114 | // Attributes |
115 | |
116 | JSC::EncodedJSValue jsOverconstrainedErrorEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
117 | bool setJSOverconstrainedErrorEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
118 | JSC::EncodedJSValue jsOverconstrainedErrorEventError(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
119 | |
120 | class JSOverconstrainedErrorEventPrototype : public JSC::JSNonFinalObject { |
121 | public: |
122 | using Base = JSC::JSNonFinalObject; |
123 | static JSOverconstrainedErrorEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
124 | { |
125 | JSOverconstrainedErrorEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSOverconstrainedErrorEventPrototype>(vm.heap)) JSOverconstrainedErrorEventPrototype(vm, globalObject, structure); |
126 | ptr->finishCreation(vm); |
127 | return ptr; |
128 | } |
129 | |
130 | DECLARE_INFO; |
131 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
132 | { |
133 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
134 | } |
135 | |
136 | private: |
137 | JSOverconstrainedErrorEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
138 | : JSC::JSNonFinalObject(vm, structure) |
139 | { |
140 | } |
141 | |
142 | void finishCreation(JSC::VM&); |
143 | }; |
144 | |
145 | using JSOverconstrainedErrorEventConstructor = JSDOMConstructor<JSOverconstrainedErrorEvent>; |
146 | |
147 | template<> EncodedJSValue JSC_HOST_CALL JSOverconstrainedErrorEventConstructor::construct(ExecState* state) |
148 | { |
149 | VM& vm = state->vm(); |
150 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
151 | UNUSED_PARAM(throwScope); |
152 | auto* castedThis = jsCast<JSOverconstrainedErrorEventConstructor*>(state->jsCallee()); |
153 | ASSERT(castedThis); |
154 | if (UNLIKELY(state->argumentCount() < 1)) |
155 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
156 | auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
157 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
158 | auto eventInitDict = convert<IDLDictionary<OverconstrainedErrorEvent::Init>>(*state, state->argument(1)); |
159 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
160 | auto object = OverconstrainedErrorEvent::create(WTFMove(type), WTFMove(eventInitDict)); |
161 | return JSValue::encode(toJSNewlyCreated<IDLInterface<OverconstrainedErrorEvent>>(*state, *castedThis->globalObject(), WTFMove(object))); |
162 | } |
163 | |
164 | template<> JSValue JSOverconstrainedErrorEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
165 | { |
166 | return JSEvent::getConstructor(vm, &globalObject); |
167 | } |
168 | |
169 | template<> void JSOverconstrainedErrorEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
170 | { |
171 | putDirect(vm, vm.propertyNames->prototype, JSOverconstrainedErrorEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
172 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("OverconstrainedErrorEvent"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
173 | putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
174 | } |
175 | |
176 | template<> const ClassInfo JSOverconstrainedErrorEventConstructor::s_info = { "OverconstrainedErrorEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOverconstrainedErrorEventConstructor) }; |
177 | |
178 | /* Hash table for prototype */ |
179 | |
180 | static const HashTableValue JSOverconstrainedErrorEventPrototypeTableValues[] = |
181 | { |
182 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsOverconstrainedErrorEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSOverconstrainedErrorEventConstructor) } }, |
183 | { "error" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsOverconstrainedErrorEventError), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
184 | }; |
185 | |
186 | const ClassInfo JSOverconstrainedErrorEventPrototype::s_info = { "OverconstrainedErrorEventPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOverconstrainedErrorEventPrototype) }; |
187 | |
188 | void JSOverconstrainedErrorEventPrototype::finishCreation(VM& vm) |
189 | { |
190 | Base::finishCreation(vm); |
191 | reifyStaticProperties(vm, JSOverconstrainedErrorEvent::info(), JSOverconstrainedErrorEventPrototypeTableValues, *this); |
192 | } |
193 | |
194 | const ClassInfo JSOverconstrainedErrorEvent::s_info = { "OverconstrainedErrorEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSOverconstrainedErrorEvent) }; |
195 | |
196 | JSOverconstrainedErrorEvent::JSOverconstrainedErrorEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<OverconstrainedErrorEvent>&& impl) |
197 | : JSEvent(structure, globalObject, WTFMove(impl)) |
198 | { |
199 | } |
200 | |
201 | void JSOverconstrainedErrorEvent::finishCreation(VM& vm) |
202 | { |
203 | Base::finishCreation(vm); |
204 | ASSERT(inherits(vm, info())); |
205 | |
206 | } |
207 | |
208 | JSObject* JSOverconstrainedErrorEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
209 | { |
210 | return JSOverconstrainedErrorEventPrototype::create(vm, &globalObject, JSOverconstrainedErrorEventPrototype::createStructure(vm, &globalObject, JSEvent::prototype(vm, globalObject))); |
211 | } |
212 | |
213 | JSObject* JSOverconstrainedErrorEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
214 | { |
215 | return getDOMPrototype<JSOverconstrainedErrorEvent>(vm, globalObject); |
216 | } |
217 | |
218 | JSValue JSOverconstrainedErrorEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
219 | { |
220 | return getDOMConstructor<JSOverconstrainedErrorEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
221 | } |
222 | |
223 | template<> inline JSOverconstrainedErrorEvent* IDLAttribute<JSOverconstrainedErrorEvent>::cast(ExecState& state, EncodedJSValue thisValue) |
224 | { |
225 | return jsDynamicCast<JSOverconstrainedErrorEvent*>(state.vm(), JSValue::decode(thisValue)); |
226 | } |
227 | |
228 | EncodedJSValue jsOverconstrainedErrorEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
229 | { |
230 | VM& vm = state->vm(); |
231 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
232 | auto* prototype = jsDynamicCast<JSOverconstrainedErrorEventPrototype*>(vm, JSValue::decode(thisValue)); |
233 | if (UNLIKELY(!prototype)) |
234 | return throwVMTypeError(state, throwScope); |
235 | return JSValue::encode(JSOverconstrainedErrorEvent::getConstructor(state->vm(), prototype->globalObject())); |
236 | } |
237 | |
238 | bool setJSOverconstrainedErrorEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
239 | { |
240 | VM& vm = state->vm(); |
241 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
242 | auto* prototype = jsDynamicCast<JSOverconstrainedErrorEventPrototype*>(vm, JSValue::decode(thisValue)); |
243 | if (UNLIKELY(!prototype)) { |
244 | throwVMTypeError(state, throwScope); |
245 | return false; |
246 | } |
247 | // Shadowing a built-in constructor |
248 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
249 | } |
250 | |
251 | static inline JSValue jsOverconstrainedErrorEventErrorGetter(ExecState& state, JSOverconstrainedErrorEvent& thisObject, ThrowScope& throwScope) |
252 | { |
253 | UNUSED_PARAM(throwScope); |
254 | UNUSED_PARAM(state); |
255 | auto& impl = thisObject.wrapped(); |
256 | JSValue result = toJS<IDLNullable<IDLInterface<OverconstrainedError>>>(state, *thisObject.globalObject(), throwScope, impl.error()); |
257 | return result; |
258 | } |
259 | |
260 | EncodedJSValue jsOverconstrainedErrorEventError(ExecState* state, EncodedJSValue thisValue, PropertyName) |
261 | { |
262 | return IDLAttribute<JSOverconstrainedErrorEvent>::get<jsOverconstrainedErrorEventErrorGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "error" ); |
263 | } |
264 | |
265 | void JSOverconstrainedErrorEvent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
266 | { |
267 | auto* thisObject = jsCast<JSOverconstrainedErrorEvent*>(cell); |
268 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
269 | if (thisObject->scriptExecutionContext()) |
270 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
271 | Base::heapSnapshot(cell, builder); |
272 | } |
273 | |
274 | #if ENABLE(BINDING_INTEGRITY) |
275 | #if PLATFORM(WIN) |
276 | #pragma warning(disable: 4483) |
277 | extern "C" { extern void (*const __identifier("??_7OverconstrainedErrorEvent@WebCore@@6B@" )[])(); } |
278 | #else |
279 | extern "C" { extern void* _ZTVN7WebCore25OverconstrainedErrorEventE[]; } |
280 | #endif |
281 | #endif |
282 | |
283 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<OverconstrainedErrorEvent>&& impl) |
284 | { |
285 | |
286 | #if ENABLE(BINDING_INTEGRITY) |
287 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
288 | #if PLATFORM(WIN) |
289 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7OverconstrainedErrorEvent@WebCore@@6B@" )); |
290 | #else |
291 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore25OverconstrainedErrorEventE[2]); |
292 | #endif |
293 | |
294 | // If this fails OverconstrainedErrorEvent does not have a vtable, so you need to add the |
295 | // ImplementationLacksVTable attribute to the interface definition |
296 | static_assert(std::is_polymorphic<OverconstrainedErrorEvent>::value, "OverconstrainedErrorEvent is not polymorphic" ); |
297 | |
298 | // If you hit this assertion you either have a use after free bug, or |
299 | // OverconstrainedErrorEvent has subclasses. If OverconstrainedErrorEvent has subclasses that get passed |
300 | // to toJS() we currently require OverconstrainedErrorEvent you to opt out of binding hardening |
301 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
302 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
303 | #endif |
304 | return createWrapper<OverconstrainedErrorEvent>(globalObject, WTFMove(impl)); |
305 | } |
306 | |
307 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, OverconstrainedErrorEvent& impl) |
308 | { |
309 | return wrap(state, globalObject, impl); |
310 | } |
311 | |
312 | |
313 | } |
314 | |
315 | #endif // ENABLE(MEDIA_STREAM) |
316 | |