mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00

We are using `ObjectPrototypeToString()` as a cross-context brand check for built-in errors, but weren’t making sure to set that when deserializing errors back into JS objects. Fix that by setting `[Symbol.toStringTag]` manually, to make sure that multiple serialize-and-deserialize cycles keep giving the same result. Fixes: https://github.com/nodejs/node/issues/34309 PR-URL: https://github.com/nodejs/node/pull/34310 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
15 lines
397 B
JavaScript
15 lines
397 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const { Worker } = require('worker_threads');
|
|
|
|
// Regression test for https://github.com/nodejs/node/issues/34309
|
|
|
|
const w = new Worker(
|
|
`const { Worker } = require('worker_threads');
|
|
new Worker("throw new Error('uncaught')", { eval:true })`,
|
|
{ eval: true });
|
|
w.on('error', common.expectsError({
|
|
name: 'Error',
|
|
message: 'uncaught'
|
|
}));
|