Skip to content

Commit

Permalink
fix: avoid structuredClone for Node 16 (#11006)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Sep 22, 2023
1 parent c3bd8eb commit 25eca9a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/puppeteer-core/src/api/Page.ts
Expand Up @@ -2277,7 +2277,15 @@ export abstract class Page extends EventEmitter<PageEvents> {
): Promise<Buffer | string> {
await this.bringToFront();

const options = structuredClone(userOptions) as ScreenshotOptions;
// TODO: use structuredClone after Node 16 support is dropped.«
const options = {
...userOptions,
clip: userOptions.clip
? {
...userOptions.clip,
}
: undefined,
} as ScreenshotOptions;
if (options.type === undefined && options.path !== undefined) {
const filePath = options.path;
// Note we cannot use Node.js here due to browser compatability.
Expand Down

0 comments on commit 25eca9a

Please sign in to comment.