Mozilla.cfg not being read
I'm trying to use the instructions at https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment to configure Firefox ESR 52.5.2 in a Mac environment. I followed all the instructions but the settings weren't being applied.
I followed the instructions at https://mike.kaply.com/2016/09/08/debugging-firefox-autoconfig-problems/ for troubleshooting. I was able to go into about:config and search for "general.config" and it came up with the expected values (general.config.filename pointed to mozilla.cfg, so I know the .js file is being read correctly). As per the troubleshooting instructions I also simplified the .cfg file so that it only contained:
// First line is always a comment lockPref("a.b.c.d", "e.f.g.h");
The file is definitely saved as a .cfg file, not as a .txt file. After closing and reopening Firefox it didn't show the "a.b.c.d" under about:config (I also tried using ' instead of " after lockPref and it didn't make any difference).
Any ideas about what I can do to fix this? I checked the permissions on the .cfg file and they grant everyone Read only access.
Chosen solution
Do you see messages in the Browser Console about mozilla.cfg?
- "3-bar" menu button or Tools -> Web Developer
Note that this is wrong:
- pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=http://yahoo.com");
The data:text/plain construction only is required if you set the default value of a complex pref since this value is read from a file.
- defaultPref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=http://yahoo.com");
For pref() and lockPref() you use the normal variant.
- pref("browser.startup.homepage", "http://yahoo.com");
Try this for local-settings.js file:
// pref("general.config.filename", "mozilla.cfg"); pref("general.config.obscure_value", 0);Read this answer in context 👍 1
All Replies (7)
To Clarify, the .cfg file is
// First line is always a comment [break] lockPref("a.b.c.d", "e.f.g.h");
This website just formatted it differently than I'd entered it.
Make sure the files are in the correct location.
The local-settings.js file needs to be in:
- /Applications/Firefox.app/Contents/Resources/defaults/pref
The mozilla.cfg file needs to be in:
- /Applications/Firefox.app/Contents/Resources
See "Changes Over Time" -> "Mac Directory Change" https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment
Yes, the files are in the correct locations.
You can check if Firefox tries to use mozilla.cfg by removing or renaming the mozilla.cfg file temporarily. You should see an error alert (Failed to read the configuration file). If that isn't working then verify that local-settings.js is a plain text file. You can also check the Browser Console.
Does it work with a pref() line for a known pref in case lockPref() isn't working?
Thanks for your response. I renamed mozilla.cfg and did indeed get the configuration file error message when I tried to launch Firefox.
I named it back to mozilla.cfg and changed lockPref to pref (with the above-mentioned ("a.b.c.d", "e.f.g.h")) and it still isn't reading that setting if I go to about:config.
Since you mentioned trying a known pref, I also tried:
pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=http://yahoo.com");
When I launched Firefox it still went to about:home (the default Firefox startup page).
Chosen Solution
Do you see messages in the Browser Console about mozilla.cfg?
- "3-bar" menu button or Tools -> Web Developer
Note that this is wrong:
- pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=http://yahoo.com");
The data:text/plain construction only is required if you set the default value of a complex pref since this value is read from a file.
- defaultPref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=http://yahoo.com");
For pref() and lockPref() you use the normal variant.
- pref("browser.startup.homepage", "http://yahoo.com");
Try this for local-settings.js file:
// pref("general.config.filename", "mozilla.cfg"); pref("general.config.obscure_value", 0);
When I open Browser Console all I see is:
OpenGL compositor Initialized Succesfully. Version: 2.1 INTEL-10.2.12 Vendor: Intel Inc. Renderer: Intel HD Graphics 3000 OpenGL Engine FBO Texture Target: TEXTURE_2DContent Security Policy: Directive ‘frame-src’ has been deprecated. Please use directive ‘child-src’ instead. (unknown) Content Security Policy: Couldn’t process unknown directive ‘worker-src’ (unknown) OpenGL compositor Initialized Succesfully. Version: 2.1 INTEL-10.2.12 Vendor: Intel Inc. Renderer: Intel HD Graphics 3000 OpenGL Engine FBO Texture Target: TEXTURE_2D
I made sure all the options were selected but nothing referenced any .cfg files.
My autoconfig.js was already set to:
// Any comment. You must start the file with a comment! pref("general.config.filename", "mozilla.cfg"); pref("general.config.obscure_value", 0)
I added the semicolon at the end...and that was it, it all of a sudden started working! Not sure how I had left that off since I just copied and pasted from the instructions page, but it is working now!
Thanks so much for your help!