Skip to content

perf_hooks: add missing resource timing attributes - #65017

Open
greenheadHQ wants to merge 5 commits into
nodejs:mainfrom
greenheadHQ:resource-timing-missing-getters
Open

perf_hooks: add missing resource timing attributes#65017
greenheadHQ wants to merge 5 commits into
nodejs:mainfrom
greenheadHQ:resource-timing-missing-getters

Conversation

@greenheadHQ

@greenheadHQ greenheadHQ commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Add the PerformanceResourceTiming attributes from the Resource Timing specification that are still missing in Node.js: finalResponseHeadersStart, firstInterimResponseStart, renderBlockingStatus, contentType, and contentEncoding.

The new getters follow the existing PerformanceResourceTiming pattern and are included in toJSON(). The WPT status file is updated to enable the ten idlharness subtests that now pass.

Update responseStart to return firstInterimResponseStart when it is non-zero and fall back to finalResponseHeadersStart otherwise, matching the Resource Timing specification.

Tests cover the new getters, default and supplied metadata, the interim = 0, final > 0 fallback, and an entry created by the built-in fetch() implementation.

Refs: #51589

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/web-standards

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Aug 4, 2026
@greenheadHQ
greenheadHQ force-pushed the resource-timing-missing-getters branch from 74a9a8a to 2ebef57 Compare August 4, 2026 14:28
Add the finalResponseHeadersStart, firstInterimResponseStart,
renderBlockingStatus, contentType and contentEncoding getters to
PerformanceResourceTiming and update the WPT status accordingly.

Signed-off-by: greenhead <shren0812@gmail.com>
@greenheadHQ
greenheadHQ force-pushed the resource-timing-missing-getters branch from 2ebef57 to 94dca40 Compare August 4, 2026 14:47
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.07%. Comparing base (31cde9f) to head (e0e7844).
⚠️ Report is 470 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65017      +/-   ##
==========================================
- Coverage   90.30%   90.07%   -0.23%     
==========================================
  Files         759      754       -5     
  Lines      247621   256399    +8778     
  Branches    46672    48495    +1823     
==========================================
+ Hits       223603   230948    +7345     
- Misses      15473    16582    +1109     
- Partials     8545     8869     +324     
Files with missing lines Coverage Δ
lib/internal/perf/resource_timing.js 99.67% <100.00%> (+0.04%) ⬆️

... and 271 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@greenheadHQ

Copy link
Copy Markdown
Contributor Author

Hello @legendecas @jasnell 🖐️

Thank you for all the work that goes into reviewing contributions here! Just a gentle ping in case this PR slipped through the cracks. I would appreciate any feedback whenever you have time, no rush at all. Thanks!

The spec defines responseStart as firstInterimResponseStart when that
is not 0, and finalResponseHeadersStart otherwise.

Signed-off-by: greenhead <greenheadhq@gmail.com>
Document the five getters PerformanceResourceTiming gained:
finalResponseHeadersStart, firstInterimResponseStart,
renderBlockingStatus, contentType and contentEncoding, add the missing
responseStart entry, and record its new interim-aware behavior.

Signed-off-by: greenhead <greenheadhq@gmail.com>
Comment thread doc/api/perf_hooks.md Outdated
The high resolution millisecond timestamp representing the time immediately
after Node.js receives the first byte of the first interim response, such as
a `103 Early Hints` response. Node.js does not currently record interim
responses, so the property always returns 0.

@daeyeon daeyeon Aug 31, 2026

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.

The added test shows that this property can return a non-zero value even though interim responses are not currently recorded.

assert.strictEqual(resource.firstInterimResponseStart, 45);

This mixes the API's capabilities with current Node.js behavior. The other added properties appear to have the same issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I missed that distinction. I updated the affected docs to separate the API behavior from the values currently produced by built-in fetch().

Signed-off-by: greenhead <greenheadhq@gmail.com>
Signed-off-by: greenhead <greenheadhq@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants