Felipe
Felipe

Reputation: 147

A Firefox extension that changes a value in the about:config

I've been searching far and wide through the web for some tiny bit of light, but found nothing. I need to create a Firefox extension that, among a few other things, changes the value of one of the about:config variables. None of the tutorials I've found covers that issue, so I don't know where to start. Can anyone throw me a link, or some lines of code or explanation, just to help me get started? Thanks in advance.

Upvotes: 12

Views: 6504

Answers (2)

Erik Nedwidek
Erik Nedwidek

Reputation: 6184

Firefox 57 and newer (WebExtensions)

Not possible, details in Is it possible to create a Firefox WebExtension that changes about:config settings? How?

Old Firefox (legacy extensions)

The about:config values are accessed via the preferences system. The reason you preface your extension's prefs with extensions.myextension is because you need to make sure you don't collide with Firefox's or another extension's preferences.

To get a firefox preference just use the same preference name as you see in about:config. If you notice, you'll see that you also see all of the extension prefs in about:config too.

https://developer.mozilla.org/en/XUL_School/Handling_Preferences * https://developer.mozilla.org/en/Code_snippets/Preferences

Upvotes: 9

theGleep
theGleep

Reputation: 1187

If you are using bootstrap, this should do what you're looking for:

prefs = require("sdk/preferences/service");
prefs.set("extensions." + extensionName + ".sdk.console.logLevel", "all");

It might not be the most elegant solution - but you can comment out the code before you publish.

If anyone finds a better way, please let me know!

Upvotes: 0

Related Questions