script: pass &mut JSContext inside worklet code (#44441)

Testing: It compiles 
Part of #40600

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24
2026-04-23 07:58:09 +02:00
committed by GitHub
parent 353e5248f1
commit 20e94989eb
7 changed files with 128 additions and 95 deletions

View File

@@ -690,9 +690,9 @@ impl Window {
self.webxr_registry.clone()
}
fn new_paint_worklet(&self, can_gc: CanGc) -> DomRoot<Worklet> {
fn new_paint_worklet(&self, cx: &mut JSContext) -> DomRoot<Worklet> {
debug!("Creating new paint worklet.");
Worklet::new(self, WorkletGlobalScopeType::Paint, can_gc)
Worklet::new(cx, self, WorkletGlobalScopeType::Paint)
}
pub(crate) fn register_image_cache_listener(
@@ -2451,9 +2451,8 @@ impl Window {
}
// https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet
pub(crate) fn paint_worklet(&self) -> DomRoot<Worklet> {
self.paint_worklet
.or_init(|| self.new_paint_worklet(CanGc::deprecated_note()))
pub(crate) fn paint_worklet(&self, cx: &mut JSContext) -> DomRoot<Worklet> {
self.paint_worklet.or_init(|| self.new_paint_worklet(cx))
}
pub(crate) fn has_document(&self) -> bool {