Android back button should close the selected tab and return to the previous tab when possible

VERIFIED FIXED

Status

()

Firefox for Android
General
P2
normal
VERIFIED FIXED
6 years ago
5 years ago

People

(Reporter: lmandel, Assigned: mbrubeck)

Tracking

unspecified
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(firefox11 fixed, firefox13 verified, fennec11+)

Details

Attachments

(1 attachment, 2 obsolete attachments)

In the Android native UI, when I select menu->More->Add-ons, about:addons opens in a new tab in my browser. I then click the back button (physical button on my phone) to return to the page that I was viewing (this is the typical flow from preferences in other Android apps) and the browser exits leaving me back at my home screen.

To reproduce:
1. Open any Web page, such as mozilla.org.
2. Select menu button->More->Add-ons.
3. Click the back button.

Expected:
I am returned to the mozilla.org tab.

Actual:
Firefox exits.
(Assignee)

Updated

6 years ago
Assignee: nobody → mbrubeck
Summary: Clicking back button from add-ons pref page exists browser → Clicking back button from add-ons pref page exits browser

Updated

6 years ago
Priority: -- → P2
(Assignee)

Updated

6 years ago
Duplicate of this bug: 709372
(Assignee)

Updated

6 years ago
Summary: Clicking back button from add-ons pref page exits browser → Android back button should close the selected tab and return to the previous tab when possible
(Assignee)

Comment 2

6 years ago
Created attachment 581433 [details] [diff] [review]
WIP

This is pretty much complete except I haven't really tested it yet.
(Assignee)

Comment 3

6 years ago
Created attachment 581479 [details] [diff] [review]
WIP 2
Attachment #581433 - Attachment is obsolete: true
(Assignee)

Comment 4

6 years ago
Created attachment 582362 [details] [diff] [review]
patch

This is not perfect, but I think it's good enough for a first pass.  This implements basically the same behavior as XUL Fennec (which in turn is based partly on both Android's stock browser).  If you press the system Back button and there is no previous history item in the current tab, then:

* If the tab was opened from another activity, Fennec closes the tab and minimizes itself (so you return to the previous activity).

* If the tab was opened from another tab (e.g. by selecting "Open link in new tab" from the context menu), Fennec closes the tab and returns to the "parent tab" if that tab is still open.

* If the tab was opened within Fennec but has no parent tab, or if the parent tab was closed, then Fennec minimizes itself (and returns to the previous activity).

In-content UI like about:firefox and about:addons is always treated as a "child" of the previous tab, so that users can easily dismiss it with the Back button whether or not they noticed that it opened in a new tab.
Attachment #581479 - Attachment is obsolete: true
Attachment #582362 - Flags: review?(mark.finkle)
Comment on attachment 582362 [details] [diff] [review]
patch

>Bug 710302 - Don't treat an address with a ":" as a search unless it has a space first [r=mfinkle, a=javascript]

Wrong comment

>diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java

>             case R.id.addons:
>-                GeckoAppShell.sendEventToGecko(new GeckoEvent("about:addons"));
>+                loadUrlInChildTab("about:addons");

The "Child" part of loadUrlInChildTab is not sitting well with me for some unknown reason. Is loadUrlInNewTab ok with you?

>diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js
> nsBrowserAccess.prototype = {
>   openURI: function browser_openURI(aURI, aOpener, aWhere, aContext) {

This method is due for some changes from Kats' patch, but the bitrot won't be too bad for either him or you.

>       gecko: {
>         type: "Tab:Added",
>         tabID: this.id,
>         uri: aURL,
>+        parentId: ("parentId" in aParams) ? aParams.parentId : -1,
>+        external: ("external" in aParams) ? aParams.external : false,
>         selected: ("selected" in aParams) ? aParams.selected : true
>       }
>     };
>+    dump(JSON.stringify(message));

Remove the dump

>diff --git a/mobile/android/components/BrowserCLH.js b/mobile/android/components/BrowserCLH.js

>       if (browserWin) {
>+        dump("openURI with OPEN_EXTERNAL");

Remove the dump

There is some good refactor in this patch too. Let's see what shakes loose so we can get this behavior nailed down.
Attachment #582362 - Flags: review?(mark.finkle) → review+

Comment 6

6 years ago
https://hg.mozilla.org/mozilla-central/rev/e588135f62ab
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
tracking-fennec: --- → 11+
https://hg.mozilla.org/releases/mozilla-aurora/rev/e588135f62ab
status-firefox11: --- → fixed
(Assignee)

Updated

5 years ago
Depends on: 731610

Comment 8

5 years ago
Verified fixed on:
Nightly Fennec 13.0a1 (2012-03-08)
Device: HTC Desire Z
OS: Android 2.3.3
Status: RESOLVED → VERIFIED

Updated

5 years ago
status-firefox13: --- → verified
You need to log in before you can comment on or make changes to this bug.