From 50c466c86b94f21a024aac24e56461e4e3a3fab5 Mon Sep 17 00:00:00 2001 From: Colin Lee Date: Thu, 30 May 2019 17:43:32 -0500 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/2893, https://github.com/mozilla-mobile/fenix/issues/2673, https://github.com/mozilla-mobile/fenix/issues/2916, https://github.com/mozilla-mobile/fenix/issues/2314: Fix race condition navigating to browser (https://github.com/mozilla-mobile/fenix/pull/3023) Since the Navigation library restores the fragment after memory eviction, if we're already on the BrowserFragment and we deep link navigate to the BrowserFragment, we briefly get two of them. This crashes GeckoView. --- CHANGELOG.md | 1 + app/src/main/java/org/mozilla/fenix/HomeActivity.kt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cba29df35..e6011974a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,4 +64,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - #654 - Updated Refresh button to turn into Stop button while menu is open. - [AC #2725](https://github.com/mozilla-mobile/android-components/issues/2725) Updated tracking protectionPolicy to [recommend](https://github.com/mozilla-mobile/android-components/blob/master/components/concept/engine/src/main/java/mozilla/components/concept/engine/EngineSession.kt#L156) - #2789 Custom tabs is not covering the full screen size. +- #2893, #2673, #2916, #2314: Fix several crashes navigating from external links ### Removed diff --git a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt index 03ed0358a3..8944a81839 100644 --- a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt @@ -156,7 +156,8 @@ open class HomeActivity : AppCompatActivity() { } private fun handleOpenedFromExternalSourceIfNecessary(intent: Intent?) { - if (intent?.extras?.getBoolean(OPEN_TO_BROWSER) != true) { return } + if (navHost.navController.currentDestination?.id == R.id.browserFragment) return + if (intent?.extras?.getBoolean(OPEN_TO_BROWSER) != true) return this.intent.putExtra(OPEN_TO_BROWSER, false) var customTabSessionId: String? = null