Revert "fix(crashlytics): move settings check and fetch off main thread at startup" (#16980)

This commit is contained in:
Nick Cooke authored and GitHub committed 2026-10-30 14:33:07 -04:00
1 parent d9728c6cae
commit 5777b16a30
6 files changed
+2 -38

No files matched your search

-2
View File
@@ -8,8 +8,6 @@
when caching settings. (#16728)
- [fixed] Fixed the app executable's minimum OS and SDK versions being recorded as `0.0.0` in
report metadata for apps targeting iOS 12, macOS 10.14, tvOS 12, watchOS 5, or later. (#16810)
- [fixed] Moved Crashlytics settings check and fetch off the main thread during
startup when automatic data collection is enabled. (#16736)
# 13.0.0
- [fixed] Safely validate memory reads when executing `DW_OP_deref_size`
@@ -283,10 +283,10 @@ typedef NSNumber FIRCLSWrappedReportAction;
FIRCLSDebugLog(@"Unsent reports will be uploaded at startup");
FIRCLSDataCollectionToken *dataCollectionToken = [FIRCLSDataCollectionToken validToken];
[self beginSettingsWithToken:dataCollectionToken];
promise = [reportProfilingPromise onQueue:_dispatchQueue
then:^id _Nullable(id _Nullable value) {
[self beginSettingsWithToken:dataCollectionToken];
[self beginReportUploadsWithToken:dataCollectionToken
blockingSend:launchFailure];
@@ -16,7 +16,6 @@
#import "Crashlytics/Crashlytics/Controllers/FIRCLSReportUploader.h"
#import "Crashlytics/Crashlytics/Models/FIRCLSLaunchMarkerModel.h"
@class FIRCLSDataCollectionToken;
@class FIRCLSInstallIdentifierModel;
@interface FIRCLSReportManager ()
@@ -30,6 +29,4 @@
@property(nonatomic, strong) FIRCLSLaunchMarkerModel *launchMarker;
- (void)beginSettingsWithToken:(FIRCLSDataCollectionToken *)token;
@end
@@ -320,9 +320,6 @@
XCTAssertEqual([self.prepareAndSubmitReportArray count], 0);
XCTAssertEqual([self.uploadReportArray count], 0);
// Fetching settings is data collection, so it must wait for consent.
XCTAssertEqual(self.reportManager.beginSettingsCallCount, 0);
}
- (void)testExistingReportOnStart {
@@ -376,10 +373,6 @@
XCTAssertEqual([self.prepareAndSubmitReportArray count], 1);
XCTAssertEqualObjects(self.prepareAndSubmitReportArray[0][@"process"], @(YES));
XCTAssertEqualObjects(self.prepareAndSubmitReportArray[0][@"urgent"], @(NO));
// Enabling data collection should fetch settings once, off the main thread.
XCTAssertEqual(self.reportManager.beginSettingsCallCount, 1);
XCTAssertFalse(self.reportManager.beginSettingsCalledOnMainThread);
}
- (void)testExistingReportOnStartWithDataCollectionDisabledAndSend {
@@ -409,10 +402,6 @@
XCTAssertEqualObjects(self.prepareAndSubmitReportArray[0][@"process"], @(YES));
XCTAssertEqualObjects(self.prepareAndSubmitReportArray[0][@"urgent"], @(NO));
// Sending unsent reports should fetch settings once, off the main thread.
XCTAssertEqual(self.reportManager.beginSettingsCallCount, 1);
XCTAssertFalse(self.reportManager.beginSettingsCalledOnMainThread);
// Calling processReports again should not call the callback.
// Technically, the behavior is unspecified.
[self processReports:YES andExpectReports:NO];
@@ -442,9 +431,6 @@
// Should not call report manager for that report.
XCTAssertEqual([self.prepareAndSubmitReportArray count], 0);
// Deleting unsent reports should not fetch settings.
XCTAssertEqual(self.reportManager.beginSettingsCallCount, 0);
}
- (void)testExistingUrgentReportOnStart {
@@ -644,11 +630,4 @@
XCTAssertEqualObjects(json, nil);
}
- (void)testBeginSettingsRunsOffMainThreadWhenDataCollectionEnabled {
XCTAssertTrue([NSThread isMainThread]);
[self startReportManager];
XCTAssertEqual(self.reportManager.beginSettingsCallCount, 1);
XCTAssertFalse(self.reportManager.beginSettingsCalledOnMainThread);
}
@end
@@ -19,9 +19,6 @@ NS_ASSUME_NONNULL_BEGIN
@interface FIRCLSMockReportManager : FIRCLSReportManager
@property(nonatomic, assign) NSUInteger beginSettingsCallCount;
@property(nonatomic, assign) BOOL beginSettingsCalledOnMainThread;
@end
NS_ASSUME_NONNULL_END
@@ -43,11 +43,4 @@
// This stuff does operations on the main thread, which we don't want during tests.
}
- (void)beginSettingsWithToken:(FIRCLSDataCollectionToken *)token {
// Intentionally doesn't call super: the real method starts a settings download over the
// network, and its process-wide dispatch_once would leak state between tests.
self.beginSettingsCallCount += 1;
self.beginSettingsCalledOnMainThread = [NSThread isMainThread];
}
@end