Bug 1476106 - Part 2 - Fix setting of mRuntime when restoring GeckoView from savedInstanceState. r?snorp draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 04 Aug 2018 15:21:40 +0200
changeset 828049 99af621bca81b8798f03ef575eaf7c198523b6be
parent 828048 258b4c5028b965b1e82a5b175b320b133fcd2cea
child 828050 21c676dc4a806eff7ad737413b7d09a0e74b5999
child 828641 77fb5e22ad1d4abf8f1c2d46fa02326046c09bc0
push id118622
push usermozilla@buttercookie.de
push dateThu, 09 Aug 2018 19:41:12 +0000
reviewerssnorp
bugs1476106
milestone63.0a1
Bug 1476106 - Part 2 - Fix setting of mRuntime when restoring GeckoView from savedInstanceState. r?snorp The call to mSession.transferFrom(ss.session) in the line above also transfers the window from ss.session into mSession, which means we subsequently won't be able to retrieve a runtime from ss.session any more, thereby defeating the goal of calling mRuntime = ss.session.getRuntime(). This case is encountered e.g. when the containing activity is destroyed and sub- sequently recreated after a configuration change that isn't handled by the app, e.g. screen rotation in the GeckoView example app. MozReview-Commit-ID: 5YGskdLZWqw
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
@@ -387,17 +387,17 @@ public class GeckoView extends FrameLayo
 
         final SavedState ss = (SavedState) state;
         super.onRestoreInstanceState(ss.getSuperState());
 
         if (mSession == null && ss.session != null) {
             setSession(ss.session, ss.session.getRuntime());
         } else if (ss.session != null) {
             mSession.transferFrom(ss.session);
-            mRuntime = ss.session.getRuntime();
+            mRuntime = mSession.getRuntime();
         }
     }
 
     @Override
     public void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
         super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
 
         if (!gainFocus || mIsResettingFocus) {