mirror of
https://github.com/servo/servo.git
synced 2025-06-08 08:33:26 +00:00
Add support for default dict values being boolean, use in MediaStreamConstraints
This commit is contained in:
parent
caa05948bf
commit
ce635b715b
2 changed files with 11 additions and 5 deletions
|
@ -747,7 +747,15 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
|||
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue