Skip to content

Commit

Permalink
src: fix unhandled error in structuredClone
Browse files Browse the repository at this point in the history
Signed-off-by: Daeyeon Jeong <[email protected]>
PR-URL: #54764
Fixes: #54602
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
daeyeon authored and aduh95 committed Sep 12, 2024
1 parent 608a611 commit 97cbcfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node_messaging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,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())
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-structuredClone-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ assert.strictEqual(structuredClone(undefined, { }), undefined);

assert.deepStrictEqual(cloned, {});
}

const blob = new Blob();
assert.throws(() => structuredClone(blob, { transfer: [blob] }), { name: 'DataCloneError' });

0 comments on commit 97cbcfb

Please sign in to comment.