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(PAYMENT_REQUEST) |
24 | |
25 | #include "JSPaymentRequestUpdateEvent.h" |
26 | |
27 | #include "DOMPromiseProxy.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructor.h" |
30 | #include "JSDOMConvertDictionary.h" |
31 | #include "JSDOMConvertInterface.h" |
32 | #include "JSDOMConvertPromise.h" |
33 | #include "JSDOMExceptionHandling.h" |
34 | #include "JSDOMOperation.h" |
35 | #include "JSDOMWrapperCache.h" |
36 | #include "JSPaymentDetailsUpdate.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(PAYMENT_REQUEST) |
45 | #include "JSDOMConvertStrings.h" |
46 | #include "JSPaymentRequestUpdateEventInit.h" |
47 | #endif |
48 | |
49 | |
50 | namespace WebCore { |
51 | using namespace JSC; |
52 | |
53 | // Functions |
54 | |
55 | JSC::EncodedJSValue JSC_HOST_CALL jsPaymentRequestUpdateEventPrototypeFunctionUpdateWith(JSC::ExecState*); |
56 | |
57 | // Attributes |
58 | |
59 | JSC::EncodedJSValue jsPaymentRequestUpdateEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
60 | bool setJSPaymentRequestUpdateEventConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
61 | |
62 | class JSPaymentRequestUpdateEventPrototype : public JSC::JSNonFinalObject { |
63 | public: |
64 | using Base = JSC::JSNonFinalObject; |
65 | static JSPaymentRequestUpdateEventPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
66 | { |
67 | JSPaymentRequestUpdateEventPrototype* ptr = new (NotNull, JSC::allocateCell<JSPaymentRequestUpdateEventPrototype>(vm.heap)) JSPaymentRequestUpdateEventPrototype(vm, globalObject, structure); |
68 | ptr->finishCreation(vm); |
69 | return ptr; |
70 | } |
71 | |
72 | DECLARE_INFO; |
73 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
74 | { |
75 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
76 | } |
77 | |
78 | private: |
79 | JSPaymentRequestUpdateEventPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
80 | : JSC::JSNonFinalObject(vm, structure) |
81 | { |
82 | } |
83 | |
84 | void finishCreation(JSC::VM&); |
85 | }; |
86 | |
87 | using JSPaymentRequestUpdateEventConstructor = JSDOMConstructor<JSPaymentRequestUpdateEvent>; |
88 | |
89 | template<> EncodedJSValue JSC_HOST_CALL JSPaymentRequestUpdateEventConstructor::construct(ExecState* state) |
90 | { |
91 | VM& vm = state->vm(); |
92 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
93 | UNUSED_PARAM(throwScope); |
94 | auto* castedThis = jsCast<JSPaymentRequestUpdateEventConstructor*>(state->jsCallee()); |
95 | ASSERT(castedThis); |
96 | if (UNLIKELY(state->argumentCount() < 1)) |
97 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
98 | auto type = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
99 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
100 | auto eventInitDict = convert<IDLDictionary<PaymentRequestUpdateEventInit>>(*state, state->argument(1)); |
101 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
102 | auto object = PaymentRequestUpdateEvent::create(WTFMove(type), WTFMove(eventInitDict)); |
103 | return JSValue::encode(toJSNewlyCreated<IDLInterface<PaymentRequestUpdateEvent>>(*state, *castedThis->globalObject(), WTFMove(object))); |
104 | } |
105 | |
106 | template<> JSValue JSPaymentRequestUpdateEventConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
107 | { |
108 | return JSEvent::getConstructor(vm, &globalObject); |
109 | } |
110 | |
111 | template<> void JSPaymentRequestUpdateEventConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
112 | { |
113 | putDirect(vm, vm.propertyNames->prototype, JSPaymentRequestUpdateEvent::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
114 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("PaymentRequestUpdateEvent"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
115 | putDirect(vm, vm.propertyNames->length, jsNumber(1), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
116 | } |
117 | |
118 | template<> const ClassInfo JSPaymentRequestUpdateEventConstructor::s_info = { "PaymentRequestUpdateEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaymentRequestUpdateEventConstructor) }; |
119 | |
120 | /* Hash table for prototype */ |
121 | |
122 | static const HashTableValue JSPaymentRequestUpdateEventPrototypeTableValues[] = |
123 | { |
124 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentRequestUpdateEventConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPaymentRequestUpdateEventConstructor) } }, |
125 | { "updateWith" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPaymentRequestUpdateEventPrototypeFunctionUpdateWith), (intptr_t) (1) } }, |
126 | }; |
127 | |
128 | const ClassInfo JSPaymentRequestUpdateEventPrototype::s_info = { "PaymentRequestUpdateEventPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaymentRequestUpdateEventPrototype) }; |
129 | |
130 | void JSPaymentRequestUpdateEventPrototype::finishCreation(VM& vm) |
131 | { |
132 | Base::finishCreation(vm); |
133 | reifyStaticProperties(vm, JSPaymentRequestUpdateEvent::info(), JSPaymentRequestUpdateEventPrototypeTableValues, *this); |
134 | } |
135 | |
136 | const ClassInfo JSPaymentRequestUpdateEvent::s_info = { "PaymentRequestUpdateEvent" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaymentRequestUpdateEvent) }; |
137 | |
138 | JSPaymentRequestUpdateEvent::JSPaymentRequestUpdateEvent(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PaymentRequestUpdateEvent>&& impl) |
139 | : JSEvent(structure, globalObject, WTFMove(impl)) |
140 | { |
141 | } |
142 | |
143 | void JSPaymentRequestUpdateEvent::finishCreation(VM& vm) |
144 | { |
145 | Base::finishCreation(vm); |
146 | ASSERT(inherits(vm, info())); |
147 | |
148 | } |
149 | |
150 | JSObject* JSPaymentRequestUpdateEvent::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
151 | { |
152 | return JSPaymentRequestUpdateEventPrototype::create(vm, &globalObject, JSPaymentRequestUpdateEventPrototype::createStructure(vm, &globalObject, JSEvent::prototype(vm, globalObject))); |
153 | } |
154 | |
155 | JSObject* JSPaymentRequestUpdateEvent::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
156 | { |
157 | return getDOMPrototype<JSPaymentRequestUpdateEvent>(vm, globalObject); |
158 | } |
159 | |
160 | JSValue JSPaymentRequestUpdateEvent::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
161 | { |
162 | return getDOMConstructor<JSPaymentRequestUpdateEventConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
163 | } |
164 | |
165 | template<> inline JSPaymentRequestUpdateEvent* IDLOperation<JSPaymentRequestUpdateEvent>::cast(ExecState& state) |
166 | { |
167 | return jsDynamicCast<JSPaymentRequestUpdateEvent*>(state.vm(), state.thisValue()); |
168 | } |
169 | |
170 | EncodedJSValue jsPaymentRequestUpdateEventConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
171 | { |
172 | VM& vm = state->vm(); |
173 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
174 | auto* prototype = jsDynamicCast<JSPaymentRequestUpdateEventPrototype*>(vm, JSValue::decode(thisValue)); |
175 | if (UNLIKELY(!prototype)) |
176 | return throwVMTypeError(state, throwScope); |
177 | return JSValue::encode(JSPaymentRequestUpdateEvent::getConstructor(state->vm(), prototype->globalObject())); |
178 | } |
179 | |
180 | bool setJSPaymentRequestUpdateEventConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
181 | { |
182 | VM& vm = state->vm(); |
183 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
184 | auto* prototype = jsDynamicCast<JSPaymentRequestUpdateEventPrototype*>(vm, JSValue::decode(thisValue)); |
185 | if (UNLIKELY(!prototype)) { |
186 | throwVMTypeError(state, throwScope); |
187 | return false; |
188 | } |
189 | // Shadowing a built-in constructor |
190 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
191 | } |
192 | |
193 | static inline JSC::EncodedJSValue jsPaymentRequestUpdateEventPrototypeFunctionUpdateWithBody(JSC::ExecState* state, typename IDLOperation<JSPaymentRequestUpdateEvent>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
194 | { |
195 | UNUSED_PARAM(state); |
196 | UNUSED_PARAM(throwScope); |
197 | auto& impl = castedThis->wrapped(); |
198 | if (UNLIKELY(state->argumentCount() < 1)) |
199 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
200 | auto detailsPromise = convert<IDLPromise<IDLDictionary<PaymentDetailsUpdate>>>(*state, state->uncheckedArgument(0)); |
201 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
202 | propagateException(*state, throwScope, impl.updateWith(detailsPromise.releaseNonNull())); |
203 | return JSValue::encode(jsUndefined()); |
204 | } |
205 | |
206 | EncodedJSValue JSC_HOST_CALL jsPaymentRequestUpdateEventPrototypeFunctionUpdateWith(ExecState* state) |
207 | { |
208 | return IDLOperation<JSPaymentRequestUpdateEvent>::call<jsPaymentRequestUpdateEventPrototypeFunctionUpdateWithBody>(*state, "updateWith" ); |
209 | } |
210 | |
211 | void JSPaymentRequestUpdateEvent::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
212 | { |
213 | auto* thisObject = jsCast<JSPaymentRequestUpdateEvent*>(cell); |
214 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
215 | if (thisObject->scriptExecutionContext()) |
216 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
217 | Base::heapSnapshot(cell, builder); |
218 | } |
219 | |
220 | #if ENABLE(BINDING_INTEGRITY) |
221 | #if PLATFORM(WIN) |
222 | #pragma warning(disable: 4483) |
223 | extern "C" { extern void (*const __identifier("??_7PaymentRequestUpdateEvent@WebCore@@6B@" )[])(); } |
224 | #else |
225 | extern "C" { extern void* _ZTVN7WebCore25PaymentRequestUpdateEventE[]; } |
226 | #endif |
227 | #endif |
228 | |
229 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<PaymentRequestUpdateEvent>&& impl) |
230 | { |
231 | |
232 | #if ENABLE(BINDING_INTEGRITY) |
233 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
234 | #if PLATFORM(WIN) |
235 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7PaymentRequestUpdateEvent@WebCore@@6B@" )); |
236 | #else |
237 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore25PaymentRequestUpdateEventE[2]); |
238 | #endif |
239 | |
240 | // If this fails PaymentRequestUpdateEvent does not have a vtable, so you need to add the |
241 | // ImplementationLacksVTable attribute to the interface definition |
242 | static_assert(std::is_polymorphic<PaymentRequestUpdateEvent>::value, "PaymentRequestUpdateEvent is not polymorphic" ); |
243 | |
244 | // If you hit this assertion you either have a use after free bug, or |
245 | // PaymentRequestUpdateEvent has subclasses. If PaymentRequestUpdateEvent has subclasses that get passed |
246 | // to toJS() we currently require PaymentRequestUpdateEvent you to opt out of binding hardening |
247 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
248 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
249 | #endif |
250 | return createWrapper<PaymentRequestUpdateEvent>(globalObject, WTFMove(impl)); |
251 | } |
252 | |
253 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, PaymentRequestUpdateEvent& impl) |
254 | { |
255 | return wrap(state, globalObject, impl); |
256 | } |
257 | |
258 | |
259 | } |
260 | |
261 | #endif // ENABLE(PAYMENT_REQUEST) |
262 | |