Closed Bug 2072896 Opened 2 months ago Closed 2 months ago

[HNT] Toggling Private Browsing spawns multiple duplicate about:home tabs

Categories

(Firefox for Android :: Homepage, defect)

All
Android
defect

Tracking

()

RESOLVED DUPLICATE of bug 2073323

People

(Reporter: breakingspell, Unassigned)

Details

Attachments

(1 file)

Steps to reproduce:

Install nightly or build latest main, enable Secret Settings -> "Homepage as a New Tab."

Toggle Private Browsing using the homepage button element, go back and forth a few times.

Actual results:

Notice that several about:home tabs have populated both lists, in both regular and Private mode. Entering/exiting the Private Tabs mode has the effect of spawning a duplicate tab each time.

Expected results:

If the last tab in the list is the homepage, a new, duplicate homepage tab should not be spawned, instead the existing homepage tab should be focused.

This might extend to cases where about:home is already somewhere in the list, not just the last position.

PrivateBrowsingController.kt calls fenixBrowserUseCases.addNewHomepageTab(private = newMode.isPrivate) on every toggle while enableHomepageAsNewTab is set, and FenixBrowserUseCases.kt dispatches tabsUseCases.addTab with no lookup for an existing about:home tab, so each switch appends one more to the target mode's list. That call came from bug 1969252 (hg 3192711610d2) to guarantee a tab exists in the new mode, which HomepageTabBinding.kt already handles when that mode's tab list is empty.

Fix: Add a selectOrAddHomepageTab(private) use case that resolves findNormalOrPrivateTabByUrl(ABOUT_HOME_URL, private) and selects the hit, falling back to addNewHomepageTab when there is none, and call it from handlePrivateModeButtonClicked; extend DefaultPrivateBrowsingControllerTest.kt, which currently asserts only on a relaxed mock, to check against a real BrowserStore that a second toggle does not grow the tab list.

I triaged this from the description and the code and did not view the attached screen recording.

Suggested severity: S3. Repeated toggling accumulates unwanted tabs in both tab lists, but closing them works around it and the feature is behind a Nightly secret setting that is off by default.


If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
If you want to categorize your feedback you can add one of the following tags: ai-triage-wrong-file, ai-triage-wrong-cause, ai-triage-hallucination, ai-triage-out-of-scope, ai-triage-wrong-fix, ai-triage-shallow-fix.

Needinfo hackbot@mozilla.tld to have a patch generated for this bug, include any questions or directions as needed in your comment.

The bot is onto something, the suggested fix (selectOrAddHomepageTab()) seems to work at first glance.

Waiting for maintainers though.

The severity field is not set for this bug.
:gl, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(gl)

Closing this as a dupe. Feel free to reopen if I've misunderstood

Status: UNCONFIRMED → RESOLVED
Closed: 2 months ago
Duplicate of bug: 2073323
Flags: needinfo?(gl)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: