Search code examples
exceptionxulpreference

Firefox add-on's weird behaviour


I have a preference entry and use below statement to access it's content

var st = easyfa.branch.getComplexValue("mapstr",Components.interfaces.nsIPrefLocalizedString).data; 

this throws exception:

*Component returned failure code: 0x804b000a (NS_ERROR_MALFORMED_URI) [nsIPrefBranch.getComplexValue]*

But after setting value of the preference manually (by entering about:config) the error disappears!?


Solution

  • The default value of a localised preference must be a chrome URL to a .properties file, in which the preference is looked up to locate the resulting string. Assuming the URL points to a locale file, this allows the value to change depending on the installed language.

    However you seem to want a simple string preference, which you should retrieve using the nsISupportsString interface.