зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1687618 - Remove isolated and topWindowOrigin from altServices r=necko-reviewers,dragana
Depends on D102713 Differential Revision: https://phabricator.services.mozilla.com/D102714
This commit is contained in:
Родитель
07f3c9f419
Коммит
8e0f7c41aa
|
@ -66,8 +66,7 @@ void AltServiceChild::ClearHostMapping(nsHttpConnectionInfo* aCi) {
|
|||
|
||||
if (!ci->GetOrigin().IsEmpty() && sAltServiceChild->CanSend()) {
|
||||
Unused << sAltServiceChild->SendClearHostMapping(
|
||||
ci->GetOrigin(), ci->OriginPort(), ci->GetOriginAttributes(),
|
||||
""_ns /* topWindowOrigin */);
|
||||
ci->GetOrigin(), ci->OriginPort(), ci->GetOriginAttributes());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -84,9 +83,8 @@ void AltServiceChild::ClearHostMapping(nsHttpConnectionInfo* aCi) {
|
|||
void AltServiceChild::ProcessHeader(
|
||||
const nsCString& aBuf, const nsCString& aOriginScheme,
|
||||
const nsCString& aOriginHost, int32_t aOriginPort,
|
||||
const nsCString& aUsername, const nsCString& aTopWindowOrigin,
|
||||
bool aPrivateBrowsing, bool aIsolated, nsIInterfaceRequestor* aCallbacks,
|
||||
nsProxyInfo* aProxyInfo, uint32_t aCaps,
|
||||
const nsCString& aUsername, bool aPrivateBrowsing,
|
||||
nsIInterfaceRequestor* aCallbacks, nsProxyInfo* aProxyInfo, uint32_t aCaps,
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
LOG(("AltServiceChild::ProcessHeader"));
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -106,8 +104,7 @@ void AltServiceChild::ProcessHeader(
|
|||
|
||||
Unused << sAltServiceChild->SendProcessHeader(
|
||||
aBuf, aOriginScheme, aOriginHost, aOriginPort, aUsername,
|
||||
aTopWindowOrigin, aPrivateBrowsing, aIsolated, proxyInfoArray, aCaps,
|
||||
aOriginAttributes);
|
||||
aPrivateBrowsing, proxyInfoArray, aCaps, aOriginAttributes);
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -25,9 +25,7 @@ class AltServiceChild final : public PAltServiceChild {
|
|||
static void ProcessHeader(const nsCString& aBuf,
|
||||
const nsCString& aOriginScheme,
|
||||
const nsCString& aOriginHost, int32_t aOriginPort,
|
||||
const nsCString& aUsername,
|
||||
const nsCString& aTopWindowOrigin,
|
||||
bool aPrivateBrowsing, bool aIsolated,
|
||||
const nsCString& aUsername, bool aPrivateBrowsing,
|
||||
nsIInterfaceRequestor* aCallbacks,
|
||||
nsProxyInfo* aProxyInfo, uint32_t aCaps,
|
||||
const OriginAttributes& aOriginAttributes);
|
||||
|
|
|
@ -16,12 +16,11 @@ namespace net {
|
|||
|
||||
mozilla::ipc::IPCResult AltServiceParent::RecvClearHostMapping(
|
||||
const nsCString& aHost, const int32_t& aPort,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsCString& aTopWindowOrigin) {
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
LOG(("AltServiceParent::RecvClearHostMapping [this=%p]\n", this));
|
||||
if (gHttpHandler) {
|
||||
gHttpHandler->AltServiceCache()->ClearHostMapping(
|
||||
aHost, aPort, aOriginAttributes, aTopWindowOrigin);
|
||||
gHttpHandler->AltServiceCache()->ClearHostMapping(aHost, aPort,
|
||||
aOriginAttributes);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -29,8 +28,7 @@ mozilla::ipc::IPCResult AltServiceParent::RecvClearHostMapping(
|
|||
mozilla::ipc::IPCResult AltServiceParent::RecvProcessHeader(
|
||||
const nsCString& aBuf, const nsCString& aOriginScheme,
|
||||
const nsCString& aOriginHost, const int32_t& aOriginPort,
|
||||
const nsACString& aUsername, const nsACString& aTopWindowOrigin,
|
||||
const bool& aPrivateBrowsing, const bool& aIsolated,
|
||||
const nsACString& aUsername, const bool& aPrivateBrowsing,
|
||||
nsTArray<ProxyInfoCloneArgs>&& aProxyInfo, const uint32_t& aCaps,
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
LOG(("AltServiceParent::RecvProcessHeader [this=%p]\n", this));
|
||||
|
@ -38,8 +36,7 @@ mozilla::ipc::IPCResult AltServiceParent::RecvProcessHeader(
|
|||
? nullptr
|
||||
: nsProxyInfo::DeserializeProxyInfo(aProxyInfo);
|
||||
AltSvcMapping::ProcessHeader(aBuf, aOriginScheme, aOriginHost, aOriginPort,
|
||||
aUsername, aTopWindowOrigin, aPrivateBrowsing,
|
||||
aIsolated, nullptr, pi, aCaps,
|
||||
aUsername, aPrivateBrowsing, nullptr, pi, aCaps,
|
||||
aOriginAttributes);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
|
|
@ -18,14 +18,12 @@ class AltServiceParent final : public PAltServiceParent {
|
|||
|
||||
mozilla::ipc::IPCResult RecvClearHostMapping(
|
||||
const nsCString& aHost, const int32_t& aPort,
|
||||
const OriginAttributes& aOriginAttributes,
|
||||
const nsCString& aTopWindowOrigin);
|
||||
const OriginAttributes& aOriginAttributes);
|
||||
|
||||
mozilla::ipc::IPCResult RecvProcessHeader(
|
||||
const nsCString& aBuf, const nsCString& aOriginScheme,
|
||||
const nsCString& aOriginHost, const int32_t& aOriginPort,
|
||||
const nsACString& aUsername, const nsACString& aTopWindowOrigin,
|
||||
const bool& aPrivateBrowsing, const bool& aIsolated,
|
||||
const nsACString& aUsername, const bool& aPrivateBrowsing,
|
||||
nsTArray<ProxyInfoCloneArgs>&& aProxyInfo, const uint32_t& aCaps,
|
||||
const OriginAttributes& aOriginAttributes);
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ bool AltSvcMapping::AcceptableProxy(nsProxyInfo* proxyInfo) {
|
|||
void AltSvcMapping::ProcessHeader(
|
||||
const nsCString& buf, const nsCString& originScheme,
|
||||
const nsCString& originHost, int32_t originPort, const nsACString& username,
|
||||
const nsACString& topWindowOrigin, bool privateBrowsing, bool isolated,
|
||||
nsIInterfaceRequestor* callbacks, nsProxyInfo* proxyInfo, uint32_t caps,
|
||||
bool privateBrowsing, nsIInterfaceRequestor* callbacks,
|
||||
nsProxyInfo* proxyInfo, uint32_t caps,
|
||||
const OriginAttributes& originAttributes,
|
||||
bool aDontValidate /* = false */) { // aDontValidate is only used for
|
||||
// testing
|
||||
|
@ -137,8 +137,8 @@ void AltSvcMapping::ProcessHeader(
|
|||
originAttributes.CreateSuffix(suffix);
|
||||
LOG(("Alt Svc clearing mapping for %s:%d:%s", originHost.get(),
|
||||
originPort, suffix.get()));
|
||||
gHttpHandler->AltServiceCache()->ClearHostMapping(
|
||||
originHost, originPort, originAttributes, topWindowOrigin);
|
||||
gHttpHandler->AltServiceCache()->ClearHostMapping(originHost, originPort,
|
||||
originAttributes);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -172,19 +172,19 @@ void AltSvcMapping::ProcessHeader(
|
|||
http3Found = true;
|
||||
}
|
||||
|
||||
RefPtr<AltSvcMapping> mapping = new AltSvcMapping(
|
||||
gHttpHandler->AltServiceCache()->GetStoragePtr(),
|
||||
gHttpHandler->AltServiceCache()->StorageEpoch(), originScheme,
|
||||
originHost, originPort, username, topWindowOrigin, privateBrowsing,
|
||||
isolated, NowInSeconds() + maxage, hostname, portno, npnToken,
|
||||
originAttributes, isHttp3);
|
||||
RefPtr<AltSvcMapping> mapping =
|
||||
new AltSvcMapping(gHttpHandler->AltServiceCache()->GetStoragePtr(),
|
||||
gHttpHandler->AltServiceCache()->StorageEpoch(),
|
||||
originScheme, originHost, originPort, username,
|
||||
privateBrowsing, NowInSeconds() + maxage, hostname,
|
||||
portno, npnToken, originAttributes, isHttp3);
|
||||
if (mapping->TTL() <= 0) {
|
||||
LOG(("Alt Svc invalid map"));
|
||||
mapping = nullptr;
|
||||
// since this isn't a parse error, let's clear any existing mapping
|
||||
// as that would have happened if we had accepted the parameters.
|
||||
gHttpHandler->AltServiceCache()->ClearHostMapping(
|
||||
originHost, originPort, originAttributes, topWindowOrigin);
|
||||
gHttpHandler->AltServiceCache()->ClearHostMapping(originHost, originPort,
|
||||
originAttributes);
|
||||
} else if (!aDontValidate) {
|
||||
gHttpHandler->UpdateAltServiceMapping(mapping, proxyInfo, callbacks, caps,
|
||||
originAttributes);
|
||||
|
@ -200,14 +200,15 @@ void AltSvcMapping::ProcessHeader(
|
|||
}
|
||||
}
|
||||
|
||||
AltSvcMapping::AltSvcMapping(
|
||||
DataStorage* storage, int32_t epoch, const nsACString& originScheme,
|
||||
const nsACString& originHost, int32_t originPort,
|
||||
const nsACString& username, const nsACString& topWindowOrigin,
|
||||
bool privateBrowsing, bool isolated, uint32_t expiresAt,
|
||||
const nsACString& alternateHost, int32_t alternatePort,
|
||||
const nsACString& npnToken, const OriginAttributes& originAttributes,
|
||||
bool aIsHttp3)
|
||||
AltSvcMapping::AltSvcMapping(DataStorage* storage, int32_t epoch,
|
||||
const nsACString& originScheme,
|
||||
const nsACString& originHost, int32_t originPort,
|
||||
const nsACString& username, bool privateBrowsing,
|
||||
uint32_t expiresAt,
|
||||
const nsACString& alternateHost,
|
||||
int32_t alternatePort, const nsACString& npnToken,
|
||||
const OriginAttributes& originAttributes,
|
||||
bool aIsHttp3)
|
||||
: mStorage(storage),
|
||||
mStorageEpoch(epoch),
|
||||
mAlternateHost(alternateHost),
|
||||
|
@ -215,9 +216,7 @@ AltSvcMapping::AltSvcMapping(
|
|||
mOriginHost(originHost),
|
||||
mOriginPort(originPort),
|
||||
mUsername(username),
|
||||
mTopWindowOrigin(topWindowOrigin),
|
||||
mPrivate(privateBrowsing),
|
||||
mIsolated(isolated),
|
||||
mExpiresAt(expiresAt),
|
||||
mValidated(false),
|
||||
mMixedScheme(false),
|
||||
|
@ -260,15 +259,16 @@ AltSvcMapping::AltSvcMapping(
|
|||
|
||||
if (mExpiresAt) {
|
||||
MakeHashKey(mHashKey, originScheme, mOriginHost, mOriginPort, mPrivate,
|
||||
mIsolated, mTopWindowOrigin, mOriginAttributes, mIsHttp3);
|
||||
mOriginAttributes, mIsHttp3);
|
||||
}
|
||||
}
|
||||
|
||||
void AltSvcMapping::MakeHashKey(
|
||||
nsCString& outKey, const nsACString& originScheme,
|
||||
const nsACString& originHost, int32_t originPort, bool privateBrowsing,
|
||||
bool isolated, const nsACString& topWindowOrigin,
|
||||
const OriginAttributes& originAttributes, bool aHttp3) {
|
||||
void AltSvcMapping::MakeHashKey(nsCString& outKey,
|
||||
const nsACString& originScheme,
|
||||
const nsACString& originHost,
|
||||
int32_t originPort, bool privateBrowsing,
|
||||
const OriginAttributes& originAttributes,
|
||||
bool aHttp3) {
|
||||
outKey.Truncate();
|
||||
|
||||
if (originPort == -1) {
|
||||
|
@ -289,13 +289,6 @@ void AltSvcMapping::MakeHashKey(
|
|||
outKey.Append(suffix);
|
||||
outKey.Append(':');
|
||||
|
||||
if (isolated) {
|
||||
outKey.Append('I');
|
||||
outKey.Append(':');
|
||||
outKey.Append(topWindowOrigin);
|
||||
outKey.Append(
|
||||
'|'); // Be careful, the top window origin may contain colons!
|
||||
}
|
||||
outKey.Append(aHttp3 ? '3' : '.');
|
||||
}
|
||||
|
||||
|
@ -403,9 +396,9 @@ void AltSvcMapping::Serialize(nsCString& out) {
|
|||
mOriginAttributes.CreateSuffix(suffix);
|
||||
out.Append(suffix);
|
||||
out.Append(':');
|
||||
out.Append(mTopWindowOrigin);
|
||||
out.Append('|'); // Be careful, the top window origin may contain colons!
|
||||
out.Append(mIsolated ? 'y' : 'n');
|
||||
out.Append(""_ns); // Formerly topWindowOrigin. Now unused empty string.
|
||||
out.Append('|'); // Be careful, the top window origin may contain colons!
|
||||
out.Append('n'); // Formerly mIsolated. Now always 'n'. Should remove someday
|
||||
out.Append(':');
|
||||
out.Append(mIsHttp3 ? 'y' : 'n');
|
||||
out.Append(':');
|
||||
|
@ -471,18 +464,17 @@ AltSvcMapping::AltSvcMapping(DataStorage* storage, int32_t epoch,
|
|||
// origin string can contain colons.
|
||||
separator = '|';
|
||||
_NS_NEXT_TOKEN;
|
||||
mTopWindowOrigin = Substring(str, start, idx - start);
|
||||
// TopWindowOrigin used to be encoded here. Now it's unused.
|
||||
separator = ':';
|
||||
_NS_NEXT_TOKEN;
|
||||
mIsolated = Substring(str, start, idx - start).EqualsLiteral("y");
|
||||
// mIsolated used to be encoded here. Now it's unused.
|
||||
_NS_NEXT_TOKEN;
|
||||
mIsHttp3 = Substring(str, start, idx - start).EqualsLiteral("y");
|
||||
// Add code to deserialize new members here!
|
||||
#undef _NS_NEXT_TOKEN
|
||||
|
||||
MakeHashKey(mHashKey, mHttps ? "https"_ns : "http"_ns, mOriginHost,
|
||||
mOriginPort, mPrivate, mIsolated, mTopWindowOrigin,
|
||||
mOriginAttributes, mIsHttp3);
|
||||
mOriginPort, mPrivate, mOriginAttributes, mIsHttp3);
|
||||
} while (false);
|
||||
}
|
||||
|
||||
|
@ -1137,9 +1129,8 @@ void AltSvcCache::UpdateAltServiceMapping(
|
|||
|
||||
already_AddRefed<AltSvcMapping> AltSvcCache::GetAltServiceMapping(
|
||||
const nsACString& scheme, const nsACString& host, int32_t port,
|
||||
bool privateBrowsing, bool isolated, const nsACString& topWindowOrigin,
|
||||
const OriginAttributes& originAttributes, bool aHttp2Allowed,
|
||||
bool aHttp3Allowed) {
|
||||
bool privateBrowsing, const OriginAttributes& originAttributes,
|
||||
bool aHttp2Allowed, bool aHttp3Allowed) {
|
||||
EnsureStorageInited();
|
||||
|
||||
bool isHTTPS;
|
||||
|
@ -1157,8 +1148,7 @@ already_AddRefed<AltSvcMapping> AltSvcCache::GetAltServiceMapping(
|
|||
if (aHttp3Allowed) {
|
||||
nsAutoCString key;
|
||||
AltSvcMapping::MakeHashKey(key, scheme, host, port, privateBrowsing,
|
||||
isolated, topWindowOrigin, originAttributes,
|
||||
true);
|
||||
originAttributes, true);
|
||||
RefPtr<AltSvcMapping> existing = LookupMapping(key, privateBrowsing);
|
||||
LOG(
|
||||
("AltSvcCache::GetAltServiceMapping %p key=%s "
|
||||
|
@ -1174,8 +1164,7 @@ already_AddRefed<AltSvcMapping> AltSvcCache::GetAltServiceMapping(
|
|||
if (aHttp2Allowed) {
|
||||
nsAutoCString key;
|
||||
AltSvcMapping::MakeHashKey(key, scheme, host, port, privateBrowsing,
|
||||
isolated, topWindowOrigin, originAttributes,
|
||||
false);
|
||||
originAttributes, false);
|
||||
RefPtr<AltSvcMapping> existing = LookupMapping(key, privateBrowsing);
|
||||
LOG(
|
||||
("AltSvcCache::GetAltServiceMapping %p key=%s "
|
||||
|
@ -1193,18 +1182,16 @@ already_AddRefed<AltSvcMapping> AltSvcCache::GetAltServiceMapping(
|
|||
class ProxyClearHostMapping : public Runnable {
|
||||
public:
|
||||
explicit ProxyClearHostMapping(const nsACString& host, int32_t port,
|
||||
const OriginAttributes& originAttributes,
|
||||
const nsACString& topWindowOrigin)
|
||||
const OriginAttributes& originAttributes)
|
||||
: Runnable("net::ProxyClearHostMapping"),
|
||||
mHost(host),
|
||||
mPort(port),
|
||||
mOriginAttributes(originAttributes),
|
||||
mTopWindowOrigin(topWindowOrigin) {}
|
||||
mOriginAttributes(originAttributes) {}
|
||||
|
||||
NS_IMETHOD Run() override {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
gHttpHandler->AltServiceCache()->ClearHostMapping(
|
||||
mHost, mPort, mOriginAttributes, mTopWindowOrigin);
|
||||
gHttpHandler->AltServiceCache()->ClearHostMapping(mHost, mPort,
|
||||
mOriginAttributes);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1212,17 +1199,15 @@ class ProxyClearHostMapping : public Runnable {
|
|||
nsCString mHost;
|
||||
int32_t mPort;
|
||||
OriginAttributes mOriginAttributes;
|
||||
nsCString mTopWindowOrigin;
|
||||
};
|
||||
|
||||
void AltSvcCache::ClearHostMapping(const nsACString& host, int32_t port,
|
||||
const OriginAttributes& originAttributes,
|
||||
const nsACString& topWindowOrigin) {
|
||||
const OriginAttributes& originAttributes) {
|
||||
MOZ_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
nsCOMPtr<nsIRunnable> event = new ProxyClearHostMapping(
|
||||
host, port, originAttributes, topWindowOrigin);
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
new ProxyClearHostMapping(host, port, originAttributes);
|
||||
if (event) {
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
|
@ -1234,21 +1219,17 @@ void AltSvcCache::ClearHostMapping(const nsACString& host, int32_t port,
|
|||
constexpr auto https = "https"_ns;
|
||||
const nsLiteralCString& scheme = secure ? https : http;
|
||||
for (int pb = 1; pb >= 0; --pb) {
|
||||
for (int isolate = 0; isolate < 2; ++isolate) {
|
||||
AltSvcMapping::MakeHashKey(key, scheme, host, port, bool(pb),
|
||||
bool(isolate), topWindowOrigin,
|
||||
originAttributes, false);
|
||||
RefPtr<AltSvcMapping> existing = LookupMapping(key, bool(pb));
|
||||
if (existing) {
|
||||
existing->SetExpired();
|
||||
}
|
||||
AltSvcMapping::MakeHashKey(key, scheme, host, port, bool(pb),
|
||||
bool(isolate), topWindowOrigin,
|
||||
originAttributes, true);
|
||||
existing = LookupMapping(key, bool(pb));
|
||||
if (existing) {
|
||||
existing->SetExpired();
|
||||
}
|
||||
AltSvcMapping::MakeHashKey(key, scheme, host, port, bool(pb),
|
||||
originAttributes, false);
|
||||
RefPtr<AltSvcMapping> existing = LookupMapping(key, bool(pb));
|
||||
if (existing) {
|
||||
existing->SetExpired();
|
||||
}
|
||||
AltSvcMapping::MakeHashKey(key, scheme, host, port, bool(pb),
|
||||
originAttributes, true);
|
||||
existing = LookupMapping(key, bool(pb));
|
||||
if (existing) {
|
||||
existing->SetExpired();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1257,7 +1238,7 @@ void AltSvcCache::ClearHostMapping(const nsACString& host, int32_t port,
|
|||
void AltSvcCache::ClearHostMapping(nsHttpConnectionInfo* ci) {
|
||||
if (!ci->GetOrigin().IsEmpty()) {
|
||||
ClearHostMapping(ci->GetOrigin(), ci->OriginPort(),
|
||||
ci->GetOriginAttributes(), ""_ns /* topWindowOrigin */);
|
||||
ci->GetOriginAttributes());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ class AltSvcMapping {
|
|||
AltSvcMapping(DataStorage* storage, int32_t storageEpoch,
|
||||
const nsACString& originScheme, const nsACString& originHost,
|
||||
int32_t originPort, const nsACString& username,
|
||||
const nsACString& topWindowOrigin, bool privateBrowsing,
|
||||
bool isolated, uint32_t expiresAt,
|
||||
bool privateBrowsing, uint32_t expiresAt,
|
||||
const nsACString& alternateHost, int32_t alternatePort,
|
||||
const nsACString& npnToken,
|
||||
const OriginAttributes& originAttributes, bool aIsHttp3);
|
||||
|
@ -63,9 +62,8 @@ class AltSvcMapping {
|
|||
static void ProcessHeader(
|
||||
const nsCString& buf, const nsCString& originScheme,
|
||||
const nsCString& originHost, int32_t originPort,
|
||||
const nsACString& username, const nsACString& topWindowOrigin,
|
||||
bool privateBrowsing, bool isolated, nsIInterfaceRequestor* callbacks,
|
||||
nsProxyInfo* proxyInfo, uint32_t caps,
|
||||
const nsACString& username, bool privateBrowsing,
|
||||
nsIInterfaceRequestor* callbacks, nsProxyInfo* proxyInfo, uint32_t caps,
|
||||
const OriginAttributes& originAttributes,
|
||||
bool aDontValidate = false); // aDontValidate is only used for testing!
|
||||
|
||||
|
@ -89,7 +87,6 @@ class AltSvcMapping {
|
|||
int32_t TTL();
|
||||
int32_t StorageEpoch() { return mStorageEpoch; }
|
||||
bool Private() { return mPrivate; }
|
||||
bool Isolated() { return mIsolated; }
|
||||
|
||||
void SetValidated(bool val);
|
||||
void SetMixedScheme(bool val);
|
||||
|
@ -100,8 +97,7 @@ class AltSvcMapping {
|
|||
|
||||
static void MakeHashKey(nsCString& outKey, const nsACString& originScheme,
|
||||
const nsACString& originHost, int32_t originPort,
|
||||
bool privateBrowsing, bool isolated,
|
||||
const nsACString& topWindowOrigin,
|
||||
bool privateBrowsing,
|
||||
const OriginAttributes& originAttributes,
|
||||
bool aIsHttp3);
|
||||
|
||||
|
@ -125,9 +121,7 @@ class AltSvcMapping {
|
|||
MOZ_INIT_OUTSIDE_CTOR int32_t mOriginPort;
|
||||
|
||||
nsCString mUsername;
|
||||
nsCString mTopWindowOrigin;
|
||||
MOZ_INIT_OUTSIDE_CTOR bool mPrivate;
|
||||
MOZ_INIT_OUTSIDE_CTOR bool mIsolated;
|
||||
|
||||
MOZ_INIT_OUTSIDE_CTOR uint32_t mExpiresAt; // alt-svc mappping
|
||||
|
||||
|
@ -198,13 +192,11 @@ class AltSvcCache {
|
|||
const OriginAttributes& originAttributes); // main thread
|
||||
already_AddRefed<AltSvcMapping> GetAltServiceMapping(
|
||||
const nsACString& scheme, const nsACString& host, int32_t port, bool pb,
|
||||
bool isolated, const nsACString& topWindowOrigin,
|
||||
const OriginAttributes& originAttributes, bool aHttp2Allowed,
|
||||
bool aHttp3Allowed);
|
||||
void ClearAltServiceMappings();
|
||||
void ClearHostMapping(const nsACString& host, int32_t port,
|
||||
const OriginAttributes& originAttributes,
|
||||
const nsACString& topWindowOrigin);
|
||||
const OriginAttributes& originAttributes);
|
||||
void ClearHostMapping(nsHttpConnectionInfo* ci);
|
||||
DataStorage* GetStoragePtr() { return mStorage.get(); }
|
||||
int32_t StorageEpoch() { return mStorageEpoch; }
|
||||
|
|
|
@ -2384,15 +2384,15 @@ class UpdateAltSvcEvent : public Runnable {
|
|||
if (XRE_IsSocketProcess()) {
|
||||
AltServiceChild::ProcessHeader(
|
||||
mHeader, originScheme, originHost, originPort, mCI->GetUsername(),
|
||||
""_ns /* topWindowOrigin*/, mCI->GetPrivate(), false, mCallbacks,
|
||||
mCI->ProxyInfo(), 0, mCI->GetOriginAttributes());
|
||||
mCI->GetPrivate(), mCallbacks, mCI->ProxyInfo(), 0,
|
||||
mCI->GetOriginAttributes());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
AltSvcMapping::ProcessHeader(
|
||||
mHeader, originScheme, originHost, originPort, mCI->GetUsername(),
|
||||
""_ns /* topWindowOrigin*/, mCI->GetPrivate(), false, nullptr,
|
||||
mCI->ProxyInfo(), 0, mCI->GetOriginAttributes());
|
||||
AltSvcMapping::ProcessHeader(mHeader, originScheme, originHost, originPort,
|
||||
mCI->GetUsername(), mCI->GetPrivate(), nullptr,
|
||||
mCI->ProxyInfo(), 0,
|
||||
mCI->GetOriginAttributes());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,17 +18,14 @@ refcounted protocol PAltService
|
|||
|
||||
parent:
|
||||
async ClearHostMapping(nsCString host, int32_t port,
|
||||
OriginAttributes originAttributes,
|
||||
nsCString topWindowOrigin);
|
||||
OriginAttributes originAttributes);
|
||||
|
||||
async ProcessHeader(nsCString buf,
|
||||
nsCString originScheme,
|
||||
nsCString originHost,
|
||||
int32_t originPort,
|
||||
nsCString username,
|
||||
nsCString topWindowOrigin,
|
||||
bool privateBrowsing,
|
||||
bool isolated,
|
||||
ProxyInfoCloneArgs[] proxyInfo,
|
||||
uint32_t caps,
|
||||
OriginAttributes originAttributes);
|
||||
|
|
|
@ -405,9 +405,8 @@ nsresult TRRServiceChannel::BeginConnect() {
|
|||
AltSvcMapping::AcceptableProxy(proxyInfo) &&
|
||||
(scheme.EqualsLiteral("http") || scheme.EqualsLiteral("https")) &&
|
||||
(mapping = gHttpHandler->GetAltServiceMapping(
|
||||
scheme, host, port, mPrivateBrowsing, IsIsolated(),
|
||||
GetTopWindowOrigin(), OriginAttributes(), http2Allowed,
|
||||
http3Allowed))) {
|
||||
scheme, host, port, mPrivateBrowsing, OriginAttributes(),
|
||||
http2Allowed, http3Allowed))) {
|
||||
LOG(("TRRServiceChannel %p Alt Service Mapping Found %s://%s:%d [%s]\n",
|
||||
this, scheme.get(), mapping->AlternateHost().get(),
|
||||
mapping->AlternatePort(), mapping->HashKey().get()));
|
||||
|
@ -966,24 +965,21 @@ void TRRServiceChannel::ProcessAltService() {
|
|||
proxyInfo = do_QueryInterface(mProxyInfo);
|
||||
}
|
||||
|
||||
nsCString topWindowOrigin = GetTopWindowOrigin();
|
||||
bool isIsolated = IsIsolated();
|
||||
auto processHeaderTask = [altSvc, scheme, originHost, originPort,
|
||||
userName(mUsername), topWindowOrigin,
|
||||
privateBrowsing(mPrivateBrowsing), isIsolated,
|
||||
callbacks, proxyInfo, caps(mCaps)]() {
|
||||
userName(mUsername),
|
||||
privateBrowsing(mPrivateBrowsing), callbacks,
|
||||
proxyInfo, caps(mCaps)]() {
|
||||
if (XRE_IsSocketProcess()) {
|
||||
AltServiceChild::ProcessHeader(
|
||||
altSvc, scheme, originHost, originPort, userName, topWindowOrigin,
|
||||
privateBrowsing, isIsolated, callbacks, proxyInfo,
|
||||
caps & NS_HTTP_DISALLOW_SPDY, OriginAttributes());
|
||||
AltServiceChild::ProcessHeader(altSvc, scheme, originHost, originPort,
|
||||
userName, privateBrowsing, callbacks,
|
||||
proxyInfo, caps & NS_HTTP_DISALLOW_SPDY,
|
||||
OriginAttributes());
|
||||
return;
|
||||
}
|
||||
|
||||
AltSvcMapping::ProcessHeader(
|
||||
altSvc, scheme, originHost, originPort, userName, topWindowOrigin,
|
||||
privateBrowsing, isIsolated, callbacks, proxyInfo,
|
||||
caps & NS_HTTP_DISALLOW_SPDY, OriginAttributes());
|
||||
altSvc, scheme, originHost, originPort, userName, privateBrowsing,
|
||||
callbacks, proxyInfo, caps & NS_HTTP_DISALLOW_SPDY, OriginAttributes());
|
||||
};
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
|
|
|
@ -2093,9 +2093,8 @@ void nsHttpChannel::ProcessAltService() {
|
|||
}
|
||||
|
||||
AltSvcMapping::ProcessHeader(
|
||||
altSvc, scheme, originHost, originPort, mUsername, GetTopWindowOrigin(),
|
||||
mPrivateBrowsing, IsIsolated(), callbacks, proxyInfo,
|
||||
mCaps & NS_HTTP_DISALLOW_SPDY, originAttributes);
|
||||
altSvc, scheme, originHost, originPort, mUsername, mPrivateBrowsing,
|
||||
callbacks, proxyInfo, mCaps & NS_HTTP_DISALLOW_SPDY, originAttributes);
|
||||
}
|
||||
|
||||
nsresult nsHttpChannel::ProcessResponse() {
|
||||
|
@ -6569,8 +6568,7 @@ nsresult nsHttpChannel::BeginConnect() {
|
|||
StoreAllowHttp3(false);
|
||||
}
|
||||
|
||||
gHttpHandler->MaybeAddAltSvcForTesting(mURI, mUsername, GetTopWindowOrigin(),
|
||||
mPrivateBrowsing, IsIsolated(),
|
||||
gHttpHandler->MaybeAddAltSvcForTesting(mURI, mUsername, mPrivateBrowsing,
|
||||
mCallbacks, originAttributes);
|
||||
|
||||
RefPtr<nsHttpConnectionInfo> connInfo = new nsHttpConnectionInfo(
|
||||
|
@ -6594,8 +6592,7 @@ nsresult nsHttpChannel::BeginConnect() {
|
|||
AltSvcMapping::AcceptableProxy(proxyInfo) &&
|
||||
(scheme.EqualsLiteral("http") || scheme.EqualsLiteral("https")) &&
|
||||
(mapping = gHttpHandler->GetAltServiceMapping(
|
||||
scheme, host, port, mPrivateBrowsing, IsIsolated(),
|
||||
GetTopWindowOrigin(), originAttributes, http2Allowed,
|
||||
scheme, host, port, mPrivateBrowsing, originAttributes, http2Allowed,
|
||||
http3Allowed))) {
|
||||
LOG(("nsHttpChannel %p Alt Service Mapping Found %s://%s:%d [%s]\n", this,
|
||||
scheme.get(), mapping->AlternateHost().get(), mapping->AlternatePort(),
|
||||
|
|
|
@ -3001,8 +3001,7 @@ void nsHttpHandler::SetDeviceModelId(const nsCString& aModelId) {
|
|||
}
|
||||
|
||||
void nsHttpHandler::MaybeAddAltSvcForTesting(
|
||||
nsIURI* aUri, const nsACString& aUsername,
|
||||
const nsACString& aTopWindowOrigin, bool aPrivateBrowsing, bool aIsolated,
|
||||
nsIURI* aUri, const nsACString& aUsername, bool aPrivateBrowsing,
|
||||
nsIInterfaceRequestor* aCallbacks,
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
if (!IsHttp3Enabled() || mAltSvcMappingTemptativeMap.IsEmpty()) {
|
||||
|
@ -3026,10 +3025,9 @@ void nsHttpHandler::MaybeAddAltSvcForTesting(
|
|||
aUri->GetPort(&originPort);
|
||||
LOG(("nsHttpHandler::MaybeAddAltSvcForTesting for %s map: %s",
|
||||
originHost.get(), PromiseFlatCString(*map).get()));
|
||||
AltSvcMapping::ProcessHeader(*map, nsCString("https"), originHost,
|
||||
originPort, aUsername, aTopWindowOrigin,
|
||||
aPrivateBrowsing, aIsolated, aCallbacks,
|
||||
nullptr, 0, aOriginAttributes, true);
|
||||
AltSvcMapping::ProcessHeader(
|
||||
*map, nsCString("https"), originHost, originPort, aUsername,
|
||||
aPrivateBrowsing, aCallbacks, nullptr, 0, aOriginAttributes, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -364,12 +364,10 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
|
|||
|
||||
already_AddRefed<AltSvcMapping> GetAltServiceMapping(
|
||||
const nsACString& scheme, const nsACString& host, int32_t port, bool pb,
|
||||
bool isolated, const nsACString& topWindowOrigin,
|
||||
const OriginAttributes& originAttributes, bool aHttp2Allowed,
|
||||
bool aHttp3Allowed) {
|
||||
return mAltSvcCache->GetAltServiceMapping(scheme, host, port, pb, isolated,
|
||||
topWindowOrigin, originAttributes,
|
||||
aHttp2Allowed, aHttp3Allowed);
|
||||
return mAltSvcCache->GetAltServiceMapping(
|
||||
scheme, host, port, pb, originAttributes, aHttp2Allowed, aHttp3Allowed);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -510,8 +508,7 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
|
|||
nsHttpConnectionInfo* aCI);
|
||||
|
||||
void MaybeAddAltSvcForTesting(nsIURI* aUri, const nsACString& aUsername,
|
||||
const nsACString& aTopWindowOrigin,
|
||||
bool aPrivateBrowsing, bool aIsolated,
|
||||
bool aPrivateBrowsing,
|
||||
nsIInterfaceRequestor* aCallbacks,
|
||||
const OriginAttributes& aOriginAttributes);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче