Commit Graph

2 Commits

Author SHA1 Message Date
Rich Trott
f93a19b428 test: address flaky worker test
Make test/parallel/test-worker-message-port-transfer-closed.js more
reliable by counting ticks rather than using a single setTimeout().

Fixes: https://github.com/nodejs/node/issues/21892

PR-URL: https://github.com/nodejs/node/pull/21893
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
2018-07-24 13:27:55 -07:00
Timothy Gu
f374d6aaf9
messaging: fix edge cases with transferring ports
Currently, transferring the port on which postMessage is called causes a
segmentation fault, and transferring the target port causes a subsequent
port.onmessage setting to throw, or a deadlock if onmessage is set
before the postMessage. Fix both of these behaviors and align the
methods more closely with the normative definitions in the HTML
Standard.

Also, per spec postMessage must not throw just because the ports are
disentangled. Implement that behavior.

PR-URL: https://github.com/nodejs/node/pull/21540
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-07-03 22:54:03 -04:00