Backed out 3 changesets (bug 1639247) for build bustages on on StoragePrincipalHelper.cpp. CLOSED TREE

Backed out changeset 48a854ee6710 (bug 1639247)
Backed out changeset 032d302608e4 (bug 1639247)
Backed out changeset 2d2ff22a0ea4 (bug 1639247)
This commit is contained in:
Razvan Maries 2020-05-20 19:34:22 +03:00
Родитель 305c356967
Коммит 02e0a1d9a4
14 изменённых файлов: 51 добавлений и 112 удалений

Просмотреть файл

@ -18,7 +18,6 @@
#include "mozilla/dom/MutationObservers.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/SRILogHelper.h"
#include "mozilla/StoragePrincipalHelper.h"
#include "nsStyleLinkElement.h"
#include "nsIDocShell.h"
#include "nsILoadContext.h"
@ -854,11 +853,9 @@ void nsContentSink::PrefetchDNS(const nsAString& aHref) {
}
if (!hostname.IsEmpty() && nsHTMLDNSPrefetch::IsAllowed(mDocument)) {
OriginAttributes oa;
StoragePrincipalHelper::GetOriginAttributesForNetworkState(mDocument, oa);
nsHTMLDNSPrefetch::PrefetchLow(hostname, isHttps, oa,
mDocument->GetChannel()->GetTRRMode());
nsHTMLDNSPrefetch::PrefetchLow(
hostname, isHttps, mDocument->NodePrincipal()->OriginAttributesRef(),
mDocument->GetChannel()->GetTRRMode());
}
}

Просмотреть файл

@ -10,7 +10,6 @@
#include "mozilla/dom/Element.h"
#include "mozilla/net/NeckoCommon.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/StoragePrincipalHelper.h"
#include "nsURLHelper.h"
#include "nsCOMPtr.h"
@ -134,10 +133,9 @@ nsresult nsHTMLDNSPrefetch::PrefetchHigh(Link* aElement) {
return Prefetch(aElement, 0);
}
nsresult nsHTMLDNSPrefetch::Prefetch(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
uint32_t flags) {
nsresult nsHTMLDNSPrefetch::Prefetch(const nsAString& hostname, bool isHttps,
const OriginAttributes& aOriginAttributes,
uint32_t flags) {
if (IsNeckoChild()) {
// We need to check IsEmpty() because net_IsValidHostName()
// considers empty strings to be valid hostnames
@ -146,8 +144,7 @@ nsresult nsHTMLDNSPrefetch::Prefetch(
// during shutdown gNeckoChild might be null
if (gNeckoChild) {
gNeckoChild->SendHTMLDNSPrefetch(nsString(hostname), isHttps,
aPartitionedPrincipalOriginAttributes,
flags);
aOriginAttributes, flags);
}
}
return NS_OK;
@ -159,8 +156,7 @@ nsresult nsHTMLDNSPrefetch::Prefetch(
nsCOMPtr<nsICancelable> tmpOutstanding;
nsresult rv = sDNSService->AsyncResolveNative(
NS_ConvertUTF16toUTF8(hostname), flags | nsIDNSService::RESOLVE_SPECULATE,
sDNSListener, nullptr, aPartitionedPrincipalOriginAttributes,
getter_AddRefs(tmpOutstanding));
sDNSListener, nullptr, aOriginAttributes, getter_AddRefs(tmpOutstanding));
if (NS_FAILED(rv)) {
return rv;
}
@ -173,7 +169,7 @@ nsresult nsHTMLDNSPrefetch::Prefetch(
Unused << sDNSService->AsyncResolveByTypeNative(
esniHost, nsIDNSService::RESOLVE_TYPE_TXT,
flags | nsIDNSService::RESOLVE_SPECULATE, sDNSListener, nullptr,
aPartitionedPrincipalOriginAttributes, getter_AddRefs(tmpOutstanding));
aOriginAttributes, getter_AddRefs(tmpOutstanding));
}
return NS_OK;
@ -181,27 +177,24 @@ nsresult nsHTMLDNSPrefetch::Prefetch(
nsresult nsHTMLDNSPrefetch::PrefetchLow(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
nsIRequest::TRRMode aMode) {
return Prefetch(hostname, isHttps, aPartitionedPrincipalOriginAttributes,
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aMode) {
return Prefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::GetFlagsFromTRRMode(aMode) |
nsIDNSService::RESOLVE_PRIORITY_LOW);
}
nsresult nsHTMLDNSPrefetch::PrefetchMedium(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
nsIRequest::TRRMode aMode) {
return Prefetch(hostname, isHttps, aPartitionedPrincipalOriginAttributes,
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aMode) {
return Prefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::GetFlagsFromTRRMode(aMode) |
nsIDNSService::RESOLVE_PRIORITY_MEDIUM);
}
nsresult nsHTMLDNSPrefetch::PrefetchHigh(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
nsIRequest::TRRMode aMode) {
return Prefetch(hostname, isHttps, aPartitionedPrincipalOriginAttributes,
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aMode) {
return Prefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::GetFlagsFromTRRMode(aMode));
}
@ -222,18 +215,15 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(Link* aElement, uint32_t flags,
if (protocol.EqualsLiteral("https:")) {
isHttps = true;
}
OriginAttributes oa;
StoragePrincipalHelper::GetOriginAttributesForNetworkState(
element->OwnerDoc(), oa);
return CancelPrefetch(hostname, isHttps, oa, flags, aReason);
return CancelPrefetch(hostname, isHttps,
element->NodePrincipal()->OriginAttributesRef(), flags,
aReason);
}
nsresult nsHTMLDNSPrefetch::CancelPrefetch(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
uint32_t flags, nsresult aReason) {
const OriginAttributes& aOriginAttributes, uint32_t flags,
nsresult aReason) {
// Forward this request to Necko Parent if we're a child process
if (IsNeckoChild()) {
// We need to check IsEmpty() because net_IsValidHostName()
@ -243,8 +233,7 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(
// during shutdown gNeckoChild might be null
if (gNeckoChild) {
gNeckoChild->SendCancelHTMLDNSPrefetch(
nsString(hostname), isHttps, aPartitionedPrincipalOriginAttributes,
flags, aReason);
nsString(hostname), isHttps, aOriginAttributes, flags, aReason);
}
}
return NS_OK;
@ -256,7 +245,7 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(
// Forward cancellation to DNS service
nsresult rv = sDNSService->CancelAsyncResolveNative(
NS_ConvertUTF16toUTF8(hostname), flags | nsIDNSService::RESOLVE_SPECULATE,
sDNSListener, aReason, aPartitionedPrincipalOriginAttributes);
sDNSListener, aReason, aOriginAttributes);
// Cancel fetching ESNI keys if needed.
if (sEsniEnabled && isHttps) {
nsAutoCString esniHost;
@ -265,7 +254,7 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetch(
sDNSService->CancelAsyncResolveByTypeNative(
esniHost, nsIDNSService::RESOLVE_TYPE_TXT,
flags | nsIDNSService::RESOLVE_SPECULATE, sDNSListener, aReason,
aPartitionedPrincipalOriginAttributes);
aOriginAttributes);
}
return rv;
}
@ -280,10 +269,9 @@ nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(Link* aElement,
nsresult nsHTMLDNSPrefetch::CancelPrefetchLow(
const nsAString& hostname, bool isHttps,
const OriginAttributes& aPartitionedPrincipalOriginAttributes,
nsIRequest::TRRMode aTRRMode, nsresult aReason) {
return CancelPrefetch(hostname, isHttps,
aPartitionedPrincipalOriginAttributes,
const OriginAttributes& aOriginAttributes, nsIRequest::TRRMode aTRRMode,
nsresult aReason) {
return CancelPrefetch(hostname, isHttps, aOriginAttributes,
nsIDNSService::GetFlagsFromTRRMode(aTRRMode) |
nsIDNSService::RESOLVE_PRIORITY_LOW,
aReason);
@ -390,18 +378,15 @@ void nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue() {
isHttps = hrefURI->SchemeIs("https");
}
OriginAttributes oa;
StoragePrincipalHelper::GetOriginAttributesForNetworkState(
element->OwnerDoc(), oa);
if (!hostName.IsEmpty() && NS_SUCCEEDED(rv) && !isLocalResource &&
element) {
if (IsNeckoChild()) {
// during shutdown gNeckoChild might be null
if (gNeckoChild) {
gNeckoChild->SendHTMLDNSPrefetch(NS_ConvertUTF8toUTF16(hostName),
isHttps, oa,
mEntries[mTail].mFlags);
gNeckoChild->SendHTMLDNSPrefetch(
NS_ConvertUTF8toUTF16(hostName), isHttps,
element->NodePrincipal()->OriginAttributesRef(),
mEntries[mTail].mFlags);
}
} else {
nsCOMPtr<nsICancelable> tmpOutstanding;
@ -409,7 +394,9 @@ void nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue() {
rv = sDNSService->AsyncResolveNative(
hostName,
mEntries[mTail].mFlags | nsIDNSService::RESOLVE_SPECULATE,
sDNSListener, nullptr, oa, getter_AddRefs(tmpOutstanding));
sDNSListener, nullptr,
element->NodePrincipal()->OriginAttributesRef(),
getter_AddRefs(tmpOutstanding));
// Fetch ESNI keys if needed.
if (NS_SUCCEEDED(rv) && sEsniEnabled && isHttps) {
nsAutoCString esniHost;
@ -418,7 +405,9 @@ void nsHTMLDNSPrefetch::nsDeferrals::SubmitQueue() {
sDNSService->AsyncResolveByTypeNative(
esniHost, nsIDNSService::RESOLVE_TYPE_TXT,
mEntries[mTail].mFlags | nsIDNSService::RESOLVE_SPECULATE,
sDNSListener, nullptr, oa, getter_AddRefs(tmpOutstanding));
sDNSListener, nullptr,
element->NodePrincipal()->OriginAttributesRef(),
getter_AddRefs(tmpOutstanding));
}
// Tell link that deferred prefetch was requested
if (NS_SUCCEEDED(rv)) link->OnDNSPrefetchRequested();

Просмотреть файл

@ -47,29 +47,25 @@ class nsHTMLDNSPrefetch {
// the DNS system immediately. The URI version is somewhat lighter
// weight, but its request is also more likely to be dropped due to a
// full queue and it may only be used from the main thread.
//
// If you are planning to use the methods with the OriginAttributes param, be
// sure that you pass a partitioned one. See StoragePrincipalHelper.h to know
// more.
static nsresult PrefetchHigh(mozilla::dom::Link* aElement);
static nsresult PrefetchMedium(mozilla::dom::Link* aElement);
static nsresult PrefetchLow(mozilla::dom::Link* aElement);
static nsresult PrefetchLow(
static nsresult PrefetchHigh(
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
const mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode);
static nsresult PrefetchMedium(
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
const mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode);
static nsresult PrefetchHigh(
static nsresult PrefetchLow(
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
const mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode);
static nsresult CancelPrefetchLow(
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
const mozilla::OriginAttributes& aOriginAttributes,
nsIRequest::TRRMode aTRRMode, nsresult aReason);
static nsresult CancelPrefetchLow(mozilla::dom::Link* aElement,
nsresult aReason);
@ -77,15 +73,14 @@ class nsHTMLDNSPrefetch {
static void LinkDestroyed(mozilla::dom::Link* aLink);
private:
static nsresult Prefetch(
const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
uint32_t flags);
static nsresult Prefetch(const nsAString& host, bool isHttps,
const mozilla::OriginAttributes& aOriginAttributes,
uint32_t flags);
static nsresult Prefetch(mozilla::dom::Link* aElement, uint32_t flags);
static nsresult CancelPrefetch(
const nsAString& hostname, bool isHttps,
const mozilla::OriginAttributes& aPartitionedPrincipalOriginAttributes,
uint32_t flags, nsresult aReason);
const mozilla::OriginAttributes& aOriginAttributes, uint32_t flags,
nsresult aReason);
static nsresult CancelPrefetch(mozilla::dom::Link* aElement, uint32_t flags,
nsresult aReason);

Просмотреть файл

@ -66,7 +66,6 @@ dictionary DnsCacheEntry {
DOMString family = "";
double expiration = 0;
boolean trr = false;
DOMString originAttributesSuffix = "";
};
[GenerateConversionToJS]

Просмотреть файл

@ -670,9 +670,6 @@ nsresult Dashboard::GetDNSCacheEntries(DnsData* dnsData) {
} else {
entry.mFamily.AssignLiteral(u"ipv4");
}
entry.mOriginAttributesSuffix =
NS_ConvertUTF8toUTF16(dnsData->mData[i].originAttributesSuffix);
}
JS::RootedValue val(cx);

Просмотреть файл

@ -32,7 +32,6 @@ struct DNSCacheEntries {
int64_t expiration;
nsCString netInterface;
bool TRR;
nsCString originAttributesSuffix;
};
struct HttpConnInfo {

Просмотреть файл

@ -2300,8 +2300,6 @@ void nsHostResolver::GetDNSCacheEntries(nsTArray<DNSCacheEntries>* args) {
info.TRR = addrRec->addr_info->IsTRR();
}
info.originAttributesSuffix = iter.Key().originSuffix;
args->AppendElement(std::move(info));
}
}

Просмотреть файл

@ -10,7 +10,6 @@
#include "HttpLog.h"
#include "AltServiceChild.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/Unused.h"
#include "nsDNSPrefetch.h"
#include "nsEscape.h"
#include "nsHttpTransaction.h"
@ -304,14 +303,12 @@ nsresult TRRServiceChannel::BeginConnect() {
rv = mURI->GetScheme(scheme);
if (NS_SUCCEEDED(rv)) rv = mURI->GetAsciiHost(host);
if (NS_SUCCEEDED(rv)) rv = mURI->GetPort(&port);
if (NS_SUCCEEDED(rv)) mURI->GetUsername(mUsername);
if (NS_SUCCEEDED(rv)) rv = mURI->GetAsciiSpec(mSpec);
if (NS_FAILED(rv)) {
return rv;
}
// Just a warning here because some nsIURIs do not implement this method.
Unused << NS_WARN_IF(NS_FAILED(mURI->GetUsername(mUsername)));
// Reject the URL if it doesn't specify a host
if (host.IsEmpty()) {
rv = NS_ERROR_MALFORMED_URI;

Просмотреть файл

@ -6740,14 +6740,12 @@ nsresult nsHttpChannel::BeginConnect() {
rv = mURI->GetScheme(scheme);
if (NS_SUCCEEDED(rv)) rv = mURI->GetAsciiHost(host);
if (NS_SUCCEEDED(rv)) rv = mURI->GetPort(&port);
if (NS_SUCCEEDED(rv)) mURI->GetUsername(mUsername);
if (NS_SUCCEEDED(rv)) rv = mURI->GetAsciiSpec(mSpec);
if (NS_FAILED(rv)) {
return rv;
}
// Just a warning here because some nsIURIs do not implement this method.
Unused << NS_WARN_IF(NS_FAILED(mURI->GetUsername(mUsername)));
// Reject the URL if it doesn't specify a host
if (host.IsEmpty()) {
rv = NS_ERROR_MALFORMED_URI;
@ -6992,8 +6990,8 @@ nsresult nsHttpChannel::MaybeStartDNSPrefetch() {
if (dnsStrategy & DNS_PREFETCH_ORIGIN) {
OriginAttributes originAttributes;
StoragePrincipalHelper::GetOriginAttributesForNetworkState(
this, originAttributes);
StoragePrincipalHelper::GetOriginAttributes(
this, originAttributes, StoragePrincipalHelper::eRegularPrincipal);
mDNSPrefetch = new nsDNSPrefetch(
mURI, originAttributes, nsIRequest::GetTRRMode(), this, mTimingEnabled);

Просмотреть файл

@ -265,24 +265,4 @@ bool StoragePrincipalHelper::GetRegularPrincipalOriginAttributes(
return true;
}
// static
bool StoragePrincipalHelper::GetOriginAttributesForNetworkState(
nsIChannel* aChannel, OriginAttributes& aAttributes) {
return StoragePrincipalHelper::GetOriginAttributes(
aChannel, aAttributes,
StaticPrefs::privacy_partition_network_state() ? ePartitionedPrincipal
: eRegularPrincipal);
}
// static
void StoragePrincipalHelper::GetOriginAttributesForNetworkState(
Document* aDocument, OriginAttributes& aAttributes) {
if (!StaticPrefs::privacy_partition_network_state()) {
aAttributes = aDocument->NodePrincipal()->OriginAttributesRef();
return;
}
aAttributes = aDocument->IntrinsicStoragePrincipal()->OriginAttributesRef();
}
} // namespace mozilla

Просмотреть файл

@ -250,13 +250,6 @@ class StoragePrincipalHelper final {
static bool GetRegularPrincipalOriginAttributes(
nsILoadGroup* aLoadGroup, OriginAttributes& aAttributes);
// These methods return the correct originAttributes to be used for network
// state components (HSTS, network cache, image-cache, and so on).
static bool GetOriginAttributesForNetworkState(nsIChannel* aChanel,
OriginAttributes& aAttributes);
static void GetOriginAttributesForNetworkState(dom::Document* aDocument,
OriginAttributes& aAttributes);
};
} // namespace mozilla

Просмотреть файл

@ -102,7 +102,6 @@
<th data-l10n-id="about-networking-trr"/>
<th data-l10n-id="about-networking-addresses"/>
<th data-l10n-id="about-networking-expires"/>
<th data-l10n-id="about-networking-originAttributesSuffix"/>
</tr>
</thead>
<tbody id="dns_content" />

Просмотреть файл

@ -124,7 +124,6 @@ function displayDns(data) {
row.appendChild(column);
row.appendChild(col(data.entries[i].expiration));
row.appendChild(col(data.entries[i].originAttributesSuffix));
new_cont.appendChild(row);
}

Просмотреть файл

@ -24,7 +24,6 @@ about-networking-family = Family
about-networking-trr = TRR
about-networking-addresses = Addresses
about-networking-expires = Expires (Seconds)
about-networking-originAttributesSuffix = Isolation Key
about-networking-messages-sent = Messages Sent
about-networking-messages-received = Messages Received
about-networking-bytes-sent = Bytes Sent