mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Make dictionaries contain Root<T> values instead of JS<T>, ensuring that they will not be collected while the dictionary is alive.
This commit is contained in:
parent
0f2d0b1dc3
commit
895e9ee37f
5 changed files with 20 additions and 11 deletions
|
@ -284,6 +284,12 @@ impl<T: Reflectable, U> ResultRootable<T, U> for Result<Temporary<T>, U> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: Reflectable, U> ResultRootable<T, U> for Result<JS<T>, U> {
|
||||
fn root<'a, 'b>(self) -> Result<Root<'a, 'b, T>, U> {
|
||||
self.map(|inner| inner.root())
|
||||
}
|
||||
}
|
||||
|
||||
/// Provides a facility to push unrooted values onto lists of rooted values. This is safe
|
||||
/// under the assumption that said lists are reachable via the GC graph, and therefore the
|
||||
/// new values are transitively rooted for the lifetime of their new owner.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue