summaryrefslogtreecommitdiffstats
path: root/dom/xhr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/xhr
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-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/xhr')
-rw-r--r--dom/xhr/XMLHttpRequest.cpp23
-rw-r--r--dom/xhr/XMLHttpRequestMainThread.cpp17
-rw-r--r--dom/xhr/XMLHttpRequestWorker.cpp8
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;
}