Skip to content

Commit

Permalink
fix: add fallback error if window.top returns undefined (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
indykoning authored Apr 27, 2024
1 parent 50afa99 commit 1afc6e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/sandbox/main-serialization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ const serializeCssRuleForWorker = (cssRule: any) => {
}
return obj;
};

let ErrorObject: any = null;
const serializedValueIsError = (value: any) => {
return value instanceof (window.top as any).Error;
ErrorObject = (window.top as any)?.Error || ErrorObject;
return value instanceof ErrorObject;
};

export const deserializeFromWorker = (
Expand Down

0 comments on commit 1afc6e2

Please sign in to comment.