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 "JSPaymentMethodData.h"
26
27#include "JSDOMConvertObject.h"
28#include "JSDOMConvertStrings.h"
29#include <JavaScriptCore/JSCInlines.h>
30
31
32namespace WebCore {
33using namespace JSC;
34
35#if ENABLE(PAYMENT_REQUEST)
36
37template<> PaymentMethodData convertDictionary<PaymentMethodData>(ExecState& state, JSValue value)
38{
39 VM& vm = state.vm();
40 auto throwScope = DECLARE_THROW_SCOPE(vm);
41 bool isNullOrUndefined = value.isUndefinedOrNull();
42 auto* object = isNullOrUndefined ? nullptr : value.getObject();
43 if (UNLIKELY(!isNullOrUndefined && !object)) {
44 throwTypeError(&state, throwScope);
45 return { };
46 }
47 PaymentMethodData result;
48 JSValue dataValue;
49 if (isNullOrUndefined)
50 dataValue = jsUndefined();
51 else {
52 dataValue = object->get(&state, Identifier::fromString(&state, "data"));
53 RETURN_IF_EXCEPTION(throwScope, { });
54 }
55 if (!dataValue.isUndefined()) {
56 result.data = convert<IDLObject>(state, dataValue);
57 RETURN_IF_EXCEPTION(throwScope, { });
58 }
59 JSValue supportedMethodsValue;
60 if (isNullOrUndefined)
61 supportedMethodsValue = jsUndefined();
62 else {
63 supportedMethodsValue = object->get(&state, Identifier::fromString(&state, "supportedMethods"));
64 RETURN_IF_EXCEPTION(throwScope, { });
65 }
66 if (!supportedMethodsValue.isUndefined()) {
67 result.supportedMethods = convert<IDLDOMString>(state, supportedMethodsValue);
68 RETURN_IF_EXCEPTION(throwScope, { });
69 } else {
70 throwRequiredMemberTypeError(state, throwScope, "supportedMethods", "PaymentMethodData", "DOMString");
71 return { };
72 }
73 return result;
74}
75
76#endif
77
78} // namespace WebCore
79
80#endif // ENABLE(PAYMENT_REQUEST)
81