Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

nsAutoConfig

100 views
Skip to first unread message

Nicholas Nethercote

unread,
Oct 31, 2017, 1:10:21 AM10/31/17
to dev-platform
Hi,

I was just looking at the extensions/pref/autoconfig/ directory and trying
to understand what it does.

As far as I can tell, the code is there to allow custom deployments with
particular prefs set, as described at
https://developer.mozilla.org/en-US/Firefox/Enterprise_deployment#Configuration

It's initialized by modules/libpref/Preferences.cpp if a
"general.config.filename" pref is found:
http://searchfox.org/mozilla-central/rev/1ebd2eff44617df3b82eea7d2f3ca1b60cc591a0/modules/libpref/Preferences.cpp#3907-3920

There is also some MozHarness code relating to it here:
http://searchfox.org/mozilla-central/source/testing/mozharness/mozharness/mozilla/firefox/autoconfig.py

Just to check: is this still supported functionality?

Thanks.

Nick

Marco Castelluccio

unread,
Oct 31, 2017, 6:22:50 AM10/31/17
to Nicholas Nethercote, dev-platform
It is not covered by any automated test:
https://codecov.io/gh/marco-c/gecko-dev/src/9ca76dcb7a5c61d33750e9718c02b11ba35c1032/extensions/pref/autoconfig/src/nsAutoConfig.cpp
(this doesn't mean it isn't actually used ever, but it can be a clue).

- Marco.

Masatoshi Kimura

unread,
Oct 31, 2017, 6:39:24 AM10/31/17
to dev-pl...@lists.mozilla.org
On 2017/10/31 19:22, Marco Castelluccio wrote:
> It is not covered by any automated test:
> https://codecov.io/gh/marco-c/gecko-dev/src/9ca76dcb7a5c61d33750e9718c02b11ba35c1032/extensions/pref/autoconfig/src/nsAutoConfig.cpp
> (this doesn't mean it isn't actually used ever, but it can be a clue).

Actually I wrote an automated test, although it is difficult for
coverage tools to find the usage:
https://bugzilla.mozilla.org/show_bug.cgi?id=1267567

Marco Castelluccio

unread,
Oct 31, 2017, 8:11:24 AM10/31/17
to Masatoshi Kimura, dev-pl...@lists.mozilla.org
Are you sure the test you wrote is testing nsAutoConfig and not
nsReadConfig?

nsReadConfig does not instantiate nsAutoConfig unless
autoadmin.global_config_url exists and is not emtpy:

https://codecov.io/gh/marco-c/gecko-dev/src/9ca76dcb7a5c61d33750e9718c02b11ba35c1032/extensions/pref/autoconfig/src/nsReadConfig.cpp#L205

https://dxr.mozilla.org/mozilla-central/rev/1c618b1a13662de7cec429f606367db3827b6dc7/extensions/pref/autoconfig/src/nsReadConfig.cpp#208

- Marco.

mka...@mozilla.com

unread,
Oct 31, 2017, 11:22:06 AM10/31/17
to
Yes, this is very much supported functionality. It is our primary means of enterprise customization right now.

The reason there are very few tests is because when it was first developed, it wasn't possible to write tests that involved putting down files before startup. There are some tests now:

http://searchfox.org/mozilla-central/source/extensions/pref/autoconfig/test/unit

Mike Kaply

Nicholas Nethercote

unread,
Oct 31, 2017, 4:53:23 PM10/31/17
to mka...@mozilla.com, dev-platform
Thank you for the info! I will leave that code alone :)

Nick
> _______________________________________________
> dev-platform mailing list
> dev-pl...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>

mcaste...@mozilla.com

unread,
Nov 1, 2017, 1:04:21 PM11/1/17
to
Hey Mike,
according to our code coverage report, nsAutoConfig is never executed during tests.

As far as I can see, it is actually not tested, as the test you mentioned is not setting the autoadmin.global_config_url pref that would make nsReadConfig instantiate nsAutoConfig. Is that correct?

I'd like to understand whether this is a problem in our coverage collection tools that are not picking up this file for some reason or if it actually is not tested. I've opened https://bugzilla.mozilla.org/show_bug.cgi?id=1413600.

- Marco.

Mike Kaply

unread,
Nov 1, 2017, 1:09:28 PM11/1/17
to mcaste...@mozilla.com, dev-pl...@lists.mozilla.org
I didn't write the test, so I honestly don't know. I'll try to make time to
take a look.

Mike
0 new messages