diff options
author | John Z Wu <jzw@chromium.org> | 2019-05-13 12:49:43 -0700 |
---|---|---|
committer | Mark Mentovai <mark@chromium.org> | 2019-05-15 03:47:37 +0000 |
commit | d930308bbbfa089a63df67c4f78065604494d39d (patch) | |
tree | 782bb4efb7c9b8b9c511b514f645e63b4b3ac965 | |
parent | Increase timeout of HTTPMultipartUpload from 10s to 60s. (diff) | |
download | breakpad-d930308bbbfa089a63df67c4f78065604494d39d.tar.xz |
Fix orphaned crash reports.
The path NSCachesDirectory may change across app updates and sometimes
even across app launches. As a result, the Config-XXX files may end up
with an outdated path to the associated minidump file.
Change-Id: I0befde26b2ac406c154ce7c7e9be0063ee99892d
Bug:850379
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1592561
Reviewed-by: Mark Mentovai <mark@chromium.org>
-rw-r--r-- | src/client/ios/Breakpad.mm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/client/ios/Breakpad.mm b/src/client/ios/Breakpad.mm index 2d8ba61e..2b61bbe3 100644 --- a/src/client/ios/Breakpad.mm +++ b/src/client/ios/Breakpad.mm @@ -161,6 +161,7 @@ class Breakpad { NSArray *CrashReportsToUpload(); NSString *NextCrashReportToUpload(); NSDictionary *NextCrashReportConfiguration(); + NSDictionary *FixedUpCrashReportConfiguration(NSDictionary *configuration); NSDate *DateOfMostRecentCrashReport(); void UploadNextReport(NSDictionary *server_parameters); void UploadReportWithConfiguration(NSDictionary *configuration, @@ -466,7 +467,18 @@ NSString *Breakpad::NextCrashReportToUpload() { //============================================================================= NSDictionary *Breakpad::NextCrashReportConfiguration() { - return [Uploader readConfigurationDataFromFile:NextCrashReportToUpload()]; + NSDictionary *configuration = [Uploader readConfigurationDataFromFile:NextCrashReportToUpload()]; + return FixedUpCrashReportConfiguration(configuration); +} + +//============================================================================= +NSDictionary *Breakpad::FixedUpCrashReportConfiguration(NSDictionary *configuration) { + NSMutableDictionary *fixedConfiguration = [[configuration mutableCopy] autorelease]; + // kReporterMinidumpDirectoryKey can become stale because the app's data container path includes + // an UUID that is not guaranteed to stay the same over time. + [fixedConfiguration setObject:KeyValue(@BREAKPAD_DUMP_DIRECTORY) + forKey:@kReporterMinidumpDirectoryKey]; + return fixedConfiguration; } //============================================================================= |