Closed Bug 2072905 Opened 2 months ago Closed 1 month ago

Newtab browser tests throw "AboutNewTab.activityStream is null" during setup

Categories

(Firefox :: New Tab Page, defect)

defect

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox158 --- fixed

People

(Reporter: florian, Assigned: florian)

References

(Blocks 1 open bug)

Details

Attachments

(2 external files)

Two tests in browser/extensions/newtab/test/browser read AboutNewTab.activityStream during setup and throw can't access property "store", AboutNewTab.activityStream is null: browser_SmartShortcuts.js and browser_activation_window.js.

AboutNewTab.onBrowserReady() assigns activityStream only after awaiting ProfileAge, the newtabTrainhop Nimbus feature and promiseBuiltInAddonInitialized. Neither test awaits AboutNewTab.activityStreamPromise, which exists for exactly this and is what AboutNewTabParent awaits before touching activityStream.

It is not a narrow race: in the one failing job carrying a profile, onBrowserReady() was dispatched at t=1.4 s and stayed in that Promise.all until 6.3 s after all three SmartShortcuts tasks had failed, with activityStream null across three test files and 12 tasks. What delays it is unestablished -- ExperimentAPI.#init() logs its first migration 9 ms before the Promise.all releases, but that is co-timing between two log paths, not a measurement.

Fix: await activityStreamPromise in each setup. browser_activation_window.js also awaits AboutNewTab.activityStream.initialized, a plain boolean, and prefsFeed.store.initialized, which the newtab Store does not define -- both read as readiness waits and neither waits, so both go.

https://tests.firefox.dev/test.html?test=browser/extensions/newtab/test/browser/browser_SmartShortcuts.js

Every task reads AboutNewTab.activityStream, which onBrowserReady() assigns
only after its startup awaits, and enrolls without waiting for
ExperimentManager.onStartup(). The ExperimentAPI.ready() calls dropped here
were no-ops, since NimbusTestUtils.enroll() already awaits store.ready()
itself.

The skip-if is from the bug 1995208 sweep and meant a bare "verify", which
passes on an unmodified tree.

Assignee: nobody → florian
Status: NEW → ASSIGNED

The setup read AboutNewTab.activityStream before onBrowserReady() had assigned
it: the await it replaces was on ActivityStream.initialized, a plain boolean,
so it never waited for anything. The await on prefsFeed.store.initialized goes
for the same reason, the newtab Store not defining it.

Pushed by fqueze@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c01c7974f9bf https://hg.mozilla.org/integration/autoland/rev/98258f051ec3 Wait for newtab and Nimbus startup in browser_SmartShortcuts.js, r=mconley. https://github.com/mozilla-firefox/firefox/commit/edd519606bef https://hg.mozilla.org/integration/autoland/rev/17d368417567 Wait for AboutNewTab.activityStreamPromise in browser_activation_window.js, r=mconley.
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch
QA Whiteboard: [qa-triage-done-c159/b158]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: