Skip to content

fix: handle swaps without a timer#15198

Merged
OrKoN merged 1 commit into
mainfrom
orkon/test-prerender
Jul 1, 2026
Merged

fix: handle swaps without a timer#15198
OrKoN merged 1 commit into
mainfrom
orkon/test-prerender

Conversation

@OrKoN

@OrKoN OrKoN commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Drive-by: skill for verification.

@OrKoN OrKoN force-pushed the orkon/test-prerender branch 2 times, most recently from e01d22c to b118d60 Compare July 1, 2026 08:24
@OrKoN OrKoN force-pushed the orkon/test-prerender branch from b118d60 to 9bca0ae Compare July 1, 2026 09:08
@OrKoN OrKoN changed the title test: add prerender tests fix: handle swaps without a timer Jul 1, 2026
@OrKoN OrKoN added the full-ci label Jul 1, 2026
@OrKoN OrKoN requested a review from Lightning00Blade July 1, 2026 09:17
@OrKoN OrKoN merged commit 2356a15 into main Jul 1, 2026
176 of 178 checks passed
@OrKoN OrKoN deleted the orkon/test-prerender branch July 1, 2026 11:49
kblok added a commit to hardkoded/puppeteer-sharp that referenced this pull request Jul 3, 2026
FrameManager.OnClientDisconnectAsync used to race a 200ms timer against
the FrameSwappedByActivation event, so a slow prerender activation could
be treated as a disconnect and tear down frames that were actually about
to be swapped in. It also didn't track which CDPSession disconnected, so
a second disconnect event on an already-swapped session could remove
frames belonging to the new session.

Now the wait has no timer: it waits until either the swap event fires or
the page closes, and it bails out early if the disconnected client isn't
the current one (meaning a swap already happened). Also treats a closed
page the same as a disconnected browser, since activation can't happen
either way.

Updated the prerender test assets/assertions to actually verify whether
a page was served from the prerender cache (via a small detection script
in target.html) instead of just checking body text, which stayed the
same either way and couldn't catch this race.

Upstream: puppeteer/puppeteer#15198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants