Closed Bug 2084506 Opened 1 month ago Closed 1 month ago

"Open on last tab" opens another about:home when "Homepage as a new tab" is enabled and about:home is the last tab on screen when you close Firefox

Categories

(Firefox for Android :: Homepage, defect)

Firefox 160
All
Android
defect

Tracking

()

RESOLVED DUPLICATE of bug 2080636
Tracking Status
firefox158 --- disabled
firefox159 --- disabled
firefox160 --- disabled
firefox161 --- affected

People

(Reporter: amirms76, Unassigned)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression, Whiteboard: [fxdroid] [group5])

Steps to reproduce

  1. Enable "Last tab" under Settings > Homepage > Opening screen
  2. Enable "Homepage as a New Tab" in secret settings
  3. Close all tabs (for convenience). Open a new tab. It opens about:home & the number of opens tabs is 1.
  4. Close Firefox while being on this tab by selecting Quit in the menu or discarding it in Android recent apps.
  5. Open Firefox again.

Actual results

It opens a new about:home & now there are 2 tabs opened.

Expected results

A new about:home should not open. Instead, Firefox should start on the existing about:home and the number of tabs should stay 1, not 2.

This is caused by the cold-start branch added in bug 2072356, combined with the "Last tab" behaviour from bug 2042934. In "Last tab" mode, Settings.shouldStartOnHome() in Settings.kt returns true when lastHomeActivity > lastBrowseActivity. HomeFragment.kt records that timestamp, so the check passes whenever you leave Firefox from the homepage. On the next cold start, HomeActivity.kt then takes the shouldStartOnHome() && enableHomepageAsNewTab branch and calls addNewHomepageTab(). That branch was meant for the "Homepage" opening screen. With homepage-as-a-new-tab, the homepage you left is already a restored about:home tab, so you get a second one.

Fix: In HomeActivity.onCreate, never call addNewHomepageTab() when the opening screen is "Last tab" (settings.alwaysOpenTheLastTabWhenOpeningTheApp). With homepage-as-a-new-tab, the time check is not needed in "Last tab" mode: call navigateToBrowserOnColdStart() as with any other last tab. When the restored selected tab is about:home, AboutHomeBinding.kt already redirects BrowserFragment to home. The simpler alternative is to stay on the home screen, which navigateToHome() has already opened. But that would show home over a web tab if lastHomeActivity was last updated through one of the actionGlobalHome paths that this setting doesn't gate. HomepageTabBinding.kt still covers the case where no tabs are restored.

Nothing tests this branch yet. Add cases to HomeActivityTest.kt, and add a test for the lastHomeActivity > lastBrowseActivity branch in SettingsTest.kt. Bug 2080636 is the same symptom for the "Homepage" opening screen and goes through the same lines, so the two fixes should be coordinated.

Suggested severity: S3. Each relaunch from the homepage adds a redundant empty homepage tab for users of the Nightly-only "Homepage as a new tab" setting with "Last tab"; no data is lost and closing the extra tab works around it.


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, wrong-cause, hallucination, out-of-scope, not-a-bug, wrong-fix, shallow-fix, wrong-severity}.

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

Setting Bug 2072356 as the regressor for now

:npoon, since you are the author of the regressor, bug 2072356, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(npoon)

I can confirm that the bug is reproducible. The regressor is likely correct. I'll add it to the homepage as new tab meta

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(npoon)
Whiteboard: [fxdroid] [group5]
Severity: -- → S3

Set release status flags based on info from the regressing bug 2072356

Status: NEW → RESOLVED
Closed: 1 month ago
Duplicate of bug: 2080636
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.