зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1384835 (part 1, attempt 2) - Use nsA[C]String references instead of pointers for outparams of Get*String() pref functions. r=froydnj.
--HG-- extra : rebase_source : fe566945a55c281d8290634a5b55bed19415c839
This commit is contained in:
Родитель
45948ad968
Коммит
581214bd8b
|
@ -13291,24 +13291,24 @@ nsDocument::PrincipalFlashClassification()
|
|||
denyTables, denyExceptionsTables,
|
||||
subDocDenyTables, subDocDenyExceptionsTables,
|
||||
tables;
|
||||
Preferences::GetCString("urlclassifier.flashAllowTable", &allowTables);
|
||||
Preferences::GetCString("urlclassifier.flashAllowTable", allowTables);
|
||||
MaybeAddTableToTableList(allowTables, tables);
|
||||
Preferences::GetCString("urlclassifier.flashAllowExceptTable",
|
||||
&allowExceptionsTables);
|
||||
allowExceptionsTables);
|
||||
MaybeAddTableToTableList(allowExceptionsTables, tables);
|
||||
Preferences::GetCString("urlclassifier.flashTable", &denyTables);
|
||||
Preferences::GetCString("urlclassifier.flashTable", denyTables);
|
||||
MaybeAddTableToTableList(denyTables, tables);
|
||||
Preferences::GetCString("urlclassifier.flashExceptTable",
|
||||
&denyExceptionsTables);
|
||||
denyExceptionsTables);
|
||||
MaybeAddTableToTableList(denyExceptionsTables, tables);
|
||||
|
||||
bool isThirdPartyDoc = IsThirdParty();
|
||||
if (isThirdPartyDoc) {
|
||||
Preferences::GetCString("urlclassifier.flashSubDocTable",
|
||||
&subDocDenyTables);
|
||||
subDocDenyTables);
|
||||
MaybeAddTableToTableList(subDocDenyTables, tables);
|
||||
Preferences::GetCString("urlclassifier.flashSubDocExceptTable",
|
||||
&subDocDenyExceptionsTables);
|
||||
subDocDenyExceptionsTables);
|
||||
MaybeAddTableToTableList(subDocDenyExceptionsTables, tables);
|
||||
}
|
||||
|
||||
|
|
|
@ -3540,8 +3540,8 @@ nsObjectLoadingContent::FavorFallbackMode(bool aIsPluginClickToPlay) {
|
|||
return false;
|
||||
}
|
||||
|
||||
nsCString prefString;
|
||||
if (NS_SUCCEEDED(Preferences::GetCString(kPrefFavorFallbackMode, &prefString))) {
|
||||
nsAutoCString prefString;
|
||||
if (NS_SUCCEEDED(Preferences::GetCString(kPrefFavorFallbackMode, prefString))) {
|
||||
if (aIsPluginClickToPlay &&
|
||||
prefString.EqualsLiteral("follow-ctp")) {
|
||||
return true;
|
||||
|
@ -3567,8 +3567,8 @@ nsObjectLoadingContent::HasGoodFallback() {
|
|||
}
|
||||
|
||||
nsTArray<nsCString> rulesList;
|
||||
nsCString prefString;
|
||||
if (NS_SUCCEEDED(Preferences::GetCString(kPrefFavorFallbackRules, &prefString))) {
|
||||
nsAutoCString prefString;
|
||||
if (NS_SUCCEEDED(Preferences::GetCString(kPrefFavorFallbackRules, prefString))) {
|
||||
ParseString(prefString, ',', rulesList);
|
||||
}
|
||||
|
||||
|
|
|
@ -307,7 +307,7 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
|||
|
||||
nsAutoString ret;
|
||||
if (overridePref) {
|
||||
nsresult res = Preferences::GetString(overridePref, &ret);
|
||||
nsresult res = Preferences::GetString(overridePref, ret);
|
||||
if (NS_SUCCEEDED(res) && ret.Length() > 0)
|
||||
hasRetVal = true;
|
||||
}
|
||||
|
|
|
@ -613,7 +613,7 @@ void
|
|||
CSSEditUtils::GetDefaultBackgroundColor(nsAString& aColor)
|
||||
{
|
||||
if (Preferences::GetBool("editor.use_custom_colors", false)) {
|
||||
nsresult rv = Preferences::GetString("editor.background_color", &aColor);
|
||||
nsresult rv = Preferences::GetString("editor.background_color", aColor);
|
||||
// XXX Why don't you validate the pref value?
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("failed to get editor.background_color");
|
||||
|
@ -627,7 +627,7 @@ CSSEditUtils::GetDefaultBackgroundColor(nsAString& aColor)
|
|||
}
|
||||
|
||||
nsresult rv =
|
||||
Preferences::GetString("browser.display.background_color", &aColor);
|
||||
Preferences::GetString("browser.display.background_color", aColor);
|
||||
// XXX Why don't you validate the pref value?
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("failed to get browser.display.background_color");
|
||||
|
@ -640,7 +640,7 @@ void
|
|||
CSSEditUtils::GetDefaultLengthUnit(nsAString& aLengthUnit)
|
||||
{
|
||||
nsresult rv =
|
||||
Preferences::GetString("editor.css.default_length_unit", &aLengthUnit);
|
||||
Preferences::GetString("editor.css.default_length_unit", aLengthUnit);
|
||||
// XXX Why don't you validate the pref value?
|
||||
if (NS_FAILED(rv)) {
|
||||
aLengthUnit.AssignLiteral("px");
|
||||
|
|
|
@ -1825,8 +1825,8 @@ gfxPlatform::GetContentBackendPref(uint32_t &aBackendBitmask)
|
|||
gfxPlatform::GetBackendPref(const char* aBackendPrefName, uint32_t &aBackendBitmask)
|
||||
{
|
||||
nsTArray<nsCString> backendList;
|
||||
nsCString prefString;
|
||||
if (NS_SUCCEEDED(Preferences::GetCString(aBackendPrefName, &prefString))) {
|
||||
nsAutoCString prefString;
|
||||
if (NS_SUCCEEDED(Preferences::GetCString(aBackendPrefName, prefString))) {
|
||||
ParseString(prefString, ',', backendList);
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ std::string gfxPrefs::PrefGet(const char* aPref, std::string aDefault)
|
|||
MOZ_ASSERT(IsPrefsServiceAvailable());
|
||||
|
||||
nsAdoptingCString result;
|
||||
Preferences::GetCString(aPref, &result);
|
||||
Preferences::GetCString(aPref, result);
|
||||
|
||||
if (result.IsEmpty()) {
|
||||
return aDefault;
|
||||
|
|
|
@ -95,7 +95,7 @@ ReadRequestedLocales(nsTArray<nsCString>& aRetVal)
|
|||
}
|
||||
|
||||
// Otherwise, we'll try to get the requested locale from the prefs.
|
||||
if (!NS_SUCCEEDED(Preferences::GetCString(SELECTED_LOCALE_PREF, &locale))) {
|
||||
if (!NS_SUCCEEDED(Preferences::GetCString(SELECTED_LOCALE_PREF, locale))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -512,12 +512,12 @@ LocaleService::IsAppLocaleRTL()
|
|||
// the locale. If that isn't set, default to left-to-right.
|
||||
nsAutoCString prefString = NS_LITERAL_CSTRING("intl.uidirection.") + locale;
|
||||
nsAutoCString dir;
|
||||
Preferences::GetCString(prefString.get(), &dir);
|
||||
Preferences::GetCString(prefString.get(), dir);
|
||||
if (dir.IsEmpty()) {
|
||||
int32_t hyphen = prefString.FindChar('-');
|
||||
if (hyphen >= 1) {
|
||||
prefString.Truncate(hyphen);
|
||||
Preferences::GetCString(prefString.get(), &dir);
|
||||
Preferences::GetCString(prefString.get(), dir);
|
||||
}
|
||||
}
|
||||
return dir.EqualsLiteral("rtl");
|
||||
|
|
|
@ -154,7 +154,7 @@ NS_IMETHODIMP nsTextToSubURI::UnEscapeURIForUI(const nsACString & aCharset,
|
|||
if (mUnsafeChars.IsEmpty()) {
|
||||
nsAdoptingString blacklist;
|
||||
nsresult rv = mozilla::Preferences::GetString("network.IDN.blacklist_chars",
|
||||
&blacklist);
|
||||
blacklist);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// we allow SPACE and IDEOGRAPHIC SPACE in this method
|
||||
blacklist.StripChars(u" \u3000");
|
||||
|
|
|
@ -59,7 +59,9 @@ static WebRtcTraceCallback gWebRtcCallback;
|
|||
// For LOG()
|
||||
static mozilla::StaticAutoPtr<LogSinkImpl> sSink;
|
||||
|
||||
void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, nsACString *aAECLogDir, bool *aMultiLog)
|
||||
void
|
||||
GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString& aLogFile,
|
||||
nsACString& aAECLogDir, bool *aMultiLog)
|
||||
{
|
||||
*aMultiLog = mozilla::Preferences::GetBool("media.webrtc.debug.multi_log");
|
||||
*aTraceMask = mozilla::Preferences::GetUint("media.webrtc.debug.trace_mask");
|
||||
|
@ -217,7 +219,7 @@ void StartWebRtcLog(uint32_t log_level)
|
|||
nsAutoCString log_file;
|
||||
nsAutoCString aec_log_dir;
|
||||
|
||||
GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
|
||||
GetWebRtcLogPrefs(&trace_mask, log_file, aec_log_dir, &multi_log);
|
||||
mozilla::LogLevel level = CheckOverrides(&trace_mask, &log_file, &multi_log);
|
||||
|
||||
if (trace_mask == 0) {
|
||||
|
@ -239,7 +241,7 @@ void EnableWebRtcLog()
|
|||
nsAutoCString log_file;
|
||||
nsAutoCString aec_log_dir;
|
||||
|
||||
GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
|
||||
GetWebRtcLogPrefs(&trace_mask, log_file, aec_log_dir, &multi_log);
|
||||
mozilla::LogLevel level = CheckOverrides(&trace_mask, &log_file, &multi_log);
|
||||
ConfigWebRtcLog(level, trace_mask, log_file, aec_log_dir, multi_log);
|
||||
}
|
||||
|
@ -295,7 +297,7 @@ void StartAecLog()
|
|||
nsAutoCString log_file;
|
||||
nsAutoCString aec_log_dir;
|
||||
|
||||
GetWebRtcLogPrefs(&trace_mask, &log_file, &aec_log_dir, &multi_log);
|
||||
GetWebRtcLogPrefs(&trace_mask, log_file, aec_log_dir, &multi_log);
|
||||
CheckOverrides(&trace_mask, &log_file, &multi_log);
|
||||
ConfigAecLog(aec_log_dir);
|
||||
|
||||
|
|
|
@ -1679,34 +1679,32 @@ nsAdoptingString
|
|||
Preferences::GetString(const char* aPref)
|
||||
{
|
||||
nsAdoptingString result;
|
||||
GetString(aPref, &result);
|
||||
GetString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetCString(const char* aPref, nsACString* aResult)
|
||||
Preferences::GetCString(const char* aPref, nsACString& aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsAutoCString result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aResult = result;
|
||||
aResult = result;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetString(const char* aPref, nsAString* aResult)
|
||||
Preferences::GetString(const char* aPref, nsAString& aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsAutoCString result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF8toUTF16(result, *aResult);
|
||||
CopyUTF8toUTF16(result, aResult);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -1716,7 +1714,7 @@ nsAdoptingCString
|
|||
Preferences::GetLocalizedCString(const char* aPref)
|
||||
{
|
||||
nsAdoptingCString result;
|
||||
GetLocalizedCString(aPref, &result);
|
||||
GetLocalizedCString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1725,28 +1723,26 @@ nsAdoptingString
|
|||
Preferences::GetLocalizedString(const char* aPref)
|
||||
{
|
||||
nsAdoptingString result;
|
||||
GetLocalizedString(aPref, &result);
|
||||
GetLocalizedString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetLocalizedCString(const char* aPref, nsACString* aResult)
|
||||
Preferences::GetLocalizedCString(const char* aPref, nsACString& aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
||||
nsAutoString result;
|
||||
nsresult rv = GetLocalizedString(aPref, &result);
|
||||
nsresult rv = GetLocalizedString(aPref, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF16toUTF8(result, *aResult);
|
||||
CopyUTF16toUTF8(result, aResult);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetLocalizedString(const char* aPref, nsAString* aResult)
|
||||
Preferences::GetLocalizedString(const char* aPref, nsAString& aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsCOMPtr<nsIPrefLocalizedString> prefLocalString;
|
||||
nsresult rv = sRootBranch->GetComplexValue(aPref,
|
||||
|
@ -1754,7 +1750,7 @@ Preferences::GetLocalizedString(const char* aPref, nsAString* aResult)
|
|||
getter_AddRefs(prefLocalString));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_ASSERTION(prefLocalString, "Succeeded but the result is NULL");
|
||||
prefLocalString->GetData(getter_Copies(*aResult));
|
||||
prefLocalString->GetData(getter_Copies(aResult));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -2198,28 +2194,26 @@ Preferences::GetDefaultInt(const char* aPref, int32_t* aResult)
|
|||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetDefaultCString(const char* aPref, nsACString* aResult)
|
||||
Preferences::GetDefaultCString(const char* aPref, nsACString& aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsAutoCString result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), true);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aResult = result;
|
||||
aResult = result;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetDefaultString(const char* aPref, nsAString* aResult)
|
||||
Preferences::GetDefaultString(const char* aPref, nsAString& aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "aResult must not be NULL");
|
||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsAutoCString result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), true);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF8toUTF16(result, *aResult);
|
||||
CopyUTF8toUTF16(result, aResult);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -2227,12 +2221,12 @@ Preferences::GetDefaultString(const char* aPref, nsAString* aResult)
|
|||
// static
|
||||
nsresult
|
||||
Preferences::GetDefaultLocalizedCString(const char* aPref,
|
||||
nsACString* aResult)
|
||||
nsACString& aResult)
|
||||
{
|
||||
nsAutoString result;
|
||||
nsresult rv = GetDefaultLocalizedString(aPref, &result);
|
||||
nsresult rv = GetDefaultLocalizedString(aPref, result);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CopyUTF16toUTF8(result, *aResult);
|
||||
CopyUTF16toUTF8(result, aResult);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -2240,7 +2234,7 @@ Preferences::GetDefaultLocalizedCString(const char* aPref,
|
|||
// static
|
||||
nsresult
|
||||
Preferences::GetDefaultLocalizedString(const char* aPref,
|
||||
nsAString* aResult)
|
||||
nsAString& aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsCOMPtr<nsIPrefLocalizedString> prefLocalString;
|
||||
|
@ -2250,7 +2244,7 @@ Preferences::GetDefaultLocalizedString(const char* aPref,
|
|||
getter_AddRefs(prefLocalString));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_ASSERTION(prefLocalString, "Succeeded but the result is NULL");
|
||||
prefLocalString->GetData(getter_Copies(*aResult));
|
||||
prefLocalString->GetData(getter_Copies(aResult));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -2260,7 +2254,7 @@ nsAdoptingString
|
|||
Preferences::GetDefaultString(const char* aPref)
|
||||
{
|
||||
nsAdoptingString result;
|
||||
GetDefaultString(aPref, &result);
|
||||
GetDefaultString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2278,7 +2272,7 @@ nsAdoptingString
|
|||
Preferences::GetDefaultLocalizedString(const char* aPref)
|
||||
{
|
||||
nsAdoptingString result;
|
||||
GetDefaultLocalizedString(aPref, &result);
|
||||
GetDefaultLocalizedString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2287,7 +2281,7 @@ nsAdoptingCString
|
|||
Preferences::GetDefaultLocalizedCString(const char* aPref)
|
||||
{
|
||||
nsAdoptingCString result;
|
||||
GetDefaultLocalizedCString(aPref, &result);
|
||||
GetDefaultLocalizedCString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -199,13 +199,12 @@ public:
|
|||
* Gets string type pref value with raw return value of nsIPrefBranch.
|
||||
*
|
||||
* @param aPref A pref name.
|
||||
* @param aResult Must not be nullptr. The value is never modified
|
||||
* when these methods fail.
|
||||
* @param aResult The value is never modified when these methods fail.
|
||||
*/
|
||||
static nsresult GetCString(const char* aPref, nsACString* aResult);
|
||||
static nsresult GetString(const char* aPref, nsAString* aResult);
|
||||
static nsresult GetLocalizedCString(const char* aPref, nsACString* aResult);
|
||||
static nsresult GetLocalizedString(const char* aPref, nsAString* aResult);
|
||||
static nsresult GetCString(const char* aPref, nsACString& aResult);
|
||||
static nsresult GetString(const char* aPref, nsAString& aResult);
|
||||
static nsresult GetLocalizedCString(const char* aPref, nsACString& aResult);
|
||||
static nsresult GetLocalizedString(const char* aPref, nsAString& aResult);
|
||||
|
||||
static nsresult GetComplex(const char* aPref, const nsIID &aType,
|
||||
void** aResult);
|
||||
|
@ -393,12 +392,12 @@ public:
|
|||
static nsAdoptingString GetDefaultLocalizedString(const char* aPref);
|
||||
static nsAdoptingCString GetDefaultLocalizedCString(const char* aPref);
|
||||
|
||||
static nsresult GetDefaultCString(const char* aPref, nsACString* aResult);
|
||||
static nsresult GetDefaultString(const char* aPref, nsAString* aResult);
|
||||
static nsresult GetDefaultCString(const char* aPref, nsACString& aResult);
|
||||
static nsresult GetDefaultString(const char* aPref, nsAString& aResult);
|
||||
static nsresult GetDefaultLocalizedCString(const char* aPref,
|
||||
nsACString* aResult);
|
||||
nsACString& aResult);
|
||||
static nsresult GetDefaultLocalizedString(const char* aPref,
|
||||
nsAString* aResult);
|
||||
nsAString& aResult);
|
||||
|
||||
static nsresult GetDefaultComplex(const char* aPref, const nsIID &aType,
|
||||
void** aResult);
|
||||
|
|
|
@ -152,7 +152,7 @@ GetDeviceModelId() {
|
|||
deviceModelId = NS_LossyConvertUTF16toASCII(androidDevice);
|
||||
}
|
||||
nsAutoCString deviceString;
|
||||
rv = Preferences::GetCString(UA_PREF("device_string"), &deviceString);
|
||||
rv = Preferences::GetCString(UA_PREF("device_string"), deviceString);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
deviceString.Trim(" ", true, true);
|
||||
deviceString.ReplaceSubstring(NS_LITERAL_CSTRING("%DEVICEID%"), deviceModelId);
|
||||
|
@ -990,8 +990,8 @@ nsHttpHandler::InitUserAgentComponents()
|
|||
{
|
||||
// Add the `Mobile` or `Tablet` or `TV` token when running in the b2g
|
||||
// desktop simulator via preference.
|
||||
nsCString deviceType;
|
||||
nsresult rv = Preferences::GetCString("devtools.useragent.device_type", &deviceType);
|
||||
nsAutoCString deviceType;
|
||||
nsresult rv = Preferences::GetCString("devtools.useragent.device_type", deviceType);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mCompatDevice.Assign(deviceType);
|
||||
} else {
|
||||
|
|
|
@ -1714,9 +1714,9 @@ void
|
|||
nsSSLIOLayerHelpers::initInsecureFallbackSites()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsCString insecureFallbackHosts;
|
||||
nsAutoCString insecureFallbackHosts;
|
||||
Preferences::GetCString("security.tls.insecure_fallback_hosts",
|
||||
&insecureFallbackHosts);
|
||||
insecureFallbackHosts);
|
||||
setInsecureFallbackSites(insecureFallbackHosts);
|
||||
}
|
||||
|
||||
|
@ -1742,8 +1742,8 @@ NS_IMETHODIMP
|
|||
FallbackPrefRemover::Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsCString oldValue;
|
||||
Preferences::GetCString("security.tls.insecure_fallback_hosts", &oldValue);
|
||||
nsAutoCString oldValue;
|
||||
Preferences::GetCString("security.tls.insecure_fallback_hosts", oldValue);
|
||||
nsCCharSeparatedTokenizer toker(oldValue, ',');
|
||||
nsCString newValue;
|
||||
while (toker.hasMoreTokens()) {
|
||||
|
@ -1944,7 +1944,8 @@ UserCertChoice
|
|||
nsGetUserCertChoice()
|
||||
{
|
||||
nsAutoCString value;
|
||||
nsresult rv = Preferences::GetCString("security.default_personal_cert", &value);
|
||||
nsresult rv =
|
||||
Preferences::GetCString("security.default_personal_cert", value);
|
||||
if (NS_FAILED(rv)) {
|
||||
return UserCertChoice::Ask;
|
||||
}
|
||||
|
|
|
@ -622,7 +622,7 @@ GenerateType3Msg(const nsString &domain,
|
|||
// (do not use local machine's hostname after bug 1046421)
|
||||
//
|
||||
rv = mozilla::Preferences::GetCString("network.generic-ntlm-auth.workstation",
|
||||
&hostBuf);
|
||||
hostBuf);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -335,12 +335,12 @@ PendingDBLookup::LookupSpecInternal(const nsACString& aSpec)
|
|||
|
||||
nsAutoCString tables;
|
||||
nsAutoCString allowlist;
|
||||
Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, &allowlist);
|
||||
Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, allowlist);
|
||||
if (!allowlist.IsEmpty()) {
|
||||
tables.Append(allowlist);
|
||||
}
|
||||
nsAutoCString blocklist;
|
||||
Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, &blocklist);
|
||||
Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, blocklist);
|
||||
if (!mAllowlistOnly && !blocklist.IsEmpty()) {
|
||||
tables.Append(',');
|
||||
tables.Append(blocklist);
|
||||
|
@ -356,7 +356,7 @@ PendingDBLookup::HandleEvent(const nsACString& tables)
|
|||
// 2) PendingLookup::LookupNext if the URL does not match the blocklist.
|
||||
// Blocklisting trumps allowlisting.
|
||||
nsAutoCString blockList;
|
||||
Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, &blockList);
|
||||
Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE, blockList);
|
||||
if (!mAllowlistOnly && FindInReadable(blockList, tables)) {
|
||||
mPendingLookup->mBlocklistCount++;
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, BLOCK_LIST);
|
||||
|
@ -366,7 +366,7 @@ PendingDBLookup::HandleEvent(const nsACString& tables)
|
|||
}
|
||||
|
||||
nsAutoCString allowList;
|
||||
Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, &allowList);
|
||||
Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE, allowList);
|
||||
if (FindInReadable(allowList, tables)) {
|
||||
mPendingLookup->mAllowlistCount++;
|
||||
Accumulate(mozilla::Telemetry::APPLICATION_REPUTATION_LOCAL, ALLOW_LIST);
|
||||
|
@ -1255,8 +1255,8 @@ PendingLookup::SendRemoteQueryInternal()
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
// If the remote lookup URL is empty or absent, bail.
|
||||
nsCString serviceUrl;
|
||||
NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_SB_APP_REP_URL, &serviceUrl),
|
||||
nsAutoCString serviceUrl;
|
||||
NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_SB_APP_REP_URL, serviceUrl),
|
||||
NS_ERROR_NOT_AVAILABLE);
|
||||
if (serviceUrl.IsEmpty()) {
|
||||
LOG(("Remote lookup URL is empty [this = %p]", this));
|
||||
|
@ -1268,7 +1268,7 @@ PendingLookup::SendRemoteQueryInternal()
|
|||
{
|
||||
nsAutoCString table;
|
||||
NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_DOWNLOAD_BLOCK_TABLE,
|
||||
&table),
|
||||
table),
|
||||
NS_ERROR_NOT_AVAILABLE);
|
||||
if (table.IsEmpty()) {
|
||||
LOG(("Blocklist is empty [this = %p]", this));
|
||||
|
@ -1278,7 +1278,7 @@ PendingLookup::SendRemoteQueryInternal()
|
|||
{
|
||||
nsAutoCString table;
|
||||
NS_ENSURE_SUCCESS(Preferences::GetCString(PREF_DOWNLOAD_ALLOW_TABLE,
|
||||
&table),
|
||||
table),
|
||||
NS_ERROR_NOT_AVAILABLE);
|
||||
if (table.IsEmpty()) {
|
||||
LOG(("Allowlist is empty [this = %p]", this));
|
||||
|
|
|
@ -148,7 +148,7 @@ ExtensionPolicyService::BaseCSP(nsAString& aBaseCSP) const
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = Preferences::GetString("extensions.webextensions.base-content-security-policy", &aBaseCSP);
|
||||
rv = Preferences::GetString("extensions.webextensions.base-content-security-policy", aBaseCSP);
|
||||
if (NS_FAILED(rv)) {
|
||||
aBaseCSP.AssignLiteral(DEFAULT_BASE_CSP);
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ ExtensionPolicyService::DefaultCSP(nsAString& aDefaultCSP) const
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = Preferences::GetString("extensions.webextensions.default-content-security-policy", &aDefaultCSP);
|
||||
rv = Preferences::GetString("extensions.webextensions.default-content-security-policy", aDefaultCSP);
|
||||
if (NS_FAILED(rv)) {
|
||||
aDefaultCSP.AssignLiteral(DEFAULT_DEFAULT_CSP);
|
||||
}
|
||||
|
|
|
@ -1532,46 +1532,46 @@ nsUrlClassifierDBService::ReadTablesFromPrefs()
|
|||
mCheckBlockedURIs = Preferences::GetBool(CHECK_BLOCKED_PREF,
|
||||
CHECK_BLOCKED_DEFAULT);
|
||||
|
||||
nsCString allTables;
|
||||
nsCString tables;
|
||||
nsAutoCString allTables;
|
||||
nsAutoCString tables;
|
||||
|
||||
mBaseTables.Truncate();
|
||||
mTrackingProtectionTables.Truncate();
|
||||
|
||||
Preferences::GetCString(PHISH_TABLE_PREF, &allTables);
|
||||
Preferences::GetCString(PHISH_TABLE_PREF, allTables);
|
||||
if (mCheckPhishing) {
|
||||
AppendTables(allTables, mBaseTables);
|
||||
}
|
||||
|
||||
Preferences::GetCString(MALWARE_TABLE_PREF, &tables);
|
||||
Preferences::GetCString(MALWARE_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
if (mCheckMalware) {
|
||||
AppendTables(tables, mBaseTables);
|
||||
}
|
||||
|
||||
Preferences::GetCString(BLOCKED_TABLE_PREF, &tables);
|
||||
Preferences::GetCString(BLOCKED_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
if (mCheckBlockedURIs) {
|
||||
AppendTables(tables, mBaseTables);
|
||||
}
|
||||
|
||||
Preferences::GetCString(DOWNLOAD_BLOCK_TABLE_PREF, &tables);
|
||||
Preferences::GetCString(DOWNLOAD_BLOCK_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
|
||||
Preferences::GetCString(DOWNLOAD_ALLOW_TABLE_PREF, &tables);
|
||||
Preferences::GetCString(DOWNLOAD_ALLOW_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
|
||||
Preferences::GetCString(TRACKING_TABLE_PREF, &tables);
|
||||
Preferences::GetCString(TRACKING_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
AppendTables(tables, mTrackingProtectionTables);
|
||||
|
||||
Preferences::GetCString(TRACKING_WHITELIST_TABLE_PREF, &tables);
|
||||
Preferences::GetCString(TRACKING_WHITELIST_TABLE_PREF, tables);
|
||||
AppendTables(tables, allTables);
|
||||
AppendTables(tables, mTrackingProtectionTables);
|
||||
|
||||
Classifier::SplitTables(allTables, mGethashTables);
|
||||
|
||||
Preferences::GetCString(DISALLOW_COMPLETION_TABLE_PREF, &tables);
|
||||
Preferences::GetCString(DISALLOW_COMPLETION_TABLE_PREF, tables);
|
||||
Classifier::SplitTables(tables, mDisallowCompletionsTables);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -751,7 +751,7 @@ GetContentProcessSandboxTempDir()
|
|||
|
||||
nsAutoString tempDirSuffix;
|
||||
rv = Preferences::GetString("security.sandbox.content.tempDirSuffix",
|
||||
&tempDirSuffix);
|
||||
tempDirSuffix);
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) || tempDirSuffix.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ nsOSHelperAppService::GetFileLocation(const char* aPrefName,
|
|||
pref. If we do not, we don't care.
|
||||
*/
|
||||
if (Preferences::HasUserValue(aPrefName) &&
|
||||
NS_SUCCEEDED(Preferences::GetString(aPrefName, &aFileLocation))) {
|
||||
NS_SUCCEEDED(Preferences::GetString(aPrefName, aFileLocation))) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ nsOSHelperAppService::GetFileLocation(const char* aPrefName,
|
|||
}
|
||||
}
|
||||
|
||||
return Preferences::GetString(aPrefName, &aFileLocation);
|
||||
return Preferences::GetString(aPrefName, aFileLocation);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ static bool
|
|||
GetPrefValueForDriverVersion(nsCString& aVersion)
|
||||
{
|
||||
return NS_SUCCEEDED(Preferences::GetCString(SUGGESTED_VERSION_PREF,
|
||||
&aVersion));
|
||||
aVersion));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -127,7 +127,7 @@ NS_IMETHODIMP nsPrintSettingsX::ReadPageFormatFromPrefs()
|
|||
|
||||
nsAutoCString encodedData;
|
||||
nsresult rv =
|
||||
Preferences::GetCString(MAC_OS_X_PAGE_SETUP_PREFNAME, &encodedData);
|
||||
Preferences::GetCString(MAC_OS_X_PAGE_SETUP_PREFNAME, encodedData);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -492,7 +492,7 @@ nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName,
|
|||
bool success = GETINTPREF(kPrintPaperSizeUnit, &sizeUnit)
|
||||
&& GETDBLPREF(kPrintPaperWidth, width)
|
||||
&& GETDBLPREF(kPrintPaperHeight, height)
|
||||
&& GETSTRPREF(kPrintPaperName, &str);
|
||||
&& GETSTRPREF(kPrintPaperName, str);
|
||||
|
||||
// Bug 315687: Sanity check paper size to avoid paper size values in
|
||||
// mm when the size unit flag is inches. The value 100 is arbitrary
|
||||
|
@ -559,42 +559,42 @@ nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName,
|
|||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveHeaderLeft) {
|
||||
if (GETSTRPREF(kPrintHeaderStrLeft, &str)) {
|
||||
if (GETSTRPREF(kPrintHeaderStrLeft, str)) {
|
||||
aPS->SetHeaderStrLeft(str.get());
|
||||
DUMP_STR(kReadStr, kPrintHeaderStrLeft, str.get());
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveHeaderCenter) {
|
||||
if (GETSTRPREF(kPrintHeaderStrCenter, &str)) {
|
||||
if (GETSTRPREF(kPrintHeaderStrCenter, str)) {
|
||||
aPS->SetHeaderStrCenter(str.get());
|
||||
DUMP_STR(kReadStr, kPrintHeaderStrCenter, str.get());
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveHeaderRight) {
|
||||
if (GETSTRPREF(kPrintHeaderStrRight, &str)) {
|
||||
if (GETSTRPREF(kPrintHeaderStrRight, str)) {
|
||||
aPS->SetHeaderStrRight(str.get());
|
||||
DUMP_STR(kReadStr, kPrintHeaderStrRight, str.get());
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveFooterLeft) {
|
||||
if (GETSTRPREF(kPrintFooterStrLeft, &str)) {
|
||||
if (GETSTRPREF(kPrintFooterStrLeft, str)) {
|
||||
aPS->SetFooterStrLeft(str.get());
|
||||
DUMP_STR(kReadStr, kPrintFooterStrLeft, str.get());
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveFooterCenter) {
|
||||
if (GETSTRPREF(kPrintFooterStrCenter, &str)) {
|
||||
if (GETSTRPREF(kPrintFooterStrCenter, str)) {
|
||||
aPS->SetFooterStrCenter(str.get());
|
||||
DUMP_STR(kReadStr, kPrintFooterStrCenter, str.get());
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveFooterRight) {
|
||||
if (GETSTRPREF(kPrintFooterStrRight, &str)) {
|
||||
if (GETSTRPREF(kPrintFooterStrRight, str)) {
|
||||
aPS->SetFooterStrRight(str.get());
|
||||
DUMP_STR(kReadStr, kPrintFooterStrRight, str.get());
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName,
|
|||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveToFileName) {
|
||||
if (GETSTRPREF(kPrintToFileName, &str)) {
|
||||
if (GETSTRPREF(kPrintToFileName, str)) {
|
||||
aPS->SetToFileName(str.get());
|
||||
DUMP_STR(kReadStr, kPrintToFileName, str.get());
|
||||
}
|
||||
|
@ -1024,7 +1024,7 @@ nsPrintOptions::GetDefaultPrinterName(char16_t * *aDefaultPrinterName)
|
|||
|
||||
// Look up the printer from the last print job
|
||||
nsAutoString lastPrinterName;
|
||||
Preferences::GetString(kPrinterName, &lastPrinterName);
|
||||
Preferences::GetString(kPrinterName, lastPrinterName);
|
||||
if (!lastPrinterName.IsEmpty()) {
|
||||
// Verify it's still a valid printer
|
||||
nsCOMPtr<nsIStringEnumerator> printers;
|
||||
|
@ -1214,7 +1214,7 @@ nsPrintOptions::ReadPrefDouble(const char * aPrefId, double& aVal)
|
|||
NS_ENSURE_ARG_POINTER(aPrefId);
|
||||
|
||||
nsAutoCString str;
|
||||
nsresult rv = Preferences::GetCString(aPrefId, &str);
|
||||
nsresult rv = Preferences::GetCString(aPrefId, str);
|
||||
if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
|
||||
aVal = atof(str.get());
|
||||
}
|
||||
|
@ -1237,9 +1237,9 @@ nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId, int32_t& aTwips,
|
|||
const char * aMarginPref)
|
||||
{
|
||||
nsAutoString str;
|
||||
nsresult rv = Preferences::GetString(aPrefId, &str);
|
||||
nsresult rv = Preferences::GetString(aPrefId, str);
|
||||
if (NS_FAILED(rv) || str.IsEmpty()) {
|
||||
rv = Preferences::GetString(aMarginPref, &str);
|
||||
rv = Preferences::GetString(aMarginPref, str);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
|
||||
nsresult errCode;
|
||||
|
@ -1291,7 +1291,7 @@ nsPrintOptions::ReadJustification(const char * aPrefId, int16_t& aJust,
|
|||
{
|
||||
aJust = aInitValue;
|
||||
nsAutoString justStr;
|
||||
if (NS_SUCCEEDED(Preferences::GetString(aPrefId, &justStr))) {
|
||||
if (NS_SUCCEEDED(Preferences::GetString(aPrefId, justStr))) {
|
||||
if (justStr.EqualsASCII(kJustRight)) {
|
||||
aJust = nsIPrintSettings::kJustRight;
|
||||
} else if (justStr.EqualsASCII(kJustCenter)) {
|
||||
|
|
|
@ -334,7 +334,7 @@ void
|
|||
nsXPLookAndFeel::ColorPrefChanged (unsigned int index, const char *prefName)
|
||||
{
|
||||
nsAutoString colorStr;
|
||||
nsresult rv = Preferences::GetString(prefName, &colorStr);
|
||||
nsresult rv = Preferences::GetString(prefName, colorStr);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ void
|
|||
nsXPLookAndFeel::InitColorFromPref(int32_t i)
|
||||
{
|
||||
nsAutoString colorStr;
|
||||
nsresult rv = Preferences::GetString(sColorPrefs[i], &colorStr);
|
||||
nsresult rv = Preferences::GetString(sColorPrefs[i], colorStr);
|
||||
if (NS_FAILED(rv) || colorStr.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -938,7 +938,7 @@ void
|
|||
IMEHandler::ShowOnScreenKeyboard()
|
||||
{
|
||||
nsAutoString cachedPath;
|
||||
nsresult result = Preferences::GetString(kOskPathPrefName, &cachedPath);
|
||||
nsresult result = Preferences::GetString(kOskPathPrefName, cachedPath);
|
||||
if (NS_FAILED(result) || cachedPath.IsEmpty()) {
|
||||
wchar_t path[MAX_PATH];
|
||||
// The path to TabTip.exe is defined at the following registry key.
|
||||
|
|
|
@ -64,7 +64,7 @@ LoadPrefValue(const char* aName)
|
|||
nsAutoCString prefName(aName);
|
||||
|
||||
if (prefName.EqualsLiteral(kLoggingPrefLogFile)) {
|
||||
rv = Preferences::GetCString(aName, &prefValue);
|
||||
rv = Preferences::GetCString(aName, prefValue);
|
||||
// The pref was reset. Clear the user file.
|
||||
if (NS_FAILED(rv) || prefValue.IsEmpty()) {
|
||||
LogModule::SetLogFile(nullptr);
|
||||
|
@ -89,7 +89,7 @@ LoadPrefValue(const char* aName)
|
|||
|
||||
if (Preferences::GetInt(aName, &prefLevel) == NS_OK) {
|
||||
logLevel = ToLogLevel(prefLevel);
|
||||
} else if (Preferences::GetCString(aName, &prefValue) == NS_OK) {
|
||||
} else if (Preferences::GetCString(aName, prefValue) == NS_OK) {
|
||||
if (prefValue.LowerCaseEqualsLiteral("error")) {
|
||||
logLevel = LogLevel::Error;
|
||||
} else if (prefValue.LowerCaseEqualsLiteral("warning")) {
|
||||
|
|
|
@ -247,8 +247,7 @@ FifoWatcher::GetSingleton()
|
|||
{
|
||||
if (!sSingleton) {
|
||||
nsAutoCString dirPath;
|
||||
Preferences::GetCString(
|
||||
"memory_info_dumper.watch_fifo.directory", &dirPath);
|
||||
Preferences::GetCString("memory_info_dumper.watch_fifo.directory", dirPath);
|
||||
sSingleton = new FifoWatcher(dirPath);
|
||||
sSingleton->Init();
|
||||
ClearOnShutdown(&sSingleton);
|
||||
|
|
Загрузка…
Ссылка в новой задаче