← Back to Pull requests

Throw the User Timing spec's errors from mark() and measure() #8849

Closed
unknown closed this pull request without merging on Nov 26, 2026 12:53 UTC
View on GitHub
unknown unknown commented on Nov 24, 2026 03:56 UTC
Author

performance.mark(), the PerformanceMark constructor and performance.measure() accept arguments the User Timing spec rejects. A negative startTime, start or end is kept as is. measure() takes an options object together with an end mark, options with neither start nor end, and options with all of start, end and duration. A mark name that doesn't exist quietly measures from 0 or to the current time, and navigationStart and the other PerformanceTiming names are looked up as ordinary marks. Browsers and Node.js throw a TypeError or a SyntaxError for each of these.

In this patch the constructor rejects a negative startTime, and mark() now builds its entry through the constructor, so both get that check. measure() follows the spec steps: the option combinations above and a negative start, end or duration throw a TypeError, a PerformanceTiming attribute name throws a TypeError even when a mark with that name exists (a Worker isn't a Window), and any other name with no mark throws a SyntaxError DOMException. Options with end and duration but no start now start the measure at end - duration instead of 0. {}, null and undefined as the second argument still mean no options.

There is no compat flag. These calls work today and will start throwing, but Workers use User Timing mostly for code that also runs in browsers and Node.js, which already throw these errors, so code is more likely to expect them than to rely on the quiet fallback.

perf-hooks-nodejs-test gets a case for each error. They call performance.mark bound, because the WPT mark-errors test calls it unbound and so passes from the "Illegal invocation" TypeError alone. The expected failures in mark-errors, measure-with-dict, measure_syntax_err and performance-measure-invalid.worker are removed. The new tests and those WPT cases fail without the fix.

Diff: 235 lines (+176 / -59) across 2 files Reviewer: littledivy Review duration: 3416m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 235 lines diff across 2 files
0.37
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.327
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #8849"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 37.1% (MEDIUM) · Higher = larger blast radius
37.1%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 16.1% · Safe to merge
16.1%