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 "JSBlobPropertyBag.h" |
23 | |
24 | #include "JSBlobLineEndings.h" |
25 | #include "JSDOMConvertEnumeration.h" |
26 | #include "JSDOMConvertStrings.h" |
27 | #include <JavaScriptCore/JSCInlines.h> |
28 | |
29 | |
30 | namespace WebCore { |
31 | using namespace JSC; |
32 | |
33 | template<> BlobPropertyBag convertDictionary<BlobPropertyBag>(ExecState& state, JSValue value) |
34 | { |
35 | VM& vm = state.vm(); |
36 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
37 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
38 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
39 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
40 | throwTypeError(&state, throwScope); |
41 | return { }; |
42 | } |
43 | BlobPropertyBag result; |
44 | JSValue endingsValue; |
45 | if (isNullOrUndefined) |
46 | endingsValue = jsUndefined(); |
47 | else { |
48 | endingsValue = object->get(&state, Identifier::fromString(&state, "endings" )); |
49 | RETURN_IF_EXCEPTION(throwScope, { }); |
50 | } |
51 | if (!endingsValue.isUndefined()) { |
52 | result.endings = convert<IDLEnumeration<BlobLineEndings>>(state, endingsValue); |
53 | RETURN_IF_EXCEPTION(throwScope, { }); |
54 | } else |
55 | result.endings = BlobLineEndings::Transparent; |
56 | JSValue typeValue; |
57 | if (isNullOrUndefined) |
58 | typeValue = jsUndefined(); |
59 | else { |
60 | typeValue = object->get(&state, Identifier::fromString(&state, "type" )); |
61 | RETURN_IF_EXCEPTION(throwScope, { }); |
62 | } |
63 | if (!typeValue.isUndefined()) { |
64 | result.type = convert<IDLDOMString>(state, typeValue); |
65 | RETURN_IF_EXCEPTION(throwScope, { }); |
66 | } else |
67 | result.type = emptyString(); |
68 | return result; |
69 | } |
70 | |
71 | } // namespace WebCore |
72 | |