autoconfig file not working

User Help for Mozilla Firefox
Post Reply
schmibble
Posts: 10
Joined: October 10th, 2007, 5:43 pm

autoconfig file not working

Post by schmibble »

As the "New Post" function is still working, I'll just slip in under the wire with a final help request before Joe shuts everything down. (Thanks Joe, the help here has always been better than at the official site).

Anyway...

So I've followed the directions in http://kb.mozillazine.org/Locking_prefe ... ile_access to the absolute letter, as far as I can tell. Indeed, I also checked https://mike.kaply.com/2012/03/20/custo ... continued/ and also follow his advice about the second line (he says, "your code MUST begin on the second line"). My files are saved as ANSI; the mozilla.cfg is in the same dir as the FF exe, while the local-settings.js is in default\prefs.

However, when I shut the browser down and restart, these settings are not applied. I.e. no italicized entry that says "locked"; the lockPref'd settings still show their default "true" colors even though I'm trying to make them false. I've even rebooted the whole machine to no avail.

The "Disable default browser checking" normal pref (not lockPref) is applied, at the end of the code--but not the lockPrefs at the beginning

MIght anyone be able to point out what I'm doing wrong? Gotta be something but I'm famboozled. Here's the code, based on http://forums.mozillazine.org/viewtopic ... #p14116067:

in mozilla.cfg:

Code: Select all

//
lockPref("geo.enabled", false);
lockPref("media.peerconnection.enabled", false);
// These first lines lock the prefs that stop FF from broadcasting
// your IP address & geographical location to all & sundry.

// Use LANG environment variable to choose locale
pref("intl.locale.matchOS", true);

// Disable default browser checking.
pref("browser.shell.checkDefaultBrowser", false);
in local-settings.js:

Code: Select all

//
pref("general.config.filename", "mozilla.cfg");

// Pointer file to my customizations, mainly locking down
// the media peerconnections setting

morat
Posts: 6426
Joined: February 3rd, 2009, 6:29 pm

Re: autoconfig file not working

Post by morat »

Here is how to set up the local-settings.js file if you need to use the Components object.

Code: Select all

// local-settings.js file needs to start with a comment line

// mozilla.cfg file is sandboxed by default i.e. can't use the Components object
// disable the sandbox by setting the general.config.sandbox_enabled pref to false

pref("general.config.sandbox_enabled", false);
pref("general.config.filename", "mozilla.cfg");
pref("general.config.obscure_value", 0);
User avatar
dickvl
Posts: 54161
Joined: July 18th, 2005, 3:25 am

Re: autoconfig file not working

Post by dickvl »

You only need to disable the sandbox if you want to include JavaScript code in autoconfig.cfg.
Since you only use pref() and lockPref() calls then this is not necessary.

Did you check the Browser Console for possible error messages?

The code you posted works for me in Firefox 71, with and without the sandbox being enabled.
schmibble
Posts: 10
Joined: October 10th, 2007, 5:43 pm

Re: autoconfig file not working

Post by schmibble »

dickvl:
I'm fully updated to 71, but not working for me. When I first start FF, here is the complete output from the browser console, prior to actually going to any real web site (I have it set to open to a blank page with a duckduckgo search field, but it's not the actual duckduckgo search page, just a field provided by FF). There are a couple of errors, but I don't have a level of knowledge sufficient to tell what they really mean. The biggest one mentions a problem with logs, though, and that doesn't seem to have anything to do with my issue.

Code: Select all

Invalid chrome URI: / 29
Log warning: The log 'Services.Common.RESTRequest' is configured to use the preference 'services.common.log.logger.rest.request' - you must adjust the level by setting this preference, not by using the level setter Log.jsm:24
    dumpError resource://gre/modules/Log.jsm:24
    set level resource://gre/modules/Log.jsm:252
    Intl resource://services-common/hawkrequest.js:164
    getIntl resource://services-common/hawkrequest.js:205
    HawkAuthenticatedRESTRequest resource://services-common/hawkrequest.js:79
    newHAWKAuthenticatedRESTRequest resource://services-common/hawkclient.js:343
    request resource://services-common/hawkclient.js:224
    _request resource://gre/modules/FxAccountsClient.jsm:787
    getDeviceList resource://gre/modules/FxAccountsClient.jsm:749
    InterpretGeneratorResume self-hosted:1150
    AsyncFunctionNext self-hosted:689
No such native application net.downloadhelper.coapp NativeMessaging.jsm:112
    startupPromise resource://gre/modules/NativeMessaging.jsm:112
Invalid chrome URI: / 58
GEThttp://detectportal.firefox.com/success.txt?ipv4
[HTTP/1.1 200 OK 280ms]
GEThttp://detectportal.firefox.com/success.txt?ipv6
GEThttp://self-hosted/
Error: Can't find profile directory. XULStore.jsm:66:15
schmibble
Posts: 10
Joined: October 10th, 2007, 5:43 pm

Re: autoconfig file not working

Post by schmibble »

OK, never mind, problem solved.

It turns out to lie with the pointer file's name. http://kb.mozillazine.org/Locking_prefe ... ile_access says to name the default\pref file "local-settings.js". But https://support.mozilla.org/en-US/kb/cu ... autoconfig is different. It explicitly says that the autoconfig file itself (the one in the top-level dir) can be anything you want, but it just as explicitly says that the pointer file in default\pref should be named "autoconfig.js", with no mention of being able to customize that name. And it turns out that that's what it has to be.

Why the guy who wrote http://kb.mozillazine.org/Locking_prefe ... ile_access was able to get away with calling his pointer file "local-settings.js" is a mystery. Certainly didn't work for me! On my system at least the official instruction to use autoconfig.js is an absolute must.

So thanks, dickvl, for pointing me to the mozilla.org file, as without that reference I'd still be banging my head against the wall.
User avatar
dickvl
Posts: 54161
Joined: July 18th, 2005, 3:25 am

Re: autoconfig file not working

Post by dickvl »

The .js file in the default\prefs folder should have any name.
If your local-settings.js file wasn't working then there migth have been a hidden .txt file extension appended or the file didn't have Unix line endings (LF) or something else was wrong.
Any filename should work as long as the file extension is .js.
Post Reply