script: Pass &mut JSContext to tasks (#41756)

This change is reviewable per commits:
In first commit we added `&mut JSContext` to `run_box` (it is very hard
to bring `&mut JSContext` to `remove_script_and_layout_blocker`).
In second commit we pass `&mut JSContext` to `run_once`.
In third commit we added support for accepting `&mut JSContext` in
closures of `task!` macro and lastly we demo new macro invocations (to
ensure they actually compile)

Testing: Just refactor, but should be covered by WPT
Part of #40600

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Sam
2026-01-08 08:49:27 +01:00
committed by GitHub
parent 7aa2dd261f
commit 89067e5450
16 changed files with 136 additions and 64 deletions

View File

@@ -1028,9 +1028,9 @@ impl ModuleHandler {
}
impl Callback for ModuleHandler {
fn callback(&self, _cx: &mut CurrentRealm, _v: HandleValue) {
fn callback(&self, cx: &mut CurrentRealm, _v: HandleValue) {
let task = self.task.borrow_mut().take().unwrap();
task.run_box();
task.run_box(cx);
}
}