From 0409b8aa646ea5192cd91976a89f71024129344c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 20 Jun 2024 06:01:55 +0200 Subject: Adding upstream version 127.0.1. Signed-off-by: Daniel Baumann --- netwerk/cookie/CookieService.cpp | 15 --------------- netwerk/ipc/DocumentLoadListener.cpp | 16 +++++++++++++--- netwerk/ipc/DocumentLoadListener.h | 2 ++ 3 files changed, 15 insertions(+), 18 deletions(-) (limited to 'netwerk') diff --git a/netwerk/cookie/CookieService.cpp b/netwerk/cookie/CookieService.cpp index 78698d44a0..8457a99249 100644 --- a/netwerk/cookie/CookieService.cpp +++ b/netwerk/cookie/CookieService.cpp @@ -1624,21 +1624,6 @@ bool CookieService::GetTokenValue(nsACString::const_char_iterator& aIter, // if on terminator, increment past & return true to process new cookie if (isterminator(*aIter)) { ++aIter; - while (aIter != aEndIter && isvalueseparator(*aIter)) { - ++aIter; - } - nsACString::const_char_iterator end = aIter - 1; - if (!isterminator(*end)) { - // The cookie isn't valid because we have multiple terminators or - // a terminator followed by a value separator. Add those invalid - // characters to the cookie string or value so it will be rejected. - if (aEqualsFound) { - aTokenString.Rebind(start, end); - } else { - aTokenValue.Rebind(start, end); - } - return false; - } return true; } // fall-through: aIter is on ';', increment and return false diff --git a/netwerk/ipc/DocumentLoadListener.cpp b/netwerk/ipc/DocumentLoadListener.cpp index a133df4663..280348e449 100644 --- a/netwerk/ipc/DocumentLoadListener.cpp +++ b/netwerk/ipc/DocumentLoadListener.cpp @@ -644,6 +644,7 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState, // See description of mFileName in nsDocShellLoadState.h mIsDownload = !aLoadState->FileName().IsVoid(); mIsLoadingJSURI = net::SchemeIsJavascript(aLoadState->URI()); + mHTTPSFirstDowngradeData = aLoadState->GetHttpsFirstDowngradeData().forget(); // Check for infinite recursive object or iframe loads if (aLoadState->OriginalFrameSrc() || !mIsDocumentLoad) { @@ -2427,9 +2428,7 @@ bool DocumentLoadListener::MaybeHandleLoadErrorWithURIFixup(nsresult aStatus) { loadState->SetWasSchemelessInput(wasSchemelessInput); if (isHTTPSFirstFixup) { - // We have to exempt the load from HTTPS-First to prevent a - // upgrade-downgrade loop. - loadState->SetIsExemptFromHTTPSFirstMode(true); + nsHTTPSOnlyUtils::UpdateLoadStateAfterHTTPSFirstDowngrade(this, loadState); } // Ensure to set referrer information in the fallback channel equally to the @@ -2571,6 +2570,17 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) { return NS_OK; } + // If this is a successful load with a successful status code, we can possibly + // submit HTTPS-First telemetry. + if (NS_SUCCEEDED(status) && httpChannel) { + uint32_t responseStatus = 0; + if (NS_SUCCEEDED(httpChannel->GetResponseStatus(&responseStatus)) && + responseStatus < 400) { + nsHTTPSOnlyUtils::SubmitHTTPSFirstTelemetry( + mChannel->LoadInfo(), mHTTPSFirstDowngradeData.forget()); + } + } + mStreamListenerFunctions.AppendElement(StreamListenerFunction{ VariantIndex<0>{}, OnStartRequestParams{aRequest}}); diff --git a/netwerk/ipc/DocumentLoadListener.h b/netwerk/ipc/DocumentLoadListener.h index 6f6ad357ae..69f7eafd0f 100644 --- a/netwerk/ipc/DocumentLoadListener.h +++ b/netwerk/ipc/DocumentLoadListener.h @@ -617,6 +617,8 @@ class DocumentLoadListener : public nsIInterfaceRequestor, bool mOpenPromiseResolved = false; const bool mIsDocumentLoad; + + RefPtr mHTTPSFirstDowngradeData; }; NS_DEFINE_STATIC_IID_ACCESSOR(DocumentLoadListener, DOCUMENT_LOAD_LISTENER_IID) -- cgit v1.2.3