diff --git a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java index 33edca8854be..c043b3fe4dbf 100644 --- a/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java +++ b/mobile/android/base/java/org/mozilla/gecko/customtabs/CustomTabsActivity.java @@ -179,6 +179,7 @@ public class CustomTabsActivity extends AppCompatActivity @Override public void onDestroy() { + mGeckoSession.closeWindow(); mTextSelection.destroy(); mFormAssistPopup.destroy(); mDoorHangerPopup.destroy(); diff --git a/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java b/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java index f1a1423e88b5..0e9b30690538 100644 --- a/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java +++ b/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java @@ -217,6 +217,7 @@ public class WebAppActivity extends AppCompatActivity @Override public void onDestroy() { + mGeckoSession.closeWindow(); mTextSelection.destroy(); mDoorHangerPopup.destroy(); mPromptService.destroy(); diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSession.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSession.java index e2ab14f98669..3bc4fb43d190 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSession.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSession.java @@ -565,7 +565,8 @@ public class GeckoSession extends LayerSession ThreadUtils.assertOnUiThread(); if (!isOpen()) { - throw new IllegalStateException("Session is not open"); + Log.w(LOGTAG, "Attempted to close a GeckoSession that was already closed."); + return; } if (GeckoThread.isStateAtLeast(GeckoThread.State.PROFILE_READY)) {