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 "JSPositionOptions.h"
23
24#include "JSDOMConvertBoolean.h"
25#include "JSDOMConvertNumbers.h"
26#include <JavaScriptCore/JSCInlines.h>
27
28
29namespace WebCore {
30using namespace JSC;
31
32template<> PositionOptions convertDictionary<PositionOptions>(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 PositionOptions result;
43 JSValue enableHighAccuracyValue;
44 if (isNullOrUndefined)
45 enableHighAccuracyValue = jsUndefined();
46 else {
47 enableHighAccuracyValue = object->get(&state, Identifier::fromString(&state, "enableHighAccuracy"));
48 RETURN_IF_EXCEPTION(throwScope, { });
49 }
50 if (!enableHighAccuracyValue.isUndefined()) {
51 result.enableHighAccuracy = convert<IDLBoolean>(state, enableHighAccuracyValue);
52 RETURN_IF_EXCEPTION(throwScope, { });
53 } else
54 result.enableHighAccuracy = false;
55 JSValue maximumAgeValue;
56 if (isNullOrUndefined)
57 maximumAgeValue = jsUndefined();
58 else {
59 maximumAgeValue = object->get(&state, Identifier::fromString(&state, "maximumAge"));
60 RETURN_IF_EXCEPTION(throwScope, { });
61 }
62 if (!maximumAgeValue.isUndefined()) {
63 result.maximumAge = convert<IDLClampAdaptor<IDLUnsignedLong>>(state, maximumAgeValue);
64 RETURN_IF_EXCEPTION(throwScope, { });
65 } else
66 result.maximumAge = 0;
67 JSValue timeoutValue;
68 if (isNullOrUndefined)
69 timeoutValue = jsUndefined();
70 else {
71 timeoutValue = object->get(&state, Identifier::fromString(&state, "timeout"));
72 RETURN_IF_EXCEPTION(throwScope, { });
73 }
74 if (!timeoutValue.isUndefined()) {
75 result.timeout = convert<IDLClampAdaptor<IDLUnsignedLong>>(state, timeoutValue);
76 RETURN_IF_EXCEPTION(throwScope, { });
77 } else
78 result.timeout = 0xFFFFFFFF;
79 return result;
80}
81
82} // namespace WebCore
83