Closed Bug 1323437 Opened 5 years ago Closed 5 years ago

Tapping on 'New Tab' from the Search Activity widget doesn't open a new one if a custom Homepage is set

Categories

(Firefox for Android Graveyard :: Search Activity, defect)

ARM
Android
defect
Not set
normal

Tracking

(firefox50 affected, firefox51 affected, firefox52 wontfix, firefox53 wontfix, firefox54 verified, firefox55 verified)

VERIFIED FIXED
Tracking Status
firefox50 --- affected
firefox51 --- affected
firefox52 --- wontfix
firefox53 --- wontfix
firefox54 --- verified
firefox55 --- verified

People

(Reporter: sflorean, Unassigned)

References

Details

Environment: 
Device: Nexus 5 (Android 6.0.1);
Build: Nightly 53.0a1 (2016-12-13);

Steps to reproduce:
1. Go to Menu -> Settings -> General -> Home-> Set a homepage -> Custom -> Enter an URL address or some text -> Tap OK;
2. Close Fennec from Task Manager;
3. Tap on 'New Tab' button from the Search Activity widget.

Expected result:
- Fennec is launched and a new tab is opened.
- The number of tabs is increased.

Actual results:
Fennec is launched but there is no new tab opened. Only the Homepage from step 1.
See Also: → 1318663
See Also: → 1339919
Mass wontfix for bugs affecting firefox 52.
GeckoApp.invokedWithExternalURL explicitly disregards external intents with the new tab url ("about:home"). Hence, the SearchActivity widget can't invoke the new tab behaviour (as an external app).

How to resolve this?
Create a new bug with feature request to allow external apps to open a new tab?
Flags: needinfo?(jh+bugzilla)
Can I pass this off to you Tom, since you had already looked into this a bit?
Flags: needinfo?(jh+bugzilla) → needinfo?(twointofive)
I'm seeing different, but still buggy, behavior on nightly (I haven't tested older versions).

Issue 1:
1) Set a custom homepage.
2) Kill fennec from the app switcher.
3) Click "New tab" in the search widget.
4) Tap the home button - don't kill fennec.
5) Click "New tab" in the search widget.

In step 3 you get a new tab with the homepage loaded; in step 5 you get a new tab with "about:home" loaded.  I would expect to get the same result in both cases [though I don't know which of the two is expected!]; this should probably be a separate bug though (I think it's just because in the step 3) case we're opening the new tab from here: https://dxr.mozilla.org/mozilla-central/rev/a748acbebbde373a88868dc02910fb2bc5e6a023/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java#1810 instead of using the intent url (about:home) as we do in the step 5 case). friedger, feel free to file if you can reproduce.

Issue 2:
I think this is the new version of the original report, though it now doesn't matter if a homepage is set or not.
1) Set "Don't keep activities" in the android developer settings.
2) Kill fennec from the app switcher.
3) Click "New tab" in the search widget.
4) Tap the home button.
5) Click "New tab" in the search widget.

In step 3 you get a new tab - that's expected (aside from the issue 1 question of whether the homepage should be loaded in the new tab or not). In step 5 you don't get a new tab.  As friedger pointed out, this looks to be because we set isExternalURL = false for "about:home", and then we wind up at [1] and _are_ restoring an activity, and so we just don't open any url at all.

friedger, I think you can try to fix that in this bug (if you're seeing the same behavior as me then you can update the title of this bug to reflect the new behavior).  I don't know this part of the code well enough to be able to comment on the _current_ reason for the distinction between "external url" and non-external (though I found some history [2]), but naively to me it looks like in this case isExternalURL should just mean passedUri != (null or empty) [assuming that that means we were passed an intent (with a VIEW action, which loadStartupTab checks for), and the intent had a non-empty url]. If there is a good reason for the _current_ code treating about:home differently in this situation then a comment here would probably be helpful :)

[Side question: if it _is_ important that invokedWithExternalURL weed out about:home, should it really be checking the more general AboutPages.isAboutPage() instead to weed out all about pages?]

[1] https://dxr.mozilla.org/mozilla-central/rev/a748acbebbde373a88868dc02910fb2bc5e6a023/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java#1809

[2] The term "external" url in this context looks like it was introduced here: https://hg.mozilla.org/mozilla-central/diff/d2b34e4338bb/mobile/android/base/GeckoApp.java where it was being used because back then we (apparently) opened about:home differently than other "external" urls (I don't think that's the case anymore).  At other points in the history isExternalURL was also being used to differentiate what type of telemetry data to send, but I think that has gone away as well.
Flags: needinfo?(twointofive)
Actually, on second thought, I think the Issue 1 issue as I described it yesterday will probably go away when Issue 2 is fixed, so we can hold off on creating a separate bug for Issue 1.  BUT, there's a separate issue which I hadn't noticed yesterday: in Settings->General->Home there's an option to "Also use for new tabs" (which I didn't have set in my earlier comments), and it looks like that works as expected if you open a new tab from within fennec, but if you click "New tab" in the search widget, it still opens about:home instead of the custom homepage.
(In reply to Tom Klein from comment #4)
> Issue 1:
> 1) Set a custom homepage.
> 2) Kill fennec from the app switcher.
> 3) Click "New tab" in the search widget.
> 4) Tap the home button - don't kill fennec.
> 5) Click "New tab" in the search widget.
> 
> In step 3 you get a new tab with the homepage loaded; in step 5 you get a
> new tab with "about:home" loaded.

Filed bug 1367063 for this.

> Issue 2:
> I think this is the new version of the original report, though it now doesn't matter if a homepage is set or not.
> 1) Set "Don't keep activities" in the android developer settings.
> 2) Kill fennec from the app switcher.
> 3) Click "New tab" in the search widget.
> 4) Tap the home button.
> 5) Click "New tab" in the search widget.
> 
> In step 3 you get a new tab - that's expected (aside from the issue 1 question of whether the homepage should be loaded in the new tab or not). In step 5 you don't get a new tab.

Bug 1366993 covers this.

(In reply to Tom Klein from comment #5)
> BUT, there's a separate issue which I
> hadn't noticed yesterday: in Settings->General->Home there's an option to
> "Also use for new tabs" (which I didn't have set in my earlier comments),
> and it looks like that works as expected if you open a new tab from within
> fennec, but if you click "New tab" in the search widget, it still opens
> about:home instead of the custom homepage.

Filed bug 1367069 for this.
I'm not sure "fixed" is the right term here since I think this just morphed into other bugs due to unrelated work, but I can't reproduce the original steps on 54 beta8 or nightly, so going with fixed unless someone else wants to change it.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Hello,

I have verified this issue following the steps in Comment 0 on a Nexus 6 (Android 7.0) & LG G4 (Android 5.1). When tapping on new tab from the Search Activity widget tabs are no longer lost and a new tab is opened. Seeing as the other issues will be solved in bug 1367063 and bug 1367069, marking this as verified.
Status: RESOLVED → VERIFIED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.