fix: MessagePort closing unexpectedly with non-cloneable objects (#42581)
* fix: MessagePort closing unexpectedly with non-cloneable objects Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * fix: handle serialization failure in parentPort Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
parent
76204e184a
commit
d7858f2f91
4 changed files with 34 additions and 3 deletions
11
spec/fixtures/api/utility-process/non-cloneable.js
vendored
Normal file
11
spec/fixtures/api/utility-process/non-cloneable.js
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
const nonClonableObject = () => {};
|
||||
|
||||
process.parentPort.on('message', () => {
|
||||
try {
|
||||
process.parentPort.postMessage(nonClonableObject);
|
||||
} catch (error) {
|
||||
if (/An object could not be cloned/.test(error.message)) {
|
||||
process.parentPort.postMessage('caught-non-cloneable');
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue