Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2024-08-15 09:42:08 +08:00
commit e5ac12c311
5 changed files with 26 additions and 2 deletions

View file

@ -1259,13 +1259,13 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
uint8_t GetBorderStyle(mozilla::Side aSide) const
{
NS_ASSERTION(aSide <= eSideLeft, "bad side");
NS_ASSERTION(aSide <= mozilla::eSideLeft, "bad side");
return mBorderStyle[aSide];
}
void SetBorderStyle(mozilla::Side aSide, uint8_t aStyle)
{
NS_ASSERTION(aSide <= eSideLeft, "bad side");
NS_ASSERTION(aSide <= mozilla::eSideLeft, "bad side");
mBorderStyle[aSide] = aStyle;
mComputedBorder.Side(aSide) =
(HasVisibleStyle(aSide) ? mBorder.Side(aSide) : 0);

View file

@ -1889,6 +1889,16 @@ pref("network.dns.disablePrefetch", false);
// rejected before being given to DNS. RFC 7686
pref("network.dns.blockDotOnion", true);
// This preference controls whether to block access to 0.0.0.0
// to mitigate local access issues in *NIX network stacks.
#if defined(XP_WIN)
// Windows is not affected, so don't block it there.
// XXX: any other OSes not having this issue?
pref("network.dns.blockQuad0", false);
#else
pref("network.dns.blockQuad0", true);
#endif
// These domains are treated as localhost equivalent
pref("network.dns.localDomains", "");

View file

@ -48,6 +48,7 @@ static const char kPrefIPv4OnlyDomains[] = "network.dns.ipv4OnlyDomains";
static const char kPrefDisableIPv6[] = "network.dns.disableIPv6";
static const char kPrefDisablePrefetch[] = "network.dns.disablePrefetch";
static const char kPrefBlockDotOnion[] = "network.dns.blockDotOnion";
static const char kPrefBlockQuad0[] = "network.dns.blockQuad0";
static const char kPrefDnsLocalDomains[] = "network.dns.localDomains";
static const char kPrefDnsOfflineLocalhost[] = "network.dns.offline-localhost";
static const char kPrefDnsNotifyResolution[] = "network.dns.notifyResolution";
@ -537,6 +538,7 @@ nsDNSService::Init()
bool offlineLocalhost = true;
bool disablePrefetch = false;
bool blockDotOnion = true;
bool blockQuad0 = false;
int proxyType = nsIProtocolProxyService::PROXYCONFIG_DIRECT;
bool notifyResolution = false;
@ -561,6 +563,7 @@ nsDNSService::Init()
prefs->GetBoolPref(kPrefDnsOfflineLocalhost, &offlineLocalhost);
prefs->GetBoolPref(kPrefDisablePrefetch, &disablePrefetch);
prefs->GetBoolPref(kPrefBlockDotOnion, &blockDotOnion);
prefs->GetBoolPref(kPrefBlockQuad0, &blockQuad0);
// If a manual proxy is in use, disable prefetch implicitly
prefs->GetIntPref("network.proxy.type", &proxyType);
@ -579,6 +582,7 @@ nsDNSService::Init()
prefs->AddObserver(kPrefDnsOfflineLocalhost, this, false);
prefs->AddObserver(kPrefDisablePrefetch, this, false);
prefs->AddObserver(kPrefBlockDotOnion, this, false);
prefs->AddObserver(kPrefBlockQuad0, this, false);
prefs->AddObserver(kPrefDnsNotifyResolution, this, false);
// Monitor these to see if there is a change in proxy configuration
@ -612,6 +616,7 @@ nsDNSService::Init()
mOfflineLocalhost = offlineLocalhost;
mDisableIPv6 = disableIPv6;
mBlockDotOnion = blockDotOnion;
mBlockQuad0 = blockQuad0;
// Disable prefetching either by explicit preference or if a manual proxy is configured
mDisablePrefetch = disablePrefetch || (proxyType == nsIProtocolProxyService::PROXYCONFIG_MANUAL);
@ -697,6 +702,14 @@ nsDNSService::PreprocessHostname(bool aLocalDomain,
return NS_ERROR_UNKNOWN_HOST;
}
// Block access to the "this machine" address.
if (mBlockQuad0 &&
(aInput.EqualsLiteral("0.0.0.0") ||
aInput.EqualsLiteral("::") ||
aInput.EqualsLiteral("::0.0.0.0"))) {
return NS_ERROR_UNKNOWN_HOST;
}
if (aLocalDomain) {
aACE.AssignLiteral("localhost");
return NS_OK;

View file

@ -62,6 +62,7 @@ private:
bool mDisableIPv6;
bool mDisablePrefetch;
bool mBlockDotOnion;
bool mBlockQuad0;
bool mFirstTime;
bool mNotifyResolution;
bool mOfflineLocalhost;

Binary file not shown.