Open Bug 2089006 Opened 20 days ago Updated 18 days ago

New Tab shortcuts take minutes or a restart to show imported browsing history

Categories

(Firefox :: New Tab Page, defect, P3)

defect
Points:
3

Tracking

()

People

(Reporter: nbarrett, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fide-fi])

After importing browser data (e.g. from Chrome), the import reports success but the New Tab shortcuts keep showing the old defaults. The imported sites only appear after the next TopSites refresh and can take up to 10 minutes

Proposal would be for TopSItesFeed to listen to the event for when import is finished.

there is a Migration:Ended notification fired after an import is done that you might be able to listen to

Imported history is written with insertMany, which fires page-visited events, and PlacesFeed.sys.mjs does not listen for those. So TopSitesFeed.sys.mjs only sees the new history when its 4.5-minute frecentCache expires and a 5-minute SYSTEM_TICK refreshes it, and that refresh does not broadcast to open tabs. Refreshing on Migration:Ended alone would still show nothing. History.cpp puts off frecency for inserts that span many URLs, so the imported rows stay at -1 until the recalculator works through them in batches, and getTopFrecentSites only returns rows with frecency >= threshold (NewTabUtils.sys.mjs).

Fix: Have TopSitesFeed observe Migration:ItemAfterMigrate filtered to resourceTypes.HISTORY, the way PlacesUIUtils.sys.mjs filters for bookmarks (or Migration:Ended as suggested in comment 1). On that notification, await recalculateAnyOutdatedFrecencies(), then call frecentCache.expire() and refresh({ broadcast: true }). That method is documented as test-only in PlacesFrecencyRecalculator.sys.mjs, so a Places peer needs to sign off on calling it from product code. Cover it with a case next to the existing observe() test in test_TopSitesFeed.js.

Suggested severity: S3. New profiles that import from another browser see default shortcuts for several minutes, which undercuts onboarding, but nothing is lost and the shortcuts update on their own.


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.

Whiteboard: [fide-fi]
Points: --- → 3
You need to log in before you can comment on or make changes to this bug.