Skip to content

Conversation

@noamr
Copy link
Collaborator

@noamr noamr commented Oct 22, 2024

This restriction only makes sense for the initial navigation, not for traversal.

Closes #11063

[css-spec-shortname-1] Brief description which should also include the #issuenum-or-URL and/or link to relevant CSSWG minutes.

Copy the above line into the Title and replace with the relevant details. Fill in any additional details here. See https://github.com/w3c/csswg-drafts/blob/master/CONTRIBUTING.md for more info.

…ument that was created using cross-origin redirects

This restriction only makes sense for the initial navigation, not for traversal.

Closes w3c#11063
@noamr noamr requested a review from khushalsagar October 22, 2024 08:46

1. If |newDocument| [=was created via cross-origin redirects=], then return false.

1. If |navigationType| is {{NavigationType/traverse}}, then return true.
Copy link
Member

Choose a reason for hiding this comment

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

If it's a non-BFCache traverse navigation, then the cross-origin restriction should still apply. It's no different from a push navigation then.

That said, we might have been overly conservative limiting navigations with cross-origin redirects. I don't quite remember the rationale other than "there could be an information leak and it's a rare use-case". So also happy to re-open that conversation if you'd like.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does the HTML spec's wording for the page swap event work here? https://html.spec.whatwg.org/multipage/browsing-the-web.html#updating-the-traversable:latest-entry

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I was thinking the same. Amended the PR

@noamr noamr merged commit 8745dbb into w3c:main Oct 24, 2024
1 check passed
webkit-commit-queue pushed a commit to mattwoodrow/WebKit that referenced this pull request Oct 24, 2024
…ld succeed even if the Document was created with a cross-origin redirect.

https://bugs.webkit.org/show_bug.cgi?id=282012
<rdar://138517027>

Reviewed by Charlie Wolfe.

As per
https://html.spec.whatwg.org/multipage/browsing-the-web.html#updating-the-traversable:latest-entry,
the cross-origin redirect check should only apply if not loading from BFCache.

I'm also changing the view-transitions logic, which isn't currently in the spec,
but is drafted here: w3c/csswg-drafts#11070.

Without this change, navigating to a site via a cross-origin redirect marks the
initial Document as having being created with a cross-origin redirect. If you
then navigate within the site, and then back to the initial, the view
transition is blocked due to this despite the redirect being unrelated to the
'back' traversal.

* LayoutTests/http/wpt/css/css-view-transitions/navigation/cross-origin-bfcache-expected.txt: Added.
* LayoutTests/http/wpt/css/css-view-transitions/navigation/cross-origin-bfcache.html: Added.
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::navigationCanTriggerCrossDocumentViewTransition):
* Source/WebCore/loader/DocumentLoader.h:
* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad):
* Source/WebCore/page/Navigation.cpp:
(WebCore::Navigation::createForPageswapEvent):
* Source/WebCore/page/Navigation.h:

Canonical link: https://commits.webkit.org/285663@main
liuminSYBS pushed a commit to liuminSYBS/webkit that referenced this pull request Mar 19, 2025
    [css-view-transitions-2] Traversal navigations to a cached entry should succeed even if the Document was created with a cross-origin redirect.
    https://bugs.webkit.org/show_bug.cgi?id=282012
    <rdar://138517027>

    Reviewed by Charlie Wolfe.

    As per
    https://html.spec.whatwg.org/multipage/browsing-the-web.html#updating-the-traversable:latest-entry,
    the cross-origin redirect check should only apply if not loading from BFCache.

    I'm also changing the view-transitions logic, which isn't currently in the spec,
    but is drafted here: w3c/csswg-drafts#11070.

    Without this change, navigating to a site via a cross-origin redirect marks the
    initial Document as having being created with a cross-origin redirect. If you
    then navigate within the site, and then back to the initial, the view
    transition is blocked due to this despite the redirect being unrelated to the
    'back' traversal.

    * LayoutTests/http/wpt/css/css-view-transitions/navigation/cross-origin-bfcache-expected.txt: Added.
    * LayoutTests/http/wpt/css/css-view-transitions/navigation/cross-origin-bfcache.html: Added.
    * Source/WebCore/loader/DocumentLoader.cpp:
    (WebCore::DocumentLoader::navigationCanTriggerCrossDocumentViewTransition):
    * Source/WebCore/loader/DocumentLoader.h:
    * Source/WebCore/loader/FrameLoader.cpp:
    (WebCore::FrameLoader::commitProvisionalLoad):
    * Source/WebCore/page/Navigation.cpp:
    (WebCore::Navigation::createForPageswapEvent):
    * Source/WebCore/page/Navigation.h:

    Canonical link: https://commits.webkit.org/285663@main

Canonical link: https://commits.webkit.org/283286.371@safari-7620-branch
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

Successfully merging this pull request may close these issues.

[css-view-transitions-2] Using 'was created via cross-origin redirects' Document creation state causes unexpected results

3 participants