From ce635b715bc61d82e3d5bafb2964c960e7cc5f9c Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Tue, 12 Feb 2019 18:38:38 -0800 Subject: Add support for default dict values being boolean, use in MediaStreamConstraints --- components/script/dom/bindings/codegen/CodegenRust.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'components/script/dom/bindings/codegen/CodegenRust.py') 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 -- cgit v1.2.3