Skip to content

Expose redirectCount for TAO opted-in redirect chains - #12513

Merged
annevk merged 8 commits into
whatwg:mainfrom
yoavweiss:tao_on_navigation_redirect
Jun 25, 2026
Merged

annevk merged 8 commits into
whatwg:mainfrom
yoavweiss:tao_on_navigation_redirect

Conversation

@yoavweiss

@yoavweiss yoavweiss commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

As part of the WebPerfWG discussion, we aligned Fetch's TAO definition to opt-in to the destination origin for navigations: whatwg/fetch#1931

This PR implements the HTML parts of using these new algorithms in order to resolve w3c/navigation-timing#215.

(See WHATWG Working Mode: Changes for more details.)


/document-lifecycle.html ( diff )
/infrastructure.html ( diff )

@yoavweiss
yoavweiss requested a review from noamr June 3, 2026 12:43

@annevk annevk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't understand how this works. What if one redirect allows it and one doesn't?

@yoavweiss

Copy link
Copy Markdown
Contributor Author

I don't understand how this works. What if one redirect allows it and one doesn't?

I may have gotten this wrong, but I thought TAO check only passes if the entire redirect chain has Timing-Allow-Origin

@annevk

annevk commented Jun 3, 2026

Copy link
Copy Markdown
Member

No, TAO check only looks at a single response. There's https://fetch.spec.whatwg.org/#concept-response-timing-allow-passed but I don't actually know if that works well for navigations. Navigations are messy.

@yoavweiss

yoavweiss commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor Author

I don't actually know if that works well for navigations.

A bit of Claude-assisted digging got me to:

So I think that simply changing the TAO check to looking at the response's timing-allow-passed value should work..

Let me know if you agree

@annevk

annevk commented Jun 3, 2026

Copy link
Copy Markdown
Member

Yeah that looks correct. I think there are still issues with it, but this is not one of them. There is still the question as to whether it's okay that same-origin redirects end up exposed without opt-in.

@yoavweiss

Copy link
Copy Markdown
Contributor Author

There is still the question as to whether it's okay that same-origin redirects end up exposed without opt-in.

Yeah, I'll open a separate issue RE that

@yoavweiss

Copy link
Copy Markdown
Contributor Author

There is still the question as to whether it's okay that same-origin redirects end up exposed without opt-in.

Yeah, I'll open a separate issue RE that

w3c/resource-timing#434

@yoavweiss
yoavweiss requested a review from annevk June 4, 2026 06:47
@yoavweiss

Copy link
Copy Markdown
Contributor Author

As discussed yesterday on the WebPerfWG call (and as pointed out by @annevk elsewhere), this is not correct, as we'd need the navigation TAO to opt-in to the destination origin, rather than the source origin. I'll revamp.

@annevk annevk added the do not merge yet Pull request must not be merged per rationale in comment label Jun 5, 2026
@yoavweiss

Copy link
Copy Markdown
Contributor Author

In w3c/navigation-timing#215 (comment) @achristensen07 suggests that we should also take the "noreferrer" values into account. This seems like we could add that condition here.

In the context of Fetch, I'm working on a PR to create navigation-specific TAO checks that look at the destination origin.

@yoavweiss

Copy link
Copy Markdown
Contributor Author

In w3c/navigation-timing#215 (comment) @achristensen07 suggests that we should also take the "noreferrer" values into account. This seems like we could add that condition here.

Thinking about this, I think it makes sense. We can think of it as:

  • The source navigation can opt-out of redirect timing (as it is the one choosing the redirectors) through noreferrer, or through Referrer-Policy.
  • The redirector itself can opt-in to timing through TAO, based on the destination origin

@noamr

noamr commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

As far as implementer support, Chrome team is supportive.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 23, 2026
This CL implements whatwg/html#12513 and
whatwg/fetch#1931, in order to resolve
w3c/navigation-timing#215.

It enables developers to opt-in to get cross-origin redirect timings,
through destination-based Timing-Allow-Origin headers.

I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/GOPn8-wQlsk/m/x5Q3G6KuAgAJ

Change-Id: Ib463010f1862af523a241d2e9180ff09bfedb101
Bug: 521861828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7915892
Commit-Queue: Yoav Weiss (@Shopify) <[email protected]>
Reviewed-by: Noam Rosenthal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1650808}
brave-builds pushed a commit to brave/chromium that referenced this pull request Jun 23, 2026
This CL implements whatwg/html#12513 and
whatwg/fetch#1931, in order to resolve
w3c/navigation-timing#215.

It enables developers to opt-in to get cross-origin redirect timings,
through destination-based Timing-Allow-Origin headers.

I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/GOPn8-wQlsk/m/x5Q3G6KuAgAJ

Change-Id: Ib463010f1862af523a241d2e9180ff09bfedb101
Bug: 521861828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7915892
Commit-Queue: Yoav Weiss (@Shopify) <[email protected]>
Reviewed-by: Noam Rosenthal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1650808}

