Script: ensure child JS runtimes are dropped before parent (#30896)

* clear js runtime of dedicated worker that immediately exits

* dedicated worker: clear js runtime if loading script fails

* when the script thread crashes, deallocate worker runtimes before dropping main runtime

* clear runtime if service worker script fails to load

* ensure worker enter their realm before executing script
This commit is contained in:
Gregory Terzian 2024-01-04 17:47:41 +08:00 committed by GitHub
parent 2f6f03a3b5
commit 90a9300f69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View file

@ -393,6 +393,8 @@ impl Window {
#[allow(unsafe_code)]
pub fn clear_js_runtime_for_script_deallocation(&self) {
self.upcast::<GlobalScope>()
.remove_web_messaging_and_dedicated_workers_infra();
unsafe {
*self.js_runtime.borrow_for_script_deallocation() = None;
self.window_proxy.set(None);