Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speculation rules prefetch results are not used for prerendering #261

Open
hiroshige-g opened this issue Mar 28, 2023 · 0 comments
Open

Comments

@hiroshige-g
Copy link

Problem

In a scenario like:

  1. Speculation rules prefetch to a URL is added to Document A
  2. Speculation rules prerender to the same URL is added to Document A

The prefetched results from Step 1 isn't used for the prerendering navigation request in Step 2.

This is because prefetch records is Document-scoped (assciated with navigable’s active document in https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate):

Let prefetchRecord be the result of finding a matching prefetch record given navigable’s active document, entry’s URL, and targetSnapshotParams’s sandboxing flags.

but start user-agent initiated prerendering and start referrer-initiated prerendering uses a newly created navigable and thus no prefetch records are there.

Possible Solution

Check sourceDocument of https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate instead of navigable’s active document in the case of prerendering.
This would make start referrer-initiated prerendering to use the prefetched results in the scenario above.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 28, 2023
The test reflects the current spec and Chromium implementation
where speculation rules prefetch results are not used for
prerendering, while
WICG/nav-speculation#261
might want to modify the behavior.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: Id9355196c9d675a9a04ecce7e2c5a56be5e3020a
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 4, 2023
The test reflects the current spec and Chromium implementation
where speculation rules prefetch results are not used for
prerendering, while
WICG/nav-speculation#261
might want to modify the behavior.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: Id9355196c9d675a9a04ecce7e2c5a56be5e3020a
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 7, 2023
The test reflects the current spec and Chromium implementation
where speculation rules prefetch results are not used for
prerendering, while
WICG/nav-speculation#261
might want to modify the behavior.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: Id9355196c9d675a9a04ecce7e2c5a56be5e3020a
aarongable pushed a commit to chromium/chromium that referenced this issue Apr 10, 2023
The test reflects the current spec and Chromium implementation
where speculation rules prefetch results are not used for
prerendering, while
WICG/nav-speculation#261
might want to modify the behavior.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: Id9355196c9d675a9a04ecce7e2c5a56be5e3020a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4369810
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128101}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 10, 2023
The test reflects the current spec and Chromium implementation
where speculation rules prefetch results are not used for
prerendering, while
WICG/nav-speculation#261
might want to modify the behavior.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: Id9355196c9d675a9a04ecce7e2c5a56be5e3020a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4369810
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128101}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 10, 2023
The test reflects the current spec and Chromium implementation
where speculation rules prefetch results are not used for
prerendering, while
WICG/nav-speculation#261
might want to modify the behavior.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: Id9355196c9d675a9a04ecce7e2c5a56be5e3020a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4369810
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128101}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 10, 2023
For prerendering navigation requests,
`PrefetchURLLoaderInterceptor::previous_render_frame_host_id_`
is not the Document where the corresponding speculation rules
prerender is added.

To associate the prerendering navigation requests with
the proper initiator Document, this CL plumbs
`initiator_render_frame_host_id` via
`PrerenderAttributes`
-> `PrerenderHost`
-> `GetReferringRenderFrameHostId()`, and uses it in
`PrefetchURLLoaderInterceptor::GetPrefetch()` and
`PrefetchDocumentManager::DidStartNavigation()`.

This CL makes prefetched results used for prerendering,
if they are initiated by the same Document.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: I8f15220c30c9199b0616704db7228ff1c604ed74
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 13, 2023
For prerendering navigation requests,
`PrefetchURLLoaderInterceptor::previous_render_frame_host_id_`
is not the Document where the corresponding speculation rules
prerender is added.

To associate the prerendering navigation requests with
the proper initiator Document, this CL plumbs
`initiator_render_frame_host_id` via
`PrerenderAttributes`
-> `PrerenderHost`
-> `GetReferringRenderFrameHostId()`, and uses it in
`PrefetchURLLoaderInterceptor::GetPrefetch()` and
`PrefetchDocumentManager::DidStartNavigation()`.

This CL makes prefetched results used for prerendering,
if they are initiated by the same Document.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: I8f15220c30c9199b0616704db7228ff1c604ed74
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 13, 2023
For prerendering navigation requests,
`PrefetchURLLoaderInterceptor::previous_render_frame_host_id_`
is not the Document where the corresponding speculation rules
prerender is added.

To associate the prerendering navigation requests with
the proper initiator Document, this CL plumbs
`initiator_render_frame_host_id` via
`PrerenderAttributes`
-> `PrerenderHost`
-> `GetReferringRenderFrameHostId()`, and uses it in
`PrefetchURLLoaderInterceptor::GetPrefetch()` and
`PrefetchDocumentManager::DidStartNavigation()`.

This CL makes prefetched results used for prerendering,
if they are initiated by the same Document.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: I8f15220c30c9199b0616704db7228ff1c604ed74
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 13, 2023
For prerendering navigation requests,
`PrefetchURLLoaderInterceptor::previous_render_frame_host_id_`
is not the Document where the corresponding speculation rules
prerender is added.

To associate the prerendering navigation requests with
the proper initiator Document, this CL plumbs
`initiator_render_frame_host_id` via
`PrerenderAttributes`
-> `PrerenderHost`
-> `GetReferringRenderFrameHostId()`, and uses it in
`PrefetchURLLoaderInterceptor::GetPrefetch()` and
`PrefetchDocumentManager::DidStartNavigation()`.

This CL makes prefetched results used for prerendering,
if they are initiated by the same Document.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: I8f15220c30c9199b0616704db7228ff1c604ed74
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Apr 13, 2023
For prerendering navigation requests,
`PrefetchURLLoaderInterceptor::previous_render_frame_host_id_`
is not the Document where the corresponding speculation rules
prerender is added.

To associate the prerendering navigation requests with
the proper initiator Document, this CL plumbs
`initiator_render_frame_host_id` via
`PrerenderAttributes`
-> `PrerenderHost`
-> `GetReferringRenderFrameHostId()`, and uses it in
`PrefetchURLLoaderInterceptor::GetPrefetch()` and
`PrefetchDocumentManager::DidStartNavigation()`.

This CL makes prefetched results used for prerendering,
if they are initiated by the same Document.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: I8f15220c30c9199b0616704db7228ff1c604ed74
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Apr 15, 2023
…erendering, a=testonly

Automatic update from web-platform-tests
[WPT] Prefetched results not used for prerendering

The test reflects the current spec and Chromium implementation
where speculation rules prefetch results are not used for
prerendering, while
WICG/nav-speculation#261
might want to modify the behavior.

Bug: 1422815, WICG/nav-speculation#261
Change-Id: Id9355196c9d675a9a04ecce7e2c5a56be5e3020a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4369810
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128101}

--

wpt-commits: e6bff2d1d16c0304b23648e4fbdc240d21143dcd
wpt-pr: 39241
aarongable pushed a commit to chromium/chromium that referenced this issue May 23, 2023
This CL uses initiator's Document/RenderFrameHost
(which basically corresponds to `sourceDocument` in the spec)
when available for prefetch lookup.

This is to align with the Spec PR:
WICG/nav-speculation#267

This CL makes prefetched results used for prerendering,
if they are initiated by the same Document.
In ordinal prerendering cases, the initiator is the same as
`PrerendererImpl::render_frame_host_`.

Some other cases affected by the spec PR aren't fixed by
this CL (e.g. https://crbug.com/1432886), because they are
also blocked by other issues (removal of
`PrefetchDocumentManager::DidStartNavigation()`, etc).

Bug: 1440607, 1422815, 1432886, 1431804, WICG/nav-speculation#261
Change-Id: I8f15220c30c9199b0616704db7228ff1c604ed74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4372403
Reviewed-by: Max Curran <curranmax@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1148246}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant