aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/testbinding.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2017-05-26 12:29:31 -0400
committerJosh Matthews <josh@joshmatthews.net>2017-09-25 16:10:58 -0400
commitda65698c5c5934220b82493b3f7bb2ab05a2e512 (patch)
treeebb8646bbbde4b988d55758598b6ea724149b79f /components/script/dom/testbinding.rs
parente481e8934a0c37a4b1eba19862ff732ec9bf19c9 (diff)
downloadservo-da65698c5c5934220b82493b3f7bb2ab05a2e512.tar.gz
servo-da65698c5c5934220b82493b3f7bb2ab05a2e512.zip
Be more conservative about safety of dictionary and union values.
Mark dictionaries containing GC values as must_root, and wrap them in RootedTraceableBox in automatically-generated APIs. To accommodate union variants that are now flagged as unsafe, add RootedTraceableBox to union variants that need to be rooted, rather than wrapping the entire union value.
Diffstat (limited to 'components/script/dom/testbinding.rs')
-rw-r--r--components/script/dom/testbinding.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs
index 1a56a77a64f..266497da83e 100644
--- a/components/script/dom/testbinding.rs
+++ b/components/script/dom/testbinding.rs
@@ -338,8 +338,8 @@ impl TestBindingMethods for TestBinding {
Some(ByteStringOrLong::ByteString(ByteString::new(vec!())))
}
fn ReceiveNullableSequence(&self) -> Option<Vec<i32>> { Some(vec![1]) }
- fn ReceiveTestDictionaryWithSuccessOnKeyword(&self) -> TestDictionary {
- TestDictionary {
+ fn ReceiveTestDictionaryWithSuccessOnKeyword(&self) -> RootedTraceableBox<TestDictionary> {
+ RootedTraceableBox::new(TestDictionary {
anyValue: Heap::new(NullValue()),
booleanValue: None,
byteValue: None,
@@ -401,7 +401,7 @@ impl TestBindingMethods for TestBinding {
usvstringValue: None,
nonRequiredNullable: None,
nonRequiredNullable2: Some(None), // null
- }
+ })
}
fn DictMatchesPassedValues(&self, arg: RootedTraceableBox<TestDictionary>) -> bool {
@@ -436,9 +436,9 @@ impl TestBindingMethods for TestBinding {
fn PassUnion6(&self, _: UnsignedLongOrBoolean) {}
fn PassUnion7(&self, _: StringSequenceOrUnsignedLong) {}
fn PassUnion8(&self, _: ByteStringSequenceOrLong) {}
- fn PassUnion9(&self, _: RootedTraceableBox<UnionTypes::TestDictionaryOrLong>) {}
+ fn PassUnion9(&self, _: UnionTypes::TestDictionaryOrLong) {}
#[allow(unsafe_code)]
- unsafe fn PassUnion10(&self, _: *mut JSContext, _: RootedTraceableBox<UnionTypes::StringOrObject>) {}
+ unsafe fn PassUnion10(&self, _: *mut JSContext, _: UnionTypes::StringOrObject) {}
fn PassUnionWithTypedef(&self, _: DocumentOrTestTypedef) {}
fn PassUnionWithTypedef2(&self, _: LongSequenceOrTestTypedef) {}
#[allow(unsafe_code)]