diff options
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 8 | ||||
-rw-r--r-- | components/script/dom/testbinding.rs | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 1207b050797..916c8770d34 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -1121,13 +1121,10 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, templateBody = "${val}.get().to_object()" default = "ptr::null_mut()" - # TODO: Do we need to do the same for dictionaries? - if isMember == "Union": + if isMember in ("Dictionary", "Union"): templateBody = "RootedTraceableBox::from_box(Heap::boxed(%s))" % templateBody default = "RootedTraceableBox::new(Heap::default())" declType = CGGeneric("RootedTraceableBox<Heap<*mut JSObject>>") - elif isMember == "Dictionary": - declType = CGGeneric("Heap<*mut JSObject>") else: # TODO: Need to root somehow # https://github.com/servo/servo/issues/6382 @@ -6168,7 +6165,8 @@ class CGDictionary(CGThing): conversion = self.getMemberConversion(memberInfo, member.type) if isInitial: return CGGeneric("%s: %s,\n" % (name, conversion.define())) - if member.type.isAny() or member.type.isObject(): + # TODO: Root Heap<JSVal> using RootedTraceableBox + if member.type.isAny(): return CGGeneric("dictionary.%s.set(%s);\n" % (name, conversion.define())) return CGGeneric("dictionary.%s = %s;\n" % (name, conversion.define())) diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 80159a30068..d450c282885 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -369,7 +369,7 @@ impl TestBindingMethods for TestBinding { nullableFloatValue: None, nullableLongLongValue: None, nullableLongValue: None, - nullableObjectValue: Heap::default(), + nullableObjectValue: RootedTraceableBox::new(Heap::default()), nullableOctetValue: None, nullableShortValue: None, nullableStringValue: None, |