blob: 07a93b39e11ed663fa2c3e8d6af6077b67db1808 [file] [log] [blame]
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +00001/*
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#include "JSTestPromiseRejectionEvent.h"
23
weinig@apple.com5a46ef02017-08-09 01:01:44 +000024#include "DOMPromiseProxy.h"
weinig@apple.com96c96d92017-05-25 17:39:57 +000025#include "JSDOMAttribute.h"
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000026#include "JSDOMBinding.h"
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000027#include "JSDOMConstructor.h"
commit-queue@webkit.orge1967142017-06-15 17:49:50 +000028#include "JSDOMConvertAny.h"
29#include "JSDOMConvertBoolean.h"
30#include "JSDOMConvertInterface.h"
31#include "JSDOMConvertPromise.h"
32#include "JSDOMConvertStrings.h"
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000033#include "JSDOMExceptionHandling.h"
weinig@apple.com5a46ef02017-08-09 01:01:44 +000034#include "JSDOMGlobalObject.h"
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000035#include "JSDOMWrapperCache.h"
don.olmstead@sony.comaa7e16482018-02-03 00:57:02 +000036#include <JavaScriptCore/JSCInlines.h>
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000037#include <wtf/GetPtr.h>
mark.lam@apple.combde8a732018-01-27 00:43:27 +000038#include <wtf/PointerPreparations.h>
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000039
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000040
41namespace WebCore {
keith_miller@apple.comce64b732017-10-17 07:10:58 +000042using namespace JSC;
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000043
44template<> TestPromiseRejectionEvent::Init convertDictionary<TestPromiseRejectionEvent::Init>(ExecState& state, JSValue value)
45{
46 VM& vm = state.vm();
47 auto throwScope = DECLARE_THROW_SCOPE(vm);
48 bool isNullOrUndefined = value.isUndefinedOrNull();
49 auto* object = isNullOrUndefined ? nullptr : value.getObject();
50 if (UNLIKELY(!isNullOrUndefined && !object)) {
51 throwTypeError(&state, throwScope);
52 return { };
53 }
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000054 TestPromiseRejectionEvent::Init result;
cdumez@apple.com8cd0d312018-02-01 23:33:19 +000055 JSValue bubblesValue;
56 if (isNullOrUndefined)
57 bubblesValue = jsUndefined();
58 else {
59 bubblesValue = object->get(&state, Identifier::fromString(&state, "bubbles"));
60 RETURN_IF_EXCEPTION(throwScope, { });
61 }
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000062 if (!bubblesValue.isUndefined()) {
63 result.bubbles = convert<IDLBoolean>(state, bubblesValue);
64 RETURN_IF_EXCEPTION(throwScope, { });
65 } else
66 result.bubbles = false;
cdumez@apple.com8cd0d312018-02-01 23:33:19 +000067 JSValue cancelableValue;
68 if (isNullOrUndefined)
69 cancelableValue = jsUndefined();
70 else {
71 cancelableValue = object->get(&state, Identifier::fromString(&state, "cancelable"));
72 RETURN_IF_EXCEPTION(throwScope, { });
73 }
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000074 if (!cancelableValue.isUndefined()) {
75 result.cancelable = convert<IDLBoolean>(state, cancelableValue);
76 RETURN_IF_EXCEPTION(throwScope, { });
77 } else
78 result.cancelable = false;
cdumez@apple.com8cd0d312018-02-01 23:33:19 +000079 JSValue composedValue;
80 if (isNullOrUndefined)
81 composedValue = jsUndefined();
82 else {
83 composedValue = object->get(&state, Identifier::fromString(&state, "composed"));
84 RETURN_IF_EXCEPTION(throwScope, { });
85 }
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000086 if (!composedValue.isUndefined()) {
87 result.composed = convert<IDLBoolean>(state, composedValue);
88 RETURN_IF_EXCEPTION(throwScope, { });
89 } else
90 result.composed = false;
cdumez@apple.com8cd0d312018-02-01 23:33:19 +000091 JSValue promiseValue;
92 if (isNullOrUndefined)
93 promiseValue = jsUndefined();
94 else {
95 promiseValue = object->get(&state, Identifier::fromString(&state, "promise"));
96 RETURN_IF_EXCEPTION(throwScope, { });
97 }
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +000098 if (!promiseValue.isUndefined()) {
99 result.promise = convert<IDLPromise<IDLAny>>(state, promiseValue);
100 RETURN_IF_EXCEPTION(throwScope, { });
101 } else {
102 throwRequiredMemberTypeError(state, throwScope, "promise", "TestPromiseRejectionEventInit", "Promise");
103 return { };
104 }
cdumez@apple.com8cd0d312018-02-01 23:33:19 +0000105 JSValue reasonValue;
106 if (isNullOrUndefined)
107 reasonValue = jsUndefined();
108 else {
109 reasonValue = object->get(&state, Identifier::fromString(&state, "reason"));
110 RETURN_IF_EXCEPTION(throwScope, { });
111 }
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000112 if (!reasonValue.isUndefined()) {
113 result.reason = convert<IDLAny>(state, reasonValue);
114 RETURN_IF_EXCEPTION(throwScope, { });
115 } else
116 result.reason = jsUndefined();
117 return result;
118}
119
120// Attributes
121
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000122JSC::EncodedJSValue jsTestPromiseRejectionEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
123bool setJSTestPromiseRejectionEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
commit-queue@webkit.org036616a2017-05-26 21:33:15 +0000124JSC::EncodedJSValue jsTestPromiseRejectionEventPromise(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
125JSC::EncodedJSValue jsTestPromiseRejectionEventReason(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000126
127class JSTestPromiseRejectionEventPrototype : public JSC::JSNonFinalObject {
128public:
129 using Base = JSC::JSNonFinalObject;
130 static JSTestPromiseRejectionEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
131 {
132 JSTestPromiseRejectionEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestPromiseRejectionEventPrototype>(vm.heap)) JSTestPromiseRejectionEventPrototype(vm, globalObject, structure);
133 ptr->finishCreation(vm);
134 return ptr;
135 }
136
137 DECLARE_INFO;
138 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
139 {
140 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
141 }
142
143private:
144 JSTestPromiseRejectionEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
145 : JSC::JSNonFinalObject(vm, structure)
146 {
147 }
148
149 void finishCreation(JSC::VM&);
150};
151
152using JSTestPromiseRejectionEventConstructor = JSDOMConstructor<JSTestPromiseRejectionEvent>;
153
154template<> EncodedJSValue JSC_HOST_CALL JSTestPromiseRejectionEventConstructor::construct(ExecState* state)
155{
156 VM& vm = state->vm();
157 auto throwScope = DECLARE_THROW_SCOPE(vm);
158 UNUSED_PARAM(throwScope);
159 auto* castedThis = jsCast<JSTestPromiseRejectionEventConstructor*>(state->jsCallee());
160 ASSERT(castedThis);
161 if (UNLIKELY(state->argumentCount() < 2))
162 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
163 auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(0));
164 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
165 auto eventInitDict = convert<IDLDictionary<TestPromiseRejectionEvent::Init>>(*state, state->uncheckedArgument(1));
166 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
167 auto object = TestPromiseRejectionEvent::create(*state, WTFMove(type), WTFMove(eventInitDict));
168 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
169 return JSValue::encode(toJSNewlyCreated<IDLInterface<TestPromiseRejectionEvent>>(*state, *castedThis->globalObject(), WTFMove(object)));
170}
171
172template<> JSValue JSTestPromiseRejectionEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
173{
174 return JSEvent::getConstructor(vm, &globalObject);
175}
176
177template<> void JSTestPromiseRejectionEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
178{
achristensen@apple.com5c6da6e2017-09-25 22:37:03 +0000179 putDirect(vm, vm.propertyNames->prototype, JSTestPromiseRejectionEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
utatane.tea@gmail.com84077632018-06-23 08:39:34 +0000180 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("TestPromiseRejectionEvent"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
achristensen@apple.com5c6da6e2017-09-25 22:37:03 +0000181 putDirect(vm, vm.propertyNames->length, jsNumber(2), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000182}
183
utatane.tea@gmail.coma5544f12017-05-19 09:23:20 +0000184template<> const ClassInfo JSTestPromiseRejectionEventConstructor::s_info = { "TestPromiseRejectionEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestPromiseRejectionEventConstructor) };
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000185
186/* Hash table for prototype */
187
188static const HashTableValue JSTestPromiseRejectionEventPrototypeTableValues[] =
189{
achristensen@apple.com5c6da6e2017-09-25 22:37:03 +0000190 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestPromiseRejectionEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestPromiseRejectionEventConstructor) } },
191 { "promise", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestPromiseRejectionEventPromise), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
192 { "reason", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestPromiseRejectionEventReason), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000193};
194
utatane.tea@gmail.coma5544f12017-05-19 09:23:20 +0000195const ClassInfo JSTestPromiseRejectionEventPrototype::s_info = { "TestPromiseRejectionEventPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestPromiseRejectionEventPrototype) };
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000196
197void JSTestPromiseRejectionEventPrototype::finishCreation(VM& vm)
198{
199 Base::finishCreation(vm);
utatane.tea@gmail.comf496c6b2017-07-27 12:35:49 +0000200 reifyStaticProperties(vm, JSTestPromiseRejectionEvent::info(), JSTestPromiseRejectionEventPrototypeTableValues, *this);
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000201}
202
utatane.tea@gmail.coma5544f12017-05-19 09:23:20 +0000203const ClassInfo JSTestPromiseRejectionEvent::s_info = { "TestPromiseRejectionEvent", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestPromiseRejectionEvent) };
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000204
205JSTestPromiseRejectionEvent::JSTestPromiseRejectionEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestPromiseRejectionEvent>&& impl)
206 : JSEvent(structure, globalObject, WTFMove(impl))
207{
208}
209
210void JSTestPromiseRejectionEvent::finishCreation(VM& vm)
211{
212 Base::finishCreation(vm);
213 ASSERT(inherits(vm, info()));
214
215}
216
217JSObject* JSTestPromiseRejectionEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
218{
219 return JSTestPromiseRejectionEventPrototype::create(vm, &globalObject, JSTestPromiseRejectionEventPrototype::createStructure(vm, &globalObject, JSEvent::prototype(vm, globalObject)));
220}
221
222JSObject* JSTestPromiseRejectionEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject)
223{
224 return getDOMPrototype<JSTestPromiseRejectionEvent>(vm, globalObject);
225}
226
commit-queue@webkit.org036616a2017-05-26 21:33:15 +0000227JSValue JSTestPromiseRejectionEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject)
228{
229 return getDOMConstructor<JSTestPromiseRejectionEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
230}
231
weinig@apple.com96c96d92017-05-25 17:39:57 +0000232template<> inline JSTestPromiseRejectionEvent* IDLAttribute<JSTestPromiseRejectionEvent>::cast(ExecState& state, EncodedJSValue thisValue)
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000233{
utatane.tea@gmail.com5ec91b72018-03-08 18:38:09 +0000234 return jsDynamicCast<JSTestPromiseRejectionEvent*>(state.vm(), JSValue::decode(thisValue));
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000235}
236
commit-queue@webkit.org036616a2017-05-26 21:33:15 +0000237EncodedJSValue jsTestPromiseRejectionEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000238{
commit-queue@webkit.org036616a2017-05-26 21:33:15 +0000239 VM& vm = state->vm();
240 auto throwScope = DECLARE_THROW_SCOPE(vm);
utatane.tea@gmail.com5ec91b72018-03-08 18:38:09 +0000241 auto* prototype = jsDynamicCast<JSTestPromiseRejectionEventPrototype*>(vm, JSValue::decode(thisValue));
commit-queue@webkit.org036616a2017-05-26 21:33:15 +0000242 if (UNLIKELY(!prototype))
243 return throwVMTypeError(state, throwScope);
244 return JSValue::encode(JSTestPromiseRejectionEvent::getConstructor(state->vm(), prototype->globalObject()));
245}
246
247bool setJSTestPromiseRejectionEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
248{
249 VM& vm = state->vm();
250 auto throwScope = DECLARE_THROW_SCOPE(vm);
utatane.tea@gmail.com5ec91b72018-03-08 18:38:09 +0000251 auto* prototype = jsDynamicCast<JSTestPromiseRejectionEventPrototype*>(vm, JSValue::decode(thisValue));
commit-queue@webkit.org036616a2017-05-26 21:33:15 +0000252 if (UNLIKELY(!prototype)) {
253 throwVMTypeError(state, throwScope);
254 return false;
255 }
256 // Shadowing a built-in constructor
mark.lam@apple.com23e96242017-09-09 16:21:45 +0000257 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000258}
259
260static inline JSValue jsTestPromiseRejectionEventPromiseGetter(ExecState& state, JSTestPromiseRejectionEvent& thisObject, ThrowScope& throwScope)
261{
262 UNUSED_PARAM(throwScope);
263 UNUSED_PARAM(state);
264 auto& impl = thisObject.wrapped();
weinig@apple.com72d0cb92017-09-25 19:16:14 +0000265 JSValue result = toJS<IDLPromise<IDLAny>>(state, *thisObject.globalObject(), throwScope, impl.promise());
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000266 return result;
267}
268
commit-queue@webkit.org036616a2017-05-26 21:33:15 +0000269EncodedJSValue jsTestPromiseRejectionEventPromise(ExecState* state, EncodedJSValue thisValue, PropertyName)
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000270{
commit-queue@webkit.org036616a2017-05-26 21:33:15 +0000271 return IDLAttribute<JSTestPromiseRejectionEvent>::get<jsTestPromiseRejectionEventPromiseGetter, CastedThisErrorBehavior::RejectPromise>(*state, thisValue, "promise");
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000272}
273
274static inline JSValue jsTestPromiseRejectionEventReasonGetter(ExecState& state, JSTestPromiseRejectionEvent& thisObject, ThrowScope& throwScope)
275{
276 UNUSED_PARAM(throwScope);
277 UNUSED_PARAM(state);
278 auto& impl = thisObject.wrapped();
weinig@apple.com72d0cb92017-09-25 19:16:14 +0000279 JSValue result = toJS<IDLAny>(state, throwScope, impl.reason());
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000280 return result;
281}
282
commit-queue@webkit.org036616a2017-05-26 21:33:15 +0000283EncodedJSValue jsTestPromiseRejectionEventReason(ExecState* state, EncodedJSValue thisValue, PropertyName)
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000284{
utatane.tea@gmail.comf496c6b2017-07-27 12:35:49 +0000285 return IDLAttribute<JSTestPromiseRejectionEvent>::get<jsTestPromiseRejectionEventReasonGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "reason");
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000286}
287
288#if ENABLE(BINDING_INTEGRITY)
289#if PLATFORM(WIN)
290#pragma warning(disable: 4483)
291extern "C" { extern void (*const __identifier("??_7TestPromiseRejectionEvent@WebCore@@6B@")[])(); }
292#else
293extern "C" { extern void* _ZTVN7WebCore25TestPromiseRejectionEventE[]; }
294#endif
295#endif
296
297JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestPromiseRejectionEvent>&& impl)
298{
299
300#if ENABLE(BINDING_INTEGRITY)
mark.lam@apple.com92c4bb12018-04-03 20:22:08 +0000301 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000302#if PLATFORM(WIN)
mark.lam@apple.combde8a732018-01-27 00:43:27 +0000303 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7TestPromiseRejectionEvent@WebCore@@6B@"));
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000304#else
mark.lam@apple.combde8a732018-01-27 00:43:27 +0000305 void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore25TestPromiseRejectionEventE[2]);
commit-queue@webkit.org1f0f62d2017-06-30 15:45:59 +0000306#endif
307
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000308 // If this fails TestPromiseRejectionEvent does not have a vtable, so you need to add the
309 // ImplementationLacksVTable attribute to the interface definition
commit-queue@webkit.org1f0f62d2017-06-30 15:45:59 +0000310 static_assert(std::is_polymorphic<TestPromiseRejectionEvent>::value, "TestPromiseRejectionEvent is not polymorphic");
311
utatane.tea@gmail.com73e7e9f2017-05-09 12:17:21 +0000312 // If you hit this assertion you either have a use after free bug, or
313 // TestPromiseRejectionEvent has subclasses. If TestPromiseRejectionEvent has subclasses that get passed
314 // to toJS() we currently require TestPromiseRejectionEvent you to opt out of binding hardening
315 // by adding the SkipVTableValidation attribute to the interface IDL definition
316 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
317#endif
318 return createWrapper<TestPromiseRejectionEvent>(globalObject, WTFMove(impl));
319}
320
321JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestPromiseRejectionEvent& impl)
322{
323 return wrap(state, globalObject, impl);
324}
325
326
327}