aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/promise.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/promise.rs')
-rw-r--r--components/script/dom/promise.rs14
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)]