@annevk annevk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should invert this. Start out with 0 and reveal the count if we're satisfied all conditions are met.

@yoavweiss

Copy link
Copy Markdown
Contributor Author

I think we should invert this. Start out with 0 and reveal the count if we're satisfied all conditions are met.

Done!

@yoavweiss
yoavweiss requested a review from annevk June 24, 2026 10:34
Comment thread source Resolved
annevk pushed a commit to whatwg/fetch that referenced this pull request Jun 25, 2026
Timing-Allow-Origin (TAO) currently only opts-in "backwards" in terms of origins and doesn't constitute an opt-in to the destination origin, which is the appropriate opt-in for navigations (contrary to subresources).

This PR adds the mechanisms that can enable such "forward" opt-in, and can enable a navigation response to a redirect chain to know that the redirect chain opted in to expose the redirects to its origin.

Tests: web-platform-tests/wpt#60823 & web-platform-tests/wpt#60873.

Corresponding HTML PR: whatwg/html#12513.
@annevk
annevk merged commit b94ff88 into whatwg:main Jun 25, 2026
1 check passed
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Jul 6, 2026
…, a=testonly

Automatic update from web-platform-tests
Navigation-Timing: destination-based TAO (#60823)

This CL implements whatwg/html#12513 and
whatwg/fetch#1931, in order to resolve
w3c/navigation-timing#215.

It enables developers to opt-in to get cross-origin redirect timings,
through destination-based Timing-Allow-Origin headers.

I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/GOPn8-wQlsk/m/x5Q3G6KuAgAJ

Change-Id: Ib463010f1862af523a241d2e9180ff09bfedb101
Bug: 521861828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7915892
Commit-Queue: Yoav Weiss (@Shopify) <[email protected]>
Reviewed-by: Noam Rosenthal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1650808}

Co-authored-by: Yoav Weiss <[email protected]>
--

wpt-commits: 2b0c3ce064199c58603edca2a8562da285f8d82b
wpt-pr: 60823
webkit-commit-queue pushed a commit to yoavweiss/WebKit that referenced this pull request Jul 13, 2026
…stination origin.

https://bugs.webkit.org/show_bug.cgi?id=316647

Reviewed by Alex Christensen.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

* LayoutTests/imported/w3c/web-platform-tests/navigation-timing/redirect-tao-expected.txt: Progression.
* LayoutTests/imported/w3c/web-platform-tests/navigation-timing/redirect-tao.html:
* LayoutTests/imported/w3c/web-platform-tests/navigation-timing/resources/redirect-tao-helper.js:
* LayoutTests/imported/w3c/web-platform-tests/navigation-timing/resources/report-navigation-redirect-timing.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/navigation-timing/response-start-after-coop-bcg-switch.https-expected.txt: Expectation change.
* LayoutTests/imported/w3c/web-platform-tests/navigation-timing/unload-event-same-origin-check-expected.txt: Progression.
* Source/WebCore/loader/DocumentLoader.cpp:
(WebCore::hideRedirectTimingForNoReferrerNavigation): Resets redirect count if noreferrer.
(WebCore::DocumentLoader::notifyFinished): Calls hideRedirectTimingForNoReferrerNavigation.
(WebCore::DocumentLoader::commitData): Calls hideRedirectTimingForNoReferrerNavigation.
* Source/WebCore/page/PerformanceNavigationTiming.cpp:
(WebCore::PerformanceNavigationTiming::shouldExposeRedirectTiming const): Only exposes redirect timing if redirectCount is not zero.
(WebCore::PerformanceNavigationTiming::redirectCount const): TAO check.
* Source/WebCore/page/PerformanceNavigationTiming.h:
* Source/WebCore/page/PerformanceResourceTiming.cpp:
(WebCore::fetchStart): Pass exposeRedirectTiming.
(WebCore::entryStartTime): Use shouldExposeRedirectTiming().
(WebCore::PerformanceResourceTiming::shouldExposeRedirectTiming const): A virtual fun that enables NavigationTiming to override the default RT behavior.
(WebCore::PerformanceResourceTiming::redirectStart const): Use shouldExposeRedirectTiming().
(WebCore::PerformanceResourceTiming::redirectEnd const): Use shouldExposeRedirectTiming().
(WebCore::PerformanceResourceTiming::fetchStart const): Use shouldExposeRedirectTiming().
* Source/WebCore/page/PerformanceResourceTiming.h:
* Source/WebCore/platform/network/TimingAllowOrigin.cpp:
(WebCore::passesNavigationTAOCheck):
* Source/WebCore/platform/network/TimingAllowOrigin.h:
* Source/WebKit/NetworkProcess/NetworkLoadChecker.cpp:
(WebKit::NetworkLoadChecker::checkRedirection): Append TAO values.
(WebKit::NetworkLoadChecker::validateResponse): Set TAO values on the response.
(WebKit::NetworkLoadChecker::appendToNavigationTimingAllowValuesList): Accumulate TAO values.
* Source/WebKit/NetworkProcess/NetworkLoadChecker.h:
(WebKit::NetworkLoadChecker::navigationTAOCheckPassed const): Getter.
* Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didFinishLoading):

