Skip to content

Cdp readystate about blank - #3862

Merged
karlseguin merged 5 commits into
mainfrom
cdp-readystate-about-blank
Oct 9, 2026
Merged

karlseguin merged 5 commits into
mainfrom
cdp-readystate-about-blank

Conversation

@krichprollsch

@krichprollsch krichprollsch commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Follow-up for #3598

  • add a stricter comparison to dispatch load event on lifecycle event enabled
  • add a special case for Document.readyState w/ about:blank

lightpanda-io/demo#272 updates the e2e test

Comment thread src/browser/webapi/Document.zig Outdated
// special case: protocols like CDP or webdriver use a fastpath for the default about:blank page.
// the page is considered immediately loaded **but** the _ready_state stay waiting for internal navigation reasons.
// So if the page is about:blank, shortcut ready_state to return complete.
if (URL.isAboutBlank(self.getURL(frame))) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems over-broad. A new iframe that does a document.open will get "complete" instead of the "loading" that it should.

In Session.createPage set frame.document._ready_state = .complete.; which then covers the "the default about:blank".

And atop Frame.navigate, you can always reset it to .loading

Comment thread src/server/cdp/domains/page.zig Outdated
// Like Chrome, report the initial about:blank as loaded. Its state is left
// as is, since the first navigation reuses it (see canNavigateInPlace).
if (frame._load_state == .waiting) {
if (URL.isAboutBlank(frame.url)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This covers the new case, but it breaks an explicit about:blank navigate. I tested in chrome by changing puppeteer/basic.js to navigate "about:blank", and I still got the network idle events.

I think you want a combination of the two, frame._load_state == .waiting and URL.isAboutBlank(frame.url) ?

@krichprollsch krichprollsch self-assigned this Oct 9, 2026
@krichprollsch

Copy link
Copy Markdown
Member Author

Thanks for the review, I mixed up frame._load_state with document._ready_state.
I tried to address your point and improve the PR in the last 2 commits.

@krichprollsch

Copy link
Copy Markdown
Member Author

I can remove the isAboutBlank thing since I don't use it anymore, let me know.

@karlseguin

Copy link
Copy Markdown
Collaborator

I think most of our about:blank checks should match against about:blank#x and about:blank?x so having the function is a first step towards that.

@karlseguin
karlseguin merged commit 9e754ea into main Oct 9, 2026
28 of 30 checks passed
@karlseguin
karlseguin deleted the cdp-readystate-about-blank branch October 9, 2026 10:13
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants