fix(browser): keep elapsed capture timing independent of wall-clock changes

This commit is contained in:
morluto
2026-10-13 15:02:54 +08:00
parent d9e9fb2273
commit 6bd2b28161
9 changed files with 73 additions and 20 deletions
+2 -2
View File
@@ -19,10 +19,10 @@ export const withPlaywrightExecutionBoundary = <Value>(
let settled = false;
let timer: ReturnType<typeof setTimeout> | undefined;
const deadline =
timeoutMs === undefined ? undefined : Date.now() + timeoutMs;
timeoutMs === undefined ? undefined : performance.now() + timeoutMs;
const scheduleTimeout = (): void => {
if (deadline === undefined) return;
const remaining = deadline - Date.now();
const remaining = deadline - performance.now();
if (remaining <= 0) {
fail(new AnalysisTimeoutError(OPERATION, timeoutMs ?? 0));
return;