VOOZH about

URL: https://phabricator.services.mozilla.com/D276668

⇱ ⚙ D276668 Bug 2006340 - Implement Resource Timing Level 3 interim response timestamps


Bug 2006340 - Implement Resource Timing Level 3 interim response timestamps
ClosedPublic

Authored by hjanuschka on Dec 16 2025, 1:59 PM.
Referenced Files
Unknown Object (File)
Mon, Jun 15, 4:59 AM
Unknown Object (File)
Mon, Jun 15, 4:08 AM
Unknown Object (File)
Mon, Jun 15, 3:43 AM
Unknown Object (File)
Mon, Jun 15, 3:28 AM
Unknown Object (File)
Mon, Jun 15, 3:19 AM
Unknown Object (File)
Sun, Jun 14, 12:43 AM
Unknown Object (File)
Sun, Jun 14, 12:32 AM
Unknown Object (File)
Sat, Jun 13, 11:50 PM

Details

Summary

Add firstInterimResponseStart and finalResponseHeadersStart properties
to distinguish interim (1xx) from final HTTP responses per W3C Resource
Timing spec.

  • Network layer: Capture timing in nsHttpTransaction and Http2Session
  • IPC: Serialize new timestamps across processes
  • DOM: Expose via PerformanceResourceTiming with TAO protection
  • Tests: Enable WPT interim-response-times tests (all pass)

Matches WebKit and Chromium implementations.

Diff Detail

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Comment Actions

sorry for the hasle, fixed the .ini file, hope bots will be green now

Comment Actions

do i need todo anything further, to re-land it?

This revision is now accepted and ready to land.Jan 4 2026, 1:50 AM
Comment Actions

@valentin i am pretty new to firefox code, is there any better way to run the tests locally!? that verify it, or CI to catch it? it is all green, local and CI it lands and then fails :/

newest upload should fix the last revert-reason, and hopefully is a full-fix!

thanks in for your time and patience with me!

Comment Actions

@valentin i am pretty new to firefox code, is there any better way to run the tests locally!? that verify it, or CI to catch it? it is all green, local and CI it lands and then fails :/

newest upload should fix the last revert-reason, and hopefully is a full-fix!

thanks in for your time and patience with me!

I pushed your changes to try: https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=171585
Frequent contributors can apply for level 1 commit rights that allows them to trigger the tests in automation https://firefox-source-docs.mozilla.org/tools/try/index.html

Lacking that, you can build the changes on your own machine and run the tests that are most likely to be impacted:
or

I have found a minor bug in the implementation that needs to be fixed.
But otherwise I think you did a great job with this contribution. Thanks!

netwerk/protocol/http/nsHttpTransaction.cpp
857

Could you return this line here?
It seems the chang caused a few tests to regress in /resource-timing/resource-timing-level1.sub.html

FAIL 'iframe 250ms delay in headers does not affect responseStart' - assert_greater_than_equal: Delay after HTTP/1.1 status should not affect 
'responseStart'. expected a number greater than or equal to 15675.76 but got 15425.94
FAIL 'xmlhttprequest 250ms delay in headers does not affect responseStart' - assert_greater_than_equal: Delay after HTTP/1.1 status should not affect 
'responseStart'. expected a number greater than or equal to 16564.18 but got 16314.42
FAIL 'script 250ms delay in headers does not affect responseStart' - assert_greater_than_equal: Delay after HTTP/1.1 status should not affect 
'responseStart'. expected a number greater than or equal to 17461.82 but got 17212.02
FAIL 'link 250ms delay in headers does not affect responseStart' - assert_greater_than_equal: Delay after HTTP/1.1 status should not affect 
'responseStart'. expected a number greater than or equal to 18342.62 but got 18092.82
This revision now requires changes to proceed.Jan 7 2026, 11:44 AM
hjanuschka updated this revision to Diff 1180779.
Comment Actions

thank you! pushed an update! with your suggestion! hope its correct (phabricator is quiet complex, and everything feels so different to e.g. chromium 🙃)

Comment Actions

Excellent. Thank you!
I'll push it to autoland. 🤞

This revision is now accepted and ready to land.Jan 7 2026, 2:45 PM
Comment Actions

thank you hop it sticks now! is there anything like AUTHORS or so where i'd need to add myself?

This revision is now accepted and ready to land.Jan 8 2026, 10:25 AM
Comment Actions

@valentin sorry that this is such a back and forth :( - could you try this patchset?

Comment Actions

@valentin sorry that this is such a back and forth :( - could you try this patchset?

Don't worry about the back and forth 🙂 It's part of the normal development cycle of any sufficiently complex piece of software.

When making updates to the patch, it would be good if you left a comment explaining what changed.
I think the failures on Android were due to the fact that we're setting both responseStart and finalResponseStart to a timestamp::now(), but if the device is slow enough (like android is sometimes), the timestamps will be different which leads to being true in FirstInterimResponseStartHighRes.
In this case, the fix is probably to make sure we use the same timestamp for mFinalResponseHeadersStart when there is no interim response.

Comment Actions

Changes in this update:

  1. is captured when the status line is FIRST parsed (in at line 2044)
  2. now reuses the SAME timestamp as for final responses (at line 2085)
Comment Actions

Code analysis found 3 defects in diff 1182741:

  • 1 defect found by clang-format
  • 2 defects found by clang-format (Mozlint)
WARNING: Found 3 defects (warning level) that can be dismissed.

You can run this analysis locally with:

For your convenience, here is a patch that fixes all the clang-format defects (use it in your repository with or ).


If you see a problem in this automated review, please report it here.

You can view these defects in the Diff Detail section of Phabricator diff 1182741.

Comment Actions

@valentin
hopefully fixed! Now sets both timestamps to same value for non-interim responses (avoids race on slow devices), and only sets finalResponseHeadersStart later for actual interim responses. HTTP/3 xpcshell tests pass locally

Comment Actions

@valentin - can you please kick off another run?
finally, i think i managed to run all the tests locally, and they pass.

Comment Actions

@valentin asking for help here, webkit and chromium already shipped it and i am stuck in a nimbus of "idfk" - it says job failed but does not show me error
could you help me through this?

Comment Actions

@valentin asking for help here, webkit and chromium already shipped it and i am stuck in a nimbus of "idfk" - it says job failed but does not show me error
could you help me through this?

https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=185181

Hope this works. Sorry I missed the previous comment.

Comment Actions

it fails again, but both of the errors dont really ring a bell for me :/ a bit lost on this change

hjanuschka edited the summary of this revision. (Show Details)
Comment Actions

@valentin really feeling bad about all this ping pong, could you PLEASE start it one more time, i thnk i found the missing test expectation updates?

Comment Actions

No reason to feel bad about it. I'm really grateful for your contributions!

https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=188120 - mach try auto
https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=188121 - linux64 all wpt + xpcshell

Comment Actions

@valentin again please, locally the da** wpt's now pass, is there any chance i could kick of bots on this changeset myself?

Comment Actions

Summary

Intent

The changes implement the W3C Resource Timing Level 3 specification for interim response timestamps. Specifically, this adds two new properties — and — to the API. These properties allow web developers to distinguish between the timing of interim HTTP responses (1xx status codes, such as 103 Early Hints or 100 Continue) and the timing of the final HTTP response (2xx/3xx/4xx/5xx). This aligns Firefox's implementation with WebKit and Chromium, which already support these properties.

Solution

The implementation spans multiple layers of the Firefox codebase:

Network Layer (Timing Capture):

  • Two new fields ( and ) are added to the used throughout the networking stack.
  • In , when HTTP response headers are fully parsed, the code now checks the status code: if it's a 1xx response, it records the timestamp (only setting it once via the flag); if it's a final response, it records . The existing field is updated for backward compatibility — it's set to the first interim response time if one exists, otherwise to the final response time.
  • The same interim/final timing logic is added to and to handle HTTP/2 and HTTP/3 protocols respectively.
  • New getter and setter methods with mutex-protected access are added to .

Channel Layer (Propagation):

  • IDL interface is updated (with a new UUID) to include the two new timestamp attributes in both and forms.
  • , , and all implement the new getter methods, reading from either the live transaction or cached timing data.
  • abstract interface and its implementations () are extended with the new virtual getters.

IPC Layer (Cross-Process Serialization):

  • The IPDL message definitions () for both and are extended with the two new fields.
  • serializes the new timestamps into IPC messages, and deserializes them back into the timing struct.
  • The IPC serialization () is updated to read/write the new fields.

DOM Layer (Web API Exposure):

  • gains the two new member fields and corresponding methods that convert timestamps to values (returning 0 when no interim response was received).
  • exposes both properties using the existing TAO (Timing-Allow-Origin) protection macro, ensuring cross-origin timing information is properly restricted.
  • The WebIDL definition for adds and as readonly attributes with annotation.

Tests:

  • All previously-expected-to-fail WPT test entries for , , and the test files are removed, indicating these tests now pass.

Please use / reactions on inline comments to provide feedback. This will have a significant impact on the quality of future reviews.
netwerk/protocol/http/Http2Session.cpp
1709

is called unconditionally but is only used inside branches. Move the call after the branch condition to avoid the cost when is null. For the 1xx path, is not needed for .

netwerk/protocol/http/nsHttpTransaction.cpp
2132

These lines directly access , , and without holding , while lines 2081 and 2084 use the lock-protected setters. The HTTP/2 and HTTP/3 code paths correctly use the locked accessors (, ). Use the same locked methods here:

TimeStamp firstInterim = GetFirstInterimResponseStart();
if (!firstInterim.IsNull()) {
 SetResponseStart(firstInterim, true);
} else {
 SetResponseStart(GetFinalResponseHeadersStart(), true);
}
Comment Actions

@valentin again please, locally the da** wpt's now pass, is there any chance i could kick of bots on this changeset myself?

https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=188385

If you're interested in contributing more following this patch you could apply for level 1 commit rights. see https://firefox-source-docs.mozilla.org/tools/try/configuration.html
That would allow you to push to try.

Comment Actions

@valentin again please, locally the da** wpt's now pass, is there any chance i could kick of bots on this changeset myself?

https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=188385

If you're interested in contributing more following this patch you could apply for level 1 commit rights. see https://firefox-source-docs.mozilla.org/tools/try/configuration.html

Comment Actions

@valentin

not sure how frequently i'll contribute, but since i enjoy closing interop gaps, and i have a pretty good chromium track, i bet/hope there'll be some more ff changes in the near future.

filed a request: https://bugzilla.mozilla.org/show_bug.cgi?id=2026703

and could you run the jobs again?

Comment Actions

@valentin may i ask you for a voucher for the level1 access?

Comment Actions

@valentin may i ask you for a voucher for the level1 access?

Vouched and pushed to try again. Sorry for the delay, I was on PTO the last week and a but swamped with bugmail.
https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod&landoCommitID=191873

Comment Actions

@valentin really appreciate the voucher, and i somehow managed to "./mach try auto" but now i have 100's failing tests.
on your push, it was only a handfull unrelated, but i couldn't retry them (since i was not the job starter)

how did you start the bots?

sorry for hijacking the changeset for such questions, is there a slack/chat/whatever channel for ff devs?

Comment Actions

@valentin really appreciate the voucher, and i somehow managed to "./mach try auto" but now i have 100's failing tests.
on your push, it was only a handfull unrelated, but i couldn't retry them (since i was not the job starter)

how did you start the bots?

I also do ./mach try auto
If you post a link I could have a look.

sorry for hijacking the changeset for such questions, is there a slack/chat/whatever channel for ff devs?

Yes, feel free to ask in https://chat.mozilla.org/#/room/#necko:mozilla.org or https://chat.mozilla.org/#/room/#dev-help:mozilla.org

Comment Actions

@valentin really appreciate the voucher, and i somehow managed to "./mach try auto" but now i have 100's failing tests.
on your push, it was only a handfull unrelated, but i couldn't retry them (since i was not the job starter)

how did you start the bots?

I also do ./mach try auto
If you post a link I could have a look.

You can also do and select only one platform web-platform-tests
https://firefox-source-docs.mozilla.org/tools/try/index.html

Revision Contents

PathSize
dom/
performance/
4 lines
10 lines
31 lines
webidl/
4 lines
netwerk/
base/
6 lines
ipc/
4 lines
protocol/
http/
24 lines
24 lines
14 lines
2 lines
4 lines
8 lines
4 lines
16 lines
2 lines
4 lines
20 lines
4 lines
57 lines
testing/
web-platform/
meta/
loading/
early-hints/
3 lines
resource-timing/
24 lines
server-timing/
24 lines
CommitTreeParentsAuthorSummaryDate
ceb343c444f6fd5fbc985b1aHelmut Januschka
Bug 2006340 - Implement Resource Timing Level 3 interim response timestamps… (Show More…)

Diff 1260097

dom/performance/PerformanceResourceTiming.h

Loading...

dom/performance/PerformanceTiming.h

Loading...

dom/performance/PerformanceTiming.cpp

Loading...

dom/webidl/PerformanceResourceTiming.webidl

Loading...

netwerk/base/nsITimedChannel.idl

Loading...

netwerk/ipc/NeckoChannelParams.ipdlh

Loading...

netwerk/protocol/http/Http2Session.cpp

Loading...

netwerk/protocol/http/Http3Session.cpp

Loading...

netwerk/protocol/http/HttpBaseChannel.cpp

Loading...

netwerk/protocol/http/HttpChannelChild.cpp

Loading...

netwerk/protocol/http/HttpChannelParent.cpp

Loading...

netwerk/protocol/http/HttpTransactionParent.cpp

Loading...

netwerk/protocol/http/HttpTransactionShell.h

Loading...

netwerk/protocol/http/NullHttpChannel.cpp

Loading...

netwerk/protocol/http/TimingStruct.h

Loading...

netwerk/protocol/http/nsHttpChannel.h

Loading...

netwerk/protocol/http/nsHttpChannel.cpp

Loading...

netwerk/protocol/http/nsHttpTransaction.h

Loading...

netwerk/protocol/http/nsHttpTransaction.cpp

Loading...

testing/web-platform/meta/loading/early-hints/early-hints-response-time.h2.html.ini

Loading...

testing/web-platform/meta/resource-timing/idlharness.any.js.ini

Loading...

testing/web-platform/meta/resource-timing/interim-response-times.h2.html.ini

Loading...

testing/web-platform/meta/resource-timing/interim-response-times.html.ini

Loading...

testing/web-platform/meta/server-timing/idlharness.https.any.js.ini

Loading...