Here is the thing: we started using Sentry to log database errors. Those events also have a stack trace attached. This all works as expected. What we did not expect is that these 'user initiated crashes that do not terminate the application' are seen as regular crash reports. So when we start up, and one of these reports is pending, SentryIntegration.crashedLastLaunch, which calls into KSCrash, returns true because it does not know better. As a result we show the Restore Tabs dialog in cases where this was not needed. This patch works around that by keeping track of a persistent flag in the UserDefaults that we use to find out if we succesfully went through app startup and clean backgrounding. If we crash before we have a chance to update the flag in applicationDidEnterBackground(), we know with more certainty that we have to show the Restore Tabs dialog.
Created attachment 8891439 [details] [review] PR https://github.com/mozilla-mobile/firefox-ios/pull/2988 Lots of comments in the code.
Landed on v8.x, moved to master.