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 | #include "JSUIEventInit.h" |
23 | |
24 | #include "JSDOMConvertBoolean.h" |
25 | #include "JSDOMConvertInterface.h" |
26 | #include "JSDOMConvertNullable.h" |
27 | #include "JSDOMConvertNumbers.h" |
28 | #include "JSWindowProxy.h" |
29 | #include <JavaScriptCore/JSCInlines.h> |
30 | |
31 | |
32 | namespace WebCore { |
33 | using namespace JSC; |
34 | |
35 | template<> UIEventInit convertDictionary<UIEventInit>(ExecState& state, JSValue value) |
36 | { |
37 | VM& vm = state.vm(); |
38 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
39 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
40 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
41 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
42 | throwTypeError(&state, throwScope); |
43 | return { }; |
44 | } |
45 | UIEventInit result; |
46 | JSValue bubblesValue; |
47 | if (isNullOrUndefined) |
48 | bubblesValue = jsUndefined(); |
49 | else { |
50 | bubblesValue = object->get(&state, Identifier::fromString(&state, "bubbles" )); |
51 | RETURN_IF_EXCEPTION(throwScope, { }); |
52 | } |
53 | if (!bubblesValue.isUndefined()) { |
54 | result.bubbles = convert<IDLBoolean>(state, bubblesValue); |
55 | RETURN_IF_EXCEPTION(throwScope, { }); |
56 | } else |
57 | result.bubbles = false; |
58 | JSValue cancelableValue; |
59 | if (isNullOrUndefined) |
60 | cancelableValue = jsUndefined(); |
61 | else { |
62 | cancelableValue = object->get(&state, Identifier::fromString(&state, "cancelable" )); |
63 | RETURN_IF_EXCEPTION(throwScope, { }); |
64 | } |
65 | if (!cancelableValue.isUndefined()) { |
66 | result.cancelable = convert<IDLBoolean>(state, cancelableValue); |
67 | RETURN_IF_EXCEPTION(throwScope, { }); |
68 | } else |
69 | result.cancelable = false; |
70 | JSValue composedValue; |
71 | if (isNullOrUndefined) |
72 | composedValue = jsUndefined(); |
73 | else { |
74 | composedValue = object->get(&state, Identifier::fromString(&state, "composed" )); |
75 | RETURN_IF_EXCEPTION(throwScope, { }); |
76 | } |
77 | if (!composedValue.isUndefined()) { |
78 | result.composed = convert<IDLBoolean>(state, composedValue); |
79 | RETURN_IF_EXCEPTION(throwScope, { }); |
80 | } else |
81 | result.composed = false; |
82 | JSValue detailValue; |
83 | if (isNullOrUndefined) |
84 | detailValue = jsUndefined(); |
85 | else { |
86 | detailValue = object->get(&state, Identifier::fromString(&state, "detail" )); |
87 | RETURN_IF_EXCEPTION(throwScope, { }); |
88 | } |
89 | if (!detailValue.isUndefined()) { |
90 | result.detail = convert<IDLLong>(state, detailValue); |
91 | RETURN_IF_EXCEPTION(throwScope, { }); |
92 | } else |
93 | result.detail = 0; |
94 | JSValue viewValue; |
95 | if (isNullOrUndefined) |
96 | viewValue = jsUndefined(); |
97 | else { |
98 | viewValue = object->get(&state, Identifier::fromString(&state, "view" )); |
99 | RETURN_IF_EXCEPTION(throwScope, { }); |
100 | } |
101 | if (!viewValue.isUndefined()) { |
102 | result.view = convert<IDLNullable<IDLInterface<WindowProxy>>>(state, viewValue); |
103 | RETURN_IF_EXCEPTION(throwScope, { }); |
104 | } else |
105 | result.view = nullptr; |
106 | return result; |
107 | } |
108 | |
109 | } // namespace WebCore |
110 | |