зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1384835 (part 3, attempt 2) - Remove the Preferences::Get*CString() variants that return nsAdoptingCString. r=froydnj.
--HG-- extra : rebase_source : d317b25be2ec21d1a60d25da3689e46cdce0b649
This commit is contained in:
Родитель
d4f9aa5530
Коммит
72c884bf74
|
@ -1642,7 +1642,8 @@ nsScriptSecurityManager::EnsureFileURIWhitelist()
|
|||
//
|
||||
|
||||
mFileURIWhitelist.emplace();
|
||||
auto policies = mozilla::Preferences::GetCString("capability.policy.policynames");
|
||||
nsAutoCString policies;
|
||||
mozilla::Preferences::GetCString("capability.policy.policynames", policies);
|
||||
for (uint32_t base = SkipPast<IsWhitespaceOrComma>(policies, 0), bound = 0;
|
||||
base < policies.Length();
|
||||
base = SkipPast<IsWhitespaceOrComma>(policies, bound))
|
||||
|
@ -1665,7 +1666,8 @@ nsScriptSecurityManager::EnsureFileURIWhitelist()
|
|||
nsCString domainPrefName = NS_LITERAL_CSTRING("capability.policy.") +
|
||||
policyName +
|
||||
NS_LITERAL_CSTRING(".sites");
|
||||
auto siteList = Preferences::GetCString(domainPrefName.get());
|
||||
nsAutoCString siteList;
|
||||
Preferences::GetCString(domainPrefName.get(), siteList);
|
||||
AddSitesToFileURIWhitelist(siteList);
|
||||
}
|
||||
|
||||
|
|
|
@ -251,11 +251,12 @@ nsChromeRegistryChrome::OverrideLocalePackage(const nsACString& aPackage,
|
|||
nsACString& aOverride)
|
||||
{
|
||||
const nsACString& pref = NS_LITERAL_CSTRING(PACKAGE_OVERRIDE_BRANCH) + aPackage;
|
||||
nsAdoptingCString override = mozilla::Preferences::GetCString(PromiseFlatCString(pref).get());
|
||||
if (override) {
|
||||
nsAutoCString override;
|
||||
nsresult rv =
|
||||
mozilla::Preferences::GetCString(PromiseFlatCString(pref).get(), override);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aOverride = override;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
aOverride = aPackage;
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -578,16 +578,17 @@ nsDefaultURIFixup::MakeAlternateURI(nsIURI* aURI)
|
|||
// are www. & .com but they could be any other value, e.g. www. & .org
|
||||
|
||||
nsAutoCString prefix("www.");
|
||||
nsAdoptingCString prefPrefix =
|
||||
Preferences::GetCString("browser.fixup.alternate.prefix");
|
||||
if (prefPrefix) {
|
||||
nsAutoCString prefPrefix;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("browser.fixup.alternate.prefix", prefPrefix);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
prefix.Assign(prefPrefix);
|
||||
}
|
||||
|
||||
nsAutoCString suffix(".com");
|
||||
nsAdoptingCString prefSuffix =
|
||||
Preferences::GetCString("browser.fixup.alternate.suffix");
|
||||
if (prefSuffix) {
|
||||
nsAutoCString prefSuffix;
|
||||
rv = Preferences::GetCString("browser.fixup.alternate.suffix", prefSuffix);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
suffix.Assign(prefSuffix);
|
||||
}
|
||||
|
||||
|
|
|
@ -5099,9 +5099,11 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
|
|||
}
|
||||
|
||||
// See if an alternate cert error page is registered
|
||||
nsAdoptingCString alternateErrorPage =
|
||||
Preferences::GetCString("security.alternate_certificate_error_page");
|
||||
if (alternateErrorPage) {
|
||||
nsAutoCString alternateErrorPage;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("security.alternate_certificate_error_page",
|
||||
alternateErrorPage);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
errorPage.Assign(alternateErrorPage);
|
||||
}
|
||||
|
||||
|
@ -5123,9 +5125,10 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
|
|||
|
||||
// Malware and phishing detectors may want to use an alternate error
|
||||
// page, but if the pref's not set, we'll fall back on the standard page
|
||||
nsAdoptingCString alternateErrorPage =
|
||||
Preferences::GetCString("urlclassifier.alternate_error_page");
|
||||
if (alternateErrorPage) {
|
||||
nsAutoCString alternateErrorPage;
|
||||
nsresult rv = Preferences::GetCString("urlclassifier.alternate_error_page",
|
||||
alternateErrorPage);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
errorPage.Assign(alternateErrorPage);
|
||||
}
|
||||
|
||||
|
|
|
@ -118,9 +118,10 @@ AudioChannelAgent::FindCorrectWindow(nsPIDOMWindowInner* aWindow)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAdoptingCString systemAppUrl =
|
||||
mozilla::Preferences::GetCString("b2g.system_startup_url");
|
||||
if (!systemAppUrl) {
|
||||
nsAutoCString systemAppUrl;
|
||||
nsresult rv =
|
||||
mozilla::Preferences::GetCString("b2g.system_startup_url", systemAppUrl);
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1705,12 +1705,11 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
|||
}
|
||||
|
||||
if (gDumpFile == nullptr) {
|
||||
const nsAdoptingCString& fname =
|
||||
Preferences::GetCString("browser.dom.window.dump.file");
|
||||
nsAutoCString fname;
|
||||
Preferences::GetCString("browser.dom.window.dump.file", fname);
|
||||
if (!fname.IsEmpty()) {
|
||||
// if this fails to open, Dump() knows to just go to stdout
|
||||
// on null.
|
||||
gDumpFile = fopen(fname, "wb+");
|
||||
// If this fails to open, Dump() knows to just go to stdout on null.
|
||||
gDumpFile = fopen(fname.get(), "wb+");
|
||||
} else {
|
||||
gDumpFile = stdout;
|
||||
}
|
||||
|
@ -6941,7 +6940,8 @@ GetFullscreenTransitionDuration(bool aEnterFullscreen,
|
|||
const char* pref = aEnterFullscreen ?
|
||||
"full-screen-api.transition-duration.enter" :
|
||||
"full-screen-api.transition-duration.leave";
|
||||
nsAdoptingCString prefValue = Preferences::GetCString(pref);
|
||||
nsAutoCString prefValue;
|
||||
Preferences::GetCString(pref, prefValue);
|
||||
if (!prefValue.IsEmpty()) {
|
||||
sscanf(prefValue.get(), "%hu%hu",
|
||||
&aDuration->mFadeIn, &aDuration->mFadeOut);
|
||||
|
|
|
@ -960,7 +960,8 @@ nsObjectLoadingContent::BuildParametersArray()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsAdoptingCString wmodeOverride = Preferences::GetCString("plugins.force.wmode");
|
||||
nsAutoCString wmodeOverride;
|
||||
Preferences::GetCString("plugins.force.wmode", wmodeOverride);
|
||||
for (uint32_t i = 0; i < mCachedAttributes.Length(); i++) {
|
||||
if (!wmodeOverride.IsEmpty() && mCachedAttributes[i].mName.EqualsIgnoreCase("wmode")) {
|
||||
CopyASCIItoUTF16(wmodeOverride, mCachedAttributes[i].mValue);
|
||||
|
@ -1663,8 +1664,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
|||
///
|
||||
|
||||
if (aJavaURI || thisContent->NodeInfo()->Equals(nsGkAtoms::applet)) {
|
||||
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||
newMime = javaMIME;
|
||||
Preferences::GetCString(kPrefJavaMIME, newMime);
|
||||
NS_ASSERTION(IsJavaMIME(newMime),
|
||||
"plugin.mime.java should be recognized as java");
|
||||
isJava = true;
|
||||
|
@ -1687,7 +1687,8 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
|||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
|
||||
if (!classIDAttr.IsEmpty()) {
|
||||
// Our classid support is limited to 'java:' ids
|
||||
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||
nsAutoCString javaMIME;
|
||||
Preferences::GetCString(kPrefJavaMIME, javaMIME);
|
||||
NS_ASSERTION(IsJavaMIME(javaMIME),
|
||||
"plugin.mime.java should be recognized as java");
|
||||
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
|
||||
|
|
|
@ -333,7 +333,9 @@ operator<(const RefPtr<nsPluginElement>& lhs,
|
|||
static bool
|
||||
PluginShouldBeHidden(const nsCString& aName) {
|
||||
// This only supports one hidden plugin
|
||||
return Preferences::GetCString("plugins.navigator.hidden_ctp_plugin").Equals(aName);
|
||||
nsAutoCString value;
|
||||
Preferences::GetCString("plugins.navigator.hidden_ctp_plugin", value);
|
||||
return value.Equals(aName);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -49,8 +49,8 @@ FallbackEncoding::Get()
|
|||
return WrapNotNull(mFallback);
|
||||
}
|
||||
|
||||
const nsAdoptingCString& override =
|
||||
Preferences::GetCString("intl.charset.fallback.override");
|
||||
nsAutoCString override;
|
||||
Preferences::GetCString("intl.charset.fallback.override", override);
|
||||
// Don't let the user break things by setting the override to unreasonable
|
||||
// values via about:config
|
||||
auto encoding = Encoding::ForLabel(override);
|
||||
|
|
|
@ -900,7 +900,8 @@ Event::PopupAllowedEventsChanged()
|
|||
free(sPopupAllowedEvents);
|
||||
}
|
||||
|
||||
nsAdoptingCString str = Preferences::GetCString("dom.popup_allowed_events");
|
||||
nsAutoCString str;
|
||||
Preferences::GetCString("dom.popup_allowed_events", str);
|
||||
|
||||
// We'll want to do this even if str is empty to avoid looking up
|
||||
// this pref all the time if it's not set.
|
||||
|
|
|
@ -431,8 +431,8 @@ IndexedDatabaseManager::Init()
|
|||
kPrefMaxSerilizedMsgSize);
|
||||
|
||||
#ifdef ENABLE_INTL_API
|
||||
const nsAdoptingCString& acceptLang =
|
||||
Preferences::GetLocalizedCString("intl.accept_languages");
|
||||
nsAutoCString acceptLang;
|
||||
Preferences::GetLocalizedCString("intl.accept_languages", acceptLang);
|
||||
|
||||
// Split values on commas.
|
||||
nsCCharSeparatedTokenizer langTokenizer(acceptLang, ',');
|
||||
|
|
|
@ -1511,13 +1511,15 @@ StartMacOSContentSandbox()
|
|||
// These paths are used to whitelist certain directories used by the testing
|
||||
// system. They should not be considered a public API, and are only intended
|
||||
// for use in automation.
|
||||
nsAdoptingCString testingReadPath1 =
|
||||
Preferences::GetCString("security.sandbox.content.mac.testing_read_path1");
|
||||
nsAutoCString testingReadPath1;
|
||||
Preferences::GetCString("security.sandbox.content.mac.testing_read_path1",
|
||||
testingReadPath1);
|
||||
if (!testingReadPath1.IsEmpty()) {
|
||||
info.testingReadPath1.assign(testingReadPath1.get());
|
||||
}
|
||||
nsAdoptingCString testingReadPath2 =
|
||||
Preferences::GetCString("security.sandbox.content.mac.testing_read_path2");
|
||||
nsAutoCString testingReadPath2;
|
||||
Preferences::GetCString("security.sandbox.content.mac.testing_read_path2",
|
||||
testingReadPath2);
|
||||
if (!testingReadPath2.IsEmpty()) {
|
||||
info.testingReadPath2.assign(testingReadPath2.get());
|
||||
}
|
||||
|
@ -1605,11 +1607,12 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
|
|||
}
|
||||
// Allow user overrides of seccomp-bpf syscall filtering
|
||||
std::vector<int> syscallWhitelist;
|
||||
nsAdoptingCString extraSyscalls =
|
||||
Preferences::GetCString("security.sandbox.content.syscall_whitelist");
|
||||
if (extraSyscalls) {
|
||||
nsAutoCString extraSyscalls;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("security.sandbox.content.syscall_whitelist",
|
||||
extraSyscalls);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
for (const nsACString& callNrString : extraSyscalls.Split(',')) {
|
||||
nsresult rv;
|
||||
int callNr = PromiseFlatCString(callNrString).ToInteger(&rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
syscallWhitelist.push_back(callNr);
|
||||
|
|
|
@ -2040,7 +2040,8 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
|
|||
boolPrefs.Append(nsPrintfCString("%u:%d|", i, Preferences::GetBool(ContentPrefs::GetContentPref(i))));
|
||||
break;
|
||||
case nsIPrefBranch::PREF_STRING: {
|
||||
nsAdoptingCString value(Preferences::GetCString(ContentPrefs::GetContentPref(i)));
|
||||
nsAutoCString value;
|
||||
Preferences::GetCString(ContentPrefs::GetContentPref(i), value);
|
||||
stringPrefs.Append(nsPrintfCString("%u:%d;%s|", i, value.Length(), value.get()));
|
||||
|
||||
}
|
||||
|
|
|
@ -404,8 +404,8 @@ AllowNotification(const NotificationAndReportStringId& aNotification)
|
|||
// - Comma-separater list of ids -> Allow if aReportStringId (from
|
||||
// dom.properties) is one of them.
|
||||
// - Nothing (missing or empty) -> Disable everything.
|
||||
nsAdoptingCString filter =
|
||||
Preferences::GetCString("media.decoder-doctor.notifications-allowed");
|
||||
nsAutoCString filter;
|
||||
Preferences::GetCString("media.decoder-doctor.notifications-allowed", filter);
|
||||
return filter.EqualsLiteral("*") ||
|
||||
StringListContains(filter, aNotification.mReportStringId);
|
||||
}
|
||||
|
@ -424,10 +424,11 @@ AllowDecodeIssue(const MediaResult& aDecodeIssue, bool aDecodeIssueIsError)
|
|||
// - '*' -> Allow everything.
|
||||
// - Comma-separater list of ids -> Allow if the issue name is one of them.
|
||||
// - Nothing (missing or empty) -> Disable everything.
|
||||
nsAdoptingCString filter =
|
||||
Preferences::GetCString(aDecodeIssueIsError
|
||||
? "media.decoder-doctor.decode-errors-allowed"
|
||||
: "media.decoder-doctor.decode-warnings-allowed");
|
||||
nsAutoCString filter;
|
||||
Preferences::GetCString(aDecodeIssueIsError
|
||||
? "media.decoder-doctor.decode-errors-allowed"
|
||||
: "media.decoder-doctor.decode-warnings-allowed",
|
||||
filter);
|
||||
if (filter.EqualsLiteral("*")) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1699,16 +1699,16 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
|
|||
RefPtr<PledgeSourceSet> p = new PledgeSourceSet();
|
||||
uint32_t id = mOutstandingPledges.Append(*p);
|
||||
|
||||
nsAdoptingCString audioLoopDev, videoLoopDev;
|
||||
nsAutoCString audioLoopDev, videoLoopDev;
|
||||
if (!aFake) {
|
||||
// Fake stream not requested. The entire device stack is available.
|
||||
// Loop in loopback devices if they are set, and their respective type is
|
||||
// requested. This is currently used for automated media tests only.
|
||||
if (aVideoType == MediaSourceEnum::Camera) {
|
||||
videoLoopDev = Preferences::GetCString("media.video_loopback_dev");
|
||||
Preferences::GetCString("media.video_loopback_dev", videoLoopDev);
|
||||
}
|
||||
if (aAudioType == MediaSourceEnum::Microphone) {
|
||||
audioLoopDev = Preferences::GetCString("media.audio_loopback_dev");
|
||||
Preferences::GetCString("media.audio_loopback_dev", audioLoopDev);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1735,7 +1735,8 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
|
|||
if (hasVideo) {
|
||||
nsTArray<RefPtr<VideoDevice>> videos;
|
||||
GetSources(fakeCams? fakeBackend : realBackend, aVideoType,
|
||||
&MediaEngine::EnumerateVideoDevices, videos, videoLoopDev);
|
||||
&MediaEngine::EnumerateVideoDevices, videos,
|
||||
videoLoopDev.get());
|
||||
for (auto& source : videos) {
|
||||
result->AppendElement(source);
|
||||
}
|
||||
|
@ -1743,7 +1744,8 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
|
|||
if (hasAudio) {
|
||||
nsTArray<RefPtr<AudioDevice>> audios;
|
||||
GetSources(fakeMics? fakeBackend : realBackend, aAudioType,
|
||||
&MediaEngine::EnumerateAudioDevices, audios, audioLoopDev);
|
||||
&MediaEngine::EnumerateAudioDevices, audios,
|
||||
audioLoopDev.get());
|
||||
for (auto& source : audios) {
|
||||
result->AppendElement(source);
|
||||
}
|
||||
|
|
|
@ -72,8 +72,8 @@ GetSpeechRecognitionService(const nsAString& aLang)
|
|||
{
|
||||
nsAutoCString speechRecognitionServiceCID;
|
||||
|
||||
nsAdoptingCString prefValue =
|
||||
Preferences::GetCString(PREFERENCE_DEFAULT_RECOGNITION_SERVICE);
|
||||
nsAutoCString prefValue;
|
||||
Preferences::GetCString(PREFERENCE_DEFAULT_RECOGNITION_SERVICE, prefValue);
|
||||
nsAutoCString speechRecognitionService;
|
||||
|
||||
if (!aLang.IsEmpty()) {
|
||||
|
|
|
@ -1554,8 +1554,8 @@ nsPluginHost::RegisterFakePlugin(JS::Handle<JS::Value> aInitDictionary,
|
|||
|
||||
mFakePlugins.AppendElement(newTag);
|
||||
|
||||
nsAdoptingCString disableFullPage =
|
||||
Preferences::GetCString(kPrefDisableFullPage);
|
||||
nsAutoCString disableFullPage;
|
||||
Preferences::GetCString(kPrefDisableFullPage, disableFullPage);
|
||||
for (uint32_t i = 0; i < newTag->MimeTypes().Length(); i++) {
|
||||
if (!IsTypeInList(newTag->MimeTypes()[i], disableFullPage)) {
|
||||
RegisterWithCategoryManager(newTag->MimeTypes()[i],
|
||||
|
@ -1822,8 +1822,9 @@ nsPluginHost::GetSpecialType(const nsACString & aMIMEType)
|
|||
|
||||
// The java mime pref may well not be one of these,
|
||||
// e.g. application/x-java-test used in the test suite
|
||||
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||
if ((!javaMIME.IsEmpty() && noParam.LowerCaseEqualsASCII(javaMIME)) ||
|
||||
nsAutoCString javaMIME;
|
||||
Preferences::GetCString(kPrefJavaMIME, javaMIME);
|
||||
if ((!javaMIME.IsEmpty() && noParam.LowerCaseEqualsASCII(javaMIME.get())) ||
|
||||
noParam.LowerCaseEqualsASCII("application/x-java-vm") ||
|
||||
noParam.LowerCaseEqualsASCII("application/x-java-applet") ||
|
||||
noParam.LowerCaseEqualsASCII("application/x-java-bean")) {
|
||||
|
@ -2013,8 +2014,8 @@ nsPluginHost::AddPluginTag(nsPluginTag* aPluginTag)
|
|||
mPlugins = aPluginTag;
|
||||
|
||||
if (aPluginTag->IsActive()) {
|
||||
nsAdoptingCString disableFullPage =
|
||||
Preferences::GetCString(kPrefDisableFullPage);
|
||||
nsAutoCString disableFullPage;
|
||||
Preferences::GetCString(kPrefDisableFullPage, disableFullPage);
|
||||
for (uint32_t i = 0; i < aPluginTag->MimeTypes().Length(); i++) {
|
||||
if (!IsTypeInList(aPluginTag->MimeTypes()[i], disableFullPage)) {
|
||||
RegisterWithCategoryManager(aPluginTag->MimeTypes()[i],
|
||||
|
@ -2407,8 +2408,8 @@ nsPluginHost::SetPluginsInContent(uint32_t aPluginEpoch,
|
|||
tag.extensions(),
|
||||
tag.niceName(),
|
||||
tag.sandboxScript()));
|
||||
nsAdoptingCString disableFullPage =
|
||||
Preferences::GetCString(kPrefDisableFullPage);
|
||||
nsAutoCString disableFullPage;
|
||||
Preferences::GetCString(kPrefDisableFullPage, disableFullPage);
|
||||
for (uint32_t i = 0; i < pluginTag->MimeTypes().Length(); i++) {
|
||||
if (!IsTypeInList(pluginTag->MimeTypes()[i], disableFullPage)) {
|
||||
RegisterWithCategoryManager(pluginTag->MimeTypes()[i],
|
||||
|
@ -2655,8 +2656,8 @@ nsPluginHost::UpdateInMemoryPluginInfo(nsPluginTag* aPluginTag)
|
|||
}
|
||||
|
||||
// Update types with category manager
|
||||
nsAdoptingCString disableFullPage =
|
||||
Preferences::GetCString(kPrefDisableFullPage);
|
||||
nsAutoCString disableFullPage;
|
||||
Preferences::GetCString(kPrefDisableFullPage, disableFullPage);
|
||||
for (uint32_t i = 0; i < aPluginTag->MimeTypes().Length(); i++) {
|
||||
nsRegisterType shouldRegister;
|
||||
|
||||
|
@ -2694,8 +2695,9 @@ nsPluginHost::UpdatePluginInfo(nsPluginTag* aPluginTag)
|
|||
/* static */ bool
|
||||
nsPluginHost::IsTypeWhitelisted(const char *aMimeType)
|
||||
{
|
||||
nsAdoptingCString whitelist = Preferences::GetCString(kPrefWhitelist);
|
||||
if (!whitelist.Length()) {
|
||||
nsAutoCString whitelist;
|
||||
Preferences::GetCString(kPrefWhitelist, whitelist);
|
||||
if (whitelist.IsEmpty()) {
|
||||
return true;
|
||||
}
|
||||
nsDependentCString wrap(aMimeType);
|
||||
|
|
|
@ -160,7 +160,8 @@ MulticastDNSDeviceProvider::Init()
|
|||
mDiscoverable = Preferences::GetBool(PREF_PRESENTATION_DISCOVERABLE);
|
||||
mDiscoverableEncrypted = Preferences::GetBool(PREF_PRESENTATION_DISCOVERABLE_ENCRYPTED);
|
||||
mServerRetryMs = Preferences::GetUint(PREF_PRESENTATION_DISCOVERABLE_RETRY_MS);
|
||||
mServiceName = Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME);
|
||||
mServiceName.Truncate();
|
||||
Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME, mServiceName);
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// FIXME: Bug 1185806 - Provide a common device name setting.
|
||||
|
@ -1098,7 +1099,8 @@ MulticastDNSDeviceProvider::Observe(nsISupports* aSubject,
|
|||
} else if (data.EqualsLiteral(PREF_PRESENTATION_DISCOVERABLE)) {
|
||||
OnDiscoverableChanged(Preferences::GetBool(PREF_PRESENTATION_DISCOVERABLE));
|
||||
} else if (data.EqualsLiteral(PREF_PRESENTATION_DEVICE_NAME)) {
|
||||
nsAdoptingCString newServiceName = Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME);
|
||||
nsAutoCString newServiceName;
|
||||
Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME, newServiceName);
|
||||
if (!mServiceName.Equals(newServiceName)) {
|
||||
OnServiceNameChanged(newServiceName);
|
||||
}
|
||||
|
|
|
@ -714,8 +714,10 @@ nsContentSecurityManager::IsOriginPotentiallyTrustworthy(nsIPrincipal* aPrincipa
|
|||
// whitelist for network resources, i.e., those with scheme "http" or "ws".
|
||||
// The pref should contain a comma-separated list of hostnames.
|
||||
if (scheme.EqualsLiteral("http") || scheme.EqualsLiteral("ws")) {
|
||||
nsAdoptingCString whitelist = Preferences::GetCString("dom.securecontext.whitelist");
|
||||
if (whitelist) {
|
||||
nsAutoCString whitelist;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("dom.securecontext.whitelist", whitelist);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCCharSeparatedTokenizer tokenizer(whitelist, ',');
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
const nsACString& allowedHost = tokenizer.nextToken();
|
||||
|
|
|
@ -276,8 +276,8 @@ HTMLEditRules::Init(TextEditor* aTextEditor)
|
|||
// cache any prefs we care about
|
||||
static const char kPrefName[] =
|
||||
"editor.html.typing.returnInEmptyListItemClosesList";
|
||||
nsAdoptingCString returnInEmptyLIKillsList =
|
||||
Preferences::GetCString(kPrefName);
|
||||
nsAutoCString returnInEmptyLIKillsList;
|
||||
Preferences::GetCString(kPrefName, returnInEmptyLIKillsList);
|
||||
|
||||
// only when "false", becomes FALSE. Otherwise (including empty), TRUE.
|
||||
// XXX Why was this pref designed as a string and not bool?
|
||||
|
|
|
@ -2857,7 +2857,8 @@ nsPermissionManager::Import()
|
|||
nsresult
|
||||
nsPermissionManager::ImportDefaults()
|
||||
{
|
||||
nsCString defaultsURL = mozilla::Preferences::GetCString(kDefaultsUrlPrefName);
|
||||
nsAutoCString defaultsURL;
|
||||
mozilla::Preferences::GetCString(kDefaultsUrlPrefName, defaultsURL);
|
||||
if (defaultsURL.IsEmpty()) { // == Don't use built-in permissions.
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ static PRLibrary* LoadApitraceLibrary()
|
|||
if (sApitraceLibrary)
|
||||
return sApitraceLibrary;
|
||||
|
||||
nsCString logFile = Preferences::GetCString("gfx.apitrace.logfile");
|
||||
|
||||
nsAutoCString logFile;
|
||||
Preferences::GetCString("gfx.apitrace.logfile", logFile);
|
||||
if (logFile.IsEmpty()) {
|
||||
logFile = "firefox.trace";
|
||||
}
|
||||
|
|
|
@ -991,9 +991,11 @@ gfxDWriteFontList::InitFontListForPlatform()
|
|||
}
|
||||
}
|
||||
|
||||
nsAdoptingCString classicFamilies =
|
||||
Preferences::GetCString("gfx.font_rendering.cleartype_params.force_gdi_classic_for_families");
|
||||
if (classicFamilies) {
|
||||
nsAutoCString classicFamilies;
|
||||
nsresult rv = Preferences::GetCString(
|
||||
"gfx.font_rendering.cleartype_params.force_gdi_classic_for_families",
|
||||
classicFamilies);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCCharSeparatedTokenizer tokenizer(classicFamilies, ',');
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
NS_ConvertUTF8toUTF16 name(tokenizer.nextToken());
|
||||
|
|
|
@ -1902,15 +1902,15 @@ gfxFcPlatformFontList::PrefFontListsUseOnlyGenerics()
|
|||
nsCCharSeparatedTokenizer tokenizer(prefName, '.');
|
||||
const nsDependentCSubstring& generic = tokenizer.nextToken();
|
||||
const nsDependentCSubstring& langGroup = tokenizer.nextToken();
|
||||
nsAdoptingCString fontPrefValue = Preferences::GetCString(names[i]);
|
||||
nsAutoCString fontPrefValue;
|
||||
Preferences::GetCString(names[i], fontPrefValue);
|
||||
if (fontPrefValue.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, this
|
||||
// should return false.
|
||||
fontPrefValue =
|
||||
Preferences::GetCString(NameListPref(generic,
|
||||
langGroup).get());
|
||||
Preferences::GetCString(NameListPref(generic, langGroup).get(),
|
||||
fontPrefValue);
|
||||
}
|
||||
|
||||
if (!langGroup.EqualsLiteral("x-math") &&
|
||||
|
|
|
@ -645,8 +645,12 @@ gfxPlatform::Init()
|
|||
gfxVars::SetPDMWMFDisableD3D11Dlls(nsCString());
|
||||
gfxVars::SetPDMWMFDisableD3D9Dlls(nsCString());
|
||||
} else {
|
||||
gfxVars::SetPDMWMFDisableD3D11Dlls(Preferences::GetCString("media.wmf.disable-d3d11-for-dlls"));
|
||||
gfxVars::SetPDMWMFDisableD3D9Dlls(Preferences::GetCString("media.wmf.disable-d3d9-for-dlls"));
|
||||
nsAutoCString d3d11;
|
||||
Preferences::GetCString("media.wmf.disable-d3d11-for-dlls", d3d11);
|
||||
gfxVars::SetPDMWMFDisableD3D11Dlls(d3d11);
|
||||
nsAutoCString d3d9;
|
||||
Preferences::GetCString("media.wmf.disable-d3d9-for-dlls", d3d9);
|
||||
gfxVars::SetPDMWMFDisableD3D9Dlls(d3d9);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
|
@ -1942,9 +1946,10 @@ gfxPlatform::GetPlatformCMSOutputProfile(void *&mem, size_t &size)
|
|||
void
|
||||
gfxPlatform::GetCMSOutputProfileData(void *&mem, size_t &size)
|
||||
{
|
||||
nsAdoptingCString fname = Preferences::GetCString("gfx.color_management.display_profile");
|
||||
nsAutoCString fname;
|
||||
Preferences::GetCString("gfx.color_management.display_profile", fname);
|
||||
if (!fname.IsEmpty()) {
|
||||
qcms_data_from_path(fname, &mem, &size);
|
||||
qcms_data_from_path(fname.get(), &mem, &size);
|
||||
}
|
||||
else {
|
||||
gfxPlatform::GetPlatform()->GetPlatformCMSOutputProfile(mem, size);
|
||||
|
|
|
@ -1089,7 +1089,8 @@ gfxPlatformFontList::AppendCJKPrefLangs(eFontPrefLang aPrefLangs[], uint32_t &aL
|
|||
uint32_t tempLen = 0;
|
||||
|
||||
// Add the CJK pref fonts from accept languages, the order should be same order
|
||||
nsAdoptingCString list = Preferences::GetLocalizedCString("intl.accept_languages");
|
||||
nsAutoCString list;
|
||||
Preferences::GetLocalizedCString("intl.accept_languages", list);
|
||||
if (!list.IsEmpty()) {
|
||||
const char kComma = ',';
|
||||
const char *p, *p_end;
|
||||
|
@ -1215,8 +1216,8 @@ gfxPlatformFontList::GetDefaultGeneric(eFontPrefLang aLang)
|
|||
for (uint32_t i = 0; i < ArrayLength(gPrefLangNames); i++) {
|
||||
nsAutoCString prefDefaultFontType("font.default.");
|
||||
prefDefaultFontType.Append(GetPrefLangName(eFontPrefLang(i)));
|
||||
nsAdoptingCString serifOrSans =
|
||||
Preferences::GetCString(prefDefaultFontType.get());
|
||||
nsAutoCString serifOrSans;
|
||||
Preferences::GetCString(prefDefaultFontType.get(), serifOrSans);
|
||||
if (serifOrSans.EqualsLiteral("sans-serif")) {
|
||||
mDefaultGenericsLangGroup[i] = eFamily_sans_serif;
|
||||
} else {
|
||||
|
|
|
@ -115,18 +115,16 @@ LoadOSVRRuntime()
|
|||
static PRLibrary* osvrClientLib = nullptr;
|
||||
static PRLibrary* osvrClientKitLib = nullptr;
|
||||
//this looks up the path in the about:config setting, from greprefs.js or modules\libpref\init\all.js
|
||||
nsAdoptingCString osvrUtilPath =
|
||||
mozilla::Preferences::GetCString("gfx.vr.osvr.utilLibPath");
|
||||
nsAdoptingCString osvrCommonPath =
|
||||
mozilla::Preferences::GetCString("gfx.vr.osvr.commonLibPath");
|
||||
nsAdoptingCString osvrClientPath =
|
||||
mozilla::Preferences::GetCString("gfx.vr.osvr.clientLibPath");
|
||||
nsAdoptingCString osvrClientKitPath =
|
||||
mozilla::Preferences::GetCString("gfx.vr.osvr.clientKitLibPath");
|
||||
|
||||
//we need all the libs to be valid
|
||||
if ((!osvrUtilPath) || (!osvrCommonPath) || (!osvrClientPath) ||
|
||||
(!osvrClientKitPath)) {
|
||||
nsAutoCString osvrUtilPath, osvrCommonPath, osvrClientPath, osvrClientKitPath;
|
||||
if (NS_FAILED(mozilla::Preferences::GetCString("gfx.vr.osvr.utilLibPath",
|
||||
osvrUtilPath)) ||
|
||||
NS_FAILED(mozilla::Preferences::GetCString("gfx.vr.osvr.commonLibPath",
|
||||
osvrCommonPath)) ||
|
||||
NS_FAILED(mozilla::Preferences::GetCString("gfx.vr.osvr.clientLibPath",
|
||||
osvrClientPath)) ||
|
||||
NS_FAILED(mozilla::Preferences::GetCString("gfx.vr.osvr.clientKitLibPath",
|
||||
osvrClientKitPath))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1346,12 +1346,13 @@ imgLoader::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
|
||||
void imgLoader::ReadAcceptHeaderPref()
|
||||
{
|
||||
nsAdoptingCString accept = Preferences::GetCString("image.http.accept");
|
||||
if (accept) {
|
||||
nsAutoCString accept;
|
||||
nsresult rv = Preferences::GetCString("image.http.accept", accept);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mAcceptHeader = accept;
|
||||
} else {
|
||||
mAcceptHeader =
|
||||
IMAGE_PNG "," IMAGE_WILDCARD ";q=0.8," ANY_WILDCARD ";q=0.5";
|
||||
IMAGE_PNG "," IMAGE_WILDCARD ";q=0.8," ANY_WILDCARD ";q=0.5";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -305,8 +305,9 @@ nsHyphenationManager::LoadAliases()
|
|||
&prefCount, &prefNames);
|
||||
if (NS_SUCCEEDED(rv) && prefCount > 0) {
|
||||
for (uint32_t i = 0; i < prefCount; ++i) {
|
||||
nsAdoptingCString value = Preferences::GetCString(prefNames[i]);
|
||||
if (value) {
|
||||
nsAutoCString value;
|
||||
rv = Preferences::GetCString(prefNames[i], value);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAutoCString alias(prefNames[i]);
|
||||
alias.Cut(0, sizeof(kIntlHyphenationAliasPrefix) - 1);
|
||||
ToLowerCase(alias);
|
||||
|
|
|
@ -19,7 +19,8 @@ OSPreferences::ReadSystemLocales(nsTArray<nsCString>& aLocaleList)
|
|||
//XXX: Notice, this value may be empty on an early read. In that case
|
||||
// we won't add anything to the return list so that it doesn't get
|
||||
// cached in mSystemLocales.
|
||||
nsAdoptingCString locale = Preferences::GetCString("intl.locale.os");
|
||||
nsAutoCString locale;
|
||||
Preferences::GetCString("intl.locale.os", locale);
|
||||
if (!locale.IsEmpty()) {
|
||||
aLocaleList.AppendElement(locale);
|
||||
return true;
|
||||
|
|
|
@ -73,9 +73,11 @@ ForbidCPOWsInCompatibleAddon(const nsACString& aAddonId)
|
|||
return false;
|
||||
}
|
||||
|
||||
nsCString allow;
|
||||
nsAutoCString allow;
|
||||
allow.Assign(',');
|
||||
allow.Append(Preferences::GetCString("dom.ipc.cpows.allow-cpows-in-compat-addons"));
|
||||
nsAutoCString pref;
|
||||
Preferences::GetCString("dom.ipc.cpows.allow-cpows-in-compat-addons", pref);
|
||||
allow.Append(pref);
|
||||
allow.Append(',');
|
||||
|
||||
nsCString searchString(",");
|
||||
|
|
|
@ -103,8 +103,8 @@ LangGroupFontPrefs::Initialize(nsIAtom* aLangGroupAtom)
|
|||
enum {eUnit_unknown = -1, eUnit_px, eUnit_pt};
|
||||
int32_t unit = eUnit_px;
|
||||
|
||||
nsAdoptingCString cvalue =
|
||||
Preferences::GetCString("font.size.unit");
|
||||
nsAutoCString cvalue;
|
||||
Preferences::GetCString("font.size.unit", cvalue);
|
||||
|
||||
if (!cvalue.IsEmpty()) {
|
||||
if (cvalue.EqualsLiteral("px")) {
|
||||
|
@ -222,7 +222,8 @@ LangGroupFontPrefs::Initialize(nsIAtom* aLangGroupAtom)
|
|||
// get font.size-adjust.[generic].[langGroup]
|
||||
// XXX only applicable on GFX ports that handle |font-size-adjust|
|
||||
MAKE_FONT_PREF_KEY(pref, "font.size-adjust", generic_dot_langGroup);
|
||||
cvalue = Preferences::GetCString(pref.get());
|
||||
cvalue.Truncate();
|
||||
Preferences::GetCString(pref.get(), cvalue);
|
||||
if (!cvalue.IsEmpty()) {
|
||||
font->sizeAdjust = (float)atof(cvalue.get());
|
||||
}
|
||||
|
|
|
@ -641,8 +641,8 @@ nsPresContext::GetUserPreferences()
|
|||
StaticPresData::Get()->ResetCachedFontPrefs();
|
||||
|
||||
// * image animation
|
||||
const nsAdoptingCString& animatePref =
|
||||
Preferences::GetCString("image.animation_mode");
|
||||
nsAutoCString animatePref;
|
||||
Preferences::GetCString("image.animation_mode", animatePref);
|
||||
if (animatePref.EqualsLiteral("normal"))
|
||||
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
|
||||
else if (animatePref.EqualsLiteral("none"))
|
||||
|
|
|
@ -1605,7 +1605,9 @@ static nsresult pref_InitInitialObjects()
|
|||
#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
|
||||
prerelease = true;
|
||||
#else
|
||||
if (Preferences::GetDefaultCString(kChannelPref).EqualsLiteral("beta")) {
|
||||
nsAutoCString prefValue;
|
||||
Preferences::GetDefaultCString(kChannelPref, prefValue);
|
||||
if (prefValue.EqualsLiteral("beta")) {
|
||||
prerelease = true;
|
||||
}
|
||||
#endif
|
||||
|
@ -1665,24 +1667,15 @@ Preferences::GetFloat(const char* aPref, float* aResult)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingCString
|
||||
Preferences::GetCString(const char* aPref)
|
||||
{
|
||||
nsAdoptingCString result;
|
||||
PREF_CopyCharPref(aPref, getter_Copies(result), false);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetCString(const char* aPref, nsACString& aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsAutoCString result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), false);
|
||||
char* result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, &result, false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aResult = result;
|
||||
aResult.Adopt(result);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -1700,15 +1693,6 @@ Preferences::GetString(const char* aPref, nsAString& aResult)
|
|||
return rv;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingCString
|
||||
Preferences::GetLocalizedCString(const char* aPref)
|
||||
{
|
||||
nsAdoptingCString result;
|
||||
GetLocalizedCString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetLocalizedCString(const char* aPref, nsACString& aResult)
|
||||
|
@ -2179,10 +2163,10 @@ nsresult
|
|||
Preferences::GetDefaultCString(const char* aPref, nsACString& aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsAutoCString result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), true);
|
||||
char* result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, &result, true);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aResult = result;
|
||||
aResult.Adopt(result);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -2231,24 +2215,6 @@ Preferences::GetDefaultLocalizedString(const char* aPref,
|
|||
return rv;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingCString
|
||||
Preferences::GetDefaultCString(const char* aPref)
|
||||
{
|
||||
nsAdoptingCString result;
|
||||
PREF_CopyCharPref(aPref, getter_Copies(result), true);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsAdoptingCString
|
||||
Preferences::GetDefaultLocalizedCString(const char* aPref)
|
||||
{
|
||||
nsAdoptingCString result;
|
||||
GetDefaultLocalizedCString(aPref, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
Preferences::GetDefaultComplex(const char* aPref, const nsIID &aType,
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "mozilla/MemoryReporting.h"
|
||||
|
||||
class nsIFile;
|
||||
class nsAdoptingCString;
|
||||
|
||||
#ifndef have_PrefChangedFunc_typedef
|
||||
typedef void (*PrefChangedFunc)(const char *, void *);
|
||||
|
@ -147,30 +146,6 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets char type pref value directly. If failed, the get() of result
|
||||
* returns nullptr. Even if succeeded but the result was empty string, the
|
||||
* get() does NOT return nullptr. So, you can check whether the method
|
||||
* succeeded or not by:
|
||||
*
|
||||
* nsAdoptingString value = Prefereces::GetString("foo.bar");
|
||||
* if (!value) {
|
||||
* // failed
|
||||
* }
|
||||
*
|
||||
* Be aware. If you wrote as:
|
||||
*
|
||||
* nsAutoString value = Preferences::GetString("foo.bar");
|
||||
* if (!value.get()) {
|
||||
* // the condition is always FALSE!!
|
||||
* }
|
||||
*
|
||||
* The value.get() doesn't return nullptr. You must use nsAdoptingString
|
||||
* when you need to check whether it was failure or not.
|
||||
*/
|
||||
static nsAdoptingCString GetCString(const char* aPref);
|
||||
static nsAdoptingCString GetLocalizedCString(const char* aPref);
|
||||
|
||||
/**
|
||||
* Gets int, float, or bool type pref value with raw return value of
|
||||
* nsIPrefBranch.
|
||||
|
@ -378,15 +353,7 @@ public:
|
|||
|
||||
/**
|
||||
* Gets the default value of the char type pref.
|
||||
* If the get() of the result returned nullptr, that meant the value didn't
|
||||
* have default value.
|
||||
*
|
||||
* See the comment at definition at GetString() and GetCString() for more
|
||||
* details of the result.
|
||||
*/
|
||||
static nsAdoptingCString GetDefaultCString(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 GetDefaultLocalizedCString(const char* aPref,
|
||||
|
|
|
@ -120,14 +120,18 @@ CachedPrefs::OnPrefsChange(const char* aPref, void* aClosure)
|
|||
CachedPrefs* prefs = static_cast<CachedPrefs*> (aClosure);
|
||||
|
||||
if (!strcmp(aPref, URLCLASSIFIER_SKIP_HOSTNAMES)) {
|
||||
nsCString skipHostnames = Preferences::GetCString(URLCLASSIFIER_SKIP_HOSTNAMES);
|
||||
nsCString skipHostnames;
|
||||
Preferences::GetCString(URLCLASSIFIER_SKIP_HOSTNAMES, skipHostnames);
|
||||
ToLowerCase(skipHostnames);
|
||||
prefs->SetSkipHostnames(skipHostnames);
|
||||
} else if (!strcmp(aPref, URLCLASSIFIER_TRACKING_WHITELIST)) {
|
||||
nsCString trackingWhitelist = Preferences::GetCString(URLCLASSIFIER_TRACKING_WHITELIST);
|
||||
nsCString trackingWhitelist;
|
||||
Preferences::GetCString(URLCLASSIFIER_TRACKING_WHITELIST,
|
||||
trackingWhitelist);
|
||||
prefs->SetTrackingWhiteList(trackingWhitelist);
|
||||
} else if (!strcmp(aPref, URLCLASSIFIER_TRACKING_TABLE)) {
|
||||
nsCString trackingBlacklist = Preferences::GetCString(URLCLASSIFIER_TRACKING_TABLE);
|
||||
nsCString trackingBlacklist;
|
||||
Preferences::GetCString(URLCLASSIFIER_TRACKING_TABLE, trackingBlacklist);
|
||||
prefs->SetTrackingBlackList(trackingBlacklist);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2003,8 +2003,8 @@ nsHttpHandler::SetAcceptLanguages()
|
|||
{
|
||||
mAcceptLanguagesIsDirty = false;
|
||||
|
||||
const nsAdoptingCString& acceptLanguages =
|
||||
Preferences::GetLocalizedCString(INTL_ACCEPT_LANGUAGES);
|
||||
nsAutoCString acceptLanguages;
|
||||
Preferences::GetLocalizedCString(INTL_ACCEPT_LANGUAGES, acceptLanguages);
|
||||
|
||||
nsAutoCString buf;
|
||||
nsresult rv = PrepareAcceptLanguages(acceptLanguages.get(), buf);
|
||||
|
|
|
@ -204,8 +204,8 @@ nsHtml5StreamParser::nsHtml5StreamParser(nsHtml5TreeOpExecutor* aExecutor,
|
|||
// Chardet is initialized here even if it turns out to be useless
|
||||
// to make the chardet refcount its observer (nsHtml5StreamParser)
|
||||
// on the main thread.
|
||||
const nsAdoptingCString& detectorName =
|
||||
Preferences::GetLocalizedCString("intl.charset.detector");
|
||||
nsAutoCString detectorName;
|
||||
Preferences::GetLocalizedCString("intl.charset.detector", detectorName);
|
||||
if (!detectorName.IsEmpty()) {
|
||||
nsAutoCString detectorContractID;
|
||||
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
||||
|
|
|
@ -85,8 +85,9 @@ AppTrustDomain::SetTrustedRoot(AppTrustedRoot trustedRoot)
|
|||
if (!file) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsresult rv = file->InitWithNativePath(
|
||||
Preferences::GetCString(kDevImportedDER));
|
||||
nsAutoCString path;
|
||||
Preferences::GetCString(kDevImportedDER, path);
|
||||
nsresult rv = file->InitWithNativePath(path);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -238,12 +238,12 @@ SandboxBrokerPolicyFactory::GetContentPolicy(int aPid, bool aFileProcess)
|
|||
// Now read any extra paths, this requires accessing user preferences
|
||||
// so we can only do it now. Our constructor is initialized before
|
||||
// user preferences are read in.
|
||||
nsAdoptingCString extraReadPathString =
|
||||
Preferences::GetCString("security.sandbox.content.read_path_whitelist");
|
||||
AddDynamicPathList(policy.get(), extraReadPathString, rdonly);
|
||||
nsAdoptingCString extraWritePathString =
|
||||
Preferences::GetCString("security.sandbox.content.write_path_whitelist");
|
||||
AddDynamicPathList(policy.get(), extraWritePathString, rdwr);
|
||||
AddDynamicPathList(policy.get(),
|
||||
"security.sandbox.content.read_path_whitelist",
|
||||
rdonly);
|
||||
AddDynamicPathList(policy.get(),
|
||||
"security.sandbox.content.write_path_whitelist",
|
||||
rdwr);
|
||||
|
||||
// file:// processes get global read permissions
|
||||
if (aFileProcess) {
|
||||
|
@ -257,9 +257,12 @@ SandboxBrokerPolicyFactory::GetContentPolicy(int aPid, bool aFileProcess)
|
|||
|
||||
void
|
||||
SandboxBrokerPolicyFactory::AddDynamicPathList(SandboxBroker::Policy *policy,
|
||||
nsAdoptingCString& pathList,
|
||||
int perms) {
|
||||
if (pathList) {
|
||||
const char* aPathListPref,
|
||||
int perms)
|
||||
{
|
||||
nsAutoCString pathList;
|
||||
nsresult rv = Preferences::GetCString(aPathListPref, pathList);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
for (const nsACString& path : pathList.Split(',')) {
|
||||
nsCString trimPath(path);
|
||||
trimPath.Trim(" ", true, true);
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
private:
|
||||
UniquePtr<const SandboxBroker::Policy> mCommonContentPolicy;
|
||||
static void AddDynamicPathList(SandboxBroker::Policy *policy,
|
||||
nsAdoptingCString& paths,
|
||||
const char* aPathListPref,
|
||||
int perms);
|
||||
};
|
||||
|
||||
|
|
|
@ -2509,7 +2509,8 @@ void nsExternalAppHandler::ProcessAnyRefreshTags()
|
|||
bool nsExternalAppHandler::GetNeverAskFlagFromPref(const char * prefName, const char * aContentType)
|
||||
{
|
||||
// Search the obsolete pref strings.
|
||||
nsAdoptingCString prefCString = Preferences::GetCString(prefName);
|
||||
nsAutoCString prefCString;
|
||||
Preferences::GetCString(prefName, prefCString);
|
||||
if (prefCString.IsEmpty()) {
|
||||
// Default is true, if not found in the pref string.
|
||||
return true;
|
||||
|
|
|
@ -206,8 +206,9 @@ GetPrefValueForFeature(int32_t aFeature, int32_t& aValue, nsACString& aFailureId
|
|||
|
||||
nsCString failureprefname(prefname);
|
||||
failureprefname += ".failureid";
|
||||
nsAdoptingCString failureValue = Preferences::GetCString(failureprefname.get());
|
||||
if (failureValue) {
|
||||
nsAutoCString failureValue;
|
||||
nsresult rv = Preferences::GetCString(failureprefname.get(), failureValue);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aFailureId = failureValue.get();
|
||||
} else {
|
||||
aFailureId = "FEATURE_FAILURE_BLACKLIST_PREF";
|
||||
|
|
|
@ -1258,12 +1258,12 @@ nsWindow::GeckoViewSupport::Open(const jni::Class::LocalRef& aCls,
|
|||
nsCOMPtr<nsIWindowWatcher> ww = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
|
||||
MOZ_RELEASE_ASSERT(ww);
|
||||
|
||||
nsAdoptingCString url;
|
||||
nsAutoCString url;
|
||||
if (aChromeURI) {
|
||||
url = aChromeURI->ToCString();
|
||||
} else {
|
||||
url = Preferences::GetCString("toolkit.defaultChromeURI");
|
||||
if (!url) {
|
||||
nsresult rv = Preferences::GetCString("toolkit.defaultChromeURI", url);
|
||||
if (NS_FAILED(rv)) {
|
||||
url = NS_LITERAL_CSTRING("chrome://geckoview/content/geckoview.xul");
|
||||
}
|
||||
}
|
||||
|
@ -1280,7 +1280,7 @@ nsWindow::GeckoViewSupport::Open(const jni::Class::LocalRef& aCls,
|
|||
chromeFlags += ",private";
|
||||
}
|
||||
nsCOMPtr<mozIDOMWindowProxy> domWindow;
|
||||
ww->OpenWindow(nullptr, url, nullptr, chromeFlags.get(),
|
||||
ww->OpenWindow(nullptr, url.get(), nullptr, chromeFlags.get(),
|
||||
androidView, getter_AddRefs(domWindow));
|
||||
MOZ_RELEASE_ASSERT(domWindow);
|
||||
|
||||
|
|
|
@ -1174,8 +1174,9 @@ nsLookAndFeel::EnsureInit()
|
|||
// Allow content Gtk theme override by pref, it's useful when styled Gtk+
|
||||
// widgets break web content.
|
||||
if (XRE_IsContentProcess()) {
|
||||
auto contentThemeName =
|
||||
mozilla::Preferences::GetCString("widget.content.gtk-theme-override");
|
||||
nsAutoCString contentThemeName;
|
||||
mozilla::Preferences::GetCString("widget.content.gtk-theme-override",
|
||||
contentThemeName);
|
||||
if (!contentThemeName.IsEmpty()) {
|
||||
g_object_set(settings, "gtk-theme-name", contentThemeName.get(), nullptr);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ nsPSPrinterList::GetPrinterList(nsTArray<nsCString>& aList)
|
|||
|
||||
nsAutoCString list(PR_GetEnv("MOZILLA_POSTSCRIPT_PRINTER_LIST"));
|
||||
if (list.IsEmpty()) {
|
||||
list = Preferences::GetCString("print.printer_list");
|
||||
Preferences::GetCString("print.printer_list", list);
|
||||
}
|
||||
if (!list.IsEmpty()) {
|
||||
// For each printer (except "default" which was already added),
|
||||
|
|
|
@ -745,10 +745,13 @@ BackgroundHangMonitor::IsDisabled() {
|
|||
|
||||
bool
|
||||
BackgroundHangMonitor::DisableOnBeta() {
|
||||
nsAdoptingCString clientID = Preferences::GetCString("toolkit.telemetry.cachedClientID");
|
||||
nsAutoCString clientID;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("toolkit.telemetry.cachedClientID", clientID);
|
||||
bool telemetryEnabled = Preferences::GetBool("toolkit.telemetry.enabled");
|
||||
|
||||
if (!telemetryEnabled || !clientID || BackgroundHangMonitor::ShouldDisableOnBeta(clientID)) {
|
||||
if (!telemetryEnabled || NS_FAILED(rv) ||
|
||||
BackgroundHangMonitor::ShouldDisableOnBeta(clientID)) {
|
||||
if (XRE_IsParentProcess()) {
|
||||
BackgroundHangMonitor::Shutdown();
|
||||
} else {
|
||||
|
|
|
@ -114,9 +114,10 @@ nsAppShellService::CreateHiddenWindowHelper(bool aIsPrivate)
|
|||
|
||||
#ifdef XP_MACOSX
|
||||
uint32_t chromeMask = 0;
|
||||
nsAdoptingCString prefVal =
|
||||
Preferences::GetCString("browser.hiddenWindowChromeURL");
|
||||
const char* hiddenWindowURL = prefVal.get() ? prefVal.get() : DEFAULT_HIDDENWINDOW_URL;
|
||||
nsAutoCString prefVal;
|
||||
rv = Preferences::GetCString("browser.hiddenWindowChromeURL", prefVal);
|
||||
const char* hiddenWindowURL =
|
||||
NS_SUCCEEDED(rv) ? prefVal.get() : DEFAULT_HIDDENWINDOW_URL;
|
||||
if (aIsPrivate) {
|
||||
hiddenWindowURL = DEFAULT_HIDDENWINDOW_URL;
|
||||
} else {
|
||||
|
|
|
@ -1958,7 +1958,8 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(int32_t aChromeFlags,
|
|||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
nsAdoptingCString urlStr = Preferences::GetCString("browser.chromeURL");
|
||||
nsAutoCString urlStr;
|
||||
Preferences::GetCString("browser.chromeURL", urlStr);
|
||||
if (urlStr.IsEmpty()) {
|
||||
urlStr.AssignLiteral("chrome://navigator/content/navigator.xul");
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче