Skip to content

Conversation

@chromium-wpt-export-bot
Copy link
Collaborator

Since prerender-until-script pages cannot execute scripts, the existing
test utilities cannot help test this case. More specifically,
prerender-until-script pages cannot tell the initiator pages that they
are ready for activation.

This CL introduces a server-side handler (pus-handler.py) to coordinate
the test.

Workflows:

  1. The initiator page (pus-initiator-page-template.html)
    triggers the prerender and simultaneously fetches a signal_url. This
    fetch is designed to hang on the server.

  2. The prerendered page (pus-page-template.html) is allowed to fetch an
    async script (which also hits the signal_url, but with
    isprerendering=True).

  3. When the server receives the request from the prerendered page, it
    puts a token in its stash, which in turn unblocks the initiator's
    hanging fetch.

  4. The .then() block of the initiator's fetch then runs, navigating to
    the prerendered page and causing activation.

  5. The (previously blocked) inline script on the prerendered page then
    executes, verifying that document.prerendering is false and sending the
    result back to the main test page.

Bug: 428500219
Change-Id: I5e1098a6adbf7abfd02f692eb32e93c9093fd501
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7082540
Reviewed-by: Hiroki Nakagawa <[email protected]>
Commit-Queue: Lingqi Chi <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1536464}

Since prerender-until-script pages cannot execute scripts, the existing
test utilities cannot help test this case. More specifically,
prerender-until-script pages cannot tell the initiator pages that they
are ready for activation.

This CL introduces a server-side handler (pus-handler.py) to coordinate
the test.

Workflows:
1. The initiator page (pus-initiator-page-template.html)
triggers the prerender and simultaneously fetches a signal_url. This
fetch is designed to hang on the server.

2. The prerendered page (pus-page-template.html) is allowed to fetch an
async script (which also hits the signal_url, but with
isprerendering=True).

3. When the server receives the request from the prerendered page, it
puts a token in its stash, which in turn unblocks the initiator's
hanging fetch.

4. The .then() block of the initiator's fetch then runs, navigating to
the prerendered page and causing activation.

5. The (previously blocked) inline script on the prerendered page then
executes, verifying that document.prerendering is false and sending the
result back to the main test page.

Bug: 428500219
Change-Id: I5e1098a6adbf7abfd02f692eb32e93c9093fd501
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7082540
Reviewed-by: Hiroki Nakagawa <[email protected]>
Commit-Queue: Lingqi Chi <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1536464}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

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

The review process for this patch is being conducted in the Chromium project.

@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 9061388 into master Oct 28, 2025
17 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-643532c56c branch October 28, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants