File tree Expand file tree Collapse file tree 2 files changed +22
-12
lines changed Expand file tree Collapse file tree 2 files changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -715,7 +715,17 @@ Used when the main process is trying to read data from the child process's
715715STDERR/STDOUT, and the data's length is longer than the ` maxBuffer ` option.
716716
717717<a id =" ERR_CLOSED_MESSAGE_PORT " ></a >
718- ### ERR_CLOSED_MESSAGE_PORT
718+ ### ` ERR_CLOSED_MESSAGE_PORT `
719+ <!--
720+ added: REPLACEME
721+ changes:
722+ - version: 11.12.0
723+ pr-url: https://github.com/nodejs/node/pull/26487
724+ description: The error message was removed.
725+ - version: REPLACEME
726+ pr-url: https://github.com/nodejs/node/pull/38510
727+ description: The error message was reintroduced.
728+ -->
719729
720730There was an attempt to use a ` MessagePort ` instance in a closed
721731state, usually after ` .close() ` has been called.
@@ -2466,16 +2476,6 @@ removed: v12.5.0
24662476The value passed to ` postMessage() ` contained an object that is not supported
24672477for transferring.
24682478
2469- <a id =" ERR_CLOSED_MESSAGE_PORT " ></a >
2470- ### ` ERR_CLOSED_MESSAGE_PORT `
2471- <!-- YAML
2472- added: v10.5.0
2473- removed: v11.12.0
2474- -->
2475-
2476- There was an attempt to use a ` MessagePort ` instance in a closed
2477- state, usually after ` .close() ` has been called.
2478-
24792479<a id =" ERR_CRYPTO_HASH_DIGEST_NO_UTF16 " ></a >
24802480### ` ERR_CRYPTO_HASH_DIGEST_NO_UTF16 `
24812481<!-- YAML
Original file line number Diff line number Diff line change 11'use strict' ;
22const common = require ( '../common' ) ;
3- const { MessageChannel } = require ( 'worker_threads' ) ;
3+ const assert = require ( 'assert' ) ;
4+ const { MessageChannel, moveMessagePortToContext } = require ( 'worker_threads' ) ;
45
56// Make sure that .start() and .stop() do not throw on closing/closed
67// MessagePorts.
@@ -29,3 +30,12 @@ function dummy() {}
2930 port1 . off ( 'message' , dummy ) ;
3031 } ) ) ;
3132}
33+
34+ {
35+ const { port2 } = new MessageChannel ( ) ;
36+ port2 . close ( ) ;
37+ assert . throws ( ( ) => moveMessagePortToContext ( port2 , { } ) , {
38+ code : 'ERR_CLOSED_MESSAGE_PORT' ,
39+ message : 'Cannot send data on closed MessagePort'
40+ } ) ;
41+ }
You can’t perform that action at this time.
0 commit comments