Closed Bug 1179519 Opened 7 years ago Closed 5 years ago

Widget fails to open new tab if Firefox is killed in the background by the OS


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



(firefox38.0.5 affected, firefox39 affected, firefox40 affected, firefox41 affected, firefox42 affected, fennec+)

Tracking Status
firefox38.0.5 --- affected
firefox39 --- affected
firefox40 --- affected
firefox41 --- affected
firefox42 --- affected
fennec + ---


(Reporter: kbrosnan, Unassigned)



* To get consistent behavior enable "Don't keep activities" in the developer options. Else you need to create a memory pressure event to get the os to kill Firefox

* Launch Firefox for Android
* Browse to a website, may I suggest
* Add the search widget to the homescreen
* tap the search widget "new tab button"

  No new tab opened, Firefox is focused with the site loaded in the setup
  New tab created
Assignee: nobody → margaret.leibovic
tracking-fennec: ? → +
See Also: → 1184514
Looks like mfinkle ran into something like this when testing the original patch :(

wesj, do you remember looking into this at all?
Flags: needinfo?(wjohnston)
So, the SearchWidget tries to open a new tab by launching an empty ACTION_VIEW intent:

On quick glance, it looks like our logic in `onNewIntent` always opens a new tab, regardless of checking the URL:

However, if the activity has been killed, we'll go through `onCreate` instead, and in `initialize`, we'll check to see if there is a URI before opening a new tab:

I wonder if instead of checking isExternalUrl before opening a new tab, we should be checking if the intent is ACTION_VIEW. But I want to spend some more time understanding this logic before making any logic changes like that.

mhaigh, did you get familiar with all this while working on tab queues? What do you think we should do?
Flags: needinfo?(mhaigh)
This code is quite difficult to follow.  

There are four places where we do incoming Intent handling: BrowserApp onCreate & onNewIntent and GeckoApp onNewIntent & initialize and we seem to be duplicating code between the two GeckoApp methods (we handle ACTION_LAUNCH_SETTINGS the exact same way in these two methods, as we do with ACTION_ALERT_CALLBACK and HELPER_BROADCAST_ACTION).  I don't fully understand the logic behind initialize and onNewIntent but I'd say that it could do with some cleanup and documentation.

But you're right in that in initialize, if the isExternalURL flag is false then we never handle the intent (but we will set the browser toolbar title -

It'd be good if we could review the code in GeckoApp onNewIntent & initialize and try to bring them more in line with each other.
Flags: needinfo?(mhaigh)
Yay, Yep! Do it (someone else do it I mean)!
Flags: needinfo?(wjohnston)
Duplicate of this bug: 1218663
Assignee: margaret.leibovic → nobody
Priority: -- → P5
Duplicate of this bug: 1339919
Closed: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1366993
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.