mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 11:38:16 +00:00
Bug 1894206 - Speculative connect for HTTPS upgraded page loads has the wrong originAttributes r=acreskey,necko-reviewers,kershaw
When entering www.wikipedia.org in the URL bar, that gets fixed up to being a http URL, and then a speculativeConnect is dispatched. nsHttpHandler::SpeculativeConnectInternal will upgrade the URL to https, but the originAttributes in the network partition key also need to be HTTPS, otherwise the speculative connection will not be used by the connection manager. Differential Revision: https://phabricator.services.mozilla.com/D209213
This commit is contained in:
parent
4e1a6b41f8
commit
69378c14ed
@ -2204,12 +2204,8 @@ nsresult nsHttpHandler::SpeculativeConnectInternal(
|
||||
originAttributes = std::move(aOriginAttributes.ref());
|
||||
} else if (aPrincipal) {
|
||||
originAttributes = aPrincipal->OriginAttributesRef();
|
||||
StoragePrincipalHelper::UpdateOriginAttributesForNetworkState(
|
||||
aURI, originAttributes);
|
||||
} else if (loadContext) {
|
||||
loadContext->GetOriginAttributes(originAttributes);
|
||||
StoragePrincipalHelper::UpdateOriginAttributesForNetworkState(
|
||||
aURI, originAttributes);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> clone;
|
||||
@ -2222,6 +2218,15 @@ nsresult nsHttpHandler::SpeculativeConnectInternal(
|
||||
}
|
||||
}
|
||||
|
||||
if (!aOriginAttributes) {
|
||||
// We must update the originAttributes with the network state first party
|
||||
// domain **after** we upgrade aURI to https.
|
||||
// Otherwise the speculative connection will be keyed by a http URL
|
||||
// and end up not being used.
|
||||
StoragePrincipalHelper::UpdateOriginAttributesForNetworkState(
|
||||
aURI, originAttributes);
|
||||
}
|
||||
|
||||
nsAutoCString scheme;
|
||||
nsresult rv = aURI->GetScheme(scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
Loading…
x
Reference in New Issue
Block a user