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

@ -10,7 +10,7 @@
//! thread pool implementation, which only performs GC or code loading on
//! a backup thread, not on the primary worklet thread.
use crate::compartments::{AlreadyInCompartment, InCompartment};
use crate::compartments::InCompartment;
use crate::dom::bindings::codegen::Bindings::RequestBinding::RequestCredentials;
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods;
use crate::dom::bindings::codegen::Bindings::WorkletBinding::WorkletMethods;
@ -111,14 +111,15 @@ impl Worklet {
impl WorkletMethods for Worklet {
/// <https://drafts.css-houdini.org/worklets/#dom-worklet-addmodule>
fn AddModule(&self, module_url: USVString, options: &WorkletOptions) -> Rc<Promise> {
fn AddModule(
&self,
module_url: USVString,
options: &WorkletOptions,
comp: InCompartment,
) -> Rc<Promise> {
// Step 1.
let global = self.window.upcast();
let in_compartment_proof = AlreadyInCompartment::assert(&global);
let promise = Promise::new_in_current_compartment(
&global,
InCompartment::Already(&in_compartment_proof),
);
let promise = Promise::new_in_current_compartment(&global, comp);
// Step 3.
let module_url_record = match self.window.Document().base_url().join(&module_url.0) {