fix: handle swaps without a timer#15198
Merged
Merged
Conversation
e01d22c to
b118d60
Compare
b118d60 to
9bca0ae
Compare
Lightning00Blade
approved these changes
Jul 1, 2026
Merged
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Drive-by: skill for verification.