Bug 1649410 - [socket-process] test_version_fallback() in netwerk/test/unit/test_http3.js fails r=necko-reviewers,kershaw

Propagate Alt-Used request header set in socket process to parent process.

Differential Revision: https://phabricator.services.mozilla.com/D81714
This commit is contained in:
Michal Novotny 2020-07-02 16:54:34 +00:00
Родитель e23d2a0d46
Коммит ae7b241f26
5 изменённых файлов: 36 добавлений и 14 удалений

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

@ -413,6 +413,13 @@ HttpTransactionChild::OnStartRequest(nsIRequest* aRequest) {
}
}
Maybe<nsCString> optionalAltSvcUsed;
nsCString altSvcUsed;
if (NS_SUCCEEDED(mTransaction->RequestHead()->GetHeader(
nsHttp::Alternate_Service_Used, altSvcUsed))) {
optionalAltSvcUsed.emplace(altSvcUsed);
}
if (CanSendODAToContentProcessDirectly(optionalHead)) {
Maybe<RefPtr<BackgroundDataBridgeParent>> dataBridgeParent =
SocketProcessChild::GetSingleton()->GetAndRemoveDataBridge(mChannelId);
@ -444,7 +451,8 @@ HttpTransactionChild::OnStartRequest(nsIRequest* aRequest) {
Unused << SendOnStartRequest(status, optionalHead, serializedSecurityInfoOut,
mTransaction->ProxyConnectFailed(),
ToTimingStructArgs(mTransaction->Timings()),
proxyConnectResponseCode, dataForSniffer);
proxyConnectResponseCode, dataForSniffer,
optionalAltSvcUsed);
return NS_OK;
}

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

@ -406,17 +406,17 @@ mozilla::ipc::IPCResult HttpTransactionParent::RecvOnStartRequest(
const nsCString& aSecurityInfoSerialization,
const bool& aProxyConnectFailed, const TimingStructArgs& aTimings,
const int32_t& aProxyConnectResponseCode,
nsTArray<uint8_t>&& aDataForSniffer) {
nsTArray<uint8_t>&& aDataForSniffer, const Maybe<nsCString>& aAltSvcUsed) {
mEventQ->RunOrEnqueue(new NeckoTargetChannelFunctionEvent(
this,
[self = UnsafePtr<HttpTransactionParent>(this), aStatus, aResponseHead,
aSecurityInfoSerialization, aProxyConnectFailed, aTimings,
aProxyConnectResponseCode,
aDataForSniffer = CopyableTArray{std::move(aDataForSniffer)}]() mutable {
this, [self = UnsafePtr<HttpTransactionParent>(this), aStatus,
aResponseHead, aSecurityInfoSerialization, aProxyConnectFailed,
aTimings, aProxyConnectResponseCode,
aDataForSniffer = CopyableTArray{std::move(aDataForSniffer)},
aAltSvcUsed]() mutable {
self->DoOnStartRequest(aStatus, aResponseHead,
aSecurityInfoSerialization, aProxyConnectFailed,
aTimings, aProxyConnectResponseCode,
std::move(aDataForSniffer));
std::move(aDataForSniffer), aAltSvcUsed);
}));
return IPC_OK();
}
@ -444,7 +444,7 @@ void HttpTransactionParent::DoOnStartRequest(
const nsCString& aSecurityInfoSerialization,
const bool& aProxyConnectFailed, const TimingStructArgs& aTimings,
const int32_t& aProxyConnectResponseCode,
nsTArray<uint8_t>&& aDataForSniffer) {
nsTArray<uint8_t>&& aDataForSniffer, const Maybe<nsCString>& aAltSvcUsed) {
LOG(("HttpTransactionParent::DoOnStartRequest [this=%p aStatus=%" PRIx32
"]\n",
this, static_cast<uint32_t>(aStatus)));
@ -471,6 +471,19 @@ void HttpTransactionParent::DoOnStartRequest(
mProxyConnectResponseCode = aProxyConnectResponseCode;
mDataForSniffer = std::move(aDataForSniffer);
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
MOZ_ASSERT(httpChannel, "mChannel is expected to implement nsIHttpChannel");
if (httpChannel) {
if (aAltSvcUsed.isSome()) {
Unused << httpChannel->SetRequestHeader(
nsDependentCString(nsHttp::Alternate_Service_Used), aAltSvcUsed.ref(),
false);
} else {
Unused << httpChannel->SetEmptyRequestHeader(
nsDependentCString(nsHttp::Alternate_Service_Used));
}
}
AutoEventEnqueuer ensureSerialDispatch(mEventQ);
nsresult rv = mChannel->OnStartRequest(this);
mOnStartRequestCalled = true;

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

@ -52,7 +52,7 @@ class HttpTransactionParent final : public PHttpTransactionParent,
const nsCString& aSecurityInfoSerialization,
const bool& aProxyConnectFailed, const TimingStructArgs& aTimings,
const int32_t& aProxyConnectResponseCode,
nsTArray<uint8_t>&& aDataForSniffer);
nsTArray<uint8_t>&& aDataForSniffer, const Maybe<nsCString>& aAltSvcUsed);
mozilla::ipc::IPCResult RecvOnTransportStatus(const nsresult& aStatus,
const int64_t& aProgress,
const int64_t& aProgressMax);
@ -92,7 +92,8 @@ class HttpTransactionParent final : public PHttpTransactionParent,
const bool& aProxyConnectFailed,
const TimingStructArgs& aTimings,
const int32_t& aProxyConnectResponseCode,
nsTArray<uint8_t>&& aDataForSniffer);
nsTArray<uint8_t>&& aDataForSniffer,
const Maybe<nsCString>& aAltSvcUsed);
void DoOnTransportStatus(const nsresult& aStatus, const int64_t& aProgress,
const int64_t& aProgressMax);
void DoOnDataAvailable(const nsCString& aData, const uint64_t& aOffset,

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

@ -37,7 +37,8 @@ parent:
bool proxyConnectFailed,
TimingStructArgs timings,
int32_t proxyConnectResponseCode,
uint8_t[] dataForSniffer);
uint8_t[] dataForSniffer,
nsCString? altSvcUsed);
async OnTransportStatus(nsresult status,
int64_t progress,
int64_t progressMax);

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

@ -425,8 +425,7 @@ skip-if = os == "android"
# tsan - bug 1622845
# win - bug 1616238
# android - bug 1622901
# socketprocess - bug 1649410
skip-if = asan || tsan || os == 'win' || os =='android' || socketprocess_networking
skip-if = asan || tsan || os == 'win' || os =='android'
[test_node_execute.js]
[test_loadgroup_cancel.js]
[test_obs-fold.js]