mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Backed out changeset ef5feef07bed (bug 1384835)
This commit is contained in:
parent
9077ac8886
commit
744a0a216b
@ -1642,8 +1642,7 @@ nsScriptSecurityManager::EnsureFileURIWhitelist()
|
||||
//
|
||||
|
||||
mFileURIWhitelist.emplace();
|
||||
nsAutoCString policies;
|
||||
mozilla::Preferences::GetCString("capability.policy.policynames", policies);
|
||||
auto policies = mozilla::Preferences::GetCString("capability.policy.policynames");
|
||||
for (uint32_t base = SkipPast<IsWhitespaceOrComma>(policies, 0), bound = 0;
|
||||
base < policies.Length();
|
||||
base = SkipPast<IsWhitespaceOrComma>(policies, bound))
|
||||
@ -1666,8 +1665,7 @@ nsScriptSecurityManager::EnsureFileURIWhitelist()
|
||||
nsCString domainPrefName = NS_LITERAL_CSTRING("capability.policy.") +
|
||||
policyName +
|
||||
NS_LITERAL_CSTRING(".sites");
|
||||
nsAutoCString siteList;
|
||||
Preferences::GetCString(domainPrefName.get(), siteList);
|
||||
auto siteList = Preferences::GetCString(domainPrefName.get());
|
||||
AddSitesToFileURIWhitelist(siteList);
|
||||
}
|
||||
|
||||
|
@ -251,12 +251,11 @@ nsChromeRegistryChrome::OverrideLocalePackage(const nsACString& aPackage,
|
||||
nsACString& aOverride)
|
||||
{
|
||||
const nsACString& pref = NS_LITERAL_CSTRING(PACKAGE_OVERRIDE_BRANCH) + aPackage;
|
||||
nsAutoCString override;
|
||||
nsresult rv =
|
||||
mozilla::Preferences::GetCString(PromiseFlatCString(pref).get(), override);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString override = mozilla::Preferences::GetCString(PromiseFlatCString(pref).get());
|
||||
if (override) {
|
||||
aOverride = override;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
aOverride = aPackage;
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -578,17 +578,16 @@ nsDefaultURIFixup::MakeAlternateURI(nsIURI* aURI)
|
||||
// are www. & .com but they could be any other value, e.g. www. & .org
|
||||
|
||||
nsAutoCString prefix("www.");
|
||||
nsAutoCString prefPrefix;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("browser.fixup.alternate.prefix", prefPrefix);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString prefPrefix =
|
||||
Preferences::GetCString("browser.fixup.alternate.prefix");
|
||||
if (prefPrefix) {
|
||||
prefix.Assign(prefPrefix);
|
||||
}
|
||||
|
||||
nsAutoCString suffix(".com");
|
||||
nsAutoCString prefSuffix;
|
||||
rv = Preferences::GetCString("browser.fixup.alternate.suffix", prefSuffix);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString prefSuffix =
|
||||
Preferences::GetCString("browser.fixup.alternate.suffix");
|
||||
if (prefSuffix) {
|
||||
suffix.Assign(prefSuffix);
|
||||
}
|
||||
|
||||
|
@ -5099,11 +5099,9 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
|
||||
}
|
||||
|
||||
// See if an alternate cert error page is registered
|
||||
nsAutoCString alternateErrorPage;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("security.alternate_certificate_error_page",
|
||||
alternateErrorPage);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString alternateErrorPage =
|
||||
Preferences::GetCString("security.alternate_certificate_error_page");
|
||||
if (alternateErrorPage) {
|
||||
errorPage.Assign(alternateErrorPage);
|
||||
}
|
||||
|
||||
@ -5125,10 +5123,9 @@ 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
|
||||
nsAutoCString alternateErrorPage;
|
||||
nsresult rv = Preferences::GetCString("urlclassifier.alternate_error_page",
|
||||
alternateErrorPage);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString alternateErrorPage =
|
||||
Preferences::GetCString("urlclassifier.alternate_error_page");
|
||||
if (alternateErrorPage) {
|
||||
errorPage.Assign(alternateErrorPage);
|
||||
}
|
||||
|
||||
|
@ -118,10 +118,9 @@ AudioChannelAgent::FindCorrectWindow(nsPIDOMWindowInner* aWindow)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoCString systemAppUrl;
|
||||
nsresult rv =
|
||||
mozilla::Preferences::GetCString("b2g.system_startup_url", systemAppUrl);
|
||||
if (NS_FAILED(rv)) {
|
||||
nsAdoptingCString systemAppUrl =
|
||||
mozilla::Preferences::GetCString("b2g.system_startup_url");
|
||||
if (!systemAppUrl) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1705,11 +1705,12 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||
}
|
||||
|
||||
if (gDumpFile == nullptr) {
|
||||
nsAutoCString fname;
|
||||
Preferences::GetCString("browser.dom.window.dump.file", fname);
|
||||
const nsAdoptingCString& fname =
|
||||
Preferences::GetCString("browser.dom.window.dump.file");
|
||||
if (!fname.IsEmpty()) {
|
||||
// If this fails to open, Dump() knows to just go to stdout on null.
|
||||
gDumpFile = fopen(fname.get(), "wb+");
|
||||
// if this fails to open, Dump() knows to just go to stdout
|
||||
// on null.
|
||||
gDumpFile = fopen(fname, "wb+");
|
||||
} else {
|
||||
gDumpFile = stdout;
|
||||
}
|
||||
@ -6940,8 +6941,7 @@ GetFullscreenTransitionDuration(bool aEnterFullscreen,
|
||||
const char* pref = aEnterFullscreen ?
|
||||
"full-screen-api.transition-duration.enter" :
|
||||
"full-screen-api.transition-duration.leave";
|
||||
nsAutoCString prefValue;
|
||||
Preferences::GetCString(pref, prefValue);
|
||||
nsAdoptingCString prefValue = Preferences::GetCString(pref);
|
||||
if (!prefValue.IsEmpty()) {
|
||||
sscanf(prefValue.get(), "%hu%hu",
|
||||
&aDuration->mFadeIn, &aDuration->mFadeOut);
|
||||
|
@ -960,8 +960,7 @@ nsObjectLoadingContent::BuildParametersArray()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsAutoCString wmodeOverride;
|
||||
Preferences::GetCString("plugins.force.wmode", wmodeOverride);
|
||||
nsAdoptingCString wmodeOverride = Preferences::GetCString("plugins.force.wmode");
|
||||
for (uint32_t i = 0; i < mCachedAttributes.Length(); i++) {
|
||||
if (!wmodeOverride.IsEmpty() && mCachedAttributes[i].mName.EqualsIgnoreCase("wmode")) {
|
||||
CopyASCIItoUTF16(wmodeOverride, mCachedAttributes[i].mValue);
|
||||
@ -1664,7 +1663,8 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
||||
///
|
||||
|
||||
if (aJavaURI || thisContent->NodeInfo()->Equals(nsGkAtoms::applet)) {
|
||||
Preferences::GetCString(kPrefJavaMIME, newMime);
|
||||
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||
newMime = javaMIME;
|
||||
NS_ASSERTION(IsJavaMIME(newMime),
|
||||
"plugin.mime.java should be recognized as java");
|
||||
isJava = true;
|
||||
@ -1687,8 +1687,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::classid, classIDAttr);
|
||||
if (!classIDAttr.IsEmpty()) {
|
||||
// Our classid support is limited to 'java:' ids
|
||||
nsAutoCString javaMIME;
|
||||
Preferences::GetCString(kPrefJavaMIME, javaMIME);
|
||||
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||
NS_ASSERTION(IsJavaMIME(javaMIME),
|
||||
"plugin.mime.java should be recognized as java");
|
||||
RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst();
|
||||
|
@ -333,9 +333,7 @@ operator<(const RefPtr<nsPluginElement>& lhs,
|
||||
static bool
|
||||
PluginShouldBeHidden(const nsCString& aName) {
|
||||
// This only supports one hidden plugin
|
||||
nsAutoCString value;
|
||||
Preferences::GetCString("plugins.navigator.hidden_ctp_plugin", value);
|
||||
return value.Equals(aName);
|
||||
return Preferences::GetCString("plugins.navigator.hidden_ctp_plugin").Equals(aName);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -49,8 +49,8 @@ FallbackEncoding::Get()
|
||||
return WrapNotNull(mFallback);
|
||||
}
|
||||
|
||||
nsAutoCString override;
|
||||
Preferences::GetCString("intl.charset.fallback.override", override);
|
||||
const nsAdoptingCString& override =
|
||||
Preferences::GetCString("intl.charset.fallback.override");
|
||||
// Don't let the user break things by setting the override to unreasonable
|
||||
// values via about:config
|
||||
auto encoding = Encoding::ForLabel(override);
|
||||
|
@ -900,8 +900,7 @@ Event::PopupAllowedEventsChanged()
|
||||
free(sPopupAllowedEvents);
|
||||
}
|
||||
|
||||
nsAutoCString str;
|
||||
Preferences::GetCString("dom.popup_allowed_events", str);
|
||||
nsAdoptingCString str = Preferences::GetCString("dom.popup_allowed_events");
|
||||
|
||||
// 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
|
||||
nsAutoCString acceptLang;
|
||||
Preferences::GetLocalizedCString("intl.accept_languages", acceptLang);
|
||||
const nsAdoptingCString& acceptLang =
|
||||
Preferences::GetLocalizedCString("intl.accept_languages");
|
||||
|
||||
// Split values on commas.
|
||||
nsCCharSeparatedTokenizer langTokenizer(acceptLang, ',');
|
||||
|
@ -1514,15 +1514,13 @@ 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.
|
||||
nsAutoCString testingReadPath1;
|
||||
Preferences::GetCString("security.sandbox.content.mac.testing_read_path1",
|
||||
testingReadPath1);
|
||||
nsAdoptingCString testingReadPath1 =
|
||||
Preferences::GetCString("security.sandbox.content.mac.testing_read_path1");
|
||||
if (!testingReadPath1.IsEmpty()) {
|
||||
info.testingReadPath1.assign(testingReadPath1.get());
|
||||
}
|
||||
nsAutoCString testingReadPath2;
|
||||
Preferences::GetCString("security.sandbox.content.mac.testing_read_path2",
|
||||
testingReadPath2);
|
||||
nsAdoptingCString testingReadPath2 =
|
||||
Preferences::GetCString("security.sandbox.content.mac.testing_read_path2");
|
||||
if (!testingReadPath2.IsEmpty()) {
|
||||
info.testingReadPath2.assign(testingReadPath2.get());
|
||||
}
|
||||
@ -1610,12 +1608,11 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
|
||||
}
|
||||
// Allow user overrides of seccomp-bpf syscall filtering
|
||||
std::vector<int> syscallWhitelist;
|
||||
nsAutoCString extraSyscalls;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("security.sandbox.content.syscall_whitelist",
|
||||
extraSyscalls);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString extraSyscalls =
|
||||
Preferences::GetCString("security.sandbox.content.syscall_whitelist");
|
||||
if (extraSyscalls) {
|
||||
for (const nsACString& callNrString : extraSyscalls.Split(',')) {
|
||||
nsresult rv;
|
||||
int callNr = PromiseFlatCString(callNrString).ToInteger(&rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
syscallWhitelist.push_back(callNr);
|
||||
|
@ -2040,8 +2040,7 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
|
||||
boolPrefs.Append(nsPrintfCString("%u:%d|", i, Preferences::GetBool(ContentPrefs::GetContentPref(i))));
|
||||
break;
|
||||
case nsIPrefBranch::PREF_STRING: {
|
||||
nsAutoCString value;
|
||||
Preferences::GetCString(ContentPrefs::GetContentPref(i), value);
|
||||
nsAdoptingCString value(Preferences::GetCString(ContentPrefs::GetContentPref(i)));
|
||||
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.
|
||||
nsAutoCString filter;
|
||||
Preferences::GetCString("media.decoder-doctor.notifications-allowed", filter);
|
||||
nsAdoptingCString filter =
|
||||
Preferences::GetCString("media.decoder-doctor.notifications-allowed");
|
||||
return filter.EqualsLiteral("*") ||
|
||||
StringListContains(filter, aNotification.mReportStringId);
|
||||
}
|
||||
@ -424,11 +424,10 @@ 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.
|
||||
nsAutoCString filter;
|
||||
Preferences::GetCString(aDecodeIssueIsError
|
||||
? "media.decoder-doctor.decode-errors-allowed"
|
||||
: "media.decoder-doctor.decode-warnings-allowed",
|
||||
filter);
|
||||
nsAdoptingCString filter =
|
||||
Preferences::GetCString(aDecodeIssueIsError
|
||||
? "media.decoder-doctor.decode-errors-allowed"
|
||||
: "media.decoder-doctor.decode-warnings-allowed");
|
||||
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);
|
||||
|
||||
nsAutoCString audioLoopDev, videoLoopDev;
|
||||
nsAdoptingCString 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) {
|
||||
Preferences::GetCString("media.video_loopback_dev", videoLoopDev);
|
||||
videoLoopDev = Preferences::GetCString("media.video_loopback_dev");
|
||||
}
|
||||
if (aAudioType == MediaSourceEnum::Microphone) {
|
||||
Preferences::GetCString("media.audio_loopback_dev", audioLoopDev);
|
||||
audioLoopDev = Preferences::GetCString("media.audio_loopback_dev");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1735,8 +1735,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
|
||||
if (hasVideo) {
|
||||
nsTArray<RefPtr<VideoDevice>> videos;
|
||||
GetSources(fakeCams? fakeBackend : realBackend, aVideoType,
|
||||
&MediaEngine::EnumerateVideoDevices, videos,
|
||||
videoLoopDev.get());
|
||||
&MediaEngine::EnumerateVideoDevices, videos, videoLoopDev);
|
||||
for (auto& source : videos) {
|
||||
result->AppendElement(source);
|
||||
}
|
||||
@ -1744,8 +1743,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
|
||||
if (hasAudio) {
|
||||
nsTArray<RefPtr<AudioDevice>> audios;
|
||||
GetSources(fakeMics? fakeBackend : realBackend, aAudioType,
|
||||
&MediaEngine::EnumerateAudioDevices, audios,
|
||||
audioLoopDev.get());
|
||||
&MediaEngine::EnumerateAudioDevices, audios, audioLoopDev);
|
||||
for (auto& source : audios) {
|
||||
result->AppendElement(source);
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ GetSpeechRecognitionService(const nsAString& aLang)
|
||||
{
|
||||
nsAutoCString speechRecognitionServiceCID;
|
||||
|
||||
nsAutoCString prefValue;
|
||||
Preferences::GetCString(PREFERENCE_DEFAULT_RECOGNITION_SERVICE, prefValue);
|
||||
nsAdoptingCString prefValue =
|
||||
Preferences::GetCString(PREFERENCE_DEFAULT_RECOGNITION_SERVICE);
|
||||
nsAutoCString speechRecognitionService;
|
||||
|
||||
if (!aLang.IsEmpty()) {
|
||||
|
@ -1554,8 +1554,8 @@ nsPluginHost::RegisterFakePlugin(JS::Handle<JS::Value> aInitDictionary,
|
||||
|
||||
mFakePlugins.AppendElement(newTag);
|
||||
|
||||
nsAutoCString disableFullPage;
|
||||
Preferences::GetCString(kPrefDisableFullPage, disableFullPage);
|
||||
nsAdoptingCString disableFullPage =
|
||||
Preferences::GetCString(kPrefDisableFullPage);
|
||||
for (uint32_t i = 0; i < newTag->MimeTypes().Length(); i++) {
|
||||
if (!IsTypeInList(newTag->MimeTypes()[i], disableFullPage)) {
|
||||
RegisterWithCategoryManager(newTag->MimeTypes()[i],
|
||||
@ -1822,9 +1822,8 @@ 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
|
||||
nsAutoCString javaMIME;
|
||||
Preferences::GetCString(kPrefJavaMIME, javaMIME);
|
||||
if ((!javaMIME.IsEmpty() && noParam.LowerCaseEqualsASCII(javaMIME.get())) ||
|
||||
nsAdoptingCString javaMIME = Preferences::GetCString(kPrefJavaMIME);
|
||||
if ((!javaMIME.IsEmpty() && noParam.LowerCaseEqualsASCII(javaMIME)) ||
|
||||
noParam.LowerCaseEqualsASCII("application/x-java-vm") ||
|
||||
noParam.LowerCaseEqualsASCII("application/x-java-applet") ||
|
||||
noParam.LowerCaseEqualsASCII("application/x-java-bean")) {
|
||||
@ -2014,8 +2013,8 @@ nsPluginHost::AddPluginTag(nsPluginTag* aPluginTag)
|
||||
mPlugins = aPluginTag;
|
||||
|
||||
if (aPluginTag->IsActive()) {
|
||||
nsAutoCString disableFullPage;
|
||||
Preferences::GetCString(kPrefDisableFullPage, disableFullPage);
|
||||
nsAdoptingCString disableFullPage =
|
||||
Preferences::GetCString(kPrefDisableFullPage);
|
||||
for (uint32_t i = 0; i < aPluginTag->MimeTypes().Length(); i++) {
|
||||
if (!IsTypeInList(aPluginTag->MimeTypes()[i], disableFullPage)) {
|
||||
RegisterWithCategoryManager(aPluginTag->MimeTypes()[i],
|
||||
@ -2408,8 +2407,8 @@ nsPluginHost::SetPluginsInContent(uint32_t aPluginEpoch,
|
||||
tag.extensions(),
|
||||
tag.niceName(),
|
||||
tag.sandboxScript()));
|
||||
nsAutoCString disableFullPage;
|
||||
Preferences::GetCString(kPrefDisableFullPage, disableFullPage);
|
||||
nsAdoptingCString disableFullPage =
|
||||
Preferences::GetCString(kPrefDisableFullPage);
|
||||
for (uint32_t i = 0; i < pluginTag->MimeTypes().Length(); i++) {
|
||||
if (!IsTypeInList(pluginTag->MimeTypes()[i], disableFullPage)) {
|
||||
RegisterWithCategoryManager(pluginTag->MimeTypes()[i],
|
||||
@ -2656,8 +2655,8 @@ nsPluginHost::UpdateInMemoryPluginInfo(nsPluginTag* aPluginTag)
|
||||
}
|
||||
|
||||
// Update types with category manager
|
||||
nsAutoCString disableFullPage;
|
||||
Preferences::GetCString(kPrefDisableFullPage, disableFullPage);
|
||||
nsAdoptingCString disableFullPage =
|
||||
Preferences::GetCString(kPrefDisableFullPage);
|
||||
for (uint32_t i = 0; i < aPluginTag->MimeTypes().Length(); i++) {
|
||||
nsRegisterType shouldRegister;
|
||||
|
||||
@ -2695,9 +2694,8 @@ nsPluginHost::UpdatePluginInfo(nsPluginTag* aPluginTag)
|
||||
/* static */ bool
|
||||
nsPluginHost::IsTypeWhitelisted(const char *aMimeType)
|
||||
{
|
||||
nsAutoCString whitelist;
|
||||
Preferences::GetCString(kPrefWhitelist, whitelist);
|
||||
if (whitelist.IsEmpty()) {
|
||||
nsAdoptingCString whitelist = Preferences::GetCString(kPrefWhitelist);
|
||||
if (!whitelist.Length()) {
|
||||
return true;
|
||||
}
|
||||
nsDependentCString wrap(aMimeType);
|
||||
|
@ -160,7 +160,7 @@ MulticastDNSDeviceProvider::Init()
|
||||
mDiscoverable = Preferences::GetBool(PREF_PRESENTATION_DISCOVERABLE);
|
||||
mDiscoverableEncrypted = Preferences::GetBool(PREF_PRESENTATION_DISCOVERABLE_ENCRYPTED);
|
||||
mServerRetryMs = Preferences::GetUint(PREF_PRESENTATION_DISCOVERABLE_RETRY_MS);
|
||||
Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME, mServiceName);
|
||||
mServiceName = Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME);
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// FIXME: Bug 1185806 - Provide a common device name setting.
|
||||
@ -1098,8 +1098,7 @@ 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)) {
|
||||
nsAutoCString newServiceName;
|
||||
Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME, newServiceName);
|
||||
nsAdoptingCString newServiceName = Preferences::GetCString(PREF_PRESENTATION_DEVICE_NAME);
|
||||
if (!mServiceName.Equals(newServiceName)) {
|
||||
OnServiceNameChanged(newServiceName);
|
||||
}
|
||||
|
@ -714,10 +714,8 @@ 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")) {
|
||||
nsAutoCString whitelist;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("dom.securecontext.whitelist", whitelist);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString whitelist = Preferences::GetCString("dom.securecontext.whitelist");
|
||||
if (whitelist) {
|
||||
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";
|
||||
nsAutoCString returnInEmptyLIKillsList;
|
||||
Preferences::GetCString(kPrefName, returnInEmptyLIKillsList);
|
||||
nsAdoptingCString returnInEmptyLIKillsList =
|
||||
Preferences::GetCString(kPrefName);
|
||||
|
||||
// only when "false", becomes FALSE. Otherwise (including empty), TRUE.
|
||||
// XXX Why was this pref designed as a string and not bool?
|
||||
|
@ -2857,8 +2857,7 @@ nsPermissionManager::Import()
|
||||
nsresult
|
||||
nsPermissionManager::ImportDefaults()
|
||||
{
|
||||
nsAutoCString defaultsURL;
|
||||
mozilla::Preferences::GetCString(kDefaultsUrlPrefName, defaultsURL);
|
||||
nsCString defaultsURL = mozilla::Preferences::GetCString(kDefaultsUrlPrefName);
|
||||
if (defaultsURL.IsEmpty()) { // == Don't use built-in permissions.
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ static PRLibrary* LoadApitraceLibrary()
|
||||
if (sApitraceLibrary)
|
||||
return sApitraceLibrary;
|
||||
|
||||
nsAutoCString logFile;
|
||||
Preferences::GetCString("gfx.apitrace.logfile", logFile);
|
||||
nsCString logFile = Preferences::GetCString("gfx.apitrace.logfile");
|
||||
|
||||
if (logFile.IsEmpty()) {
|
||||
logFile = "firefox.trace";
|
||||
}
|
||||
|
@ -991,11 +991,9 @@ gfxDWriteFontList::InitFontListForPlatform()
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoCString classicFamilies;
|
||||
nsresult rv = Preferences::GetCString(
|
||||
"gfx.font_rendering.cleartype_params.force_gdi_classic_for_families",
|
||||
classicFamilies);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString classicFamilies =
|
||||
Preferences::GetCString("gfx.font_rendering.cleartype_params.force_gdi_classic_for_families");
|
||||
if (classicFamilies) {
|
||||
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();
|
||||
nsAutoCString fontPrefValue;
|
||||
Preferences::GetCString(names[i], fontPrefValue);
|
||||
nsAdoptingCString fontPrefValue = Preferences::GetCString(names[i]);
|
||||
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.
|
||||
Preferences::GetCString(NameListPref(generic, langGroup).get(),
|
||||
fontPrefValue);
|
||||
fontPrefValue =
|
||||
Preferences::GetCString(NameListPref(generic,
|
||||
langGroup).get());
|
||||
}
|
||||
|
||||
if (!langGroup.EqualsLiteral("x-math") &&
|
||||
|
@ -645,12 +645,8 @@ gfxPlatform::Init()
|
||||
gfxVars::SetPDMWMFDisableD3D11Dlls(nsCString());
|
||||
gfxVars::SetPDMWMFDisableD3D9Dlls(nsCString());
|
||||
} else {
|
||||
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);
|
||||
gfxVars::SetPDMWMFDisableD3D11Dlls(Preferences::GetCString("media.wmf.disable-d3d11-for-dlls"));
|
||||
gfxVars::SetPDMWMFDisableD3D9Dlls(Preferences::GetCString("media.wmf.disable-d3d9-for-dlls"));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
@ -1946,10 +1942,9 @@ gfxPlatform::GetPlatformCMSOutputProfile(void *&mem, size_t &size)
|
||||
void
|
||||
gfxPlatform::GetCMSOutputProfileData(void *&mem, size_t &size)
|
||||
{
|
||||
nsAutoCString fname;
|
||||
Preferences::GetCString("gfx.color_management.display_profile", fname);
|
||||
nsAdoptingCString fname = Preferences::GetCString("gfx.color_management.display_profile");
|
||||
if (!fname.IsEmpty()) {
|
||||
qcms_data_from_path(fname.get(), &mem, &size);
|
||||
qcms_data_from_path(fname, &mem, &size);
|
||||
}
|
||||
else {
|
||||
gfxPlatform::GetPlatform()->GetPlatformCMSOutputProfile(mem, size);
|
||||
|
@ -1089,8 +1089,7 @@ 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
|
||||
nsAutoCString list;
|
||||
Preferences::GetLocalizedCString("intl.accept_languages", list);
|
||||
nsAdoptingCString list = Preferences::GetLocalizedCString("intl.accept_languages");
|
||||
if (!list.IsEmpty()) {
|
||||
const char kComma = ',';
|
||||
const char *p, *p_end;
|
||||
@ -1216,8 +1215,8 @@ gfxPlatformFontList::GetDefaultGeneric(eFontPrefLang aLang)
|
||||
for (uint32_t i = 0; i < ArrayLength(gPrefLangNames); i++) {
|
||||
nsAutoCString prefDefaultFontType("font.default.");
|
||||
prefDefaultFontType.Append(GetPrefLangName(eFontPrefLang(i)));
|
||||
nsAutoCString serifOrSans;
|
||||
Preferences::GetCString(prefDefaultFontType.get(), serifOrSans);
|
||||
nsAdoptingCString serifOrSans =
|
||||
Preferences::GetCString(prefDefaultFontType.get());
|
||||
if (serifOrSans.EqualsLiteral("sans-serif")) {
|
||||
mDefaultGenericsLangGroup[i] = eFamily_sans_serif;
|
||||
} else {
|
||||
|
@ -115,16 +115,18 @@ 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
|
||||
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))) {
|
||||
if ((!osvrUtilPath) || (!osvrCommonPath) || (!osvrClientPath) ||
|
||||
(!osvrClientKitPath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1344,13 +1344,12 @@ imgLoader::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
|
||||
void imgLoader::ReadAcceptHeaderPref()
|
||||
{
|
||||
nsAutoCString accept;
|
||||
nsresult rv = Preferences::GetCString("image.http.accept", accept);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString accept = Preferences::GetCString("image.http.accept");
|
||||
if (accept) {
|
||||
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,9 +305,8 @@ nsHyphenationManager::LoadAliases()
|
||||
&prefCount, &prefNames);
|
||||
if (NS_SUCCEEDED(rv) && prefCount > 0) {
|
||||
for (uint32_t i = 0; i < prefCount; ++i) {
|
||||
nsAutoCString value;
|
||||
rv = Preferences::GetCString(prefNames[i], value);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString value = Preferences::GetCString(prefNames[i]);
|
||||
if (value) {
|
||||
nsAutoCString alias(prefNames[i]);
|
||||
alias.Cut(0, sizeof(kIntlHyphenationAliasPrefix) - 1);
|
||||
ToLowerCase(alias);
|
||||
|
@ -19,8 +19,7 @@ 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.
|
||||
nsAutoCString locale;
|
||||
Preferences::GetCString("intl.locale.os", locale);
|
||||
nsAdoptingCString locale = Preferences::GetCString("intl.locale.os");
|
||||
if (!locale.IsEmpty()) {
|
||||
aLocaleList.AppendElement(locale);
|
||||
return true;
|
||||
|
@ -73,11 +73,9 @@ ForbidCPOWsInCompatibleAddon(const nsACString& aAddonId)
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoCString allow;
|
||||
nsCString allow;
|
||||
allow.Assign(',');
|
||||
nsAutoCString pref;
|
||||
Preferences::GetCString("dom.ipc.cpows.allow-cpows-in-compat-addons", pref);
|
||||
allow.Append(pref);
|
||||
allow.Append(Preferences::GetCString("dom.ipc.cpows.allow-cpows-in-compat-addons"));
|
||||
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;
|
||||
|
||||
nsAutoCString cvalue;
|
||||
Preferences::GetCString("font.size.unit", cvalue);
|
||||
nsAdoptingCString cvalue =
|
||||
Preferences::GetCString("font.size.unit");
|
||||
|
||||
if (!cvalue.IsEmpty()) {
|
||||
if (cvalue.EqualsLiteral("px")) {
|
||||
@ -222,7 +222,7 @@ 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);
|
||||
Preferences::GetCString(pref.get(), cvalue);
|
||||
cvalue = Preferences::GetCString(pref.get());
|
||||
if (!cvalue.IsEmpty()) {
|
||||
font->sizeAdjust = (float)atof(cvalue.get());
|
||||
}
|
||||
|
@ -636,8 +636,8 @@ nsPresContext::GetUserPreferences()
|
||||
StaticPresData::Get()->ResetCachedFontPrefs();
|
||||
|
||||
// * image animation
|
||||
nsAutoCString animatePref;
|
||||
Preferences::GetCString("image.animation_mode", animatePref);
|
||||
const nsAdoptingCString& animatePref =
|
||||
Preferences::GetCString("image.animation_mode");
|
||||
if (animatePref.EqualsLiteral("normal"))
|
||||
mImageAnimationModePref = imgIContainer::kNormalAnimMode;
|
||||
else if (animatePref.EqualsLiteral("none"))
|
||||
|
@ -1605,9 +1605,7 @@ static nsresult pref_InitInitialObjects()
|
||||
#ifdef MOZ_TELEMETRY_ON_BY_DEFAULT
|
||||
prerelease = true;
|
||||
#else
|
||||
nsAutoCString prefValue;
|
||||
Preferences::GetDefaultCString(kChannelPref, prefValue);
|
||||
if (prefValue.EqualsLiteral("beta")) {
|
||||
if (Preferences::GetDefaultCString(kChannelPref).EqualsLiteral("beta")) {
|
||||
prerelease = true;
|
||||
}
|
||||
#endif
|
||||
@ -1667,15 +1665,24 @@ 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);
|
||||
char* result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, &result, false);
|
||||
nsAutoCString result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aResult.Adopt(result);
|
||||
aResult = result;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -1693,6 +1700,15 @@ 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)
|
||||
@ -2163,10 +2179,10 @@ nsresult
|
||||
Preferences::GetDefaultCString(const char* aPref, nsACString& aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(InitStaticMembers(), NS_ERROR_NOT_AVAILABLE);
|
||||
char* result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, &result, true);
|
||||
nsAutoCString result;
|
||||
nsresult rv = PREF_CopyCharPref(aPref, getter_Copies(result), true);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aResult.Adopt(result);
|
||||
aResult = result;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -2215,6 +2231,24 @@ 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,6 +21,7 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
|
||||
class nsIFile;
|
||||
class nsAdoptingCString;
|
||||
|
||||
#ifndef have_PrefChangedFunc_typedef
|
||||
typedef void (*PrefChangedFunc)(const char *, void *);
|
||||
@ -146,6 +147,30 @@ 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.
|
||||
@ -353,7 +378,15 @@ 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,18 +120,14 @@ 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, skipHostnames);
|
||||
nsCString skipHostnames = Preferences::GetCString(URLCLASSIFIER_SKIP_HOSTNAMES);
|
||||
ToLowerCase(skipHostnames);
|
||||
prefs->SetSkipHostnames(skipHostnames);
|
||||
} else if (!strcmp(aPref, URLCLASSIFIER_TRACKING_WHITELIST)) {
|
||||
nsCString trackingWhitelist;
|
||||
Preferences::GetCString(URLCLASSIFIER_TRACKING_WHITELIST,
|
||||
trackingWhitelist);
|
||||
nsCString trackingWhitelist = Preferences::GetCString(URLCLASSIFIER_TRACKING_WHITELIST);
|
||||
prefs->SetTrackingWhiteList(trackingWhitelist);
|
||||
} else if (!strcmp(aPref, URLCLASSIFIER_TRACKING_TABLE)) {
|
||||
nsCString trackingBlacklist;
|
||||
Preferences::GetCString(URLCLASSIFIER_TRACKING_TABLE, trackingBlacklist);
|
||||
nsCString trackingBlacklist = Preferences::GetCString(URLCLASSIFIER_TRACKING_TABLE);
|
||||
prefs->SetTrackingBlackList(trackingBlacklist);
|
||||
}
|
||||
}
|
||||
|
@ -2000,8 +2000,8 @@ nsHttpHandler::SetAcceptLanguages()
|
||||
{
|
||||
mAcceptLanguagesIsDirty = false;
|
||||
|
||||
nsAutoCString acceptLanguages;
|
||||
Preferences::GetLocalizedCString(INTL_ACCEPT_LANGUAGES, acceptLanguages);
|
||||
const nsAdoptingCString& acceptLanguages =
|
||||
Preferences::GetLocalizedCString(INTL_ACCEPT_LANGUAGES);
|
||||
|
||||
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.
|
||||
nsAutoCString detectorName;
|
||||
Preferences::GetLocalizedCString("intl.charset.detector", detectorName);
|
||||
const nsAdoptingCString& detectorName =
|
||||
Preferences::GetLocalizedCString("intl.charset.detector");
|
||||
if (!detectorName.IsEmpty()) {
|
||||
nsAutoCString detectorContractID;
|
||||
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
|
||||
|
@ -85,9 +85,8 @@ AppTrustDomain::SetTrustedRoot(AppTrustedRoot trustedRoot)
|
||||
if (!file) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsAutoCString path;
|
||||
Preferences::GetCString(kDevImportedDER, path);
|
||||
nsresult rv = file->InitWithNativePath(path);
|
||||
nsresult rv = file->InitWithNativePath(
|
||||
Preferences::GetCString(kDevImportedDER));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -235,12 +235,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.
|
||||
AddDynamicPathList(policy.get(),
|
||||
"security.sandbox.content.read_path_whitelist",
|
||||
rdonly);
|
||||
AddDynamicPathList(policy.get(),
|
||||
"security.sandbox.content.write_path_whitelist",
|
||||
rdwr);
|
||||
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);
|
||||
|
||||
// file:// processes get global read permissions
|
||||
if (aFileProcess) {
|
||||
@ -254,12 +254,9 @@ SandboxBrokerPolicyFactory::GetContentPolicy(int aPid, bool aFileProcess)
|
||||
|
||||
void
|
||||
SandboxBrokerPolicyFactory::AddDynamicPathList(SandboxBroker::Policy *policy,
|
||||
const char* aPathListPref,
|
||||
int perms)
|
||||
{
|
||||
nsAutoCString pathList;
|
||||
nsresult rv = Preferences::GetCString(aPathListPref, pathList);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString& pathList,
|
||||
int perms) {
|
||||
if (pathList) {
|
||||
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,
|
||||
const char* aPathListPref,
|
||||
nsAdoptingCString& paths,
|
||||
int perms);
|
||||
};
|
||||
|
||||
|
@ -2509,8 +2509,7 @@ void nsExternalAppHandler::ProcessAnyRefreshTags()
|
||||
bool nsExternalAppHandler::GetNeverAskFlagFromPref(const char * prefName, const char * aContentType)
|
||||
{
|
||||
// Search the obsolete pref strings.
|
||||
nsAutoCString prefCString;
|
||||
Preferences::GetCString(prefName, prefCString);
|
||||
nsAdoptingCString prefCString = Preferences::GetCString(prefName);
|
||||
if (prefCString.IsEmpty()) {
|
||||
// Default is true, if not found in the pref string.
|
||||
return true;
|
||||
|
@ -206,9 +206,8 @@ GetPrefValueForFeature(int32_t aFeature, int32_t& aValue, nsACString& aFailureId
|
||||
|
||||
nsCString failureprefname(prefname);
|
||||
failureprefname += ".failureid";
|
||||
nsAutoCString failureValue;
|
||||
nsresult rv = Preferences::GetCString(failureprefname.get(), failureValue);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsAdoptingCString failureValue = Preferences::GetCString(failureprefname.get());
|
||||
if (failureValue) {
|
||||
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);
|
||||
|
||||
nsAutoCString url;
|
||||
nsAdoptingCString url;
|
||||
if (aChromeURI) {
|
||||
url = aChromeURI->ToCString();
|
||||
} else {
|
||||
nsresult rv = Preferences::GetCString("toolkit.defaultChromeURI", url);
|
||||
if (NS_FAILED(rv)) {
|
||||
url = Preferences::GetCString("toolkit.defaultChromeURI");
|
||||
if (!url) {
|
||||
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.get(), nullptr, chromeFlags.get(),
|
||||
ww->OpenWindow(nullptr, url, nullptr, chromeFlags.get(),
|
||||
androidView, getter_AddRefs(domWindow));
|
||||
MOZ_RELEASE_ASSERT(domWindow);
|
||||
|
||||
|
@ -1174,9 +1174,8 @@ nsLookAndFeel::EnsureInit()
|
||||
// Allow content Gtk theme override by pref, it's useful when styled Gtk+
|
||||
// widgets break web content.
|
||||
if (XRE_IsContentProcess()) {
|
||||
nsAutoCString contentThemeName;
|
||||
mozilla::Preferences::GetCString("widget.content.gtk-theme-override",
|
||||
contentThemeName);
|
||||
auto contentThemeName =
|
||||
mozilla::Preferences::GetCString("widget.content.gtk-theme-override");
|
||||
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()) {
|
||||
Preferences::GetCString("print.printer_list", list);
|
||||
list = Preferences::GetCString("print.printer_list");
|
||||
}
|
||||
if (!list.IsEmpty()) {
|
||||
// For each printer (except "default" which was already added),
|
||||
|
@ -745,13 +745,10 @@ BackgroundHangMonitor::IsDisabled() {
|
||||
|
||||
bool
|
||||
BackgroundHangMonitor::DisableOnBeta() {
|
||||
nsAutoCString clientID;
|
||||
nsresult rv =
|
||||
Preferences::GetCString("toolkit.telemetry.cachedClientID", clientID);
|
||||
nsAdoptingCString clientID = Preferences::GetCString("toolkit.telemetry.cachedClientID");
|
||||
bool telemetryEnabled = Preferences::GetBool("toolkit.telemetry.enabled");
|
||||
|
||||
if (!telemetryEnabled || NS_FAILED(rv) ||
|
||||
BackgroundHangMonitor::ShouldDisableOnBeta(clientID)) {
|
||||
if (!telemetryEnabled || !clientID || BackgroundHangMonitor::ShouldDisableOnBeta(clientID)) {
|
||||
if (XRE_IsParentProcess()) {
|
||||
BackgroundHangMonitor::Shutdown();
|
||||
} else {
|
||||
|
@ -114,10 +114,9 @@ nsAppShellService::CreateHiddenWindowHelper(bool aIsPrivate)
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
uint32_t chromeMask = 0;
|
||||
nsAutoCString prefVal;
|
||||
rv = Preferences::GetCString("browser.hiddenWindowChromeURL", prefVal);
|
||||
const char* hiddenWindowURL =
|
||||
NS_SUCCEEDED(rv) ? prefVal.get() : DEFAULT_HIDDENWINDOW_URL;
|
||||
nsAdoptingCString prefVal =
|
||||
Preferences::GetCString("browser.hiddenWindowChromeURL");
|
||||
const char* hiddenWindowURL = prefVal.get() ? prefVal.get() : DEFAULT_HIDDENWINDOW_URL;
|
||||
if (aIsPrivate) {
|
||||
hiddenWindowURL = DEFAULT_HIDDENWINDOW_URL;
|
||||
} else {
|
||||
|
@ -1958,8 +1958,7 @@ NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(int32_t aChromeFlags,
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
nsAutoCString urlStr;
|
||||
Preferences::GetCString("browser.chromeURL", urlStr);
|
||||
nsAdoptingCString urlStr = Preferences::GetCString("browser.chromeURL");
|
||||
if (urlStr.IsEmpty()) {
|
||||
urlStr.AssignLiteral("chrome://navigator/content/navigator.xul");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user