Clear the pinned top sites preferences between newtab browser tests
Categories
(Firefox :: New Tab Page, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: florian, Assigned: florian)
References
(Blocks 1 open bug)
Details
Attachments
(1 external file)
browser.newtabpage.pinned holds the pinned top sites and is written by NewTabUtils.pinnedLinks, not by any test's pref environment, so SpecialPowers.popPrefEnv does not restore it, and NewTabUtils.undoAll() clears only the blocked list, deliberately. Tests in browser/extensions/newtab/test/browser therefore inherit whatever the previous test pinned, and the order the manifest happens to run in is load-bearing.
browser_topsites_section.js is the leaker: topsites_pin_unpin pins the first default tile and topsites_add adds https://bugzilla.mozilla.org, and each one unpins or dismisses only on the path where nothing before it failed. Whatever is left pinned stays pinned for the rest of the job.
It has reached one test. browser_topsites_sponsored.js runs immediately after, and three per-test failure profiles of its Should have 4 topsites by default - 5 == 4 failure show browser.newtabpage.pinned holding https://bugzilla.mozilla.org or https://www.youtube.com/ beside @amazon, with the pinned badge visible in the screenshot. That is 8 failures in the 21 days to 2026-09-14, and it is being fixed inside bug 2011958 by counting only the sponsored tiles, so this bug retires nothing by itself.
The leak still sets the row up for the next test that counts tiles or addresses one by position, and it also moves the search shortcut: _maybeInsertSearchShortcuts re-pins @amazon at pinnedSites.indexOf(null), so an occupied slot 0 pushes it along by one. Clearing browser.newtabpage.pinned and browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.havePinned in the folder's head.js setup would let every test start from a known row.
| Assignee | ||
Comment 1•2 months ago
|
||
Pinning writes browser.newtabpage.pinned through NewTabUtils.pinnedLinks, not
through a test's pref environment, so popPrefEnv does not restore it and every
file in the folder inherits the row the previous one left behind. Calling the
existing clearPinnedTopSites() helper from head.js makes that inheritance stop
at the file boundary, instead of each test having to opt out of it.
Updated•2 months ago
|
Comment 3•1 month ago
|
||
| bugherder | ||
Updated•1 month ago
|
Description
•