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

前端 未结 2 588
日久生厌
日久生厌 2021-01-13 00:49

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

相关标签:
2条回答
  • 2021-01-13 01:11

    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

    0 讨论(0)
  • 2021-01-13 01:13

    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!

    0 讨论(0)
提交回复
热议问题