diff options
author | Aron Zwaan <aronzwaan@gmail.com> | 2019-04-24 18:53:50 +0200 |
---|---|---|
committer | Aron Zwaan <aronzwaan@gmail.com> | 2019-04-24 19:46:10 +0200 |
commit | 1b6949d4cf951600efa6db6747b65e2db42a96cd (patch) | |
tree | c6270640b2f73045f91c1b65723e865490e69656 /components/script/dom/promise.rs | |
parent | 7b293ee8cba64937c591c36a9a7e1d6c727d247c (diff) | |
download | servo-1b6949d4cf951600efa6db6747b65e2db42a96cd.tar.gz servo-1b6949d4cf951600efa6db6747b65e2db42a96cd.zip |
Add proof parameter to Promise::new_in_current_compartment
Diffstat (limited to 'components/script/dom/promise.rs')
-rw-r--r-- | components/script/dom/promise.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs index 9ff4adfe397..52e6dfab56a 100644 --- a/components/script/dom/promise.rs +++ b/components/script/dom/promise.rs @@ -11,6 +11,7 @@ //! native Promise values that refer to the same JS value yet are distinct native objects //! (ie. address equality for the native objects is meaningless). +use crate::compartments::InCompartment; use crate::dom::bindings::conversions::root_from_object; use crate::dom::bindings::error::{Error, Fallible}; use crate::dom::bindings::reflector::{DomObject, MutDomObject, Reflector}; @@ -79,17 +80,18 @@ impl Drop for Promise { } impl Promise { - #[allow(unsafe_code)] - pub fn new(global: &GlobalScope, _comp: &JSAutoCompartment) -> Rc<Promise> { - unsafe { Promise::new_in_current_compartment(global) } + pub fn new(global: &GlobalScope, comp: &InCompartment) -> Rc<Promise> { + Promise::new_in_current_compartment(global, comp) } #[allow(unsafe_code)] - pub unsafe fn new_in_current_compartment(global: &GlobalScope) -> Rc<Promise> { + pub fn new_in_current_compartment(global: &GlobalScope, _comp: &InCompartment) -> Rc<Promise> { let cx = global.get_cx(); rooted!(in(cx) let mut obj = ptr::null_mut::<JSObject>()); - Promise::create_js_promise(cx, HandleObject::null(), obj.handle_mut()); - Promise::new_with_js_promise(obj.handle(), cx) + unsafe { + Promise::create_js_promise(cx, HandleObject::null(), obj.handle_mut()); + Promise::new_with_js_promise(obj.handle(), cx) + } } #[allow(unsafe_code)] |