worker: handle detached `MessagePort` from a different context · nodejs/node@87be790 · GitHub
Skip to content

Commit 87be790

Browse files
juanarboltargos
authored andcommitted
worker: handle detached MessagePort from a different context
When `worker.moveMessagePortToContext` is used, the async handle associated with the port, will be triggered more than needed (at least one more time) and with null data. That can be avoided by simply checking that the data is present and the port is not detached. Fixes: #49075 Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: #49150 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 1464eba commit 87be790

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

src/node_messaging.cc

Lines changed: 7 additions & 0 deletions

test/parallel/test-worker-workerdata-messageport.js

Lines changed: 28 additions & 2 deletions

0 commit comments

Comments
 (0)