From 1b6949d4cf951600efa6db6747b65e2db42a96cd Mon Sep 17 00:00:00 2001 From: Aron Zwaan Date: Wed, 24 Apr 2019 18:53:50 +0200 Subject: Add proof parameter to Promise::new_in_current_compartment --- components/script/dom/promise.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'components/script/dom/promise.rs') 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 { - unsafe { Promise::new_in_current_compartment(global) } + pub fn new(global: &GlobalScope, comp: &InCompartment) -> Rc { + Promise::new_in_current_compartment(global, comp) } #[allow(unsafe_code)] - pub unsafe fn new_in_current_compartment(global: &GlobalScope) -> Rc { + pub fn new_in_current_compartment(global: &GlobalScope, _comp: &InCompartment) -> Rc { let cx = global.get_cx(); rooted!(in(cx) let mut obj = ptr::null_mut::()); - 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)] -- cgit v1.2.3