nsresult rv;  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr<nsISupportsWString> theString = do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) { theString->SetData(value); rv = prefBranch->SetComplexValue(pref, NS_GET_IID(nsISupportsWString), theString); } } return rv;
if (NS_FAILED(SecurePrefCheck(pref))) return NS_ERROR_FAILURE; return SetCharPref(pref, NS_ConvertUCS2toUTF8(value).get());
NS_IMETHODIMP nsPref::SetUnicharPref(const char *pref, const PRUnichar *value){  nsresult rv;  nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mPrefService, &rv);  if (NS_SUCCEEDED(rv)) {    nsCOMPtr<nsISupportsWString> theString = do_CreateInstance(NS_SUPPORTS_WSTRING_CONTRACTID, &rv);    if (NS_SUCCEEDED(rv)) {      theString->SetData(value);      rv = prefBranch->SetComplexValue(pref, NS_GET_IID(nsISupportsWString), theString);    }  }  return rv;}