Use the newly added inCompartments option everywhere it can be

This commit is contained in:
Bastien Orivel 2019-05-25 17:00:10 +02:00
parent 0b29caa554
commit 292d468cd1
22 changed files with 216 additions and 259 deletions

View file

@ -4,7 +4,7 @@
// check-tidy: no specs after this line
use crate::compartments::{AlreadyInCompartment, InCompartment};
use crate::compartments::InCompartment;
use crate::dom::bindings::callback::ExceptionHandling;
use crate::dom::bindings::codegen::Bindings::EventListenerBinding::EventListener;
use crate::dom::bindings::codegen::Bindings::FunctionBinding::Function;
@ -1014,6 +1014,7 @@ impl TestBindingMethods for TestBinding {
&self,
resolve: Option<Rc<SimpleCallback>>,
reject: Option<Rc<SimpleCallback>>,
comp: InCompartment,
) -> Rc<Promise> {
let global = self.global();
let handler = PromiseNativeHandler::new(
@ -1021,11 +1022,7 @@ impl TestBindingMethods for TestBinding {
resolve.map(SimpleHandler::new),
reject.map(SimpleHandler::new),
);
let in_compartment_proof = AlreadyInCompartment::assert(&global);
let p = Promise::new_in_current_compartment(
&global,
InCompartment::Already(&in_compartment_proof),
);
let p = Promise::new_in_current_compartment(&global, comp);
p.append_native_handler(&handler);
return p;
@ -1049,10 +1046,7 @@ impl TestBindingMethods for TestBinding {
}
fn PromiseAttribute(&self, comp: InCompartment) -> Rc<Promise> {
Promise::new_in_current_compartment(
&self.global(),
comp
)
Promise::new_in_current_compartment(&self.global(), comp)
}
fn AcceptPromise(&self, _promise: &Promise) {}