Skip to content

Commit

Permalink
Sanitize all values
Browse files Browse the repository at this point in the history
  • Loading branch information
domchristie committed Sep 21, 2023
1 parent 29cbcd9 commit 3c3c8e3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/drive/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,13 @@ export class Navigator {
}

#sanitizeVisitOptionsForTransfer(options) {
const { initiator, referrer, visitCachedSnapshot, ...rest } = options
return window.structuredClone(rest)
return Object.entries(options).reduce((sanitized, [key, value]) => {
try {
sanitized[key] = window.structuredClone(value)
} catch (_) {
// Ignore non-transferable values
}
return sanitized
}, {})
}
}

0 comments on commit 3c3c8e3

Please sign in to comment.