Since a SessionRestoreException also happens if we deliberately skipped all tabs (because they didn't contain anything interesting apart from about:home) or the session file was valid but didn't contain any tabs (because the user cleared history), we need to ensure that we don't switch to the backup copy in that case.
To that extent, we extend the SessionParser's parse function to return whether any JSON exceptions occured while parsing the session file, which would signify a corrupt session file.
MozReview-Commit-ID: Kdh5d69irqF
If the browser is set to always restore the session (default) then we will never
start with an empty session. Even if the user closes all tabs we will re-create
a new tab pointing to about:home. So we will always at least restore this tab on
the next startup. As a consequence we will never open the 'homepage' on app start
because we will never have a non-empty session.
With this patch we won't restore tabs that point to about:home and do not contain
any other history. As a result we might restore an empty session and load the
homepage or about:home (depending on configuration) in a new tab.
In case we decide to not restore the currently selected tab, we just select the
first restored tab if there's any.
MozReview-Commit-ID: DuN03M60Gi8