Skip to content
Permalink
Browse files

Add support for default dict values being boolean, use in MediaStream…

…Constraints
  • Loading branch information...
Manishearth committed Feb 13, 2019
1 parent caa0594 commit ce635b715bc61d82e3d5bafb2964c960e7cc5f9c
@@ -747,7 +747,15 @@ def wrapObjectTemplate(templateBody, nullValue, isDefinitelyObject, type,
for memberType in type.unroll().flatMemberTypes
if memberType.isDictionary()
]
if dictionaries:
if defaultValue and not isinstance(defaultValue, IDLNullValue):
tag = defaultValue.type.tag()
if tag is IDLType.Tags.bool:
default = "%s::Boolean(%s)" % (
union_native_type(type),
"true" if defaultValue.value else "false")
else:
raise("We don't currently support default values that aren't null or boolean")
elif dictionaries:
if defaultValue:
assert isinstance(defaultValue, IDLNullValue)
dictionary, = dictionaries
@@ -23,10 +23,8 @@ partial interface MediaDevices {


dictionary MediaStreamConstraints {
(boolean or MediaTrackConstraints) video;
// (boolean or MediaTrackConstraints) video = false;
(boolean or MediaTrackConstraints) audio;
// (boolean or MediaTrackConstraints) audio = false;
(boolean or MediaTrackConstraints) video = false;
(boolean or MediaTrackConstraints) audio = false;
};

dictionary DoubleRange {

0 comments on commit ce635b7

Please sign in to comment.
You can’t perform that action at this time.