Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe('structuredClone', () => {

it('throws with symbols, functions, WeakMap, WeakSet, Promise', () => {
expectDataCloneError(() => structuredClone(Symbol()));
expectDataCloneError(() => structuredClone(Object(Symbol())));
expectDataCloneError(() => structuredClone(() => {}));
expectDataCloneError(() => structuredClone(new WeakMap()));
expectDataCloneError(() => structuredClone(new WeakSet()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ function structuredCloneInternal<T>(value: T): T {
return result;
}

if (value instanceof Symbol) {
throw new DOMException(
"Failed to execute 'structuredClone' on 'Window': Symbol object could not be cloned.",
'DataCloneError',
);
}

// Known non-serializable objects.
if (isNonSerializableObject(value) || isPlatformObject(value)) {
throw new DOMException(
Expand Down
Loading