LibWeb: Visit the MessagePort's associated Worker target
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

Without this, a worker can be GC'd in a very simple script such as:

    const worker = new Worker("script.js");
    worker.onmessage = () => {};

Where script.js attempts to post a message back to the parent window.

When the Worker is GC'd, the IPC connection from the WebContent process
to the WebWorker process is closed. When this occurs, the WebWorker will
exit() from LibIPC, and any message from the worker to its parent does
not have a chance to run.
This commit is contained in:
Timothy Flynn 2024-10-16 19:51:05 -04:00 committed by Tim Flynn
parent ba1b26cdc2
commit eeee6ba3f5
Notes: github-actions[bot] 2024-10-17 20:35:33 +00:00

View file

@ -68,10 +68,7 @@ void MessagePort::visit_edges(Cell::Visitor& visitor)
{ {
Base::visit_edges(visitor); Base::visit_edges(visitor);
visitor.visit(m_remote_port); visitor.visit(m_remote_port);
visitor.visit(m_worker_event_target);
// FIXME: This is incorrect!! We *should* be visiting the worker event target,
// but CI hangs if we do: https://github.com/SerenityOS/serenity/issues/23899
visitor.ignore(m_worker_event_target);
} }
void MessagePort::set_worker_event_target(JS::NonnullGCPtr<DOM::EventTarget> target) void MessagePort::set_worker_event_target(JS::NonnullGCPtr<DOM::EventTarget> target)