Firefox - Adding preferences
Adding preferences isn’t too hard. I followed the instructions here. I had several problems of my own making plus one in the example code. The example code problem was:
var gMyPrefs = new PrefsWrapper(”extensions.myextension.”);
PrefsWrapper needed a number “1″ appended:
var gMyPrefs = new PrefsWrapper1(”extensions.myextension.”);
The other minor problem was “myextension” and “yourextension” needs to be “sparkrocket”.
The problems of my own making were a miss-understanding of javascript. At first I added the example code at the global scope but nothing would happen. After a little while of adding debug I figured out I needed to not have the example code at the global scope, but it needed to be in sr_initialize. I could then execute the code from prefsutils.js.
Also, the prompt service described here is similar but different from “prompt()” builtin function which also prompts for input but I couldn’t find the docs for it so I used the prompt service.
Finally, after adding the setUnicharPref I couldn’t unset it, at first I thought it would replace the defaults/preferences/extensions.js value for user.name. But no, that is just the default, the value is actually stored in ~/.mozilla/firefox/fbgu8siq.default/prefs.js and can be modified by going to the url “about:config”.