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(WEB_CRYPTO) |
24 | |
25 | #include "JSRsaPssParams.h" |
26 | |
27 | #include "JSDOMConvertNumbers.h" |
28 | #include "JSDOMConvertStrings.h" |
29 | #include <JavaScriptCore/JSCInlines.h> |
30 | |
31 | |
32 | namespace WebCore { |
33 | using namespace JSC; |
34 | |
35 | #if ENABLE(WEB_CRYPTO) |
36 | |
37 | template<> CryptoAlgorithmRsaPssParams convertDictionary<CryptoAlgorithmRsaPssParams>(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 | CryptoAlgorithmRsaPssParams result; |
48 | JSValue nameValue; |
49 | if (isNullOrUndefined) |
50 | nameValue = jsUndefined(); |
51 | else { |
52 | nameValue = object->get(&state, Identifier::fromString(&state, "name" )); |
53 | RETURN_IF_EXCEPTION(throwScope, { }); |
54 | } |
55 | if (!nameValue.isUndefined()) { |
56 | result.name = convert<IDLDOMString>(state, nameValue); |
57 | RETURN_IF_EXCEPTION(throwScope, { }); |
58 | } else { |
59 | throwRequiredMemberTypeError(state, throwScope, "name" , "RsaPssParams" , "DOMString" ); |
60 | return { }; |
61 | } |
62 | JSValue saltLengthValue; |
63 | if (isNullOrUndefined) |
64 | saltLengthValue = jsUndefined(); |
65 | else { |
66 | saltLengthValue = object->get(&state, Identifier::fromString(&state, "saltLength" )); |
67 | RETURN_IF_EXCEPTION(throwScope, { }); |
68 | } |
69 | if (!saltLengthValue.isUndefined()) { |
70 | result.saltLength = convert<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(state, saltLengthValue); |
71 | RETURN_IF_EXCEPTION(throwScope, { }); |
72 | } else { |
73 | throwRequiredMemberTypeError(state, throwScope, "saltLength" , "RsaPssParams" , "unsigned long" ); |
74 | return { }; |
75 | } |
76 | return result; |
77 | } |
78 | |
79 | #endif |
80 | |
81 | } // namespace WebCore |
82 | |
83 | #endif // ENABLE(WEB_CRYPTO) |
84 | |