Question

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!?

Was it helpful?

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.

OTHER TIPS

Getting the value of a preference that isn't set will always throw. You have to wrap it in a try-catch block and handle it accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top