diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/ipc/WindowGlobalChild.cpp | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/ipc/WindowGlobalChild.cpp')
-rw-r--r-- | dom/ipc/WindowGlobalChild.cpp | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/dom/ipc/WindowGlobalChild.cpp b/dom/ipc/WindowGlobalChild.cpp index ec2811f972..4072828911 100644 --- a/dom/ipc/WindowGlobalChild.cpp +++ b/dom/ipc/WindowGlobalChild.cpp @@ -35,7 +35,7 @@ #include "nsQueryObject.h" #include "nsSerializationHelper.h" #include "nsFrameLoader.h" -#include "nsIScriptSecurityManager.h" +#include "nsScriptSecurityManager.h" #include "mozilla/dom/JSWindowActorBinding.h" #include "mozilla/dom/JSWindowActorChild.h" @@ -588,30 +588,19 @@ void WindowGlobalChild::SetDocumentURI(nsIURI* aDocumentURI) { embedderInnerWindowID, BrowsingContext()->UsePrivateBrowsing()); if (StaticPrefs::dom_security_setdocumenturi()) { - auto isLoadableViaInternet = [](nsIURI* uri) { - return (uri && (net::SchemeIsHTTP(uri) || net::SchemeIsHTTPS(uri))); - }; - if (isLoadableViaInternet(aDocumentURI)) { - nsCOMPtr<nsIURI> principalURI = mDocumentPrincipal->GetURI(); - if (mDocumentPrincipal->GetIsNullPrincipal()) { - nsCOMPtr<nsIPrincipal> precursor = - mDocumentPrincipal->GetPrecursorPrincipal(); - if (precursor) { - principalURI = precursor->GetURI(); - } - } - - if (isLoadableViaInternet(principalURI)) { - nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); - - if (!NS_SUCCEEDED(ssm->CheckSameOriginURI(principalURI, aDocumentURI, - false, false))) { - MOZ_DIAGNOSTIC_ASSERT(false, - "Setting DocumentURI with a different origin " - "than principal URI"); - } + nsCOMPtr<nsIURI> principalURI = mDocumentPrincipal->GetURI(); + if (mDocumentPrincipal->GetIsNullPrincipal()) { + nsCOMPtr<nsIPrincipal> precursor = + mDocumentPrincipal->GetPrecursorPrincipal(); + if (precursor) { + principalURI = precursor->GetURI(); } } + + MOZ_DIAGNOSTIC_ASSERT(!nsScriptSecurityManager::IsHttpOrHttpsAndCrossOrigin( + principalURI, aDocumentURI), + "Setting DocumentURI with a different origin " + "than principal URI"); } mDocumentURI = aDocumentURI; |