From 1b6949d4cf951600efa6db6747b65e2db42a96cd Mon Sep 17 00:00:00 2001 From: Aron Zwaan Date: Wed, 24 Apr 2019 18:53:50 +0200 Subject: Add proof parameter to Promise::new_in_current_compartment --- components/script/dom/worklet.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'components/script/dom/worklet.rs') diff --git a/components/script/dom/worklet.rs b/components/script/dom/worklet.rs index 357a52bb482..caccf0609d4 100644 --- a/components/script/dom/worklet.rs +++ b/components/script/dom/worklet.rs @@ -10,6 +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::dom::bindings::codegen::Bindings::RequestBinding::RequestCredentials; use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowBinding::WindowMethods; use crate::dom::bindings::codegen::Bindings::WorkletBinding::WorkletMethods; @@ -110,10 +111,14 @@ impl Worklet { impl WorkletMethods for Worklet { /// - #[allow(unsafe_code)] fn AddModule(&self, module_url: USVString, options: &WorkletOptions) -> Rc { // Step 1. - let promise = unsafe { Promise::new_in_current_compartment(self.window.upcast()) }; + 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), + ); // Step 3. let module_url_record = match self.window.Document().base_url().join(&module_url.0) { -- cgit v1.2.3