summaryrefslogtreecommitdiff
path: root/ext/web/13_message_port.js
diff options
context:
space:
mode:
authorMark Ladyshau <47859603+mrkldshv@users.noreply.github.com>2022-05-26 17:14:38 +0200
committerGitHub <noreply@github.com>2022-05-26 17:14:38 +0200
commit402b497299c04e3b4714842c5caad50197088d0c (patch)
treeb223a24e7a0f680fc8e9e6f6a9de23cb59080733 /ext/web/13_message_port.js
parent3aa6d5d8b0911e9c5fcd38dd856f419692b28085 (diff)
fix(core): rethrow exception during structured cloning serialization (#14671)
- Introduced optional callback for Deno.core.serialize API, that returns cloning error if there is one. - Removed try/catch in seralize structured clone function and throw error from callback. - Removed "Object with a getter that throws" assertion from WPT.
Diffstat (limited to 'ext/web/13_message_port.js')
-rw-r--r--ext/web/13_message_port.js21
1 files changed, 9 insertions, 12 deletions
diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js
index 8242f85f3..01ed92d9a 100644
--- a/ext/web/13_message_port.js
+++ b/ext/web/13_message_port.js
@@ -265,18 +265,15 @@
WeakSetPrototypeAdd(detachedArrayBuffers, arrayBuffer);
}
- let serializedData;
- try {
- serializedData = core.serialize(data, {
- hostObjects: ArrayPrototypeFilter(
- transferables,
- (a) => ObjectPrototypeIsPrototypeOf(MessagePortPrototype, a),
- ),
- transferedArrayBuffers,
- });
- } catch (err) {
- throw new DOMException(err.message, "DataCloneError");
- }
+ const serializedData = core.serialize(data, {
+ hostObjects: ArrayPrototypeFilter(
+ transferables,
+ (a) => ObjectPrototypeIsPrototypeOf(MessagePortPrototype, a),
+ ),
+ transferedArrayBuffers,
+ }, (err) => {
+ throw new DOMException(err, "DataCloneError");
+ });
/** @type {globalThis.__bootstrap.messagePort.Transferable[]} */
const serializedTransferables = [];