2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

Bug 1851678 - Catch AutofillApiException exception when fetching autofill data and setting startup metrics

This commit is contained in:
Gabriel Luong 2023-09-06 22:04:51 -04:00 committed by mergify[bot]
parent 200dab4054
commit 3db5fbce22

View File

@ -28,6 +28,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async import kotlinx.coroutines.async
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import mozilla.appservices.Megazord import mozilla.appservices.Megazord
import mozilla.appservices.autofill.AutofillApiException
import mozilla.components.browser.state.action.SystemAction import mozilla.components.browser.state.action.SystemAction
import mozilla.components.browser.state.selector.selectedTab import mozilla.components.browser.state.selector.selectedTab
import mozilla.components.browser.state.state.searchEngines import mozilla.components.browser.state.state.searchEngines
@ -837,9 +838,13 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
@OptIn(DelicateCoroutinesApi::class) @OptIn(DelicateCoroutinesApi::class)
GlobalScope.launch(IO) { GlobalScope.launch(IO) {
val autoFillStorage = applicationContext.components.core.autofillStorage try {
Addresses.savedAll.set(autoFillStorage.getAllAddresses().size.toLong()) val autoFillStorage = applicationContext.components.core.autofillStorage
CreditCards.savedAll.set(autoFillStorage.getAllCreditCards().size.toLong()) Addresses.savedAll.set(autoFillStorage.getAllAddresses().size.toLong())
CreditCards.savedAll.set(autoFillStorage.getAllCreditCards().size.toLong())
} catch (e: AutofillApiException) {
logger.error("Failed to fetch autofill data", e)
}
try { try {
val passwordsStorage = applicationContext.components.core.passwordsStorage val passwordsStorage = applicationContext.components.core.passwordsStorage