[Bug] Deleting browsing data is still displaying the number of open tabs
Steps to reproduce
- Open a few tabs.
- Go to Settings - Delete browsing data and select to delete "Open tabs".
Expected behavior
The opened tabs should close and "0 tabs" should be displayed.
Actual behavior
Even if the opened tabs are closed, in Settings - Delete browsing data still displays the number of them.
Device information
- Android device: all
- Fenix version: RC v1.1.0-rc.2, Nightly build 190722 (#12031851)
- Not reproducible on RC v1.1.0-rc.1

┆Issue is synchronized with this Jira Task
Tried to reproduce it but I couldn't. Mira, can you please try again?
I am no longer able to reproduce this issue on the latest Nightly build 190724 (#12050609), nor on the RC v1.1.0-rc.1 build, with Samsung Galaxy Tab A6 (Android 5.1.1). I will close it.
I will reopen this issue because I was able to reproduce it again today with the latest Nightly build from 7/26, with Huawei P9 Lite (Android 6), and Motorola Nexus 6 (Android 7.1.1).
The steps that are 100% reproducible are:
- Set Firefox Preview as default broser.
- Close Firefox Preview.
- Go to Gmail and open a link in custom tab.
- Minimize Gmail, and open Firefox Preview, making sure you have 0 tabs open.
- Go to Settings - Delete browsing data and select "Open tabs".
- Choose to delete browsing data, allow deletion, and observe the number below "Open tabs". It should be 0. It is still 1, although there is no tab opened.
I have investigated more and the exact scenario where I could have reproduced this bug is this: Let’s assume that initial we have 0 opened tabs.
- Open Firefox Preview and set it as default browser.
- Open Gmail(or other app) and open a link in custom tab.
- Open Firefox Preview from Recents apps.
Go to Settings -> Delete browsing data; The “Open Tabs” view shows “1 tabs” (the custom tab). - Remove Gmail app from Recents apps and go back to Firefox Preview. The “Open Tabs” view still shows “1 tabs”. The expected behaviour would be for this to show “0 tabs”.
- Now, if you select "Open tabs”, choose to delete browsing data and allow deletion the “Open Tabs” view still shows “1 tabs”. The expected behaviour would be for this to show “0 tabs”.
The problem is that the custom tab is leaked when the user closes that app from Recents and we don’t receive any event in Firefox Preview to know when this happens.
I found that the app only handles the ‘custom tab’ back and close buttons. So the scenario where the user closes Gmail(which contains the custom tab) from Recents apps is not handled.
A possible solution for this issue is to keep a weak reference to the activity (from the Gmail app in our example) that contains the ‘custom tab’ and somehow check when this activity dies.
Note that if the custom tab is opened and you go to Firefox Preview, Settings -> Delete browsing data -> check Open Tabs -> Delete browsing data and click allow the “Open Tabs” view now shows “1 tabs” correctly because this is the expected behaviour according to the removeSessions method, “Removes all sessions but CustomTab sessions.”.
Please keep in mind we could also reproduce this without opening custom tabs, but there are no steps determined yet.
Verified as fixed on the latest build of RC 1.2.0-rc.2 with Huawei P9 Lite (Android 6), and Motorola Moto G6 (Android 8). Verified both scenarios, with or without custom tabs.