From 4e7657bca114ddf24696f943ace648c96783aa7c Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Tue, 26 Dec 2023 10:20:53 -0700 Subject: [PATCH] Allow structuredClone to be explicitly turned off for the decoder --- unpack.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unpack.js b/unpack.js index a9af6f0..af26e03 100644 --- a/unpack.js +++ b/unpack.js @@ -1013,6 +1013,7 @@ currentExtensions[0x65] = () => { currentExtensions[0x69] = (data) => { // id extension (for structured clones) + if (currentUnpackr.structuredClone === false) throw new Error('Structured clone extension is disabled') let id = dataView.getUint32(position - 4) if (!referenceMap) referenceMap = new Map() @@ -1036,6 +1037,7 @@ currentExtensions[0x69] = (data) => { currentExtensions[0x70] = (data) => { // pointer extension (for structured clones) + if (currentUnpackr.structuredClone === false) throw new Error('Structured clone extension is disabled') let id = dataView.getUint32(position - 4) let refEntry = referenceMap.get(id) refEntry.used = true