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 "JSPaymentAddress.h"
26
27#include "JSDOMAttribute.h"
28#include "JSDOMBinding.h"
29#include "JSDOMConstructorNotConstructable.h"
30#include "JSDOMConvertSequences.h"
31#include "JSDOMConvertStrings.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMGlobalObject.h"
34#include "JSDOMOperation.h"
35#include "JSDOMWrapperCache.h"
36#include "ScriptExecutionContext.h"
37#include <JavaScriptCore/FunctionPrototype.h>
38#include <JavaScriptCore/HeapSnapshotBuilder.h>
39#include <JavaScriptCore/JSArray.h>
40#include <JavaScriptCore/JSCInlines.h>
41#include <JavaScriptCore/ObjectConstructor.h>
42#include <wtf/GetPtr.h>
43#include <wtf/PointerPreparations.h>
44#include <wtf/URL.h>
45
46
47namespace WebCore {
48using namespace JSC;
49
50// Functions
51
52JSC::EncodedJSValue JSC_HOST_CALL jsPaymentAddressPrototypeFunctionToJSON(JSC::ExecState*);
53
54// Attributes
55
56JSC::EncodedJSValue jsPaymentAddressConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
57bool setJSPaymentAddressConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
58JSC::EncodedJSValue jsPaymentAddressCountry(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
59JSC::EncodedJSValue jsPaymentAddressAddressLine(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
60JSC::EncodedJSValue jsPaymentAddressRegion(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
61JSC::EncodedJSValue jsPaymentAddressCity(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
62JSC::EncodedJSValue jsPaymentAddressDependentLocality(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
63JSC::EncodedJSValue jsPaymentAddressPostalCode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
64JSC::EncodedJSValue jsPaymentAddressSortingCode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
65JSC::EncodedJSValue jsPaymentAddressOrganization(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
66JSC::EncodedJSValue jsPaymentAddressRecipient(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
67JSC::EncodedJSValue jsPaymentAddressPhone(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
68
69class JSPaymentAddressPrototype : public JSC::JSNonFinalObject {
70public:
71 using Base = JSC::JSNonFinalObject;
72 static JSPaymentAddressPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
73 {
74 JSPaymentAddressPrototype* ptr = new (NotNull, JSC::allocateCell<JSPaymentAddressPrototype>(vm.heap)) JSPaymentAddressPrototype(vm, globalObject, structure);
75 ptr->finishCreation(vm);
76 return ptr;
77 }
78
79 DECLARE_INFO;
80 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
81 {
82 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
83 }
84
85private:
86 JSPaymentAddressPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
87 : JSC::JSNonFinalObject(vm, structure)
88 {
89 }
90
91 void finishCreation(JSC::VM&);
92};
93
94using JSPaymentAddressConstructor = JSDOMConstructorNotConstructable<JSPaymentAddress>;
95
96template<> JSValue JSPaymentAddressConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
97{
98 UNUSED_PARAM(vm);
99 return globalObject.functionPrototype();
100}
101
102template<> void JSPaymentAddressConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
103{
104 putDirect(vm, vm.propertyNames->prototype, JSPaymentAddress::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
105 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("PaymentAddress"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
106 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
107}
108
109template<> const ClassInfo JSPaymentAddressConstructor::s_info = { "PaymentAddress", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaymentAddressConstructor) };
110
111/* Hash table for prototype */
112
113static const HashTableValue JSPaymentAddressPrototypeTableValues[] =
114{
115 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPaymentAddressConstructor) } },
116 { "country", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressCountry), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
117 { "addressLine", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressAddressLine), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
118 { "region", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressRegion), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
119 { "city", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressCity), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
120 { "dependentLocality", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressDependentLocality), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
121 { "postalCode", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressPostalCode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
122 { "sortingCode", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressSortingCode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
123 { "organization", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressOrganization), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
124 { "recipient", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressRecipient), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
125 { "phone", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentAddressPhone), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
126 { "toJSON", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPaymentAddressPrototypeFunctionToJSON), (intptr_t) (0) } },
127};
128
129const ClassInfo JSPaymentAddressPrototype::s_info = { "PaymentAddressPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaymentAddressPrototype) };
130
131void JSPaymentAddressPrototype::finishCreation(VM& vm)
132{
133 Base::finishCreation(vm);
134 reifyStaticProperties(vm, JSPaymentAddress::info(), JSPaymentAddressPrototypeTableValues, *this);
135}
136
137const ClassInfo JSPaymentAddress::s_info = { "PaymentAddress", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaymentAddress) };
138
139JSPaymentAddress::JSPaymentAddress(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PaymentAddress>&& impl)
140 : JSDOMWrapper<PaymentAddress>(structure, globalObject, WTFMove(impl))
141{
142}
143
144void JSPaymentAddress::finishCreation(VM& vm)
145{
146 Base::finishCreation(vm);
147 ASSERT(inherits(vm, info()));
148
149}
150
151JSObject* JSPaymentAddress::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
152{
153 return JSPaymentAddressPrototype::create(vm, &globalObject, JSPaymentAddressPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
154}
155
156JSObject* JSPaymentAddress::prototype(VM& vm, JSDOMGlobalObject& globalObject)
157{
158 return getDOMPrototype<JSPaymentAddress>(vm, globalObject);
159}
160
161JSValue JSPaymentAddress::getConstructor(VM& vm, const JSGlobalObject* globalObject)
162{
163 return getDOMConstructor<JSPaymentAddressConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
164}
165
166void JSPaymentAddress::destroy(JSC::JSCell* cell)
167{
168 JSPaymentAddress* thisObject = static_cast<JSPaymentAddress*>(cell);
169 thisObject->JSPaymentAddress::~JSPaymentAddress();
170}
171
172template<> inline JSPaymentAddress* IDLAttribute<JSPaymentAddress>::cast(ExecState& state, EncodedJSValue thisValue)
173{
174 return jsDynamicCast<JSPaymentAddress*>(state.vm(), JSValue::decode(thisValue));
175}
176
177template<> inline JSPaymentAddress* IDLOperation<JSPaymentAddress>::cast(ExecState& state)
178{
179 return jsDynamicCast<JSPaymentAddress*>(state.vm(), state.thisValue());
180}
181
182EncodedJSValue jsPaymentAddressConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
183{
184 VM& vm = state->vm();
185 auto throwScope = DECLARE_THROW_SCOPE(vm);
186 auto* prototype = jsDynamicCast<JSPaymentAddressPrototype*>(vm, JSValue::decode(thisValue));
187 if (UNLIKELY(!prototype))
188 return throwVMTypeError(state, throwScope);
189 return JSValue::encode(JSPaymentAddress::getConstructor(state->vm(), prototype->globalObject()));
190}
191
192bool setJSPaymentAddressConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
193{
194 VM& vm = state->vm();
195 auto throwScope = DECLARE_THROW_SCOPE(vm);
196 auto* prototype = jsDynamicCast<JSPaymentAddressPrototype*>(vm, JSValue::decode(thisValue));
197 if (UNLIKELY(!prototype)) {
198 throwVMTypeError(state, throwScope);
199 return false;
200 }
201 // Shadowing a built-in constructor
202 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
203}
204
205static inline JSValue jsPaymentAddressCountryGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
206{
207 UNUSED_PARAM(throwScope);
208 UNUSED_PARAM(state);
209 auto& impl = thisObject.wrapped();
210 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.country());
211 return result;
212}
213
214EncodedJSValue jsPaymentAddressCountry(ExecState* state, EncodedJSValue thisValue, PropertyName)
215{
216 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressCountryGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "country");
217}
218
219static inline JSValue jsPaymentAddressAddressLineGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
220{
221 UNUSED_PARAM(throwScope);
222 UNUSED_PARAM(state);
223 auto& impl = thisObject.wrapped();
224 JSValue result = toJS<IDLFrozenArray<IDLDOMString>>(state, *thisObject.globalObject(), throwScope, impl.addressLine());
225 return result;
226}
227
228EncodedJSValue jsPaymentAddressAddressLine(ExecState* state, EncodedJSValue thisValue, PropertyName)
229{
230 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressAddressLineGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "addressLine");
231}
232
233static inline JSValue jsPaymentAddressRegionGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
234{
235 UNUSED_PARAM(throwScope);
236 UNUSED_PARAM(state);
237 auto& impl = thisObject.wrapped();
238 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.region());
239 return result;
240}
241
242EncodedJSValue jsPaymentAddressRegion(ExecState* state, EncodedJSValue thisValue, PropertyName)
243{
244 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressRegionGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "region");
245}
246
247static inline JSValue jsPaymentAddressCityGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
248{
249 UNUSED_PARAM(throwScope);
250 UNUSED_PARAM(state);
251 auto& impl = thisObject.wrapped();
252 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.city());
253 return result;
254}
255
256EncodedJSValue jsPaymentAddressCity(ExecState* state, EncodedJSValue thisValue, PropertyName)
257{
258 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressCityGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "city");
259}
260
261static inline JSValue jsPaymentAddressDependentLocalityGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
262{
263 UNUSED_PARAM(throwScope);
264 UNUSED_PARAM(state);
265 auto& impl = thisObject.wrapped();
266 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.dependentLocality());
267 return result;
268}
269
270EncodedJSValue jsPaymentAddressDependentLocality(ExecState* state, EncodedJSValue thisValue, PropertyName)
271{
272 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressDependentLocalityGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "dependentLocality");
273}
274
275static inline JSValue jsPaymentAddressPostalCodeGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
276{
277 UNUSED_PARAM(throwScope);
278 UNUSED_PARAM(state);
279 auto& impl = thisObject.wrapped();
280 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.postalCode());
281 return result;
282}
283
284EncodedJSValue jsPaymentAddressPostalCode(ExecState* state, EncodedJSValue thisValue, PropertyName)
285{
286 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressPostalCodeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "postalCode");
287}
288
289static inline JSValue jsPaymentAddressSortingCodeGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
290{
291 UNUSED_PARAM(throwScope);
292 UNUSED_PARAM(state);
293 auto& impl = thisObject.wrapped();
294 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.sortingCode());
295 return result;
296}
297
298EncodedJSValue jsPaymentAddressSortingCode(ExecState* state, EncodedJSValue thisValue, PropertyName)
299{
300 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressSortingCodeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "sortingCode");
301}
302
303static inline JSValue jsPaymentAddressOrganizationGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
304{
305 UNUSED_PARAM(throwScope);
306 UNUSED_PARAM(state);
307 auto& impl = thisObject.wrapped();
308 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.organization());
309 return result;
310}
311
312EncodedJSValue jsPaymentAddressOrganization(ExecState* state, EncodedJSValue thisValue, PropertyName)
313{
314 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressOrganizationGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "organization");
315}
316
317static inline JSValue jsPaymentAddressRecipientGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
318{
319 UNUSED_PARAM(throwScope);
320 UNUSED_PARAM(state);
321 auto& impl = thisObject.wrapped();
322 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.recipient());
323 return result;
324}
325
326EncodedJSValue jsPaymentAddressRecipient(ExecState* state, EncodedJSValue thisValue, PropertyName)
327{
328 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressRecipientGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "recipient");
329}
330
331static inline JSValue jsPaymentAddressPhoneGetter(ExecState& state, JSPaymentAddress& thisObject, ThrowScope& throwScope)
332{
333 UNUSED_PARAM(throwScope);
334 UNUSED_PARAM(state);
335 auto& impl = thisObject.wrapped();
336 JSValue result = toJS<IDLDOMString>(state, throwScope, impl.phone());
337 return result;
338}
339
340EncodedJSValue jsPaymentAddressPhone(ExecState* state, EncodedJSValue thisValue, PropertyName)
341{
342 return IDLAttribute<JSPaymentAddress>::get<jsPaymentAddressPhoneGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "phone");
343}
344
345JSC::JSObject* JSPaymentAddress::serialize(ExecState& state, JSPaymentAddress& thisObject, JSDOMGlobalObject& globalObject, ThrowScope& throwScope)
346{
347 auto& vm = state.vm();
348 auto* result = constructEmptyObject(&state, globalObject.objectPrototype());
349
350 auto countryValue = jsPaymentAddressCountryGetter(state, thisObject, throwScope);
351 throwScope.assertNoException();
352 result->putDirect(vm, Identifier::fromString(&vm, "country"), countryValue);
353
354 auto addressLineValue = jsPaymentAddressAddressLineGetter(state, thisObject, throwScope);
355 throwScope.assertNoException();
356 result->putDirect(vm, Identifier::fromString(&vm, "addressLine"), addressLineValue);
357
358 auto regionValue = jsPaymentAddressRegionGetter(state, thisObject, throwScope);
359 throwScope.assertNoException();
360 result->putDirect(vm, Identifier::fromString(&vm, "region"), regionValue);
361
362 auto cityValue = jsPaymentAddressCityGetter(state, thisObject, throwScope);
363 throwScope.assertNoException();
364 result->putDirect(vm, Identifier::fromString(&vm, "city"), cityValue);
365
366 auto dependentLocalityValue = jsPaymentAddressDependentLocalityGetter(state, thisObject, throwScope);
367 throwScope.assertNoException();
368 result->putDirect(vm, Identifier::fromString(&vm, "dependentLocality"), dependentLocalityValue);
369
370 auto postalCodeValue = jsPaymentAddressPostalCodeGetter(state, thisObject, throwScope);
371 throwScope.assertNoException();
372 result->putDirect(vm, Identifier::fromString(&vm, "postalCode"), postalCodeValue);
373
374 auto sortingCodeValue = jsPaymentAddressSortingCodeGetter(state, thisObject, throwScope);
375 throwScope.assertNoException();
376 result->putDirect(vm, Identifier::fromString(&vm, "sortingCode"), sortingCodeValue);
377
378 auto organizationValue = jsPaymentAddressOrganizationGetter(state, thisObject, throwScope);
379 throwScope.assertNoException();
380 result->putDirect(vm, Identifier::fromString(&vm, "organization"), organizationValue);
381
382 auto recipientValue = jsPaymentAddressRecipientGetter(state, thisObject, throwScope);
383 throwScope.assertNoException();
384 result->putDirect(vm, Identifier::fromString(&vm, "recipient"), recipientValue);
385
386 auto phoneValue = jsPaymentAddressPhoneGetter(state, thisObject, throwScope);
387 throwScope.assertNoException();
388 result->putDirect(vm, Identifier::fromString(&vm, "phone"), phoneValue);
389
390 return result;
391}
392
393static inline EncodedJSValue jsPaymentAddressPrototypeFunctionToJSONBody(ExecState* state, JSPaymentAddress* thisObject, JSC::ThrowScope& throwScope)
394{
395 return JSValue::encode(JSPaymentAddress::serialize(*state, *thisObject, *thisObject->globalObject(), throwScope));
396}
397
398EncodedJSValue JSC_HOST_CALL jsPaymentAddressPrototypeFunctionToJSON(ExecState* state)
399{
400 return IDLOperation<JSPaymentAddress>::call<jsPaymentAddressPrototypeFunctionToJSONBody>(*state, "toJSON");
401}
402
403void JSPaymentAddress::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
404{
405 auto* thisObject = jsCast<JSPaymentAddress*>(cell);
406 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
407 if (thisObject->scriptExecutionContext())
408 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
409 Base::heapSnapshot(cell, builder);
410}
411
412bool JSPaymentAddressOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
413{
414 UNUSED_PARAM(handle);
415 UNUSED_PARAM(visitor);
416 UNUSED_PARAM(reason);
417 return false;
418}
419
420void JSPaymentAddressOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
421{
422 auto* jsPaymentAddress = static_cast<JSPaymentAddress*>(handle.slot()->asCell());
423 auto& world = *static_cast<DOMWrapperWorld*>(context);
424 uncacheWrapper(world, &jsPaymentAddress->wrapped(), jsPaymentAddress);
425}
426
427JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<PaymentAddress>&& impl)
428{
429 // If you hit this failure the interface definition has the ImplementationLacksVTable
430 // attribute. You should remove that attribute. If the class has subclasses
431 // that may be passed through this toJS() function you should use the SkipVTableValidation
432 // attribute to PaymentAddress.
433 static_assert(!std::is_polymorphic<PaymentAddress>::value, "PaymentAddress is polymorphic but the IDL claims it is not");
434 return createWrapper<PaymentAddress>(globalObject, WTFMove(impl));
435}
436
437JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, PaymentAddress& impl)
438{
439 return wrap(state, globalObject, impl);
440}
441
442PaymentAddress* JSPaymentAddress::toWrapped(JSC::VM& vm, JSC::JSValue value)
443{
444 if (auto* wrapper = jsDynamicCast<JSPaymentAddress*>(vm, value))
445 return &wrapper->wrapped();
446 return nullptr;
447}
448
449}
450
451#endif // ENABLE(PAYMENT_REQUEST)
452