Bug 1642667 - Isolate alt-srv and connection pool per first-party when privacy.partition.network_state is set to true - part 1 - implementation, r=dragana,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D78082
This commit is contained in:
Andrea Marchesini 2020-06-10 13:38:26 +00:00
parent 35ee005dee
commit 6a5e156133

View File

@ -2427,13 +2427,20 @@ void nsHttpChannel::ProcessAltService() {
nsCOMPtr<nsProxyInfo> proxyInfo;
NS_NewNotificationCallbacksAggregation(mCallbacks, mLoadGroup,
getter_AddRefs(callbacks));
if (mProxyInfo) {
proxyInfo = do_QueryInterface(mProxyInfo);
}
OriginAttributes originAttributes;
StoragePrincipalHelper::GetOriginAttributes(
this, originAttributes, StoragePrincipalHelper::eRegularPrincipal);
// Regular principal in case we have a proxy.
if (proxyInfo) {
StoragePrincipalHelper::GetOriginAttributes(
this, originAttributes, StoragePrincipalHelper::eRegularPrincipal);
} else {
StoragePrincipalHelper::GetOriginAttributesForNetworkState(
this, originAttributes);
}
AltSvcMapping::ProcessHeader(
altSvc, scheme, originHost, originPort, mUsername, GetTopWindowOrigin(),
@ -6761,8 +6768,14 @@ nsresult nsHttpChannel::BeginConnect() {
SetDoNotTrack();
OriginAttributes originAttributes;
StoragePrincipalHelper::GetOriginAttributes(
this, originAttributes, StoragePrincipalHelper::eRegularPrincipal);
// Regular principal in case we have a proxy.
if (proxyInfo) {
StoragePrincipalHelper::GetOriginAttributes(
this, originAttributes, StoragePrincipalHelper::eRegularPrincipal);
} else {
StoragePrincipalHelper::GetOriginAttributesForNetworkState(
this, originAttributes);
}
RefPtr<nsHttpConnectionInfo> connInfo = new nsHttpConnectionInfo(
host, port, EmptyCString(), mUsername, GetTopWindowOrigin(), proxyInfo,