nsIPref is deprecated and removed on Firefox 3.7
On firefox 3.7a4, following code throws a exception:
Thrown exception is:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80570018 (NS_ERROR_XPC_BAD_IID) [nsIJSCID.getService]" nsresult: "0x80570018 (NS_ERROR_XPC_BAD_IID)" location: ...]
Components.interfaces.nsIPref
is removed on Firefox 3.7. And extension javascript code should use nsIPrefService
and/or nsIPrefBranch
instead of nsIPref
. nsIPref
methods are moved to nsIPrefService
or nsIPrefBranch
. There seems to be no method name change.
Note: nsIPrefService
and nsIPrefBranch
is forzen.
In addition, class Components.classes["@mozilla.org/preferences;1"]
is also deprecated. Components.classes["@mozilla.org/preferences-service;1"]
is preferred.
I found this fact when I try to change User-Agent with Configuration Mania dialog on Firefox 3.7a4. Today this issue is fixed (changeset:d644b9eacaad).
Example#1
nsIPref#getBranch
-> nsIPrefService#getBranch
shall be replaced with
Example#2
nsIPref#getBoolPref
-> nsIPrefBranch#getBoolPref
shall be replaced with
See Also
- Preferences - MDC
- nsIPrefはFirefox 3.7以降では利用できません - Mozilla Developer Street (japanese)
- Bug 524449 – Remove nsIPref from tree