From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- netwerk/ipc/DocumentLoadListener.cpp | 33 +++++++++++++++++++++------------ netwerk/ipc/DocumentLoadListener.h | 1 + netwerk/ipc/NeckoChannelParams.ipdlh | 7 +++++++ netwerk/ipc/NeckoMessageUtils.h | 14 +++++++------- netwerk/ipc/NeckoParent.cpp | 2 +- 5 files changed, 37 insertions(+), 20 deletions(-) (limited to 'netwerk/ipc') diff --git a/netwerk/ipc/DocumentLoadListener.cpp b/netwerk/ipc/DocumentLoadListener.cpp index ca1f59e884..d849eab750 100644 --- a/netwerk/ipc/DocumentLoadListener.cpp +++ b/netwerk/ipc/DocumentLoadListener.cpp @@ -303,12 +303,12 @@ class ParentProcessDocumentOpenInfo final : public nsDocumentOpenInfo, nsresult rv = nsDocumentOpenInfo::OnStartRequest(request); - // If we didn't find a content handler, - // and we don't have a listener, then just forward to our - // default listener. This happens when the channel is in - // an error state, and we want to just forward that on to be - // handled in the content process. - if (NS_SUCCEEDED(rv) && !mUsedContentHandler && !m_targetStreamListener) { + // If we didn't find a content handler, and we don't have a listener, then + // just forward to our default listener. This happens when the channel is in + // an error state, and we want to just forward that on to be handled in the + // content process, or when DONT_RETARGET is set. + if ((NS_SUCCEEDED(rv) || rv == NS_ERROR_WONT_HANDLE_CONTENT) && + !mUsedContentHandler && !m_targetStreamListener) { m_targetStreamListener = mListener; return m_targetStreamListener->OnStartRequest(request); } @@ -340,6 +340,17 @@ class ParentProcessDocumentOpenInfo final : public nsDocumentOpenInfo, nsresult OnObjectStartRequest(nsIRequest* request) { LOG(("ParentProcessDocumentOpenInfo OnObjectStartRequest [this=%p]", this)); + + // If this load will be treated as a document load, run through + // nsDocumentOpenInfo for consistency with other document loads. + // + // If the dom.navigation.object_embed.allow_retargeting pref is enabled, + // this may lead to the resource being downloaded. + if (nsCOMPtr channel = do_QueryInterface(request); + channel && channel->IsDocument()) { + return OnDocumentStartRequest(request); + } + // Just redirect to the nsObjectLoadingContent in the content process. m_targetStreamListener = mListener; return m_targetStreamListener->OnStartRequest(request); @@ -815,11 +826,9 @@ auto DocumentLoadListener::Open(nsDocShellLoadState* aLoadState, } // Recalculate the openFlags, matching the logic in use in Content process. - // NOTE: The only case not handled here to mirror Content process is - // redirecting to re-use the channel. MOZ_ASSERT(!aLoadState->GetPendingRedirectedChannel()); - uint32_t openFlags = - nsDocShell::ComputeURILoaderFlags(loadingContext, aLoadState->LoadType()); + uint32_t openFlags = nsDocShell::ComputeURILoaderFlags( + loadingContext, aLoadState->LoadType(), mIsDocumentLoad); RefPtr openInfo = new ParentProcessDocumentOpenInfo(mParentChannelListener, openFlags, @@ -2377,8 +2386,8 @@ bool DocumentLoadListener::MaybeHandleLoadErrorWithURIFixup(nsresult aStatus) { // we can downgrade the scheme to HTTP again. bool isHTTPSFirstFixup = false; if (!newURI) { - newURI = nsHTTPSOnlyUtils::PotentiallyDowngradeHttpsFirstRequest(mChannel, - aStatus); + newURI = + nsHTTPSOnlyUtils::PotentiallyDowngradeHttpsFirstRequest(this, aStatus); isHTTPSFirstFixup = true; } diff --git a/netwerk/ipc/DocumentLoadListener.h b/netwerk/ipc/DocumentLoadListener.h index 98aacc98f8..a8e4ffa7ab 100644 --- a/netwerk/ipc/DocumentLoadListener.h +++ b/netwerk/ipc/DocumentLoadListener.h @@ -300,6 +300,7 @@ class DocumentLoadListener : public nsIInterfaceRequestor, uint32_t GetLoadType() const { return mLoadStateLoadType; } bool IsDownload() const { return mIsDownload; } bool IsLoadingJSURI() const { return mIsLoadingJSURI; } + nsDOMNavigationTiming* GetTiming() { return mTiming; } mozilla::dom::LoadingSessionHistoryInfo* GetLoadingSessionHistoryInfo() { return mLoadingSessionHistoryInfo.get(); diff --git a/netwerk/ipc/NeckoChannelParams.ipdlh b/netwerk/ipc/NeckoChannelParams.ipdlh index 44af8d4808..c2948c7766 100644 --- a/netwerk/ipc/NeckoChannelParams.ipdlh +++ b/netwerk/ipc/NeckoChannelParams.ipdlh @@ -420,6 +420,7 @@ struct HttpConnectionInfoCloneArgs nsCString topWindowOrigin; bool isHttp3; bool webTransport; + uint64_t webTransportId; bool hasIPHintAddress; nsCString echConfig; ProxyInfoCloneArgs[] proxyInfo; @@ -454,6 +455,12 @@ struct CookieStruct uint8_t schemeMap; }; +struct CookieStructTable +{ + OriginAttributes attrs; + CookieStruct[] cookies; +}; + struct DocumentCreationArgs { bool uriModified; bool isEmbeddingBlockedError; diff --git a/netwerk/ipc/NeckoMessageUtils.h b/netwerk/ipc/NeckoMessageUtils.h index a15398330e..a0729a94a0 100644 --- a/netwerk/ipc/NeckoMessageUtils.h +++ b/netwerk/ipc/NeckoMessageUtils.h @@ -10,15 +10,15 @@ #include "ipc/EnumSerializer.h" #include "ipc/IPCMessageUtils.h" +#include "ipc/IPCMessageUtilsSpecializations.h" +#include "mozilla/net/DNS.h" #include "nsExceptionHandler.h" +#include "nsIDNSService.h" #include "nsIHttpChannel.h" +#include "nsITRRSkipReason.h" #include "nsPrintfCString.h" #include "nsString.h" #include "prio.h" -#include "mozilla/net/DNS.h" -#include "ipc/IPCMessageUtilsSpecializations.h" -#include "nsITRRSkipReason.h" -#include "nsIDNSService.h" namespace IPC { @@ -92,9 +92,9 @@ struct ParamTraits { #endif } else { if (XRE_IsParentProcess()) { - nsPrintfCString msg("%d", aParam.raw.family); - CrashReporter::AnnotateCrashReport( - CrashReporter::Annotation::UnknownNetAddrSocketFamily, msg); + CrashReporter::RecordAnnotationU32( + CrashReporter::Annotation::UnknownNetAddrSocketFamily, + aParam.raw.family); } MOZ_CRASH("Unknown socket family"); diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp index 102b46a378..727aea4660 100644 --- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -123,7 +123,7 @@ const char* NeckoParent::GetValidatedOriginAttributes( if (!aSerialized.IsNotNull()) { // If serialized is null, we cannot validate anything. We have to assume // that this requests comes from a SystemPrincipal. - aAttrs = OriginAttributes(false); + aAttrs = OriginAttributes(); } else { aAttrs = aSerialized.mOriginAttributes; } -- cgit v1.2.3