diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /dom/xhr | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dom/xhr/XMLHttpRequest.cpp | 23 | ||||
-rw-r--r-- | dom/xhr/XMLHttpRequestMainThread.cpp | 17 | ||||
-rw-r--r-- | dom/xhr/XMLHttpRequestWorker.cpp | 8 |
3 files changed, 34 insertions, 14 deletions
diff --git a/dom/xhr/XMLHttpRequest.cpp b/dom/xhr/XMLHttpRequest.cpp index be94267d63..8807c5515a 100644 --- a/dom/xhr/XMLHttpRequest.cpp +++ b/dom/xhr/XMLHttpRequest.cpp @@ -7,7 +7,9 @@ #include "XMLHttpRequest.h" #include "XMLHttpRequestMainThread.h" #include "XMLHttpRequestWorker.h" +#include "mozilla/BasePrincipal.h" #include "mozilla/Logging.h" +#include "mozilla/StaticPrefs_network.h" #include "mozilla/net/CookieJarSettings.h" mozilla::LazyLogModule gXMLHttpRequestLog("XMLHttpRequest"); @@ -21,15 +23,16 @@ already_AddRefed<XMLHttpRequest> XMLHttpRequest::Constructor( if (NS_IsMainThread()) { nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports()); - nsCOMPtr<nsIScriptObjectPrincipal> principal = + nsCOMPtr<nsIScriptObjectPrincipal> scriptPrincipal = do_QueryInterface(aGlobal.GetAsSupports()); - if (!global || !principal) { + if (!global || !scriptPrincipal) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } nsCOMPtr<nsICookieJarSettings> cookieJarSettings; nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(global); + nsCOMPtr<nsIPrincipal> principal = scriptPrincipal->GetPrincipal(); if (window) { Document* document = window->GetExtantDoc(); if (NS_WARN_IF(!document)) { @@ -40,13 +43,21 @@ already_AddRefed<XMLHttpRequest> XMLHttpRequest::Constructor( cookieJarSettings = document->CookieJarSettings(); } else { // We are here because this is a sandbox. - cookieJarSettings = - net::CookieJarSettings::Create(principal->GetPrincipal()); + cookieJarSettings = net::CookieJarSettings::Create(principal); } RefPtr<XMLHttpRequestMainThread> req = new XMLHttpRequestMainThread(global); - req->Construct(principal->GetPrincipal(), cookieJarSettings, false); - req->InitParameters(aParams.mMozAnon, aParams.mMozSystem); + req->Construct(principal, cookieJarSettings, false); + + bool isAnon = false; + if (aParams.mMozAnon.WasPassed()) { + isAnon = aParams.mMozAnon.Value(); + } else { + isAnon = + StaticPrefs::network_fetch_systemDefaultsToOmittingCredentials() && + (aParams.mMozSystem || principal->IsSystemPrincipal()); + } + req->InitParameters(isAnon, aParams.mMozSystem); return req.forget(); } diff --git a/dom/xhr/XMLHttpRequestMainThread.cpp b/dom/xhr/XMLHttpRequestMainThread.cpp index ace26f296f..e18800e24a 100644 --- a/dom/xhr/XMLHttpRequestMainThread.cpp +++ b/dom/xhr/XMLHttpRequestMainThread.cpp @@ -228,12 +228,19 @@ struct DebugWorkerRefs { (((const std::ostringstream&)(std::ostringstream() << stuff)) \ .str()) // NOLINT -# define DEBUG_WORKERREFS \ - DebugWorkerRefs MOZ_UNIQUE_VAR(debugWR__)(*this, __func__) +# if 1 // Disabling because bug 1855699 +# define DEBUG_WORKERREFS void() +# define DEBUG_WORKERREFS1(x) void() +# else -# define DEBUG_WORKERREFS1(x) \ - DebugWorkerRefs MOZ_UNIQUE_VAR(debugWR__)( \ - *this, STREAM_STRING(__func__ << ": " << x)) // NOLINT +# define DEBUG_WORKERREFS \ + DebugWorkerRefs MOZ_UNIQUE_VAR(debugWR__)(*this, __func__) + +# define DEBUG_WORKERREFS1(x) \ + DebugWorkerRefs MOZ_UNIQUE_VAR(debugWR__)( \ + *this, STREAM_STRING(__func__ << ": " << x)) // NOLINT + +# endif #else # define DEBUG_WORKERREFS void() diff --git a/dom/xhr/XMLHttpRequestWorker.cpp b/dom/xhr/XMLHttpRequestWorker.cpp index 7fdfa8fee9..67cba876db 100644 --- a/dom/xhr/XMLHttpRequestWorker.cpp +++ b/dom/xhr/XMLHttpRequestWorker.cpp @@ -1388,10 +1388,12 @@ already_AddRefed<XMLHttpRequest> XMLHttpRequestWorker::Construct( new XMLHttpRequestWorker(workerPrivate, global); if (workerPrivate->XHRParamsAllowed()) { - if (aParams.mMozSystem) + if (aParams.mMozSystem) { xhr->mMozAnon = true; - else - xhr->mMozAnon = aParams.mMozAnon; + } else { + xhr->mMozAnon = + aParams.mMozAnon.WasPassed() ? aParams.mMozAnon.Value() : false; + } xhr->mMozSystem = aParams.mMozSystem; } |