Canonical link: https://commits.webkit.org/317061@main
zerox80 pushed a commit to zerox80/firefox that referenced this pull request Oct 16, 2026
…, a=testonly

Automatic update from web-platform-tests
Navigation-Timing: destination-based TAO (#60823)

This CL implements whatwg/html#12513 and
whatwg/fetch#1931, in order to resolve
w3c/navigation-timing#215.

It enables developers to opt-in to get cross-origin redirect timings,
through destination-based Timing-Allow-Origin headers.

I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/GOPn8-wQlsk/m/x5Q3G6KuAgAJ

Change-Id: Ib463010f1862af523a241d2e9180ff09bfedb101
Bug: 521861828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7915892
Commit-Queue: Yoav Weiss (@Shopify) <[email protected]>
Reviewed-by: Noam Rosenthal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1650808}

Co-authored-by: Yoav Weiss <[email protected]>
--

wpt-commits: 2b0c3ce064199c58603edca2a8562da285f8d82b
wpt-pr: 60823
annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 3, 2026
…stination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061@main
annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Nov 3, 2026
…stination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061@main
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Nov 18, 2026
…/show_bug.cgi?id=316647, a=testonly

Automatic update from web-platform-tests
Navigation Timing: cross-origin redirect opt-in should be based on destination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061@main

--

wpt-commits: 6662bb5ac7dfcf0b31d010d7f402360e00cbf0e3
wpt-pr: 64599
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Nov 18, 2026
…/show_bug.cgi?id=316647, a=testonly

Automatic update from web-platform-tests
Navigation Timing: cross-origin redirect opt-in should be based on destination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061@main

--

wpt-commits: 5a686a30bc8638de1a161d781e4234a661116879
wpt-pr: 64618
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 19, 2026
…/show_bug.cgi?id=316647, a=testonly

Automatic update from web-platform-tests
Navigation Timing: cross-origin redirect opt-in should be based on destination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061main

--

wpt-commits: 6662bb5ac7dfcf0b31d010d7f402360e00cbf0e3
wpt-pr: 64599

UltraBlame original commit: 60b9f2299b1e1102d2e9d99367f2238f5204e19e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 19, 2026
…/show_bug.cgi?id=316647, a=testonly

Automatic update from web-platform-tests
Navigation Timing: cross-origin redirect opt-in should be based on destination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061main

--

wpt-commits: 5a686a30bc8638de1a161d781e4234a661116879
wpt-pr: 64618

UltraBlame original commit: d061e4b754b982c689b5a94599eea146292b0e53
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 19, 2026
…/show_bug.cgi?id=316647, a=testonly

Automatic update from web-platform-tests
Navigation Timing: cross-origin redirect opt-in should be based on destination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061main

--

wpt-commits: 6662bb5ac7dfcf0b31d010d7f402360e00cbf0e3
wpt-pr: 64599

UltraBlame original commit: 60b9f2299b1e1102d2e9d99367f2238f5204e19e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 19, 2026
…/show_bug.cgi?id=316647, a=testonly

Automatic update from web-platform-tests
Navigation Timing: cross-origin redirect opt-in should be based on destination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061main

--

wpt-commits: 5a686a30bc8638de1a161d781e4234a661116879
wpt-pr: 64618

UltraBlame original commit: d061e4b754b982c689b5a94599eea146292b0e53
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 19, 2026
…/show_bug.cgi?id=316647, a=testonly

Automatic update from web-platform-tests
Navigation Timing: cross-origin redirect opt-in should be based on destination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061main

--

wpt-commits: 6662bb5ac7dfcf0b31d010d7f402360e00cbf0e3
wpt-pr: 64599

UltraBlame original commit: 60b9f2299b1e1102d2e9d99367f2238f5204e19e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 19, 2026
…/show_bug.cgi?id=316647, a=testonly

Automatic update from web-platform-tests
Navigation Timing: cross-origin redirect opt-in should be based on destination origin.

This PR aligns the WebKit implementation with whatwg/fetch#1931 and whatwg/html#12513,
and ensures that TAO opt-ins for navigation timing take the destination origin into account.

New iframe tests, plus test progressions.

WebKit-Bug: https://bugs.webkit.org/show_bug.cgi?id=316647
WebKit-Canonical-Link: https://commits.webkit.org/317061main

--

wpt-commits: 5a686a30bc8638de1a161d781e4234a661116879
wpt-pr: 64618

UltraBlame original commit: d061e4b754b982c689b5a94599eea146292b0e53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge yet Pull request must not be merged per rationale in comment

Development

Successfully merging this pull request may close these issues.

(Re-)Expose redirectCount, redirectStart and redirectEnd for TAO opted-in cross-origin redirects

3 participants