diff options
author | Ms2ger <Ms2ger@gmail.com> | 2017-02-16 15:27:16 +0100 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2017-02-16 15:27:16 +0100 |
commit | d5f8b35a5f65549615c2c574e479aa4596bd06f8 (patch) | |
tree | db8ac7f6a014694ecf4f94f549e73add5db542eb /components | |
parent | 0cc6d3e99781394b76ad2725661ae8f6bb895f7b (diff) | |
download | servo-d5f8b35a5f65549615c2c574e479aa4596bd06f8.tar.gz servo-d5f8b35a5f65549615c2c574e479aa4596bd06f8.zip |
Use RootedTraceableBox for unions.
Diffstat (limited to 'components')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 6 | ||||
-rw-r--r-- | components/script/dom/testbinding.rs | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index e4448ff834c..4a9e7a8cc32 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -722,6 +722,9 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, if type.nullable(): declType = CGWrapper(declType, pre="Option<", post=" >") + if isMember != "Dictionary" and type_needs_tracing(type): + declType = CGTemplatedType("RootedTraceableBox", declType) + templateBody = ("match FromJSValConvertible::from_jsval(cx, ${val}, ()) {\n" " Ok(ConversionResult::Success(value)) => value,\n" " Ok(ConversionResult::Failure(error)) => {\n" @@ -6190,6 +6193,9 @@ def type_needs_tracing(t): if t.isSequence(): return type_needs_tracing(t.inner) + if t.isUnion(): + return any(type_needs_tracing(member) for member in t.flatMemberTypes) + return False if t.isDictionary(): diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 1582647ca33..3be8597ed41 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -435,7 +435,7 @@ impl TestBindingMethods for TestBinding { fn PassUnion6(&self, _: UnsignedLongOrBoolean) {} fn PassUnion7(&self, _: StringSequenceOrUnsignedLong) {} fn PassUnion8(&self, _: ByteStringSequenceOrLong) {} - fn PassUnion9(&self, _: UnionTypes::TestDictionaryOrLong) {} + fn PassUnion9(&self, _: RootedTraceableBox<UnionTypes::TestDictionaryOrLong>) {} fn PassUnionWithTypedef(&self, _: DocumentOrTestTypedef) {} fn PassUnionWithTypedef2(&self, _: LongSequenceOrTestTypedef) {} #[allow(unsafe_code)] |