Closed
Bug 896170
Opened 12 years ago
Closed 12 years ago
Tabs are duplicated after going back to Firefox, when "Don't keep activities" is enabled
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(fennec+)
RESOLVED
FIXED
Firefox 26
Tracking | Status | |
---|---|---|
fennec | + | --- |
People
(Reporter: u421692, Assigned: bnicholson)
References
Details
(Keywords: addon-compat)
Attachments
(3 files)
42.08 KB,
text/plain
|
Details | |
2.97 KB,
patch
|
mfinkle
:
review+
|
Details | Diff | Splinter Review |
27.24 KB,
patch
|
mfinkle
:
review+
|
Details | Diff | Splinter Review |
Environment:
Build: Firefox for Android 25.0a1 (2013-07-19)
Device: Samsung Galaxy Vibrant(AOKP Android 4.2.2) / LG Nexus 4 (Android 4.2.2)
Preconditions:
Enable "Don't keep activities" from Developer options
Steps to reproduce:
1. Open some webpages in different tabs.
2. Open ADD-ONS page and install an add-on that needs to restart the app.(e.g. SanRockstar).
3. When prompted restart the app.
4. Put Firefox to background then back to foreground.
Expected result:
The tabs are correctly restored.
Actual result:
Every time you perform the action from step 4, tabs are being duplicated.
Updated•12 years ago
|
tracking-fennec: --- → ?
Comment 1•12 years ago
|
||
Kevin, why should this track?
Updated•12 years ago
|
Assignee: nobody → bnicholson
Updated•12 years ago
|
tracking-fennec: ? → +
Assignee | ||
Comment 2•12 years ago
|
||
This fix may overlap with bug 899141 (see https://bugzilla.mozilla.org/show_bug.cgi?id=899141#c3).
Assignee | ||
Updated•12 years ago
|
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
Fixing bug 899141 did not fix this issue. Reopening bug.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Assignee | ||
Comment 5•12 years ago
|
||
Session:Restore is sent every time we initialize, but we only want to send that message the first time the browser starts.
Attachment #796328 -
Flags: review?(mark.finkle)
Assignee | ||
Comment 6•12 years ago
|
||
The first patch is enough to fix this bug, but looking through some of this old code, I think we can simplify things quite a bit. For all restart cases I can think of (crashes, guest mode, add-ons), we always want to do a restore. So rather than saving Java prefs to remember whether we want to restore, we can just attach an extra to the intent that indicates we just restarted.
This removes old code that prevents crash loops, but that code hasn't been working anyway as described by the comments. I'm not sure whether we even need this crash loop prevention code anymore: we only load one tab when we restore (since all others are in the background) and, thanks to tab stubs, the user can simply close any offending tab at startup before a crash if it repeats.
This patch also improves the UX for add-on restarts. We're currenly handling restart restores in Gecko (by checking resume_session_once), so about:home is shown for several seconds before tabs are actually restored. Add-ons restarts will be handled here as part of the always-restore-on-restart intents, so they'll now be able to take advantage of tab stubs.
I tested this change with the crash reporter, add-on restarts, guest mode, and session restore prefs.
Attachment #796350 -
Flags: review?(mark.finkle)
Assignee | ||
Comment 7•12 years ago
|
||
Assignee | ||
Comment 8•12 years ago
|
||
Comment on attachment 796350 [details] [diff] [review]
Part 2: Use intent extra to trigger restore on restart
Review of attachment 796350 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/base/BrowserApp.java
@@ +396,3 @@
> }
>
> + GeckoProfile.maybeCleanupGuestProfile(this);
This should be in an else statement; I changed this locally.
Updated•12 years ago
|
Attachment #796328 -
Flags: review?(mark.finkle) → review+
Comment 9•12 years ago
|
||
Comment on attachment 796350 [details] [diff] [review]
Part 2: Use intent extra to trigger restore on restart
>diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java
>+ protected boolean getSessionRestoreState(Bundle savedInstanceState) {
>+ } else if (savedInstanceState != null
>+ || PreferenceManager.getDefaultSharedPreferences(this)
>+ .getString(GeckoPreferences.PREFS_RESTORE_SESSION, "quit")
>+ .equals("always")
>+ || getIntent().getBooleanExtra("didRestart", false)) {
Good lord, my eyes are bleeding! I'm trying to think of how to make this more readable.
Would you mind something like this:
} else {
boolean didQuit = PreferenceManager.getDefaultSharedPreferences(this)
.getString(GeckoPreferences.PREFS_RESTORE_SESSION, "quit")
.equals("always");
boolean didRestart = getIntent().getBooleanExtra("didRestart", false);
if (savedInstanceState != null || didQuit || didRestart) {
>diff --git a/mobile/android/components/SessionStore.js b/mobile/android/components/SessionStore.js
> case "quit-application":
>- // If we are restarting, lets restore the tabs
>- if (aData == "restart") {
>- Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true);
>-
>- // Ignore purges when restarting. The notification is fired after "quit-application".
>- Services.obs.removeObserver(this, "browser:purge-session-history");
>- }
>-
How are Gecko side restarts handled? Like this one:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#5587
Based on the Try results and the testing you've done, we can try this.
Attachment #796350 -
Flags: review?(mark.finkle) → review+
Comment 10•12 years ago
|
||
Comment on attachment 796350 [details] [diff] [review]
Part 2: Use intent extra to trigger restore on restart
>diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java
>+ protected boolean getSessionRestoreState(Bundle savedInstanceState) {
>+ } else if (savedInstanceState != null
>+ || PreferenceManager.getDefaultSharedPreferences(this)
>+ .getString(GeckoPreferences.PREFS_RESTORE_SESSION, "quit")
>+ .equals("always")
>+ || getIntent().getBooleanExtra("didRestart", false)) {
Actually, how about refactoring this into two new methods:
getSessionRestorePreference()
getRestartFromIntent()
then
} else if (savedInstanceState != null || getSessionRestorePreference().equals("always") || getRestartFromIntent()) {
Assignee | ||
Comment 11•12 years ago
|
||
(In reply to Mark Finkle (:mfinkle) from comment #10)
> Comment on attachment 796350 [details] [diff] [review]
> Part 2: Use intent extra to trigger restore on restart
>
> >diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java
>
> >+ protected boolean getSessionRestoreState(Bundle savedInstanceState) {
>
> >+ } else if (savedInstanceState != null
> >+ || PreferenceManager.getDefaultSharedPreferences(this)
> >+ .getString(GeckoPreferences.PREFS_RESTORE_SESSION, "quit")
> >+ .equals("always")
> >+ || getIntent().getBooleanExtra("didRestart", false)) {
>
> Actually, how about refactoring this into two new methods:
>
> getSessionRestorePreference()
> getRestartFromIntent()
>
> then
>
> } else if (savedInstanceState != null ||
> getSessionRestorePreference().equals("always") || getRestartFromIntent()) {
Yeah, I like that better than your first suggestion since we still get short-circuit evaluation that way.
> >diff --git a/mobile/android/components/SessionStore.js b/mobile/android/components/SessionStore.js
>
> > case "quit-application":
> >- // If we are restarting, lets restore the tabs
> >- if (aData == "restart") {
> >- Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true);
> >-
> >- // Ignore purges when restarting. The notification is fired after "quit-application".
> >- Services.obs.removeObserver(this, "browser:purge-session-history");
> >- }
> >-
>
> How are Gecko side restarts handled? Like this one:
> http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/
> browser.js#5587
I didn't trace the whole thing, but we eventually call onXreExit which calls doRestart here: http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/GeckoAppShell.java#652
Assignee | ||
Comment 12•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/cacfd928e6dc
https://hg.mozilla.org/mozilla-central/rev/7d0fc78efe59
Status: REOPENED → RESOLVED
Closed: 12 years ago → 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 26
Updated•11 years ago
|
Keywords: addon-compat
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•