diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2019-02-12 18:38:38 -0800 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2019-03-04 15:31:47 +0530 |
commit | ce635b715bc61d82e3d5bafb2964c960e7cc5f9c (patch) | |
tree | 2025d73316b015f3081a3072796dd385c09e0764 /components/script | |
parent | caa05948bf250944b259a5a95a8e6ef1db6a947b (diff) | |
download | servo-ce635b715bc61d82e3d5bafb2964c960e7cc5f9c.tar.gz servo-ce635b715bc61d82e3d5bafb2964c960e7cc5f9c.zip |
Add support for default dict values being boolean, use in MediaStreamConstraints
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 10 | ||||
-rw-r--r-- | components/script/dom/webidls/MediaDevices.webidl | 6 |
2 files changed, 11 insertions, 5 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 1bd01651e76..fe88275bf20 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -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 diff --git a/components/script/dom/webidls/MediaDevices.webidl b/components/script/dom/webidls/MediaDevices.webidl index e439a80c512..866e1e964d0 100644 --- a/components/script/dom/webidls/MediaDevices.webidl +++ b/components/script/dom/webidls/MediaDevices.webidl @@ -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 { |