src: fix unhandled error in structuredClone

Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/54764
Fixes: https://github.com/nodejs/node/issues/54602
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Daeyeon Jeong authored and GitHub committed 2024-09-07 23:05:00 +00:00
1 parent 46c6f8ce26
commit eab9729d16
2 files changed
+6 -1

No files matched your search

+3 -1
View File
@@ -567,7 +567,9 @@ Maybe<bool> Message::Serialize(Environment* env,
if (host_object &&
host_object->GetTransferMode() == TransferMode::kTransferable) {
delegate.AddHostObject(host_object);
continue;
} else {
ThrowDataCloneException(context, env->clone_untransferable_str());
return Nothing<bool>();
}
}
if (delegate.AddNestedHostObjects().IsNothing())
@@ -26,3 +26,6 @@ assert.strictEqual(structuredClone(undefined, { }), undefined);
assert.deepStrictEqual(cloned, {});
}
const blob = new Blob();
assert.throws(() => structuredClone(blob, { transfer: [blob] }), { name: 'DataCloneError' });