On firefox 3.7a4, following code throws a exception:

Components.classes["@mozilla.org/preferences;1"]
  .getService(Components.interfaces.nsIPref);

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

 var pref = Components.classes["@mozilla.org/preferences;1"]
  .getService(Components.interfaces.nsIPref);
 var branch = pref.getBranch("browser");

shall be replaced with

 var pref = Components.classes["@mozilla.org/preferences-service;1"]
  .getService(Components.interfaces.nsIPrefService);
 var branch = pref.getBranch("browser");

Example#2

nsIPref#getBoolPref -> nsIPrefBranch#getBoolPref

 var pref = Components.classes["@mozilla.org/preferences;1"]
  .getService(Components.interfaces.nsIPref);
 var autoHide = pref.getBoolPref("browser.tabs.autoHide");

shall be replaced with

 var pref = Components.classes["@mozilla.org/preferences-service;1"]
  .getService(Components.interfaces.nsIPrefBranch);
 var autoHide = pref.getBoolPref("browser.tabs.autoHide");

See Also