File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed
RNSentryCocoaTester/RNSentryCocoaTesterTests Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 4343- crashedLastRun now returns the correct value ([ #4829 ] ( https://github.com/getsentry/sentry-react-native/pull/4829 ) )
4444- Use engine-specific promise rejection tracking ([ #4826 ] ( https://github.com/getsentry/sentry-react-native/pull/4826 ) )
4545- Fixes Feedback Widget accessibility issue on iOS ([ #4739 ] ( https://github.com/getsentry/sentry-react-native/pull/4739 ) )
46+ - Measuring TTID or TTFD could cause a crash when ` parentSpanId ` was removed ([ #4881 ] ( https://github.com/getsentry/sentry-react-native/pull/4881 ) )
4647
4748### Dependencies
4849
Original file line number Diff line number Diff line change @@ -119,4 +119,30 @@ final class RNSentryOnDrawReporterTests: XCTestCase {
119119
120120 XCTAssertNil ( RNSentryTimeToDisplay . pop ( for: ttidPrefix + spanId) )
121121 }
122+
123+ func testFullDisplayEmitNewFrameCallbackHandlesMissingParentSpanId( ) {
124+ let reporter = RNSentryOnDrawReporterView . createWithMockedListener ( )
125+
126+ // We call the callback manually in this test to simulate a change between
127+ // start of listening for next frame and the next frame render
128+ let emitNewFrameCallback = reporter!. createEmitNewFrameEvent ( )
129+
130+ reporter!. fullDisplay = true
131+ reporter!. parentSpanId = nil
132+
133+ emitNewFrameCallback!( 1 )
134+ }
135+
136+ func testInitialDisplayEmitNewFrameCallbackHandlesMissingParentSpanId( ) {
137+ let reporter = RNSentryOnDrawReporterView . createWithMockedListener ( )
138+
139+ // We call the callback manually in this test to simulate a change between
140+ // start of listening for next frame and the next frame render
141+ let emitNewFrameCallback = reporter!. createEmitNewFrameEvent ( )
142+
143+ reporter!. initialDisplay = true
144+ reporter!. parentSpanId = nil
145+
146+ emitNewFrameCallback!( 1 )
147+ }
122148}
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ - (RNSentryEmitNewFrameEvent)createEmitNewFrameEvent
4242 return ^(NSNumber *newFrameTimestampInSeconds) {
4343 self->isListening = NO ;
4444
45+ if (![_parentSpanId isKindOfClass: [NSString class ]]) {
46+ return ;
47+ }
48+
4549 if (self->_fullDisplay ) {
4650 [RNSentryTimeToDisplay
4751 putTimeToDisplayFor: [@" ttfd-" stringByAppendingString: self ->_parentSpanId]
You can’t perform that action at this time.
0 commit comments