Search code examples
firefoxfirefox-addonpreferences

Maximum length of a String Preference in Firefox?


I would like to know what is the maximum length of a String when saving in the classic preferences System:

var prefs = Components.classes["@mozilla.org/preferences-service;1"]
                .getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref("com.exemple.namespace.preference", potentiallyLongString);

Couldn't find it in official documentation.

Note: I tried to type in more than 255, it works on Firefox 3.6, but I'm looking for a documented answer which would certify that length L works since version V.


Solution

  • There's no documentation on that. You shouldn't store unreasonably large strings in prefs -- if you're not sure if it will be reasonable, it's likely not a pref.