Bug 1476106 - Part 2 - Fix setting of mRuntime when restoring GeckoView from savedInstanceState. r=snorp
authorJan Henning <jh+bugzilla@buttercookie.de>
Sat, 04 Aug 2018 15:21:40 +0200
changeset 431658 70bfe613b3253974eb3a2d2562739a6fd6d4ed22
parent 431657 1484cdde97b801100ce3b06eb19d510b4f7408ff
child 431659 e936ef6b4b50fc09d0ffb988cb563f4a79d7b34c
push id67811
push usermozilla@buttercookie.de
push dateWed, 15 Aug 2018 18:33:04 +0000
treeherderautoland@73efbce701a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1476106
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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) {