Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update performance.now() when calling in a busy loop #35435

Merged
merged 1 commit into from
Apr 7, 2025

Conversation

mxschmitt
Copy link
Member

Fixes #35362

This comment has been minimized.

Copy link
Contributor

@dgozman dgozman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like Pavel to review this one, since he is more familiar with internal details of the clock.

@mxschmitt mxschmitt force-pushed the increment-performance-now branch 2 times, most recently from 3188710 to 0ad1bf4 Compare April 7, 2025 14:28

This comment has been minimized.

This comment has been minimized.

@@ -437,8 +437,7 @@ it.describe('while running', () => {
await page.clock.install({ time: 0 });
await page.goto('data:text/html,');
await page.clock.pauseAt(1000);
await page.waitForTimeout(1000);
await page.clock.resume();
await page.waitForTimeout(2000); // Should not progress time.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did this change?

Copy link
Member Author

@mxschmitt mxschmitt Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test looked wrong to me (the resume call), it was testing that the paused time at 1000 corresponds to the Date.now() call. For some unknown reason it resumed the clock afterwards. Was this intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted into #35522.

pavelfeldman
pavelfeldman previously approved these changes Apr 7, 2025
@mxschmitt mxschmitt merged commit 76d5b87 into microsoft:main Apr 7, 2025
23 of 29 checks passed
@mxschmitt mxschmitt deleted the increment-performance-now branch April 7, 2025 20:40
Copy link
Contributor

github-actions bot commented Apr 7, 2025

Test results for "tests 1"

6 failed
❌ [chromium-library] › library/page-clock.spec.ts:436:3 › while running › should pause @chromium-ubuntu-22.04-node18
❌ [chromium-library] › library/page-clock.spec.ts:436:3 › while running › should pause @chromium-ubuntu-22.04-node20
❌ [chromium-library] › library/page-clock.spec.ts:436:3 › while running › should pause @chromium-ubuntu-22.04-node22
❌ [firefox-library] › library/page-clock.spec.ts:436:3 › while running › should pause @firefox-ubuntu-22.04-node18
❌ [chromium-library] › library/page-clock.spec.ts:436:3 › while running › should pause @ubuntu-22.04-chromium-tip-of-tree
❌ [playwright-test] › reporter-html.spec.ts:2841:5 › created › should include diff in AI prompt @ubuntu-latest-node22-2

5 flaky ⚠️ [chromium-library] › library/chromium/oopif.spec.ts:284:3 › should click @chromium-ubuntu-22.04-node18
⚠️ [chromium-library] › library/chromium/oopif.spec.ts:284:3 › should click @chromium-ubuntu-22.04-node22
⚠️ [firefox-page] › page/page-evaluate.spec.ts:424:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [webkit-library] › library/browsercontext-viewport-mobile.spec.ts:97:5 › mobile viewport › should fire orientationchange event @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18

39063 passed, 806 skipped
✔️✔️✔️

Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Unexpected timeout when .clock() is used
3 participants