diff options
author | Aron Zwaan <aronzwaan@gmail.com> | 2019-04-29 11:36:43 +0200 |
---|---|---|
committer | Aron Zwaan <aronzwaan@gmail.com> | 2019-04-29 11:36:43 +0200 |
commit | 3229af509f9931f85a1372323f90427d2ad5898d (patch) | |
tree | 6021d52bb424614928c7439472a02201cc34b2c4 /components/script | |
parent | e2e6e2ac9428b9448edb06f7f11b201ce68e7191 (diff) | |
download | servo-3229af509f9931f85a1372323f90427d2ad5898d.tar.gz servo-3229af509f9931f85a1372323f90427d2ad5898d.zip |
Create new compartment in Promise constructor
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/promise.rs | 8 |
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)] |