2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] FennecWebAppIntentProcessor: Catch JSONException.

This commit is contained in:
Sebastian Kaspari 2020-10-20 13:46:23 +02:00
parent 274ab54236
commit 09efe75e27

View File

@ -24,8 +24,10 @@ import mozilla.components.feature.pwa.ManifestStorage
import mozilla.components.feature.pwa.ext.putWebAppManifest import mozilla.components.feature.pwa.ext.putWebAppManifest
import mozilla.components.feature.pwa.ext.toCustomTabConfig import mozilla.components.feature.pwa.ext.toCustomTabConfig
import mozilla.components.feature.session.SessionUseCases import mozilla.components.feature.session.SessionUseCases
import mozilla.components.support.base.log.logger.Logger
import mozilla.components.support.utils.SafeIntent import mozilla.components.support.utils.SafeIntent
import mozilla.components.support.utils.toSafeIntent import mozilla.components.support.utils.toSafeIntent
import org.json.JSONException
import org.json.JSONObject import org.json.JSONObject
import org.mozilla.fenix.R import org.mozilla.fenix.R
import java.io.File import java.io.File
@ -40,6 +42,7 @@ class FennecWebAppIntentProcessor(
private val loadUrlUseCase: SessionUseCases.DefaultLoadUrlUseCase, private val loadUrlUseCase: SessionUseCases.DefaultLoadUrlUseCase,
private val storage: ManifestStorage private val storage: ManifestStorage
) : IntentProcessor { ) : IntentProcessor {
val logger = Logger("FennecWebAppIntentProcessor")
/** /**
* Returns true if this intent should launch a progressive web app created in Fennec. * Returns true if this intent should launch a progressive web app created in Fennec.
@ -113,6 +116,10 @@ class FennecWebAppIntentProcessor(
WebAppManifestParser().parse(manifestField).getOrNull() WebAppManifestParser().parse(manifestField).getOrNull()
} catch (e: IOException) { } catch (e: IOException) {
logger.error("Failed to parse web app manifest due to IOException", e)
null
} catch (e: JSONException) {
logger.error("Failed to parse web app manifest due to JSONException", e)
null null
} }
} }