New XDG basedir support still creates an empty ~/.mozilla/extensions directory
Categories
(WebExtensions :: General, task, P2)
Tracking
(firefox147 verified, firefox148 verified, firefox149 verified)
People
(Reporter: emilio, Assigned: robwu)
References
Details
(Whiteboard: [addons-jira])
Attachments
(2 files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-release+
|
Details | Review |
STR:
mv ~/.mozilla ~/.mozilla-bak- Launch nightly
I expect a bunch of files to be under ~/.config/mozilla. That's alright and works. However the ~/.mozilla directory is resurrected and empty with a ~/.mozilla/extensions directory, which is rather weird / unexpected.
| Reporter | ||
Comment 1•1 month ago
|
||
I guess this is expected because of the aForceLegacy = true here: https://searchfox.org/firefox-main/rev/3f22e78e34249196edab0a5b756394169533b8a1/toolkit/xre/nsXREDirProvider.cpp#1177-1190?
Comment 2•1 month ago
|
||
This was a review requirement change, from rob I think?
Comment 4•1 month ago
|
||
Searching for addons in the legacy location is very much on purpose, but the problem here is the directory being created when it doesn't exist.
| Assignee | ||
Comment 5•1 month ago
|
||
(In reply to :gerard-majax from comment #2)
This was a review requirement change, from rob I think?
I was never involved in the thread, perhaps you were thinking of my feedback at bug 1986219? The original request in the current bug came from :glandium at https://phabricator.services.mozilla.com/D6995#inline-1400955
The directory is being created at https://searchfox.org/firefox-main/rev/af0f713f785417023666ef557e856b3a9d132041/toolkit/xre/nsXREDirProvider.cpp#1184,1187
I wonder how many still rely on this location. It is at https://searchfox.org/firefox-main/rev/af0f713f785417023666ef557e856b3a9d132041/toolkit/mozapps/extensions/internal/XPIProvider.sys.mjs#2571-2572 (along with the lookup of a registry key on Windows only), but by default we only look up in SCOPE_PROFILE: https://searchfox.org/firefox-main/rev/af0f713f785417023666ef557e856b3a9d132041/toolkit/mozapps/extensions/internal/AddonSettings.sys.mjs#125-138 (which is enabled by default on ESR only).
Comment 6•1 month ago
|
||
(In reply to Rob Wu [:robwu] from comment #5)
(In reply to :gerard-majax from comment #2)
This was a review requirement change, from rob I think?
I was never involved in the thread, perhaps you were thinking of my feedback at bug 1986219? The original request in the current bug came from :glandium at https://phabricator.services.mozilla.com/D6995#inline-1400955
Oops, maybe you're right
The directory is being created at https://searchfox.org/firefox-main/rev/af0f713f785417023666ef557e856b3a9d132041/toolkit/xre/nsXREDirProvider.cpp#1184,1187
Yes, thanks, and it confirms my memory of this being already created by default prior to my changes.
While it may look weird now that we support XDG_CONFIG_HOME, it predates it. I worry some of our code down the like in XPI/extensions handling may silently break if it does not exists for real
(In reply to :gerard-majax from comment #6)
Yes, thanks, and it confirms my memory of this being already created by default prior to my changes.
While it may look weird now that we supportXDG_CONFIG_HOME, it predates it. I worry some of our code down the like in XPI/extensions handling may silently break if it does not exists for real
Would regression tests catch any issues if you just disable creating it when non in legacy mode?
Comment 8•1 month ago
|
||
The severity field is not set for this bug.
:nika, could you have a look please?
For more information, please visit BugBot documentation.
Another issue that breaks XDG spec, just for the reference: bug #2005167.
Updated•1 month ago
|
| Assignee | ||
Comment 10•1 month ago
|
||
(In reply to :gerard-majax from comment #6)
(In reply to Rob Wu [:robwu] from comment #5)
The directory is being created at https://searchfox.org/firefox-main/rev/af0f713f785417023666ef557e856b3a9d132041/toolkit/xre/nsXREDirProvider.cpp#1184,1187
Yes, thanks, and it confirms my memory of this being already created by default prior to my changes.
While it may look weird now that we supportXDG_CONFIG_HOME, it predates it. I worry some of our code down the like in XPI/extensions handling may silently break if it does not exists for real
The add-ons manager (extensions) don't care about the existence of the directory, see least comment 5 for an explanation on its non-use (other than ESR, or with a custom pref). All uses of this path can be found here:
- https://searchfox.org/firefox-main/search?q=XREUSysExt&redirect=false
- https://searchfox.org/firefox-main/search?q=XRE_USER_SYS_EXTENSION_DIR&redirect=false
Given the lack of use, I think that it would be okay to disable the directory creation.
:sinker
Please do not set severity (S3) on bugs, at least not for bugs in the WebExtensions product. Assigning severity is the responsibility of the triage owners (or their team). In the WebExtensions team, our query for bugs to triage exclude bugs that already have an assigned severity. So by changing the severity of a bug, you are increasing the likelihood of the bug to be unnoticed and therefore not get looked into.
Comment 12•1 month ago
|
||
Seems like this is perhaps an extension issue, although the code exists within XPCOM. We can review the change from the extensions side, but I think it would just involve removing the EnsureDirectoryExists call (https://searchfox.org/firefox-main/rev/54da8f6bfead7871ca89f2cb18323af5f00d9620/toolkit/xre/nsXREDirProvider.cpp#1187) and doing some testing to ensure everything still works as expected.
| Assignee | ||
Updated•1 month ago
|
Updated•27 days ago
|
| Assignee | ||
Comment 13•21 days ago
|
||
Updated•21 days ago
|
Comment 14•21 days ago
|
||
Will this fix this?
| Assignee | ||
Comment 16•21 days ago
|
||
(In reply to Mike Kaply [:mkaply] from comment #14)
Will this fix this?
Yes. On Windows this code path uses Mozilla\Extensions\ instead of .mozilla/extensions/ - https://searchfox.org/firefox-main/rev/f9d8702e26624ab46a35bf6561a7c8143c6f246a/toolkit/xre/nsXREDirProvider.cpp#1262-1275
Bug 732435 points to %USERPROFILE%\Mozilla\, but according to this source at https://searchfox.org/firefox-main/rev/b67c6262ecbe7d4c9385a1bd335fd7dd1d3f887d/browser/components/enterprisepolicies/Policies.sys.mjs#467-468
the path is expected to be %USERNAME\AppData\Roaming\Mozilla. Is this as expected? Has nothing to do with this bug, but since we're looking at it, I'd like to double-check.
Comment 17•21 days ago
|
||
Comment 18•21 days ago
|
||
Is this as expected? Has nothing to do with this bug, but since we're looking at it, I'd like to double-check.
Yes. Roaming is the default, so that's what %USERPROFILE%\Mozilla pointed to
Comment 19•21 days ago
|
||
| bugherder | ||
| Assignee | ||
Comment 20•6 days ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D277627
Updated•6 days ago
|
Comment 21•6 days ago
|
||
firefox-release Uplift Approval Request
- User impact if declined: Firefox 147's release notes indicate support for the XDG Base Directory Specification.
If someone were to try this out, they would still see Firefox creating a ~/.mozilla/ directory, in violation of that spec. So the 147 release does not match user expectations in this regards. The directory creation was unnecessary, and this patch removes that.
- Code covered by automated testing: no
- Fix verified in Nightly: yes
- Needs manual QE test: yes
- Steps to reproduce for manual QE testing: 1. On a new Linux user account (or at least one where ~/.mozilla/ was removed), start Firefox.
- Verify that the ~/.mozilla/ directory was not created.
- Risk associated with taking this patch: low
- Explanation of risk level: Removes logic that creates the empty directory. Low risk because we do not rely on the directory's existence. The only build where users can opt in to the dependent feature is ESR, and even there users can create the directory themselves if needed.
- String changes made/needed: None
- Is Android affected?: no
Updated•5 days ago
|
Comment 22•5 days ago
|
||
Verified as Fixed. Tested on the latest Nightly (149.0a1/20260114211245) and Beta (148.0b2/20260114090336) under Ubuntu 24.10 according to the STR from Comment 21.
Using a new Linux user account where the ~/.mozilla/ directoy is non-existent, installing and starting the browser will not create the ~/.mozilla/ directory, confirming the fix.
For comparison, I’ve also tested the latest Release (147.0/20260105210555) as well. Launching this browser version without the fix, will create the ~/.mozilla/ directory as expected.
When the uplift to Firefox Release is completed, I will check once again.
Updated•4 days ago
|
Updated•4 days ago
|
Comment 23•4 days ago
|
||
| uplift | ||
Comment 24•1 day ago
|
||
Verified as Fixed. Tested on the latest Release (147.0.1/2026011609130) under Ubuntu 24.10 according to the STR from Comment 21.
Using a new Linux user account where the ~/.mozilla/ directoy is non-existent, installing and starting the browser will not create the ~/.mozilla/ directory, confirming the fix.
Description
•