Loading components/browser/engine-gecko-nightly/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineView.kt +24 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ import mozilla.components.concept.engine.EngineSession import mozilla.components.concept.engine.EngineView import mozilla.components.concept.engine.permission.PermissionRequest import org.mozilla.geckoview.GeckoResult import java.lang.IllegalStateException /** * Gecko-based EngineView implementation. Loading @@ -25,6 +26,19 @@ class GeckoEngineView @JvmOverloads constructor( ) : FrameLayout(context, attrs, defStyleAttr), EngineView { @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) internal var currentGeckoView = object : NestedGeckoView(context) { override fun onAttachedToWindow() { try { super.onAttachedToWindow() } catch (e: IllegalStateException) { // This is to debug "display already acquired" crashes val otherActivityClassName = this.session?.accessibility?.view?.context?.javaClass?.simpleName val activityClassName = context.javaClass.simpleName val msg = "ATTACH VIEW: Current activity: $activityClassName Other activity: $otherActivityClassName" throw IllegalStateException(msg, e) } } override fun onDetachedFromWindow() { // We are releasing the session before GeckoView gets detached from the window. Otherwise // GeckoView will close the session automatically and we do not want that. Loading Loading @@ -82,7 +96,16 @@ class GeckoEngineView @JvmOverloads constructor( currentGeckoView.releaseSession() } try { currentGeckoView.setSession(internalSession.geckoSession) } catch (e: IllegalStateException) { // This is to debug "display already acquired" crashes val otherActivityClassName = internalSession.geckoSession.accessibility.view?.context?.javaClass?.simpleName val activityClassName = context.javaClass.simpleName val msg = "SET SESSION: Current activity: $activityClassName Other activity: $otherActivityClassName" throw IllegalStateException(msg, e) } } } Loading Loading
components/browser/engine-gecko-nightly/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngineView.kt +24 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ import mozilla.components.concept.engine.EngineSession import mozilla.components.concept.engine.EngineView import mozilla.components.concept.engine.permission.PermissionRequest import org.mozilla.geckoview.GeckoResult import java.lang.IllegalStateException /** * Gecko-based EngineView implementation. Loading @@ -25,6 +26,19 @@ class GeckoEngineView @JvmOverloads constructor( ) : FrameLayout(context, attrs, defStyleAttr), EngineView { @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) internal var currentGeckoView = object : NestedGeckoView(context) { override fun onAttachedToWindow() { try { super.onAttachedToWindow() } catch (e: IllegalStateException) { // This is to debug "display already acquired" crashes val otherActivityClassName = this.session?.accessibility?.view?.context?.javaClass?.simpleName val activityClassName = context.javaClass.simpleName val msg = "ATTACH VIEW: Current activity: $activityClassName Other activity: $otherActivityClassName" throw IllegalStateException(msg, e) } } override fun onDetachedFromWindow() { // We are releasing the session before GeckoView gets detached from the window. Otherwise // GeckoView will close the session automatically and we do not want that. Loading Loading @@ -82,7 +96,16 @@ class GeckoEngineView @JvmOverloads constructor( currentGeckoView.releaseSession() } try { currentGeckoView.setSession(internalSession.geckoSession) } catch (e: IllegalStateException) { // This is to debug "display already acquired" crashes val otherActivityClassName = internalSession.geckoSession.accessibility.view?.context?.javaClass?.simpleName val activityClassName = context.javaClass.simpleName val msg = "SET SESSION: Current activity: $activityClassName Other activity: $otherActivityClassName" throw IllegalStateException(msg, e) } } } Loading