From cc3f73d38dd5ae5e7eb0ad5dbd5c16da4d6e9621 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Mon, 6 Jul 2020 19:46:09 +0200 Subject: [PATCH] Avoid setting state and uri to null when restoring a session (#3629) --- .../org/mozilla/vrbrowser/browser/engine/Session.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java index d579c5a49..e754ee05e 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java @@ -431,6 +431,11 @@ public void suspend() { } private boolean shouldLoadDefaultPage(@NonNull SessionState aState) { + // data:text URLs can not be restored. + if (mState.mSessionState != null && ((mState.mUri == null) || mState.mUri.startsWith("data:text"))) { + return true; + } + if (aState.mUri != null && aState.mUri.length() != 0 && !aState.mUri.equals(mContext.getString(R.string.about_blank))) { return false; } @@ -468,12 +473,6 @@ private void restore() { openSession(); - // data:text URLs can not be restored. - if (mState.mSessionState != null && ((mState.mUri == null) || mState.mUri.startsWith("data:text"))) { - mState.mSessionState = null; - mState.mUri = null; - } - if (shouldLoadDefaultPage(mState)) { loadDefaultPage(); } else if (mState.mSessionState != null) {