Skip to content

Commit eab9729

Browse files
authoredSep 7, 2024··
src: fix unhandled error in structuredClone
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]>
1 parent 46c6f8c commit eab9729

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
 

Diff for: ‎src/node_messaging.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,9 @@ Maybe<bool> Message::Serialize(Environment* env,
567567
if (host_object &&
568568
host_object->GetTransferMode() == TransferMode::kTransferable) {
569569
delegate.AddHostObject(host_object);
570-
continue;
570+
} else {
571+
ThrowDataCloneException(context, env->clone_untransferable_str());
572+
return Nothing<bool>();
571573
}
572574
}
573575
if (delegate.AddNestedHostObjects().IsNothing())

Diff for: ‎test/parallel/test-structuredClone-global.js

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ assert.strictEqual(structuredClone(undefined, { }), undefined);
2626

2727
assert.deepStrictEqual(cloned, {});
2828
}
29+
30+
const blob = new Blob();
31+
assert.throws(() => structuredClone(blob, { transfer: [blob] }), { name: 'DataCloneError' });

0 commit comments

Comments
 (0)