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 "JSCacheQueryOptions.h"
23
24#include "JSDOMConvertBoolean.h"
25#include "JSDOMConvertStrings.h"
26#include <JavaScriptCore/JSCInlines.h>
27
28
29namespace WebCore {
30using namespace JSC;
31
32template<> CacheQueryOptions convertDictionary<CacheQueryOptions>(ExecState& state, JSValue value)
33{
34 VM& vm = state.vm();
35 auto throwScope = DECLARE_THROW_SCOPE(vm);
36 bool isNullOrUndefined = value.isUndefinedOrNull();
37 auto* object = isNullOrUndefined ? nullptr : value.getObject();
38 if (UNLIKELY(!isNullOrUndefined && !object)) {
39 throwTypeError(&state, throwScope);
40 return { };
41 }
42 CacheQueryOptions result;
43 JSValue cacheNameValue;
44 if (isNullOrUndefined)
45 cacheNameValue = jsUndefined();
46 else {
47 cacheNameValue = object->get(&state, Identifier::fromString(&state, "cacheName"));
48 RETURN_IF_EXCEPTION(throwScope, { });
49 }
50 if (!cacheNameValue.isUndefined()) {
51 result.cacheName = convert<IDLDOMString>(state, cacheNameValue);
52 RETURN_IF_EXCEPTION(throwScope, { });
53 }
54 JSValue ignoreMethodValue;
55 if (isNullOrUndefined)
56 ignoreMethodValue = jsUndefined();
57 else {
58 ignoreMethodValue = object->get(&state, Identifier::fromString(&state, "ignoreMethod"));
59 RETURN_IF_EXCEPTION(throwScope, { });
60 }
61 if (!ignoreMethodValue.isUndefined()) {
62 result.ignoreMethod = convert<IDLBoolean>(state, ignoreMethodValue);
63 RETURN_IF_EXCEPTION(throwScope, { });
64 } else
65 result.ignoreMethod = false;
66 JSValue ignoreSearchValue;
67 if (isNullOrUndefined)
68 ignoreSearchValue = jsUndefined();
69 else {
70 ignoreSearchValue = object->get(&state, Identifier::fromString(&state, "ignoreSearch"));
71 RETURN_IF_EXCEPTION(throwScope, { });
72 }
73 if (!ignoreSearchValue.isUndefined()) {
74 result.ignoreSearch = convert<IDLBoolean>(state, ignoreSearchValue);
75 RETURN_IF_EXCEPTION(throwScope, { });
76 } else
77 result.ignoreSearch = false;
78 JSValue ignoreVaryValue;
79 if (isNullOrUndefined)
80 ignoreVaryValue = jsUndefined();
81 else {
82 ignoreVaryValue = object->get(&state, Identifier::fromString(&state, "ignoreVary"));
83 RETURN_IF_EXCEPTION(throwScope, { });
84 }
85 if (!ignoreVaryValue.isUndefined()) {
86 result.ignoreVary = convert<IDLBoolean>(state, ignoreVaryValue);
87 RETURN_IF_EXCEPTION(throwScope, { });
88 } else
89 result.ignoreVary = false;
90 return result;
91}
92
93} // namespace WebCore
94