Make DomRoot::new unsafe

This commit is contained in:
Anthony Ramine 2017-09-26 15:38:10 +02:00
parent 3dbb97922d
commit 1ff6c4f9aa
3 changed files with 7 additions and 6 deletions

View file

@ -22,7 +22,6 @@
//! its hash table during the next GC. During GC, the entries of the hash table are counted
//! as JS roots.
use core::nonzero::NonZero;
use dom::bindings::conversions::ToJSValConvertible;
use dom::bindings::error::Error;
use dom::bindings::reflector::{DomObject, Reflector};
@ -185,7 +184,7 @@ impl<T: DomObject> Trusted<T> {
self.owner_thread == (&*live_references) as *const _ as *const libc::c_void
}));
unsafe {
DomRoot::new(NonZero::new_unchecked(self.refcount.0 as *const T))
DomRoot::from_ref(&*(self.refcount.0 as *const T))
}
}
}