-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(browser): Guard against undefined nextHopProtocol #16806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Protocol Extraction Triggered Incorrectly
The condition if (resourceTiming.nextHopProtocol != undefined)
incorrectly calls extractNetworkProtocol
when nextHopProtocol
is an empty string. This contradicts test expectations that extractNetworkProtocol
should not be called for empty or undefined values. The condition should be if (resourceTiming.nextHopProtocol)
to properly handle these cases.
packages/browser/src/tracing/resource-timing.ts#L18-L19
sentry-javascript/packages/browser/src/tracing/resource-timing.ts
Lines 18 to 19 in 0c449a4
const timingSpanData: Array<Parameters<Span['setAttribute']>> = []; | |
if (resourceTiming.nextHopProtocol != undefined) { |
Was this report helpful? Give feedback by reacting with 👍 or 👎
fixes #16804
Although
PerformanceResourceTiming.nextHopProtocol
is available in all the browsers we support in v9, I think adding an extra guard is reasonable to make it easier for older browser support (it's hard to polyfill some of the performance apis).This PR just adds a condition
if (resourceTiming.nextHopProtocol != undefined)
.Used cursor to generate some tests for the
resourceTimingToSpanAttributes
I extracted out.