mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1384835 (part 2, attempt 2) - Remove the Preferences::Get*String() variants that return nsAdoptingString. r=froydnj.
--HG-- extra : rebase_source : 6c24fbacb03d4adebe5f22b5e7fc60b069913f20
This commit is contained in:
parent
581214bd8b
commit
d4f9aa5530
@ -1655,7 +1655,9 @@ nsScriptSecurityManager::EnsureFileURIWhitelist()
|
||||
nsCString checkLoadURIPrefName = NS_LITERAL_CSTRING("capability.policy.") +
|
||||
policyName +
|
||||
NS_LITERAL_CSTRING(".checkloaduri.enabled");
|
||||
if (!Preferences::GetString(checkLoadURIPrefName.get()).LowerCaseEqualsLiteral("allaccess")) {
|
||||
nsAutoString value;
|
||||
nsresult rv = Preferences::GetString(checkLoadURIPrefName.get(), value);
|
||||
if (NS_FAILED(rv) || !value.LowerCaseEqualsLiteral("allaccess")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,8 @@ AudioChannelService::GetAudioChannel(const nsAString& aChannel)
|
||||
/* static */ AudioChannel
|
||||
AudioChannelService::GetDefaultAudioChannel()
|
||||
{
|
||||
nsAutoString audioChannel(Preferences::GetString("media.defaultAudioChannel"));
|
||||
nsAutoString audioChannel;
|
||||
Preferences::GetString("media.defaultAudioChannel", audioChannel);
|
||||
if (audioChannel.IsEmpty()) {
|
||||
return AudioChannel::Normal;
|
||||
}
|
||||
|
@ -379,8 +379,8 @@ Navigator::GetAcceptLanguages(nsTArray<nsString>& aLanguages)
|
||||
aLanguages.Clear();
|
||||
|
||||
// E.g. "de-de, en-us,en".
|
||||
const nsAdoptingString& acceptLang =
|
||||
Preferences::GetLocalizedString("intl.accept_languages");
|
||||
nsAutoString acceptLang;
|
||||
Preferences::GetLocalizedString("intl.accept_languages", acceptLang);
|
||||
|
||||
// Split values on commas.
|
||||
nsCharSeparatedTokenizer langTokenizer(acceptLang, ',');
|
||||
@ -473,10 +473,9 @@ Navigator::GetOscpu(nsAString& aOSCPU, CallerType aCallerType,
|
||||
return;
|
||||
}
|
||||
|
||||
const nsAdoptingString& override =
|
||||
Preferences::GetString("general.oscpu.override");
|
||||
|
||||
if (override) {
|
||||
nsAutoString override;
|
||||
nsresult rv = Preferences::GetString("general.oscpu.override", override);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aOSCPU = override;
|
||||
return;
|
||||
}
|
||||
@ -653,10 +652,9 @@ Navigator::GetBuildID(nsAString& aBuildID, CallerType aCallerType,
|
||||
aBuildID.AssignLiteral(LEGACY_BUILD_ID);
|
||||
return;
|
||||
}
|
||||
const nsAdoptingString& override =
|
||||
Preferences::GetString("general.buildID.override");
|
||||
|
||||
if (override) {
|
||||
nsAutoString override;
|
||||
nsresult rv = Preferences::GetString("general.buildID.override", override);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aBuildID = override;
|
||||
return;
|
||||
}
|
||||
@ -704,7 +702,8 @@ Navigator::JavaEnabled(CallerType aCallerType, ErrorResult& aRv)
|
||||
Telemetry::AutoTimer<Telemetry::CHECK_JAVA_ENABLED> telemetryTimer;
|
||||
|
||||
// Return true if we have a handler for the java mime
|
||||
nsAdoptingString javaMIME = Preferences::GetString("plugin.java.mime");
|
||||
nsAutoString javaMIME;
|
||||
Preferences::GetString("plugin.java.mime", javaMIME);
|
||||
NS_ENSURE_TRUE(!javaMIME.IsEmpty(), false);
|
||||
|
||||
if (!mMimeTypes) {
|
||||
@ -1783,10 +1782,11 @@ Navigator::GetPlatform(nsAString& aPlatform, bool aUsePrefOverriddenValue)
|
||||
aPlatform.AssignLiteral(SPOOFED_PLATFORM);
|
||||
return NS_OK;
|
||||
}
|
||||
const nsAdoptingString& override =
|
||||
mozilla::Preferences::GetString("general.platform.override");
|
||||
nsAutoString override;
|
||||
nsresult rv =
|
||||
mozilla::Preferences::GetString("general.platform.override", override);
|
||||
|
||||
if (override) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aPlatform = override;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1834,10 +1834,11 @@ Navigator::GetAppVersion(nsAString& aAppVersion, bool aUsePrefOverriddenValue)
|
||||
aAppVersion.AssignLiteral(SPOOFED_APPVERSION);
|
||||
return NS_OK;
|
||||
}
|
||||
const nsAdoptingString& override =
|
||||
mozilla::Preferences::GetString("general.appversion.override");
|
||||
nsAutoString override;
|
||||
nsresult rv =
|
||||
mozilla::Preferences::GetString("general.appversion.override", override);
|
||||
|
||||
if (override) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aAppVersion = override;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1878,10 +1879,11 @@ Navigator::AppName(nsAString& aAppName, bool aUsePrefOverriddenValue)
|
||||
return;
|
||||
}
|
||||
|
||||
const nsAdoptingString& override =
|
||||
mozilla::Preferences::GetString("general.appname.override");
|
||||
nsAutoString override;
|
||||
nsresult rv =
|
||||
mozilla::Preferences::GetString("general.appname.override", override);
|
||||
|
||||
if (override) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aAppName = override;
|
||||
return;
|
||||
}
|
||||
@ -1907,10 +1909,11 @@ Navigator::GetUserAgent(nsPIDOMWindowInner* aWindow,
|
||||
// when 'privacy.resistFingerprinting' is true.
|
||||
if (!aIsCallerChrome &&
|
||||
!nsContentUtils::ShouldResistFingerprinting()) {
|
||||
const nsAdoptingString& override =
|
||||
mozilla::Preferences::GetString("general.useragent.override");
|
||||
nsAutoString override;
|
||||
nsresult rv =
|
||||
mozilla::Preferences::GetString("general.useragent.override", override);
|
||||
|
||||
if (override) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aUserAgent = override;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -5577,7 +5577,8 @@ nsContentUtils::GetLocalizedEllipsis()
|
||||
{
|
||||
static char16_t sBuf[4] = { 0, 0, 0, 0 };
|
||||
if (!sBuf[0]) {
|
||||
nsAdoptingString tmp = Preferences::GetLocalizedString("intl.ellipsis");
|
||||
nsAutoString tmp;
|
||||
Preferences::GetLocalizedString("intl.ellipsis", tmp);
|
||||
uint32_t len = std::min(uint32_t(tmp.Length()),
|
||||
uint32_t(ArrayLength(sBuf) - 1));
|
||||
CopyUnicodeTo(tmp, 0, sBuf, len);
|
||||
|
@ -2764,8 +2764,9 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
// Note that when the content signing becomes a standard, we might have
|
||||
// to restrict this enforcement to "remote content" only.
|
||||
if (applySignedContentCSP) {
|
||||
nsAdoptingString signedContentCSP =
|
||||
Preferences::GetString("security.signed_content.CSP.default");
|
||||
nsAutoString signedContentCSP;
|
||||
Preferences::GetString("security.signed_content.CSP.default",
|
||||
signedContentCSP);
|
||||
csp->AppendPolicy(signedContentCSP, false, false);
|
||||
}
|
||||
|
||||
|
@ -8046,8 +8046,8 @@ nsGlobalWindow::HomeOuter(nsIPrincipal& aSubjectPrincipal, ErrorResult& aError)
|
||||
return;
|
||||
}
|
||||
|
||||
nsAdoptingString homeURL =
|
||||
Preferences::GetLocalizedString(PREF_BROWSER_STARTUP_HOMEPAGE);
|
||||
nsAutoString homeURL;
|
||||
Preferences::GetLocalizedString(PREF_BROWSER_STARTUP_HOMEPAGE, homeURL);
|
||||
|
||||
if (homeURL.IsEmpty()) {
|
||||
// if all else fails, use this
|
||||
|
@ -484,7 +484,7 @@ UploadLastDir::ContentPrefCallback::HandleCompletion(uint16_t aReason)
|
||||
nsAutoString prefStr;
|
||||
|
||||
if (aReason == nsIContentPrefCallback2::COMPLETE_ERROR || !mResult) {
|
||||
prefStr = Preferences::GetString("dom.input.fallbackUploadDir");
|
||||
Preferences::GetString("dom.input.fallbackUploadDir", prefStr);
|
||||
}
|
||||
|
||||
if (prefStr.IsEmpty() && mResult) {
|
||||
|
@ -162,13 +162,13 @@ namespace CubebUtils {
|
||||
void PrefChanged(const char* aPref, void* aClosure)
|
||||
{
|
||||
if (strcmp(aPref, PREF_VOLUME_SCALE) == 0) {
|
||||
nsAdoptingString value = Preferences::GetString(aPref);
|
||||
nsAutoCString value;
|
||||
Preferences::GetCString(aPref, value);
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
if (value.IsEmpty()) {
|
||||
sVolumeScale = 1.0;
|
||||
} else {
|
||||
NS_ConvertUTF16toUTF8 utf8(value);
|
||||
sVolumeScale = std::max<double>(0, PR_strtod(utf8.get(), nullptr));
|
||||
sVolumeScale = std::max<double>(0, PR_strtod(value.get(), nullptr));
|
||||
}
|
||||
} else if (strcmp(aPref, PREF_CUBEB_LATENCY_PLAYBACK) == 0) {
|
||||
// Arbitrary default stream latency of 100ms. The higher this
|
||||
@ -188,28 +188,28 @@ void PrefChanged(const char* aPref, void* aClosure)
|
||||
// experiment.
|
||||
sCubebMSGLatencyInFrames = std::min<uint32_t>(std::max<uint32_t>(value, 128), 1e6);
|
||||
} else if (strcmp(aPref, PREF_CUBEB_LOGGING_LEVEL) == 0) {
|
||||
nsAdoptingString value = Preferences::GetString(aPref);
|
||||
NS_ConvertUTF16toUTF8 utf8(value);
|
||||
nsAutoCString value;
|
||||
Preferences::GetCString(aPref, value);
|
||||
LogModule* cubebLog = LogModule::Get("cubeb");
|
||||
if (strcmp(utf8.get(), "verbose") == 0) {
|
||||
if (value.EqualsLiteral("verbose")) {
|
||||
cubeb_set_log_callback(CUBEB_LOG_VERBOSE, CubebLogCallback);
|
||||
cubebLog->SetLevel(LogLevel::Verbose);
|
||||
} else if (strcmp(utf8.get(), "normal") == 0) {
|
||||
} else if (value.EqualsLiteral("normal")) {
|
||||
cubeb_set_log_callback(CUBEB_LOG_NORMAL, CubebLogCallback);
|
||||
cubebLog->SetLevel(LogLevel::Error);
|
||||
} else if (utf8.IsEmpty()) {
|
||||
} else if (value.IsEmpty()) {
|
||||
cubeb_set_log_callback(CUBEB_LOG_DISABLED, nullptr);
|
||||
cubebLog->SetLevel(LogLevel::Disabled);
|
||||
}
|
||||
} else if (strcmp(aPref, PREF_CUBEB_BACKEND) == 0) {
|
||||
nsAdoptingString value = Preferences::GetString(aPref);
|
||||
nsAutoCString value;
|
||||
Preferences::GetCString(aPref, value);
|
||||
if (value.IsEmpty()) {
|
||||
sCubebBackendName = nullptr;
|
||||
} else {
|
||||
NS_LossyConvertUTF16toASCII ascii(value);
|
||||
sCubebBackendName = new char[ascii.Length() + 1];
|
||||
PodCopy(sCubebBackendName.get(), ascii.get(), ascii.Length());
|
||||
sCubebBackendName[ascii.Length()] = 0;
|
||||
sCubebBackendName = new char[value.Length() + 1];
|
||||
PodCopy(sCubebBackendName.get(), value.get(), value.Length());
|
||||
sCubebBackendName[value.Length()] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -628,8 +628,8 @@ DecoderDoctorDocumentWatcher::SynthesizeAnalysis()
|
||||
nsAutoCString formatsPref("media.decoder-doctor.");
|
||||
formatsPref += id->mReportStringId;
|
||||
formatsPref += ".formats";
|
||||
nsAdoptingString formatsWithIssues =
|
||||
Preferences::GetString(formatsPref.Data());
|
||||
nsAutoString formatsWithIssues;
|
||||
Preferences::GetString(formatsPref.Data(), formatsWithIssues);
|
||||
if (formatsWithIssues.IsEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -127,8 +127,8 @@ SVGSwitchElement::IsAttributeMapped(const nsIAtom* name) const
|
||||
nsIContent *
|
||||
SVGSwitchElement::FindActiveChild() const
|
||||
{
|
||||
const nsAdoptingString& acceptLangs =
|
||||
Preferences::GetLocalizedString("intl.accept_languages");
|
||||
nsAutoString acceptLangs;
|
||||
Preferences::GetLocalizedString("intl.accept_languages", acceptLangs);
|
||||
|
||||
if (!acceptLangs.IsEmpty()) {
|
||||
int32_t bestLanguagePreferenceRank = -1;
|
||||
|
@ -147,8 +147,12 @@ SVGTests::PassesConditionalProcessingTests(const nsString *aAcceptLangs) const
|
||||
}
|
||||
|
||||
// Get our language preferences
|
||||
const nsAutoString acceptLangs(aAcceptLangs ? *aAcceptLangs :
|
||||
Preferences::GetLocalizedString("intl.accept_languages"));
|
||||
nsAutoString acceptLangs;
|
||||
if (aAcceptLangs) {
|
||||
acceptLangs.Assign(*aAcceptLangs);
|
||||
} else {
|
||||
Preferences::GetLocalizedString("intl.accept_languages", acceptLangs);
|
||||
}
|
||||
|
||||
if (acceptLangs.IsEmpty()) {
|
||||
NS_WARNING("no default language specified for systemLanguage conditional test");
|
||||
|
@ -1324,8 +1324,8 @@ AppNameOverrideChanged(const char* /* aPrefName */, void* /* aClosure */)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
const nsAdoptingString& override =
|
||||
mozilla::Preferences::GetString("general.appname.override");
|
||||
nsAutoString override;
|
||||
Preferences::GetString("general.appname.override", override);
|
||||
|
||||
RuntimeService* runtime = RuntimeService::GetService();
|
||||
if (runtime) {
|
||||
@ -1338,8 +1338,8 @@ AppVersionOverrideChanged(const char* /* aPrefName */, void* /* aClosure */)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
const nsAdoptingString& override =
|
||||
mozilla::Preferences::GetString("general.appversion.override");
|
||||
nsAutoString override;
|
||||
Preferences::GetString("general.appversion.override", override);
|
||||
|
||||
RuntimeService* runtime = RuntimeService::GetService();
|
||||
if (runtime) {
|
||||
@ -1352,8 +1352,8 @@ PlatformOverrideChanged(const char* /* aPrefName */, void* /* aClosure */)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
const nsAdoptingString& override =
|
||||
mozilla::Preferences::GetString("general.platform.override");
|
||||
nsAutoString override;
|
||||
Preferences::GetString("general.platform.override", override);
|
||||
|
||||
RuntimeService* runtime = RuntimeService::GetService();
|
||||
if (runtime) {
|
||||
|
@ -904,7 +904,7 @@ nsEditorSpellCheck::SetFallbackDictionary(DictionaryFetcher* aFetcher)
|
||||
|
||||
// Get the preference value.
|
||||
nsAutoString preferredDict;
|
||||
preferredDict = Preferences::GetLocalizedString("spellchecker.dictionary");
|
||||
Preferences::GetLocalizedString("spellchecker.dictionary", preferredDict);
|
||||
|
||||
if (!dictName.IsEmpty()) {
|
||||
// RFC 5646 explicitly states that matches should be case-insensitive.
|
||||
|
@ -351,7 +351,8 @@ DriverCrashGuard::CheckAndUpdatePref(const char* aPrefName, const nsAString& aCu
|
||||
{
|
||||
std::string pref = GetFullPrefName(aPrefName);
|
||||
|
||||
nsAdoptingString oldValue = Preferences::GetString(pref.c_str());
|
||||
nsAutoString oldValue;
|
||||
Preferences::GetString(pref.c_str(), oldValue);
|
||||
if (oldValue == aCurrentValue) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1698,17 +1698,21 @@ gfxFcPlatformFontList::AddGenericFonts(mozilla::FontFamilyType aGenericType,
|
||||
if ((!mAlwaysUseFontconfigGenerics && aLanguage) ||
|
||||
aLanguage == nsGkAtoms::x_math) {
|
||||
nsIAtom* langGroup = GetLangGroup(aLanguage);
|
||||
nsAdoptingString fontlistValue =
|
||||
Preferences::GetString(NamePref(generic, langGroup).get());
|
||||
nsAutoString fontlistValue;
|
||||
Preferences::GetString(NamePref(generic, langGroup).get(),
|
||||
fontlistValue);
|
||||
nsresult rv;
|
||||
if (fontlistValue.IsEmpty()) {
|
||||
// The font name list may have two or more family names as comma
|
||||
// separated list. In such case, not matching with generic font
|
||||
// name is fine because if the list prefers specific font, we
|
||||
// should try to use the pref with complicated path.
|
||||
fontlistValue =
|
||||
Preferences::GetString(NameListPref(generic, langGroup).get());
|
||||
rv = Preferences::GetString(NameListPref(generic, langGroup).get(),
|
||||
fontlistValue);
|
||||
} else {
|
||||
rv = NS_OK;
|
||||
}
|
||||
if (fontlistValue) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (!fontlistValue.EqualsLiteral("serif") &&
|
||||
!fontlistValue.EqualsLiteral("sans-serif") &&
|
||||
!fontlistValue.EqualsLiteral("monospace")) {
|
||||
|
@ -860,8 +860,9 @@ void gfxFontUtils::AppendPrefsFontList(const char *aPrefName,
|
||||
nsTArray<nsString>& aFontList)
|
||||
{
|
||||
// get the list of single-face font families
|
||||
nsAdoptingString fontlistValue = Preferences::GetString(aPrefName);
|
||||
if (!fontlistValue) {
|
||||
nsAutoString fontlistValue;
|
||||
nsresult rv = Preferences::GetString(aPrefName, fontlistValue);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -570,9 +570,9 @@ void RecordingPrefChanged(const char *aPrefName, void *aClosure)
|
||||
{
|
||||
if (Preferences::GetBool("gfx.2d.recording", false)) {
|
||||
nsAutoCString fileName;
|
||||
nsAdoptingString prefFileName = Preferences::GetString("gfx.2d.recordingfile");
|
||||
|
||||
if (prefFileName) {
|
||||
nsAutoString prefFileName;
|
||||
nsresult rv = Preferences::GetString("gfx.2d.recordingfile", prefFileName);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
fileName.Append(NS_ConvertUTF16toUTF8(prefFileName));
|
||||
} else {
|
||||
nsCOMPtr<nsIFile> tmpFile;
|
||||
|
@ -163,7 +163,8 @@ LangGroupFontPrefs::Initialize(nsIAtom* aLangGroupAtom)
|
||||
// XXX "font.name.variable."? There is no such pref...
|
||||
MAKE_FONT_PREF_KEY(pref, "font.name.variable.", langGroup);
|
||||
|
||||
nsAdoptingString value = Preferences::GetString(pref.get());
|
||||
nsAutoString value;
|
||||
Preferences::GetString(pref.get(), value);
|
||||
if (!value.IsEmpty()) {
|
||||
FontFamilyName defaultVariableName = FontFamilyName::Convert(value);
|
||||
FontFamilyType defaultType = defaultVariableName.mType;
|
||||
@ -174,7 +175,7 @@ LangGroupFontPrefs::Initialize(nsIAtom* aLangGroupAtom)
|
||||
}
|
||||
else {
|
||||
MAKE_FONT_PREF_KEY(pref, "font.default.", langGroup);
|
||||
value = Preferences::GetString(pref.get());
|
||||
Preferences::GetString(pref.get(), value);
|
||||
if (!value.IsEmpty()) {
|
||||
FontFamilyName defaultVariableName = FontFamilyName::Convert(value);
|
||||
FontFamilyType defaultType = defaultVariableName.mType;
|
||||
|
@ -516,15 +516,14 @@ nsPresContext::GetDocumentColorPreferences()
|
||||
mBackgroundColor = LookAndFeel::GetColorUsingStandins(
|
||||
LookAndFeel::eColorID_window, NS_RGB(0xff, 0xff, 0xff));
|
||||
} else if (usePrefColors) {
|
||||
nsAdoptingString colorStr =
|
||||
Preferences::GetString("browser.display.foreground_color");
|
||||
|
||||
nsAutoString colorStr;
|
||||
Preferences::GetString("browser.display.foreground_color", colorStr);
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mDefaultColor = MakeColorPref(colorStr);
|
||||
}
|
||||
|
||||
colorStr = Preferences::GetString("browser.display.background_color");
|
||||
|
||||
colorStr.Truncate();
|
||||
Preferences::GetString("browser.display.background_color", colorStr);
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mBackgroundColor = MakeColorPref(colorStr);
|
||||
}
|
||||
@ -583,20 +582,20 @@ nsPresContext::GetUserPreferences()
|
||||
mUnderlineLinks =
|
||||
Preferences::GetBool("browser.underline_anchors", mUnderlineLinks);
|
||||
|
||||
nsAdoptingString colorStr = Preferences::GetString("browser.anchor_color");
|
||||
|
||||
nsAutoString colorStr;
|
||||
Preferences::GetString("browser.anchor_color", colorStr);
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mLinkColor = MakeColorPref(colorStr);
|
||||
}
|
||||
|
||||
colorStr = Preferences::GetString("browser.active_color");
|
||||
|
||||
colorStr.Truncate();
|
||||
Preferences::GetString("browser.active_color", colorStr);
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mActiveLinkColor = MakeColorPref(colorStr);
|
||||
}
|
||||
|
||||
colorStr = Preferences::GetString("browser.visited_color");
|
||||
|
||||
colorStr.Truncate();
|
||||
Preferences::GetString("browser.visited_color", colorStr);
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mVisitedLinkColor = MakeColorPref(colorStr);
|
||||
}
|
||||
@ -607,14 +606,14 @@ nsPresContext::GetUserPreferences()
|
||||
mFocusTextColor = mDefaultColor;
|
||||
mFocusBackgroundColor = mBackgroundColor;
|
||||
|
||||
colorStr = Preferences::GetString("browser.display.focus_text_color");
|
||||
|
||||
colorStr.Truncate();
|
||||
Preferences::GetString("browser.display.focus_text_color", colorStr);
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mFocusTextColor = MakeColorPref(colorStr);
|
||||
}
|
||||
|
||||
colorStr = Preferences::GetString("browser.display.focus_background_color");
|
||||
|
||||
colorStr.Truncate();
|
||||
Preferences::GetString("browser.display.focus_background_color", colorStr);
|
||||
if (!colorStr.IsEmpty()) {
|
||||
mFocusBackgroundColor = MakeColorPref(colorStr);
|
||||
}
|
||||
|
@ -146,7 +146,8 @@ nsTextBoxFrame::AlwaysAppendAccessKey()
|
||||
gAccessKeyPrefInitialized = true;
|
||||
|
||||
const char* prefName = "intl.menuitems.alwaysappendaccesskeys";
|
||||
nsAdoptingString val = Preferences::GetLocalizedString(prefName);
|
||||
nsAutoString val;
|
||||
Preferences::GetLocalizedString(prefName, val);
|
||||
gAlwaysAppendAccessKey = val.EqualsLiteral("true");
|
||||
}
|
||||
return gAlwaysAppendAccessKey;
|
||||
@ -160,7 +161,8 @@ nsTextBoxFrame::InsertSeparatorBeforeAccessKey()
|
||||
gInsertSeparatorPrefInitialized = true;
|
||||
|
||||
const char* prefName = "intl.menuitems.insertseparatorbeforeaccesskeys";
|
||||
nsAdoptingString val = Preferences::GetLocalizedString(prefName);
|
||||
nsAutoString val;
|
||||
Preferences::GetLocalizedString(prefName, val);
|
||||
gInsertSeparatorBeforeAccessKey = val.EqualsLiteral("true");
|
||||
}
|
||||
return gInsertSeparatorBeforeAccessKey;
|
||||
|
@ -1674,15 +1674,6 @@ Preferences::GetCString(const char* aPref)
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingString
|
||||
Preferences::GetString(const char* aPref)
|
||||
{
|
||||
nsAdoptingString result;
|
||||
GetString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetCString(const char* aPref, nsACString& aResult)
|
||||
@ -1718,15 +1709,6 @@ Preferences::GetLocalizedCString(const char* aPref)
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingString
|
||||
Preferences::GetLocalizedString(const char* aPref)
|
||||
{
|
||||
nsAdoptingString result;
|
||||
GetLocalizedString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetLocalizedCString(const char* aPref, nsACString& aResult)
|
||||
@ -2249,15 +2231,6 @@ Preferences::GetDefaultLocalizedString(const char* aPref,
|
||||
return rv;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingString
|
||||
Preferences::GetDefaultString(const char* aPref)
|
||||
{
|
||||
nsAdoptingString result;
|
||||
GetDefaultString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingCString
|
||||
Preferences::GetDefaultCString(const char* aPref)
|
||||
@ -2267,15 +2240,6 @@ Preferences::GetDefaultCString(const char* aPref)
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingString
|
||||
Preferences::GetDefaultLocalizedString(const char* aPref)
|
||||
{
|
||||
nsAdoptingString result;
|
||||
GetDefaultLocalizedString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingCString
|
||||
Preferences::GetDefaultLocalizedCString(const char* aPref)
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
||||
class nsIFile;
|
||||
class nsAdoptingString;
|
||||
class nsAdoptingCString;
|
||||
|
||||
#ifndef have_PrefChangedFunc_typedef
|
||||
@ -170,9 +169,7 @@ public:
|
||||
* when you need to check whether it was failure or not.
|
||||
*/
|
||||
static nsAdoptingCString GetCString(const char* aPref);
|
||||
static nsAdoptingString GetString(const char* aPref);
|
||||
static nsAdoptingCString GetLocalizedCString(const char* aPref);
|
||||
static nsAdoptingString GetLocalizedString(const char* aPref);
|
||||
|
||||
/**
|
||||
* Gets int, float, or bool type pref value with raw return value of
|
||||
@ -387,9 +384,7 @@ public:
|
||||
* See the comment at definition at GetString() and GetCString() for more
|
||||
* details of the result.
|
||||
*/
|
||||
static nsAdoptingString GetDefaultString(const char* aPref);
|
||||
static nsAdoptingCString GetDefaultCString(const char* aPref);
|
||||
static nsAdoptingString GetDefaultLocalizedString(const char* aPref);
|
||||
static nsAdoptingCString GetDefaultLocalizedCString(const char* aPref);
|
||||
|
||||
static nsresult GetDefaultCString(const char* aPref, nsACString& aResult);
|
||||
|
@ -1950,11 +1950,13 @@ nsNSSComponent::InitializeNSS()
|
||||
|
||||
// ensure we have initial values for various root hashes
|
||||
#ifdef DEBUG
|
||||
mTestBuiltInRootHash =
|
||||
Preferences::GetString("security.test.built_in_root_hash");
|
||||
mTestBuiltInRootHash.Truncate();
|
||||
Preferences::GetString("security.test.built_in_root_hash",
|
||||
mTestBuiltInRootHash);
|
||||
#endif
|
||||
mContentSigningRootHash =
|
||||
Preferences::GetString("security.content.signature.root_hash");
|
||||
mContentSigningRootHash.Truncate();
|
||||
Preferences::GetString("security.content.signature.root_hash",
|
||||
mContentSigningRootHash);
|
||||
|
||||
mNSSInitialized = true;
|
||||
}
|
||||
@ -2122,14 +2124,17 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
#ifdef DEBUG
|
||||
} else if (prefName.EqualsLiteral("security.test.built_in_root_hash")) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
mTestBuiltInRootHash = Preferences::GetString("security.test.built_in_root_hash");
|
||||
mTestBuiltInRootHash.Truncate();
|
||||
Preferences::GetString("security.test.built_in_root_hash",
|
||||
mTestBuiltInRootHash);
|
||||
#endif // DEBUG
|
||||
} else if (prefName.Equals(kFamilySafetyModePref)) {
|
||||
MaybeEnableFamilySafetyCompatibility();
|
||||
} else if (prefName.EqualsLiteral("security.content.signature.root_hash")) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
mContentSigningRootHash =
|
||||
Preferences::GetString("security.content.signature.root_hash");
|
||||
mContentSigningRootHash.Truncate();
|
||||
Preferences::GetString("security.content.signature.root_hash",
|
||||
mContentSigningRootHash);
|
||||
} else if (prefName.Equals(kEnterpriseRootModePref)) {
|
||||
MaybeImportEnterpriseRoots();
|
||||
} else {
|
||||
|
@ -779,8 +779,9 @@ CreateContentProcessSandboxTempDir()
|
||||
|
||||
// Get (and create if blank) temp directory suffix pref.
|
||||
nsresult rv;
|
||||
nsAdoptingString tempDirSuffix =
|
||||
Preferences::GetString("security.sandbox.content.tempDirSuffix");
|
||||
nsAutoString tempDirSuffix;
|
||||
Preferences::GetString("security.sandbox.content.tempDirSuffix",
|
||||
tempDirSuffix);
|
||||
if (tempDirSuffix.IsEmpty()) {
|
||||
nsCOMPtr<nsIUUIDGenerator> uuidgen =
|
||||
do_GetService("@mozilla.org/uuid-generator;1", &rv);
|
||||
|
@ -138,7 +138,7 @@ public:
|
||||
nsTArray<jni::Object::LocalRef> nameRefArray(aPrefNames->GetElements());
|
||||
nsCOMPtr<nsIObserverService> obsServ;
|
||||
nsCOMPtr<nsIWritableVariant> value;
|
||||
nsAdoptingString strVal;
|
||||
nsAutoString strVal;
|
||||
|
||||
for (jni::Object::LocalRef& nameRef : nameRefArray) {
|
||||
jni::String::LocalRef nameStr(mozilla::Move(nameRef));
|
||||
@ -147,6 +147,7 @@ public:
|
||||
int32_t type = java::PrefsHelper::PREF_INVALID;
|
||||
bool boolVal = false;
|
||||
int32_t intVal = 0;
|
||||
strVal.Truncate();
|
||||
|
||||
switch (Preferences::GetType(name.get())) {
|
||||
case nsIPrefBranch::PREF_BOOL:
|
||||
@ -159,14 +160,15 @@ public:
|
||||
intVal = Preferences::GetInt(name.get());
|
||||
break;
|
||||
|
||||
case nsIPrefBranch::PREF_STRING:
|
||||
case nsIPrefBranch::PREF_STRING: {
|
||||
type = java::PrefsHelper::PREF_STRING;
|
||||
strVal = Preferences::GetLocalizedString(name.get());
|
||||
if (!strVal) {
|
||||
strVal = Preferences::GetString(name.get());
|
||||
nsresult rv =
|
||||
Preferences::GetLocalizedString(name.get(), strVal);
|
||||
if (NS_FAILED(rv)) {
|
||||
Preferences::GetString(name.get(), strVal);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
// Pref not found; try to find it.
|
||||
if (!obsServ) {
|
||||
@ -288,7 +290,7 @@ public:
|
||||
int32_t type = -1;
|
||||
bool boolVal = false;
|
||||
int32_t intVal = false;
|
||||
nsAdoptingString strVal;
|
||||
nsAutoString strVal;
|
||||
|
||||
switch (Preferences::GetType(name.get())) {
|
||||
case nsIPrefBranch::PREF_BOOL:
|
||||
@ -299,13 +301,15 @@ public:
|
||||
type = java::PrefsHelper::PREF_INT;
|
||||
intVal = Preferences::GetInt(name.get());
|
||||
break;
|
||||
case nsIPrefBranch::PREF_STRING:
|
||||
case nsIPrefBranch::PREF_STRING: {
|
||||
type = java::PrefsHelper::PREF_STRING;
|
||||
strVal = Preferences::GetLocalizedString(name.get());
|
||||
if (!strVal) {
|
||||
strVal = Preferences::GetString(name.get());
|
||||
nsresult rv =
|
||||
Preferences::GetLocalizedString(name.get(), strVal);
|
||||
if (NS_FAILED(rv)) {
|
||||
Preferences::GetString(name.get(), strVal);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NS_WARNING(nsPrintfCString("Invalid pref %s",
|
||||
name.get()).get());
|
||||
|
@ -80,9 +80,9 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIWidget *aWidget,
|
||||
mPrintSettings = settings->GetPMPrintSettings();
|
||||
|
||||
#ifdef MOZ_ENABLE_SKIA_PDF
|
||||
const nsAdoptingString& printViaPdf =
|
||||
mozilla::Preferences::GetString("print.print_via_pdf_encoder");
|
||||
if (printViaPdf == NS_LITERAL_STRING("skia-pdf")) {
|
||||
nsAutoString printViaPdf;
|
||||
mozilla::Preferences::GetString("print.print_via_pdf_encoder", printViaPdf);
|
||||
if (printViaPdf.EqualsLiteral("skia-pdf")) {
|
||||
// Annoyingly, PMPrinterPrintWithFile does not pay attention to the
|
||||
// kPMDestination* value set in the PMPrintSession; it always sends the PDF
|
||||
// to the specified printer. This means that if we create the PDF using
|
||||
|
@ -363,8 +363,8 @@ IMMHandler::InitKeyboardLayout(nsWindow* aWindow,
|
||||
// For hacking some bugs of some TIP, we should set an IME name from the
|
||||
// pref.
|
||||
if (sCodePage == 932 && sIMEName.IsEmpty()) {
|
||||
sIMEName =
|
||||
Preferences::GetString("intl.imm.japanese.assume_active_tip_name_as");
|
||||
Preferences::GetString("intl.imm.japanese.assume_active_tip_name_as",
|
||||
sIMEName);
|
||||
}
|
||||
|
||||
// Whether the IME supports vertical writing mode might be changed or
|
||||
@ -2538,8 +2538,12 @@ IMMHandler::AdjustCompositionFont(nsWindow* aWindow,
|
||||
// Therefore, we need to store the information which are set to the IM
|
||||
// context to static variables since IM context is never recreated.
|
||||
static bool sCompositionFontsInitialized = false;
|
||||
static nsString sCompositionFont =
|
||||
Preferences::GetString("intl.imm.composition_font");
|
||||
static nsString sCompositionFont;
|
||||
static bool sCompositionFontPrefDone = false;
|
||||
if (!sCompositionFontPrefDone) {
|
||||
sCompositionFontPrefDone = true;
|
||||
Preferences::GetString("intl.imm.composition_font", sCompositionFont);
|
||||
}
|
||||
|
||||
// If composition font is customized by pref, we need to modify the
|
||||
// composition font of the IME context at first time even if the writing mode
|
||||
@ -2588,8 +2592,8 @@ IMMHandler::AdjustCompositionFont(nsWindow* aWindow,
|
||||
if (IsJapanist2003Active() && sCompositionFontForJapanist2003.IsEmpty()) {
|
||||
const char* kCompositionFontForJapanist2003 =
|
||||
"intl.imm.composition_font.japanist_2003";
|
||||
sCompositionFontForJapanist2003 =
|
||||
Preferences::GetString(kCompositionFontForJapanist2003);
|
||||
Preferences::GetString(kCompositionFontForJapanist2003,
|
||||
sCompositionFontForJapanist2003);
|
||||
// If the font name is not specified properly, let's use
|
||||
// "MS PGothic" instead.
|
||||
if (sCompositionFontForJapanist2003.IsEmpty() ||
|
||||
|
@ -65,8 +65,8 @@ PDFiumEngineShim::Init()
|
||||
}
|
||||
|
||||
#ifdef USE_EXTERNAL_PDFIUM
|
||||
const nsAdoptingString& PDFiumPath =
|
||||
mozilla::Preferences::GetString("print.load_external_pdfium");
|
||||
nsAutoString PDFiumPath;
|
||||
mozilla::Preferences::GetString("print.load_external_pdfium", PDFiumPath);
|
||||
NS_ENSURE_FALSE(PDFiumPath.IsEmpty(), false);
|
||||
|
||||
nsAutoCString filePath = NS_ConvertUTF16toUTF8(PDFiumPath);
|
||||
@ -169,4 +169,4 @@ PDFiumEngineShim::RenderPage(HDC aDC, FPDF_PAGE aPage,
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
} // namespace mozilla
|
||||
|
@ -153,10 +153,9 @@ NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget,
|
||||
nsresult rv = NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
|
||||
if (aPrintSettings) {
|
||||
#ifdef MOZ_ENABLE_SKIA_PDF
|
||||
const nsAdoptingString& printViaPdf =
|
||||
mozilla::Preferences::GetString("print.print_via_pdf_encoder");
|
||||
|
||||
if (printViaPdf == NS_LITERAL_STRING("skia-pdf")) {
|
||||
nsAutoString printViaPdf;
|
||||
Preferences::GetString("print.print_via_pdf_encoder", printViaPdf);
|
||||
if (printViaPdf.EqualsLiteral("skia-pdf")) {
|
||||
mPrintViaSkPDF = true;
|
||||
}
|
||||
#endif
|
||||
|
@ -8132,8 +8132,8 @@ nsWindow::GetMainWindowClass()
|
||||
{
|
||||
static const wchar_t* sMainWindowClass = nullptr;
|
||||
if (!sMainWindowClass) {
|
||||
nsAdoptingString className =
|
||||
Preferences::GetString("ui.window_class_override");
|
||||
nsAutoString className;
|
||||
Preferences::GetString("ui.window_class_override", className);
|
||||
if (!className.IsEmpty()) {
|
||||
sMainWindowClass = wcsdup(className.get());
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user