Skip to content

Commit

Permalink
Allow structuredClone to be explicitly turned off for the decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Dec 26, 2023
1 parent 18f44f8 commit 4e7657b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions unpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 4e7657b

Please sign in to comment.