Bug 1909202 - Use NS_BINDING_ABORTED for ORB blocked errors r=kershaw,necko-reviewers

Http2 uses a single connection for multiple requests. When ORB blocks a
request with NS_ERROR_FAILURE, it's treated as a hard error in necko,
then the entire connection is closed.

This patches converts ORB to uses NS_BINDING_ABORTED.

Differential Revision: https://phabricator.services.mozilla.com/D218643
This commit is contained in:
Sean Feng 2024-08-06 16:31:12 +00:00
parent 8858a7db2f
commit bea2e00552
4 changed files with 8 additions and 8 deletions

View File

@ -3522,7 +3522,7 @@ void HttpBaseChannel::BlockOpaqueResponseAfterSniff(
const OpaqueResponseBlockedTelemetryReason aTelemetryReason) {
MOZ_DIAGNOSTIC_ASSERT(mORB);
LogORBError(aReason, aTelemetryReason);
mORB->BlockResponse(this, NS_ERROR_FAILURE);
mORB->BlockResponse(this, NS_BINDING_ABORTED);
}
void HttpBaseChannel::AllowOpaqueResponseAfterSniff() {

View File

@ -384,7 +384,7 @@ OpaqueResponseBlocker::OnDataAvailable(nsIRequest* aRequest,
}
if (mState == State::Blocked) {
return NS_ERROR_FAILURE;
return NS_BINDING_ABORTED;
}
MOZ_ASSERT(mState == State::Sniffing);
@ -441,8 +441,8 @@ nsresult OpaqueResponseBlocker::EnsureOpaqueResponseIsAllowedAfterSniff(
switch (httpBaseChannel->PerformOpaqueResponseSafelistCheckAfterSniff(
mContentType, mNoSniff)) {
case OpaqueResponse::Block:
BlockResponse(httpBaseChannel, NS_ERROR_FAILURE);
return NS_ERROR_FAILURE;
BlockResponse(httpBaseChannel, NS_BINDING_ABORTED);
return NS_BINDING_ABORTED;
case OpaqueResponse::Allow:
AllowResponse();
return NS_OK;
@ -569,7 +569,7 @@ nsresult OpaqueResponseBlocker::ValidateJavaScript(HttpBaseChannel* aChannel,
MOZ_ASSERT_UNREACHABLE(
"We should only ever have Allow or Block here.");
allowed = false;
self->BlockResponse(channel, NS_ERROR_FAILURE);
self->BlockResponse(channel, NS_BINDING_ABORTED);
break;
}

View File

@ -1863,9 +1863,9 @@ nsresult nsHttpChannel::CallOnStartRequest() {
PerformOpaqueResponseSafelistCheckBeforeSniff();
if (opaqueResponse == OpaqueResponse::Block) {
SetChannelBlockedByOpaqueResponse();
CancelWithReason(NS_ERROR_FAILURE,
CancelWithReason(NS_BINDING_ABORTED,
"OpaqueResponseBlocker::BlockResponse"_ns);
return NS_ERROR_FAILURE;
return NS_BINDING_ABORTED;
}
// Allow consumers to override our content type

View File

@ -66,7 +66,7 @@ async function test_empty_header(server, doSniff) {
let req = await new Promise(resolve => {
chan.asyncOpen(new ChannelListener(resolve, null, CL_EXPECT_FAILURE));
});
equal(req.status, Cr.NS_ERROR_FAILURE);
equal(req.status, Cr.NS_BINDING_ABORTED);
equal(req.QueryInterface(Ci.nsIHttpChannel).responseStatus, 500);
req.visitResponseHeaders({