Recommended preferences are restored too late on shutdown to be persisted
Categories
(Remote Protocol :: Agent, defect, P3)
Tracking
(firefox-esr140 unaffected, firefox-esr153 wontfix, firefox154 wontfix, firefox155 wontfix, firefox156 wontfix, firefox157 fixed)
People
(Reporter: jdescottes, Assigned: jdescottes)
References
(Regression)
Details
(Keywords: regression, Whiteboard: [webdriver:m21] [webdriver:external][webdriver:relnote] )
Attachments
(1 external file)
(suggested by Claude, will check later)
RecommendedPreferences restores the preferences it applied on xpcom-shutdown, but the preference service stops accepting writes before that:
profile-before-change-> asyncSavePrefFile(Preferences.cpp:4997)profile-before-change-telemetry->SavePrefFileBlocking(), thenmProfileShutdown = true(Preferences.cpp:5006)xpcom-shutdown->restoreAllPreferences()->clearUserPref()->HandleDirty()returns early with "Setting user pref after profile shutdown." (Preferences.cpp:4002)
So the preferences are cleared in memory after the last write, and prefs.js keeps the automation values permanently. Once stuck there, applyPreferences skips them forever after because of the prefHasUserValue check, so later automation runs silently do not get them either.
This was invisible while automation only ever used throwaway profiles. Bug 2066518 made it visible: dynamic start applies these preferences to a profile users keep.
Suggested fix: restore on profile-before-change instead of xpcom-shutdown.
Comment 1•3 months ago
|
||
This regressed by bug 2028422 which landed in Firefox 151. We originally reset the preferences in the quit-application phase. Lets check that we do not regress other use cases with this change to profile-before-change.
Comment 2•3 months ago
|
||
Set release status flags based on info from the regressing bug 2028422
:hbenl, since you are the author of the regressor, bug 2028422, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Updated•3 months ago
|
| Assignee | ||
Comment 3•2 months ago
|
||
(need to repro in isolation, should not impact mcp workflow anymore)
| Assignee | ||
Comment 4•2 months ago
|
||
I confirm the bug and the fix.
During the triage meeting there was some discussion about the type of restart needed, but here we are not really concerned about restarts. The issue (at least on my machine!) occurs on shutdown.
STRs:
- open the Browser Console and execute:
ChromeUtils.importESModule(
"chrome://remote/content/shared/RecommendedPreferences.sys.mjs"
).RecommendedPreferences.applyPreferences();
- quit the browser (I used
cmd+QFWIW) - start the browser with the same profile
ER: Preferences should have been restored
AR: Recommended preferences are still applied. Eg open a new tab, instead of about:newtab, you will get about:blank.
Note: I use the Browser Console here to trigger this, but you could swap it for anything that applies recommended preferences on a profile that can be reused.
And I confirm that switching from xpcom-shutdown to profile-before-change fixes this issue.
| Assignee | ||
Comment 5•2 months ago
|
||
Updated•2 months ago
|
Comment 6•2 months ago
|
||
Julian, good to see that we have steps now. Is that reproducible with a Marionette test? Here we do not set the recommended prefs by default but we could turn it on for just a single test. Then we could trigger an in-app quit and verify that after the restart with no recommended prefs applied these are reset. Maybe we just check some prefs, which should probably be enough.
Updated•2 months ago
|
| Assignee | ||
Comment 8•2 months ago
|
||
I am landing this because it blocks a firefox-devtools-mcp work, but it's fine to count it as external.
Updated•2 months ago
|
Comment 10•2 months ago
|
||
| bugherder | ||
Comment 11•2 months ago
|
||
The patch landed in nightly and beta is affected, along with ESR.
:jdescottes, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta and ESR approvals.
- See https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift for documentation on how to request an uplift.
- If no, please set
status-firefox156and the ESR status flag(s) towontfix.
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 12•2 months ago
|
||
I don't think we need to uplift anything here, usually we use throwaway profiles for automation. This mostly becomes relevant for ai-assisted browsing or tooling, but those flows are Nightly-only at the moment.
Updated•2 months ago
|
Description
•