浏览代码

LibWeb: Visit the MessagePort's associated Worker target

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.
Timothy Flynn 8 月之前
父节点
当前提交
eeee6ba3f5
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. 1 4
      Userland/Libraries/LibWeb/HTML/MessagePort.cpp

+ 1 - 4
Userland/Libraries/LibWeb/HTML/MessagePort.cpp

@@ -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);
-
-    // 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);
+    visitor.visit(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)