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 "JSMediaConfiguration.h"
23
24#include "JSAudioConfiguration.h"
25#include "JSVideoConfiguration.h"
26#include <JavaScriptCore/JSCInlines.h>
27
28
29namespace WebCore {
30using namespace JSC;
31
32template<> MediaConfiguration convertDictionary<MediaConfiguration>(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 MediaConfiguration result;
43 JSValue audioValue;
44 if (isNullOrUndefined)
45 audioValue = jsUndefined();
46 else {
47 audioValue = object->get(&state, Identifier::fromString(&state, "audio"));
48 RETURN_IF_EXCEPTION(throwScope, { });
49 }
50 if (!audioValue.isUndefined()) {
51 result.audio = convert<IDLDictionary<AudioConfiguration>>(state, audioValue);
52 RETURN_IF_EXCEPTION(throwScope, { });
53 }
54 JSValue videoValue;
55 if (isNullOrUndefined)
56 videoValue = jsUndefined();
57 else {
58 videoValue = object->get(&state, Identifier::fromString(&state, "video"));
59 RETURN_IF_EXCEPTION(throwScope, { });
60 }
61 if (!videoValue.isUndefined()) {
62 result.video = convert<IDLDictionary<VideoConfiguration>>(state, videoValue);
63 RETURN_IF_EXCEPTION(throwScope, { });
64 }
65 return result;
66}
67
68} // namespace WebCore
69