Bug 1292191 - Remove unneccesary check for mShouldRestore. r=mkaply
authorZero One <mesmeriz3@gmail.com>
Wed, 07 Sep 2016 16:35:26 -0500
changeset 354433 888c7dec3cae94f06b6690684408e11b3ec3a57a
parent 354432 218a0249ee4fb13af3b620ec83fcf04e02bdf14c
child 354434 6d002007a8f1e7b44a73de082437d85b98a48936
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkaply
bugs1292191
milestone51.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 1292191 - Remove unneccesary check for mShouldRestore. r=mkaply MozReview-Commit-ID: 3amKuifhpfu
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -1719,43 +1719,41 @@ public abstract class GeckoApp
             String sessionString = getProfile().readSessionFile(useBackup);
             if (sessionString == null) {
                 throw new SessionRestoreException("Could not read from session file");
             }
 
             // If we are doing an OOM restore, parse the session data and
             // stub the restored tabs immediately. This allows the UI to be
             // updated before Gecko has restored.
-            if (mShouldRestore) {
-                final JSONArray tabs = new JSONArray();
-                final JSONObject windowObject = new JSONObject();
-                final boolean sessionDataValid;
-
-                LastSessionParser parser = new LastSessionParser(tabs, windowObject, isExternalURL);
-
-                if (mPrivateBrowsingSession == null) {
-                    sessionDataValid = parser.parse(sessionString);
-                } else {
-                    sessionDataValid = parser.parse(sessionString, mPrivateBrowsingSession);
+            final JSONArray tabs = new JSONArray();
+            final JSONObject windowObject = new JSONObject();
+            final boolean sessionDataValid;
+
+            LastSessionParser parser = new LastSessionParser(tabs, windowObject, isExternalURL);
+
+            if (mPrivateBrowsingSession == null) {
+                sessionDataValid = parser.parse(sessionString);
+            } else {
+                sessionDataValid = parser.parse(sessionString, mPrivateBrowsingSession);
+            }
+
+            if (tabs.length() > 0) {
+                windowObject.put("tabs", tabs);
+                sessionString = new JSONObject().put("windows", new JSONArray().put(windowObject)).toString();
+            } else {
+                if (parser.allTabsSkipped() || sessionDataValid) {
+                    // If we intentionally skipped all tabs we've read from the session file, we
+                    // set mShouldRestore back to false at this point already, so the calling code
+                    // can infer that the exception wasn't due to a damaged session store file.
+                    // The same applies if the session file was syntactically valid and
+                    // simply didn't contain any tabs.
+                    mShouldRestore = false;
                 }
-
-                if (tabs.length() > 0) {
-                    windowObject.put("tabs", tabs);
-                    sessionString = new JSONObject().put("windows", new JSONArray().put(windowObject)).toString();
-                } else {
-                    if (parser.allTabsSkipped() || sessionDataValid) {
-                        // If we intentionally skipped all tabs we've read from the session file, we
-                        // set mShouldRestore back to false at this point already, so the calling code
-                        // can infer that the exception wasn't due to a damaged session store file.
-                        // The same applies if the session file was syntactically valid and
-                        // simply didn't contain any tabs.
-                        mShouldRestore = false;
-                    }
-                    throw new SessionRestoreException("No tabs could be read from session file");
-                }
+                throw new SessionRestoreException("No tabs could be read from session file");
             }
 
             JSONObject restoreData = new JSONObject();
             restoreData.put("sessionString", sessionString);
             return restoreData.toString();
         } catch (JSONException e) {
             throw new SessionRestoreException(e);
         }