aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorAron Zwaan <aronzwaan@gmail.com>2019-04-29 11:36:43 +0200
committerAron Zwaan <aronzwaan@gmail.com>2019-04-29 11:36:43 +0200
commit3229af509f9931f85a1372323f90427d2ad5898d (patch)
tree6021d52bb424614928c7439472a02201cc34b2c4 /components/script
parente2e6e2ac9428b9448edb06f7f11b201ce68e7191 (diff)
downloadservo-3229af509f9931f85a1372323f90427d2ad5898d.tar.gz
servo-3229af509f9931f85a1372323f90427d2ad5898d.zip
Create new compartment in Promise constructor
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/promise.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs
index b4e3109e789..c868d5d52d7 100644
--- a/components/script/dom/promise.rs
+++ b/components/script/dom/promise.rs
@@ -11,7 +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::{AlreadyInCompartment, InCompartment};
+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};
@@ -81,8 +81,10 @@ impl Drop for Promise {
impl Promise {
pub fn new(global: &GlobalScope) -> Rc<Promise> {
- let comp = AlreadyInCompartment::assert(&global);
- Promise::new_in_current_compartment(global, InCompartment::Already(&comp))
+ let compartment =
+ JSAutoCompartment::new(global.get_cx(), global.reflector().get_jsobject().get());
+ let comp = InCompartment::Entered(&compartment);
+ Promise::new_in_current_compartment(global, comp)
}
#[allow(unsafe_code)]