| 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 "JSPaymentResponse.h" |
| 26 | |
| 27 | #include "EventNames.h" |
| 28 | #include "JSDOMAttribute.h" |
| 29 | #include "JSDOMBinding.h" |
| 30 | #include "JSDOMConstructorNotConstructable.h" |
| 31 | #include "JSDOMConvertDictionary.h" |
| 32 | #include "JSDOMConvertEnumeration.h" |
| 33 | #include "JSDOMConvertInterface.h" |
| 34 | #include "JSDOMConvertNullable.h" |
| 35 | #include "JSDOMConvertStrings.h" |
| 36 | #include "JSDOMExceptionHandling.h" |
| 37 | #include "JSDOMGlobalObject.h" |
| 38 | #include "JSDOMOperation.h" |
| 39 | #include "JSDOMOperationReturningPromise.h" |
| 40 | #include "JSDOMWrapperCache.h" |
| 41 | #include "JSEventListener.h" |
| 42 | #include "JSPaymentAddress.h" |
| 43 | #include "JSPaymentComplete.h" |
| 44 | #include "JSPaymentValidationErrors.h" |
| 45 | #include "ScriptExecutionContext.h" |
| 46 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 47 | #include <JavaScriptCore/JSCInlines.h> |
| 48 | #include <JavaScriptCore/ObjectConstructor.h> |
| 49 | #include <wtf/GetPtr.h> |
| 50 | #include <wtf/PointerPreparations.h> |
| 51 | #include <wtf/URL.h> |
| 52 | |
| 53 | |
| 54 | namespace WebCore { |
| 55 | using namespace JSC; |
| 56 | |
| 57 | // Functions |
| 58 | |
| 59 | JSC::EncodedJSValue JSC_HOST_CALL jsPaymentResponsePrototypeFunctionComplete(JSC::ExecState*); |
| 60 | JSC::EncodedJSValue JSC_HOST_CALL jsPaymentResponsePrototypeFunctionRetry(JSC::ExecState*); |
| 61 | JSC::EncodedJSValue JSC_HOST_CALL jsPaymentResponsePrototypeFunctionToJSON(JSC::ExecState*); |
| 62 | |
| 63 | // Attributes |
| 64 | |
| 65 | JSC::EncodedJSValue jsPaymentResponseConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 66 | bool setJSPaymentResponseConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 67 | JSC::EncodedJSValue jsPaymentResponseRequestId(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 68 | JSC::EncodedJSValue jsPaymentResponseMethodName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 69 | JSC::EncodedJSValue jsPaymentResponseDetails(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 70 | JSC::EncodedJSValue jsPaymentResponseShippingAddress(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 71 | JSC::EncodedJSValue jsPaymentResponseShippingOption(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 72 | JSC::EncodedJSValue jsPaymentResponsePayerName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 73 | JSC::EncodedJSValue jsPaymentResponsePayerEmail(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 74 | JSC::EncodedJSValue jsPaymentResponsePayerPhone(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 75 | JSC::EncodedJSValue jsPaymentResponseOnpayerdetailchange(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 76 | bool setJSPaymentResponseOnpayerdetailchange(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 77 | |
| 78 | class JSPaymentResponsePrototype : public JSC::JSNonFinalObject { |
| 79 | public: |
| 80 | using Base = JSC::JSNonFinalObject; |
| 81 | static JSPaymentResponsePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 82 | { |
| 83 | JSPaymentResponsePrototype* ptr = new (NotNull, JSC::allocateCell<JSPaymentResponsePrototype>(vm.heap)) JSPaymentResponsePrototype(vm, globalObject, structure); |
| 84 | ptr->finishCreation(vm); |
| 85 | return ptr; |
| 86 | } |
| 87 | |
| 88 | DECLARE_INFO; |
| 89 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 90 | { |
| 91 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 92 | } |
| 93 | |
| 94 | private: |
| 95 | JSPaymentResponsePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 96 | : JSC::JSNonFinalObject(vm, structure) |
| 97 | { |
| 98 | } |
| 99 | |
| 100 | void finishCreation(JSC::VM&); |
| 101 | }; |
| 102 | |
| 103 | using JSPaymentResponseConstructor = JSDOMConstructorNotConstructable<JSPaymentResponse>; |
| 104 | |
| 105 | template<> JSValue JSPaymentResponseConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 106 | { |
| 107 | return JSEventTarget::getConstructor(vm, &globalObject); |
| 108 | } |
| 109 | |
| 110 | template<> void JSPaymentResponseConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 111 | { |
| 112 | putDirect(vm, vm.propertyNames->prototype, JSPaymentResponse::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 113 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("PaymentResponse"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 114 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 115 | } |
| 116 | |
| 117 | template<> const ClassInfo JSPaymentResponseConstructor::s_info = { "PaymentResponse" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaymentResponseConstructor) }; |
| 118 | |
| 119 | /* Hash table for prototype */ |
| 120 | |
| 121 | static const HashTableValue JSPaymentResponsePrototypeTableValues[] = |
| 122 | { |
| 123 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponseConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPaymentResponseConstructor) } }, |
| 124 | { "requestId" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponseRequestId), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 125 | { "methodName" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponseMethodName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 126 | { "details" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponseDetails), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 127 | { "shippingAddress" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponseShippingAddress), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 128 | { "shippingOption" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponseShippingOption), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 129 | { "payerName" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponsePayerName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 130 | { "payerEmail" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponsePayerEmail), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 131 | { "payerPhone" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponsePayerPhone), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
| 132 | { "onpayerdetailchange" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPaymentResponseOnpayerdetailchange), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSPaymentResponseOnpayerdetailchange) } }, |
| 133 | { "complete" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPaymentResponsePrototypeFunctionComplete), (intptr_t) (0) } }, |
| 134 | { "retry" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPaymentResponsePrototypeFunctionRetry), (intptr_t) (0) } }, |
| 135 | { "toJSON" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsPaymentResponsePrototypeFunctionToJSON), (intptr_t) (0) } }, |
| 136 | }; |
| 137 | |
| 138 | const ClassInfo JSPaymentResponsePrototype::s_info = { "PaymentResponsePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaymentResponsePrototype) }; |
| 139 | |
| 140 | void JSPaymentResponsePrototype::finishCreation(VM& vm) |
| 141 | { |
| 142 | Base::finishCreation(vm); |
| 143 | reifyStaticProperties(vm, JSPaymentResponse::info(), JSPaymentResponsePrototypeTableValues, *this); |
| 144 | } |
| 145 | |
| 146 | const ClassInfo JSPaymentResponse::s_info = { "PaymentResponse" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSPaymentResponse) }; |
| 147 | |
| 148 | JSPaymentResponse::JSPaymentResponse(Structure* structure, JSDOMGlobalObject& globalObject, Ref<PaymentResponse>&& impl) |
| 149 | : JSEventTarget(structure, globalObject, WTFMove(impl)) |
| 150 | { |
| 151 | } |
| 152 | |
| 153 | void JSPaymentResponse::finishCreation(VM& vm) |
| 154 | { |
| 155 | Base::finishCreation(vm); |
| 156 | ASSERT(inherits(vm, info())); |
| 157 | |
| 158 | } |
| 159 | |
| 160 | JSObject* JSPaymentResponse::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 161 | { |
| 162 | return JSPaymentResponsePrototype::create(vm, &globalObject, JSPaymentResponsePrototype::createStructure(vm, &globalObject, JSEventTarget::prototype(vm, globalObject))); |
| 163 | } |
| 164 | |
| 165 | JSObject* JSPaymentResponse::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
| 166 | { |
| 167 | return getDOMPrototype<JSPaymentResponse>(vm, globalObject); |
| 168 | } |
| 169 | |
| 170 | JSValue JSPaymentResponse::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
| 171 | { |
| 172 | return getDOMConstructor<JSPaymentResponseConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 173 | } |
| 174 | |
| 175 | template<> inline JSPaymentResponse* IDLAttribute<JSPaymentResponse>::cast(ExecState& state, EncodedJSValue thisValue) |
| 176 | { |
| 177 | return jsDynamicCast<JSPaymentResponse*>(state.vm(), JSValue::decode(thisValue)); |
| 178 | } |
| 179 | |
| 180 | template<> inline JSPaymentResponse* IDLOperation<JSPaymentResponse>::cast(ExecState& state) |
| 181 | { |
| 182 | return jsDynamicCast<JSPaymentResponse*>(state.vm(), state.thisValue()); |
| 183 | } |
| 184 | |
| 185 | EncodedJSValue jsPaymentResponseConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 186 | { |
| 187 | VM& vm = state->vm(); |
| 188 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 189 | auto* prototype = jsDynamicCast<JSPaymentResponsePrototype*>(vm, JSValue::decode(thisValue)); |
| 190 | if (UNLIKELY(!prototype)) |
| 191 | return throwVMTypeError(state, throwScope); |
| 192 | return JSValue::encode(JSPaymentResponse::getConstructor(state->vm(), prototype->globalObject())); |
| 193 | } |
| 194 | |
| 195 | bool setJSPaymentResponseConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 196 | { |
| 197 | VM& vm = state->vm(); |
| 198 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 199 | auto* prototype = jsDynamicCast<JSPaymentResponsePrototype*>(vm, JSValue::decode(thisValue)); |
| 200 | if (UNLIKELY(!prototype)) { |
| 201 | throwVMTypeError(state, throwScope); |
| 202 | return false; |
| 203 | } |
| 204 | // Shadowing a built-in constructor |
| 205 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 206 | } |
| 207 | |
| 208 | static inline JSValue jsPaymentResponseRequestIdGetter(ExecState& state, JSPaymentResponse& thisObject, ThrowScope& throwScope) |
| 209 | { |
| 210 | UNUSED_PARAM(throwScope); |
| 211 | UNUSED_PARAM(state); |
| 212 | auto& impl = thisObject.wrapped(); |
| 213 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.requestId()); |
| 214 | return result; |
| 215 | } |
| 216 | |
| 217 | EncodedJSValue jsPaymentResponseRequestId(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 218 | { |
| 219 | return IDLAttribute<JSPaymentResponse>::get<jsPaymentResponseRequestIdGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "requestId" ); |
| 220 | } |
| 221 | |
| 222 | static inline JSValue jsPaymentResponseMethodNameGetter(ExecState& state, JSPaymentResponse& thisObject, ThrowScope& throwScope) |
| 223 | { |
| 224 | UNUSED_PARAM(throwScope); |
| 225 | UNUSED_PARAM(state); |
| 226 | auto& impl = thisObject.wrapped(); |
| 227 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.methodName()); |
| 228 | return result; |
| 229 | } |
| 230 | |
| 231 | EncodedJSValue jsPaymentResponseMethodName(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 232 | { |
| 233 | return IDLAttribute<JSPaymentResponse>::get<jsPaymentResponseMethodNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "methodName" ); |
| 234 | } |
| 235 | |
| 236 | static inline JSValue jsPaymentResponseDetailsGetter(ExecState& state, JSPaymentResponse& thisObject, ThrowScope& throwScope) |
| 237 | { |
| 238 | UNUSED_PARAM(throwScope); |
| 239 | UNUSED_PARAM(state); |
| 240 | return thisObject.details(state); |
| 241 | } |
| 242 | |
| 243 | EncodedJSValue jsPaymentResponseDetails(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 244 | { |
| 245 | return IDLAttribute<JSPaymentResponse>::get<jsPaymentResponseDetailsGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "details" ); |
| 246 | } |
| 247 | |
| 248 | static inline JSValue jsPaymentResponseShippingAddressGetter(ExecState& state, JSPaymentResponse& thisObject, ThrowScope& throwScope) |
| 249 | { |
| 250 | UNUSED_PARAM(throwScope); |
| 251 | UNUSED_PARAM(state); |
| 252 | auto& impl = thisObject.wrapped(); |
| 253 | JSValue result = toJS<IDLNullable<IDLInterface<PaymentAddress>>>(state, *thisObject.globalObject(), throwScope, impl.shippingAddress()); |
| 254 | return result; |
| 255 | } |
| 256 | |
| 257 | EncodedJSValue jsPaymentResponseShippingAddress(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 258 | { |
| 259 | return IDLAttribute<JSPaymentResponse>::get<jsPaymentResponseShippingAddressGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "shippingAddress" ); |
| 260 | } |
| 261 | |
| 262 | static inline JSValue jsPaymentResponseShippingOptionGetter(ExecState& state, JSPaymentResponse& thisObject, ThrowScope& throwScope) |
| 263 | { |
| 264 | UNUSED_PARAM(throwScope); |
| 265 | UNUSED_PARAM(state); |
| 266 | auto& impl = thisObject.wrapped(); |
| 267 | JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.shippingOption()); |
| 268 | return result; |
| 269 | } |
| 270 | |
| 271 | EncodedJSValue jsPaymentResponseShippingOption(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 272 | { |
| 273 | return IDLAttribute<JSPaymentResponse>::get<jsPaymentResponseShippingOptionGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "shippingOption" ); |
| 274 | } |
| 275 | |
| 276 | static inline JSValue jsPaymentResponsePayerNameGetter(ExecState& state, JSPaymentResponse& thisObject, ThrowScope& throwScope) |
| 277 | { |
| 278 | UNUSED_PARAM(throwScope); |
| 279 | UNUSED_PARAM(state); |
| 280 | auto& impl = thisObject.wrapped(); |
| 281 | JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.payerName()); |
| 282 | return result; |
| 283 | } |
| 284 | |
| 285 | EncodedJSValue jsPaymentResponsePayerName(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 286 | { |
| 287 | return IDLAttribute<JSPaymentResponse>::get<jsPaymentResponsePayerNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "payerName" ); |
| 288 | } |
| 289 | |
| 290 | static inline JSValue jsPaymentResponsePayerEmailGetter(ExecState& state, JSPaymentResponse& thisObject, ThrowScope& throwScope) |
| 291 | { |
| 292 | UNUSED_PARAM(throwScope); |
| 293 | UNUSED_PARAM(state); |
| 294 | auto& impl = thisObject.wrapped(); |
| 295 | JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.payerEmail()); |
| 296 | return result; |
| 297 | } |
| 298 | |
| 299 | EncodedJSValue jsPaymentResponsePayerEmail(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 300 | { |
| 301 | return IDLAttribute<JSPaymentResponse>::get<jsPaymentResponsePayerEmailGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "payerEmail" ); |
| 302 | } |
| 303 | |
| 304 | static inline JSValue jsPaymentResponsePayerPhoneGetter(ExecState& state, JSPaymentResponse& thisObject, ThrowScope& throwScope) |
| 305 | { |
| 306 | UNUSED_PARAM(throwScope); |
| 307 | UNUSED_PARAM(state); |
| 308 | auto& impl = thisObject.wrapped(); |
| 309 | JSValue result = toJS<IDLNullable<IDLDOMString>>(state, throwScope, impl.payerPhone()); |
| 310 | return result; |
| 311 | } |
| 312 | |
| 313 | EncodedJSValue jsPaymentResponsePayerPhone(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 314 | { |
| 315 | return IDLAttribute<JSPaymentResponse>::get<jsPaymentResponsePayerPhoneGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "payerPhone" ); |
| 316 | } |
| 317 | |
| 318 | static inline JSValue jsPaymentResponseOnpayerdetailchangeGetter(ExecState& state, JSPaymentResponse& thisObject, ThrowScope& throwScope) |
| 319 | { |
| 320 | UNUSED_PARAM(throwScope); |
| 321 | UNUSED_PARAM(state); |
| 322 | return eventHandlerAttribute(thisObject.wrapped(), eventNames().payerdetailchangeEvent, worldForDOMObject(thisObject)); |
| 323 | } |
| 324 | |
| 325 | EncodedJSValue jsPaymentResponseOnpayerdetailchange(ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 326 | { |
| 327 | return IDLAttribute<JSPaymentResponse>::get<jsPaymentResponseOnpayerdetailchangeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "onpayerdetailchange" ); |
| 328 | } |
| 329 | |
| 330 | static inline bool setJSPaymentResponseOnpayerdetailchangeSetter(ExecState& state, JSPaymentResponse& thisObject, JSValue value, ThrowScope& throwScope) |
| 331 | { |
| 332 | UNUSED_PARAM(throwScope); |
| 333 | setEventHandlerAttribute(state, thisObject, thisObject.wrapped(), eventNames().payerdetailchangeEvent, value); |
| 334 | return true; |
| 335 | } |
| 336 | |
| 337 | bool setJSPaymentResponseOnpayerdetailchange(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 338 | { |
| 339 | return IDLAttribute<JSPaymentResponse>::set<setJSPaymentResponseOnpayerdetailchangeSetter>(*state, thisValue, encodedValue, "onpayerdetailchange" ); |
| 340 | } |
| 341 | |
| 342 | static inline JSC::EncodedJSValue jsPaymentResponsePrototypeFunctionCompleteBody(JSC::ExecState* state, typename IDLOperationReturningPromise<JSPaymentResponse>::ClassParameter castedThis, Ref<DeferredPromise>&& promise, JSC::ThrowScope& throwScope) |
| 343 | { |
| 344 | UNUSED_PARAM(state); |
| 345 | UNUSED_PARAM(throwScope); |
| 346 | auto& impl = castedThis->wrapped(); |
| 347 | auto result = state->argument(0).isUndefined() ? PaymentComplete::Unknown : convert<IDLEnumeration<PaymentComplete>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(state, scope, 0, "result" , "PaymentResponse" , "complete" , expectedEnumerationValues<PaymentComplete>()); }); |
| 348 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 349 | impl.complete(WTFMove(result), WTFMove(promise)); |
| 350 | return JSValue::encode(jsUndefined()); |
| 351 | } |
| 352 | |
| 353 | EncodedJSValue JSC_HOST_CALL jsPaymentResponsePrototypeFunctionComplete(ExecState* state) |
| 354 | { |
| 355 | return IDLOperationReturningPromise<JSPaymentResponse>::call<jsPaymentResponsePrototypeFunctionCompleteBody, PromiseExecutionScope::WindowOrWorker>(*state, "complete" ); |
| 356 | } |
| 357 | |
| 358 | static inline JSC::EncodedJSValue jsPaymentResponsePrototypeFunctionRetryBody(JSC::ExecState* state, typename IDLOperationReturningPromise<JSPaymentResponse>::ClassParameter castedThis, Ref<DeferredPromise>&& promise, JSC::ThrowScope& throwScope) |
| 359 | { |
| 360 | UNUSED_PARAM(state); |
| 361 | UNUSED_PARAM(throwScope); |
| 362 | auto& impl = castedThis->wrapped(); |
| 363 | auto errorFields = convert<IDLDictionary<PaymentValidationErrors>>(*state, state->argument(0)); |
| 364 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 365 | impl.retry(WTFMove(errorFields), WTFMove(promise)); |
| 366 | return JSValue::encode(jsUndefined()); |
| 367 | } |
| 368 | |
| 369 | EncodedJSValue JSC_HOST_CALL jsPaymentResponsePrototypeFunctionRetry(ExecState* state) |
| 370 | { |
| 371 | return IDLOperationReturningPromise<JSPaymentResponse>::call<jsPaymentResponsePrototypeFunctionRetryBody, PromiseExecutionScope::WindowOrWorker>(*state, "retry" ); |
| 372 | } |
| 373 | |
| 374 | JSC::JSObject* JSPaymentResponse::serialize(ExecState& state, JSPaymentResponse& thisObject, JSDOMGlobalObject& globalObject, ThrowScope& throwScope) |
| 375 | { |
| 376 | auto& vm = state.vm(); |
| 377 | auto* result = constructEmptyObject(&state, globalObject.objectPrototype()); |
| 378 | |
| 379 | auto requestIdValue = jsPaymentResponseRequestIdGetter(state, thisObject, throwScope); |
| 380 | throwScope.assertNoException(); |
| 381 | result->putDirect(vm, Identifier::fromString(&vm, "requestId" ), requestIdValue); |
| 382 | |
| 383 | auto methodNameValue = jsPaymentResponseMethodNameGetter(state, thisObject, throwScope); |
| 384 | throwScope.assertNoException(); |
| 385 | result->putDirect(vm, Identifier::fromString(&vm, "methodName" ), methodNameValue); |
| 386 | |
| 387 | auto shippingAddressValue = jsPaymentResponseShippingAddressGetter(state, thisObject, throwScope); |
| 388 | throwScope.assertNoException(); |
| 389 | if (!shippingAddressValue.isNull()) { |
| 390 | auto* shippingAddressSerializedValue = JSPaymentAddress::serialize(state, *jsCast<JSPaymentAddress*>(shippingAddressValue), globalObject, throwScope); |
| 391 | result->putDirect(vm, Identifier::fromString(&vm, "shippingAddress" ), shippingAddressSerializedValue); |
| 392 | } else |
| 393 | result->putDirect(vm, Identifier::fromString(&vm, "shippingAddress" ), shippingAddressValue); |
| 394 | |
| 395 | auto shippingOptionValue = jsPaymentResponseShippingOptionGetter(state, thisObject, throwScope); |
| 396 | throwScope.assertNoException(); |
| 397 | result->putDirect(vm, Identifier::fromString(&vm, "shippingOption" ), shippingOptionValue); |
| 398 | |
| 399 | auto payerNameValue = jsPaymentResponsePayerNameGetter(state, thisObject, throwScope); |
| 400 | throwScope.assertNoException(); |
| 401 | result->putDirect(vm, Identifier::fromString(&vm, "payerName" ), payerNameValue); |
| 402 | |
| 403 | auto payerEmailValue = jsPaymentResponsePayerEmailGetter(state, thisObject, throwScope); |
| 404 | throwScope.assertNoException(); |
| 405 | result->putDirect(vm, Identifier::fromString(&vm, "payerEmail" ), payerEmailValue); |
| 406 | |
| 407 | auto payerPhoneValue = jsPaymentResponsePayerPhoneGetter(state, thisObject, throwScope); |
| 408 | throwScope.assertNoException(); |
| 409 | result->putDirect(vm, Identifier::fromString(&vm, "payerPhone" ), payerPhoneValue); |
| 410 | |
| 411 | return result; |
| 412 | } |
| 413 | |
| 414 | static inline EncodedJSValue jsPaymentResponsePrototypeFunctionToJSONBody(ExecState* state, JSPaymentResponse* thisObject, JSC::ThrowScope& throwScope) |
| 415 | { |
| 416 | return JSValue::encode(JSPaymentResponse::serialize(*state, *thisObject, *thisObject->globalObject(), throwScope)); |
| 417 | } |
| 418 | |
| 419 | EncodedJSValue JSC_HOST_CALL jsPaymentResponsePrototypeFunctionToJSON(ExecState* state) |
| 420 | { |
| 421 | return IDLOperation<JSPaymentResponse>::call<jsPaymentResponsePrototypeFunctionToJSONBody>(*state, "toJSON" ); |
| 422 | } |
| 423 | |
| 424 | void JSPaymentResponse::visitChildren(JSCell* cell, SlotVisitor& visitor) |
| 425 | { |
| 426 | auto* thisObject = jsCast<JSPaymentResponse*>(cell); |
| 427 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
| 428 | Base::visitChildren(thisObject, visitor); |
| 429 | thisObject->visitAdditionalChildren(visitor); |
| 430 | } |
| 431 | |
| 432 | void JSPaymentResponse::visitOutputConstraints(JSCell* cell, SlotVisitor& visitor) |
| 433 | { |
| 434 | auto* thisObject = jsCast<JSPaymentResponse*>(cell); |
| 435 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
| 436 | Base::visitOutputConstraints(thisObject, visitor); |
| 437 | thisObject->visitAdditionalChildren(visitor); |
| 438 | } |
| 439 | |
| 440 | void JSPaymentResponse::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
| 441 | { |
| 442 | auto* thisObject = jsCast<JSPaymentResponse*>(cell); |
| 443 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 444 | if (thisObject->scriptExecutionContext()) |
| 445 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 446 | Base::heapSnapshot(cell, builder); |
| 447 | } |
| 448 | |
| 449 | #if ENABLE(BINDING_INTEGRITY) |
| 450 | #if PLATFORM(WIN) |
| 451 | #pragma warning(disable: 4483) |
| 452 | extern "C" { extern void (*const __identifier("??_7PaymentResponse@WebCore@@6B@" )[])(); } |
| 453 | #else |
| 454 | extern "C" { extern void* _ZTVN7WebCore15PaymentResponseE[]; } |
| 455 | #endif |
| 456 | #endif |
| 457 | |
| 458 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<PaymentResponse>&& impl) |
| 459 | { |
| 460 | |
| 461 | #if ENABLE(BINDING_INTEGRITY) |
| 462 | void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr())); |
| 463 | #if PLATFORM(WIN) |
| 464 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7PaymentResponse@WebCore@@6B@" )); |
| 465 | #else |
| 466 | void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore15PaymentResponseE[2]); |
| 467 | #endif |
| 468 | |
| 469 | // If this fails PaymentResponse does not have a vtable, so you need to add the |
| 470 | // ImplementationLacksVTable attribute to the interface definition |
| 471 | static_assert(std::is_polymorphic<PaymentResponse>::value, "PaymentResponse is not polymorphic" ); |
| 472 | |
| 473 | // If you hit this assertion you either have a use after free bug, or |
| 474 | // PaymentResponse has subclasses. If PaymentResponse has subclasses that get passed |
| 475 | // to toJS() we currently require PaymentResponse you to opt out of binding hardening |
| 476 | // by adding the SkipVTableValidation attribute to the interface IDL definition |
| 477 | RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer); |
| 478 | #endif |
| 479 | return createWrapper<PaymentResponse>(globalObject, WTFMove(impl)); |
| 480 | } |
| 481 | |
| 482 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, PaymentResponse& impl) |
| 483 | { |
| 484 | return wrap(state, globalObject, impl); |
| 485 | } |
| 486 | |
| 487 | PaymentResponse* JSPaymentResponse::toWrapped(JSC::VM& vm, JSC::JSValue value) |
| 488 | { |
| 489 | if (auto* wrapper = jsDynamicCast<JSPaymentResponse*>(vm, value)) |
| 490 | return &wrapper->wrapped(); |
| 491 | return nullptr; |
| 492 | } |
| 493 | |
| 494 | } |
| 495 | |
| 496 | #endif // ENABLE(PAYMENT_REQUEST) |
| 497 | |