aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/CodegenRust.py
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py10
1 files changed, 9 insertions, 1 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