Yes. In Fennec (and Fennec F-Droid), you can retrieve the profile path from privileged JavaScript (e.g., an extension/add-on) using the ProfD directory service key:
const profilePath = Services.dirsvc.get("ProfD", Ci.nsIFile).path;
For Fennec F-Droid, this will return a path like:
/data/data/org.mozilla.fennec_fdroid/files/mozilla/XXXXXXXX.default
(where XXXXXXXX is a random profile identifier).
Notes:
- This API is only available to privileged code (extensions/add-ons). Regular web content cannot access it for security reasons.
- The same
ProfD key works across Firefox platforms, including Fennec.
- If you're developing an add-on, ensure you have the necessary permissions and use the
Services module (import via ChromeUtils.import("resource://gre/modules/Services.jsm") in modern Firefox).