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

@@ -2009,7 +2009,7 @@ impl ScriptThread {
let global = self.documents.borrow().find_global(id);
global.map(|global| enter_realm(&*global))
});
task.run_box()
task.run_box(cx)
},
MainThreadScriptMsg::Common(CommonScriptMsg::CollectReports(chan)) => {
self.collect_reports(chan)