mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: avoid structuredClone for Node 16 (#11006)
This commit is contained in:
parent
c3bd8eb878
commit
25eca9a747
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user