Fix multi-webview browser capture prep

This commit is contained in:
Mohamed Boudra
2026-07-03 07:00:06 +02:00
parent 33ffeb4d42
commit f22865df62
7 changed files with 392 additions and 82 deletions

View File

@@ -149,6 +149,17 @@ async function restorePixelCapture(
}
}
async function capturePreparedPixelFrame<T>(capture: () => Promise<T>): Promise<T> {
try {
return await withPixelCaptureTimeout(capture());
} catch (error) {
if (isScreenshotNoFrameError(error)) {
throw error;
}
throw new ScreenshotNoFrameError();
}
}
async function runPreparedPixelCapture<T>(
contents: TabContents,
capture: () => Promise<T>,
@@ -163,7 +174,7 @@ async function runPreparedPixelCapture<T>(
preparation = await prepareForPixelCapture(contents);
contents.setBackgroundThrottling(false);
contents.invalidate();
return await withPixelCaptureTimeout(capture());
return await capturePreparedPixelFrame(capture);
} finally {
try {
if (preparation) {