[Bug]: A paused clock still fires a timer the page sets while loading

オープン
#43,869 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@microsoft-playwright-automation がすでに取り組んでいます。

2026年11月3日 から。

  • #43873 @microsoft-playwright-automation による — オープン

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
javascript, typescript
領域
testing-qa

調査の方向性

The clock logic lives in the injected clock code, where _replayLogOnce() sets _realTime = undefined in the paused branch while _currentRealTimeTimer is left armed; compare with _innerPause(), which disposes it. Start by running the repro test from the issue under the Playwright clock tests. Done when the timer no longer fires with the clock paused, and the test asserting fired is 0 passes in Chromium, Firefox and WebKit.

索引モデルが issue の本文から書いたものです。

説明

needs-triage

After page.clock.pauseAt(), a timer that a newly loaded page sets during load fires once by itself, without runFor or fastForward.

Version: 1.63.0 in Chromium, Firefox and WebKit; also Chromium on 1.60.0, 1.64.1 and 1.65.0-alpha-2026-11-02 (after #43224). Linux, Node 24. Not seen on 1.48 or 1.56.

Repro:

import { test, expect } from "@playwright/test";

test("a paused clock does not fire a timer the page sets while loading", async ({ page }) => {
  await page.route("http://repro.test/", (route) =>
    route.fulfill({
      contentType: "text/html",
      body: "<script>window.fired = 0; setTimeout(() => window.fired++, 0);</script>",
    }),
  );
  await page.clock.install({ time: new Date("2024-01-15T12:00:00Z") });
  await page.clock.pauseAt(new Date("2024-01-15T12:00:10Z"));
  await page.goto("http://repro.test/");
  await page.waitForTimeout(500);
  expect(await page.evaluate(() => (window as any).fired)).toBe(0);
});

Expected: fired is 0. The clock is paused, so the timer waits for runFor.

Actual: fired is 1, 5 times out of 5 in each case above. Possibly related to #43214, but #43224 does not fix this one.

Cause: in a new document the injected clock starts running, and resume() arms the real-time timer. When _replayLogOnce() replays a log that ends paused, it sets _realTime = undefined but never disposes _currentRealTimeTimer. Up to 100 ms later that timer fires and runs _runTo(now), which fires every timer already due. Disposing the timer in the paused branch, as _innerPause() does, should fix it.

主要言語
TypeScript
スター
99.1k
フォーク
6.8k
平均マージ
16時間 3分
マージ済み PR(30日)
315

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/playwright のほかの issue

microsoft/playwright の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。