diff options
Diffstat (limited to 'components/script/dom/workletglobalscope.rs')
-rw-r--r-- | components/script/dom/workletglobalscope.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/components/script/dom/workletglobalscope.rs b/components/script/dom/workletglobalscope.rs index 0196d6a83ea..6e81220731c 100644 --- a/components/script/dom/workletglobalscope.rs +++ b/components/script/dom/workletglobalscope.rs @@ -15,6 +15,7 @@ use js::rust::Runtime; use net_traits::ResourceThreads; use net_traits::image_cache::ImageCache; use profile_traits::{mem, time}; +use script_bindings::realms::InRealm; use script_traits::Painter; use servo_url::{ImmutableOrigin, MutableOrigin, ServoUrl}; use stylo_atoms::Atom; @@ -22,6 +23,7 @@ use stylo_atoms::Atom; use crate::dom::bindings::inheritance::Castable; use crate::dom::bindings::root::DomRoot; use crate::dom::bindings::trace::CustomTraceable; +use crate::dom::bindings::utils::define_all_exposed_interfaces; use crate::dom::globalscope::GlobalScope; use crate::dom::paintworkletglobalscope::{PaintWorkletGlobalScope, PaintWorkletTask}; use crate::dom::testworkletglobalscope::{TestWorkletGlobalScope, TestWorkletTask}; @@ -29,6 +31,7 @@ use crate::dom::testworkletglobalscope::{TestWorkletGlobalScope, TestWorkletTask use crate::dom::webgpu::identityhub::IdentityHub; use crate::dom::worklet::WorkletExecutor; use crate::messaging::MainThreadScriptMsg; +use crate::realms::enter_realm; use crate::script_module::ScriptFetchOptions; use crate::script_runtime::{CanGc, JSContext}; @@ -56,7 +59,7 @@ impl WorkletGlobalScope { executor: WorkletExecutor, init: &WorkletGlobalScopeInit, ) -> DomRoot<WorkletGlobalScope> { - match scope_type { + let scope: DomRoot<WorkletGlobalScope> = match scope_type { WorkletGlobalScopeType::Test => DomRoot::upcast(TestWorkletGlobalScope::new( runtime, pipeline_id, @@ -71,7 +74,12 @@ impl WorkletGlobalScope { executor, init, )), - } + }; + + let realm = enter_realm(&*scope); + define_all_exposed_interfaces(scope.upcast(), InRealm::entered(&realm), CanGc::note()); + + scope } /// Create a new stack-allocated `WorkletGlobalScope`. |