From d0e568577f0c041ced0f480f7286b962a8486fb8 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 10 Jul 2024 23:25:49 +0200 Subject: [PATCH] Issue #2547 - Remove hidden network.dns.disablePrefetchFromHTTPS pref. Resolves #2547 --- dom/base/nsDocument.cpp | 11 ----------- dom/html/nsHTMLDNSPrefetch.cpp | 8 -------- 2 files changed, 19 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index c13e775a94..3edcb39020 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -2802,20 +2802,9 @@ nsDocument::GetPrincipal() return NodePrincipal(); } -extern bool sDisablePrefetchHTTPSPref; - void nsDocument::SetPrincipal(nsIPrincipal *aNewPrincipal) { - if (aNewPrincipal && mAllowDNSPrefetch && sDisablePrefetchHTTPSPref) { - nsCOMPtr uri; - aNewPrincipal->GetURI(getter_AddRefs(uri)); - bool isHTTPS; - if (!uri || NS_FAILED(uri->SchemeIs("https", &isHTTPS)) || - isHTTPS) { - mAllowDNSPrefetch = false; - } - } mNodeInfoManager->SetDocumentPrincipal(aNewPrincipal); #ifdef DEBUG diff --git a/dom/html/nsHTMLDNSPrefetch.cpp b/dom/html/nsHTMLDNSPrefetch.cpp index 6a7217021f..1b91d8041d 100644 --- a/dom/html/nsHTMLDNSPrefetch.cpp +++ b/dom/html/nsHTMLDNSPrefetch.cpp @@ -37,7 +37,6 @@ using namespace mozilla::dom; using namespace mozilla::net; static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID); -bool sDisablePrefetchHTTPSPref; static bool sInitialized = false; static nsIDNSService *sDNSService = nullptr; static nsHTMLDNSPrefetch::nsDeferrals *sPrefetches = nullptr; @@ -59,13 +58,6 @@ nsHTMLDNSPrefetch::Initialize() sPrefetches->Activate(); - Preferences::AddBoolVarCache(&sDisablePrefetchHTTPSPref, - "network.dns.disablePrefetchFromHTTPS"); - - // Default is false, so we need an explicit call to prime the cache. - sDisablePrefetchHTTPSPref = - Preferences::GetBool("network.dns.disablePrefetchFromHTTPS", true); - NS_IF_RELEASE(sDNSService); nsresult rv; rv = CallGetService(kDNSServiceCID, &sDNSService);