You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ports the new PageEvent.FrameNavigatedSameDocument / FrameNavigatedNewDocument events from puppeteer/puppeteer#15760 as IPage.FrameNavigatedSameDocument and IPage.FrameNavigatedNewDocument (with XML docs, and a remark on FrameNavigated).
CDP: FrameManager raises them after FrameNavigated (new document / within document).
BiDi: fragment navigation and historyUpdated raise FrameNavigated + same-document; DOMContentLoaded raises new-document.
Tests ported from upstream frame.test.ts (Chrome/CDP: all FrameTests and NavigationTests pass; the only failure, ShouldWorkHeadful, is an environment limit). BiDi was not run locally.
Upstream parity
Verdict: parity with upstream (api/Page.ts, cdp/Page.ts, cdp/FrameManager.ts, bidi/Frame.ts) including event order and docs. The /hardkoded:upstream-parity-check skill wasn't available in this session, so this was checked manually.
No actionable comments were generated in the recent review.
Walkthrough
The page API now exposes separate events for same-document and new-document frame navigations. CDP and BiDi handlers report the corresponding events. Tests cover event order, frame identity, event counts, and URLs for document, fragment, history API, and child-frame navigation.
Changes: Frame navigation events
Layer / File(s)
Summary
Public navigation event contract lib/PuppeteerSharp/IPage.cs, lib/PuppeteerSharp/Page.cs
The page API documents and exposes FrameNavigatedSameDocument and FrameNavigatedNewDocument. Page adds internal raisers for both events.
CDP event dispatch and navigation tests lib/PuppeteerSharp/Cdp/FrameManager.cs, lib/PuppeteerSharp/Cdp/CdpPage.cs, lib/PuppeteerSharp.Tests/FrameTests/FrameManagementTests.cs
The CDP frame manager reports new-document and same-document navigations, with FrameNavigated raised first for within-document navigation. Tests assert event ordering, frame identity, counts, and URLs.
This adds same-document and new-document frame navigation events to the page API for both CDP and BiDi, with tests for event order, counts and URLs. No concrete merge-blocking defect was found. One BiDi edge case, cached history restoration, remains unverified. It may be worth a follow-up check on supported browsers but does not block merging.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Out of Scope Changes check
Issue #3727 covers documentation only and states 'once the feature is ported', which implies the port is a prerequisite handled elsewhere. This PR also ports the feature: new public events in Page.cs …
Confirm whether the feature port belongs in this PR or in a separate change referenced by #3727. Confirm that the reordering of FrameNavigated and FrameNavigatedWithinDocument in FrameManager.cs is intended and required by the port. Provide…
Passed checks: 3 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the two new public page events, FrameNavigatedSameDocument and FrameNavigatedNewDocument, which are the main change in the PR. The changeset adds these events to IPage and Page, wires …
Linked Issues check
Issue #3727 asks for XML docs and site docs for FrameNavigatedSameDocument and FrameNavigatedNewDocument after the feature is ported. The coding requirement is the XML documentation. At head, lib/Pupp…
Full details: Title check
Explanation
The title names the two new public page events, FrameNavigatedSameDocument and FrameNavigatedNewDocument, which are the main change in the PR. The changeset adds these events to IPage and Page, wires them through CdpPage and BidiFrame, and adjusts FrameManager event ordering. The title is specific and matches the primary change, so it passes.
Full details: Linked Issues check
Explanation
Issue #3727 asks for XML docs and site docs for FrameNavigatedSameDocument and FrameNavigatedNewDocument after the feature is ported. The coding requirement is the XML documentation. At head, lib/PuppeteerSharp/IPage.cs documents both events. FrameNavigatedSameDocument states it is raised for same-document navigation, and FrameNavigatedNewDocument states it is raised for new-document navigation. Both remarks state that the event is raised after FrameNavigated. The FrameNavigated remark directs readers to the two new events. Site docs are documentation outside the code and are treated as non-coding, so they are not assessed. The tests in FrameManagementTests.cs cover the event behavior, but the issue does not require tests.
Full details: Out of Scope Changes check
Explanation
Issue #3727 covers documentation only and states 'once the feature is ported', which implies the port is a prerequisite handled elsewhere. This PR also ports the feature: new public events in Page.cs and IPage.cs, CDP raising in CdpPage.cs and FrameManager.cs, and BiDi raising in BidiFrame.cs. These changes are needed for the documented events to exist, so they are not shown to be unrelated. However, FrameManager.cs also changes existing behavior: within-document navigation now updates state and raises FrameNavigated before FrameNavigatedWithinDocument, where the order was previously reversed. The issue does not request this change. The BiDi tests were not run, and the CDP results cover only the author's local run.
Resolution
Confirm whether the feature port belongs in this PR or in a separate change referenced by #3727. Confirm that the reordering of FrameNavigated and FrameNavigatedWithinDocument in FrameManager.cs is intended and required by the port. Provide evidence that the BiDi changes in BidiFrame.cs are covered by tests.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
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
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.
Closes #3727
Ports the new
PageEvent.FrameNavigatedSameDocument/FrameNavigatedNewDocumentevents from puppeteer/puppeteer#15760 asIPage.FrameNavigatedSameDocumentandIPage.FrameNavigatedNewDocument(with XML docs, and a remark onFrameNavigated).FrameManagerraises them afterFrameNavigated(new document / within document).historyUpdatedraiseFrameNavigated+ same-document;DOMContentLoadedraises new-document.frame.test.ts(Chrome/CDP: all FrameTests and NavigationTests pass; the only failure,ShouldWorkHeadful, is an environment limit). BiDi was not run locally.Upstream parity
Verdict: parity with upstream (
api/Page.ts,cdp/Page.ts,cdp/FrameManager.ts,bidi/Frame.ts) including event order and docs. The/hardkoded:upstream-parity-checkskill wasn't available in this session, so this was checked manually.Generated by Claude Code
Summary by CodeRabbit