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 "JSPaymentDetailsModifier.h" |
26 | |
27 | #include "JSDOMConvertObject.h" |
28 | #include "JSDOMConvertSequences.h" |
29 | #include "JSDOMConvertStrings.h" |
30 | #include "JSPaymentItem.h" |
31 | #include <JavaScriptCore/JSArray.h> |
32 | #include <JavaScriptCore/JSCInlines.h> |
33 | |
34 | |
35 | namespace WebCore { |
36 | using namespace JSC; |
37 | |
38 | #if ENABLE(PAYMENT_REQUEST) |
39 | |
40 | template<> PaymentDetailsModifier convertDictionary<PaymentDetailsModifier>(ExecState& state, JSValue value) |
41 | { |
42 | VM& vm = state.vm(); |
43 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
44 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
45 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
46 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
47 | throwTypeError(&state, throwScope); |
48 | return { }; |
49 | } |
50 | PaymentDetailsModifier result; |
51 | JSValue additionalDisplayItemsValue; |
52 | if (isNullOrUndefined) |
53 | additionalDisplayItemsValue = jsUndefined(); |
54 | else { |
55 | additionalDisplayItemsValue = object->get(&state, Identifier::fromString(&state, "additionalDisplayItems" )); |
56 | RETURN_IF_EXCEPTION(throwScope, { }); |
57 | } |
58 | if (!additionalDisplayItemsValue.isUndefined()) { |
59 | result.additionalDisplayItems = convert<IDLSequence<IDLDictionary<PaymentItem>>>(state, additionalDisplayItemsValue); |
60 | RETURN_IF_EXCEPTION(throwScope, { }); |
61 | } |
62 | JSValue dataValue; |
63 | if (isNullOrUndefined) |
64 | dataValue = jsUndefined(); |
65 | else { |
66 | dataValue = object->get(&state, Identifier::fromString(&state, "data" )); |
67 | RETURN_IF_EXCEPTION(throwScope, { }); |
68 | } |
69 | if (!dataValue.isUndefined()) { |
70 | result.data = convert<IDLObject>(state, dataValue); |
71 | RETURN_IF_EXCEPTION(throwScope, { }); |
72 | } |
73 | JSValue supportedMethodsValue; |
74 | if (isNullOrUndefined) |
75 | supportedMethodsValue = jsUndefined(); |
76 | else { |
77 | supportedMethodsValue = object->get(&state, Identifier::fromString(&state, "supportedMethods" )); |
78 | RETURN_IF_EXCEPTION(throwScope, { }); |
79 | } |
80 | if (!supportedMethodsValue.isUndefined()) { |
81 | result.supportedMethods = convert<IDLDOMString>(state, supportedMethodsValue); |
82 | RETURN_IF_EXCEPTION(throwScope, { }); |
83 | } else { |
84 | throwRequiredMemberTypeError(state, throwScope, "supportedMethods" , "PaymentDetailsModifier" , "DOMString" ); |
85 | return { }; |
86 | } |
87 | JSValue totalValue; |
88 | if (isNullOrUndefined) |
89 | totalValue = jsUndefined(); |
90 | else { |
91 | totalValue = object->get(&state, Identifier::fromString(&state, "total" )); |
92 | RETURN_IF_EXCEPTION(throwScope, { }); |
93 | } |
94 | if (!totalValue.isUndefined()) { |
95 | result.total = convert<IDLDictionary<PaymentItem>>(state, totalValue); |
96 | RETURN_IF_EXCEPTION(throwScope, { }); |
97 | } |
98 | return result; |
99 | } |
100 | |
101 | #endif |
102 | |
103 | } // namespace WebCore |
104 | |
105 | #endif // ENABLE(PAYMENT_REQUEST) |
106 | |