From 27084394a5b62b322c1a43f7124dc108aae13701 Mon Sep 17 00:00:00 2001 From: Sean Feng Date: Tue, 28 Feb 2023 19:46:11 +0000 Subject: [PATCH] Bug 1809518 - Special case the HTTPS Only timeout request to make it bypass ORB r=farre,necko-reviewers This particular request is used to identify the potential timeout issue for HTTPS only requests. ORB doesn't need to block this request. Differential Revision: https://phabricator.services.mozilla.com/D170251 --- dom/security/nsHTTPSOnlyUtils.cpp | 3 ++- netwerk/base/nsILoadInfo.idl | 5 +++++ netwerk/base/nsIRequest.idl | 3 +++ netwerk/protocol/http/HttpBaseChannel.cpp | 6 ++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dom/security/nsHTTPSOnlyUtils.cpp b/dom/security/nsHTTPSOnlyUtils.cpp index 8c99a223eb73..1a26827a84e7 100644 --- a/dom/security/nsHTTPSOnlyUtils.cpp +++ b/dom/security/nsHTTPSOnlyUtils.cpp @@ -1033,7 +1033,8 @@ TestHTTPAnswerRunnable::Notify(nsITimer* aTimer) { nsCOMPtr loadInfo = testHTTPChannel->LoadInfo(); uint32_t httpsOnlyStatus = loadInfo->GetHttpsOnlyStatus(); httpsOnlyStatus |= nsILoadInfo::HTTPS_ONLY_EXEMPT | - nsILoadInfo::HTTPS_ONLY_DO_NOT_LOG_TO_CONSOLE; + nsILoadInfo::HTTPS_ONLY_DO_NOT_LOG_TO_CONSOLE | + nsILoadInfo::HTTPS_ONLY_BYPASS_ORB; loadInfo->SetHttpsOnlyStatus(httpsOnlyStatus); testHTTPChannel->SetNotificationCallbacks(this); diff --git a/netwerk/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl index fdc2f84d7d5b..358fb5885447 100644 --- a/netwerk/base/nsILoadInfo.idl +++ b/netwerk/base/nsILoadInfo.idl @@ -500,6 +500,11 @@ interface nsILoadInfo : nsISupports */ const unsigned long HTTPS_ONLY_UPGRADED_HTTPS_FIRST = (1 << 7); + /** + * This flag indicates that the request should not be blocked by ORB. + */ + const unsigned long HTTPS_ONLY_BYPASS_ORB = (1 << 8); + /** * Upgrade state of HTTPS-Only Mode. The flag HTTPS_ONLY_EXEMPT can get * set on requests that should be excempt from an upgrade. diff --git a/netwerk/base/nsIRequest.idl b/netwerk/base/nsIRequest.idl index 61fa2ae2e4bb..84b168dc605a 100644 --- a/netwerk/base/nsIRequest.idl +++ b/netwerk/base/nsIRequest.idl @@ -335,4 +335,7 @@ interface nsIRequest : nsISupports * effect. */ const unsigned long LOAD_FRESH_CONNECTION = 1 << 15; + + // Note that all flags are taken, the rest of the flags + // are located in nsIChannel and nsICachingChannel }; diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index 10cd8e467565..3d68c0049e43 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -3086,6 +3086,12 @@ bool HttpBaseChannel::ShouldBlockOpaqueResponse() const { } } + uint32_t httpsOnlyStatus = mLoadInfo->GetHttpsOnlyStatus(); + if (httpsOnlyStatus & nsILoadInfo::HTTPS_ONLY_BYPASS_ORB) { + LOGORB("No block: HTTPS_ONLY_BYPASS_ORB"); + return false; + } + bool isInDevToolsContext; mLoadInfo->GetIsInDevToolsContext(&isInDevToolsContext); if (isInDevToolsContext) {