summaryrefslogtreecommitdiffstats
path: root/dom/worklet
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/worklet
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/worklet')
-rw-r--r--dom/worklet/WorkletFetchHandler.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/dom/worklet/WorkletFetchHandler.cpp b/dom/worklet/WorkletFetchHandler.cpp
index b259d6a357..b0c9ec1cfa 100644
--- a/dom/worklet/WorkletFetchHandler.cpp
+++ b/dom/worklet/WorkletFetchHandler.cpp
@@ -458,11 +458,8 @@ nsresult WorkletFetchHandler::StartFetch(JSContext* aCx, nsIURI* aURI,
return NS_ERROR_FAILURE;
}
- RequestOrUSVString requestInput;
-
- nsAutoString url;
- CopyUTF8toUTF16(spec, url);
- requestInput.SetAsUSVString().ShareOrDependUpon(url);
+ RequestOrUTF8String requestInput;
+ requestInput.SetAsUTF8String().ShareOrDependUpon(spec);
RootedDictionary<RequestInit> requestInit(aCx);
requestInit.mCredentials.Construct(mCredentials);
@@ -472,30 +469,33 @@ nsresult WorkletFetchHandler::StartFetch(JSContext* aCx, nsIURI* aURI,
requestInit.mMode.Construct(RequestMode::Cors);
if (aReferrer) {
- nsAutoString referrer;
- res = aReferrer->GetSpec(spec);
+ res = aReferrer->GetSpec(requestInit.mReferrer.Construct());
if (NS_WARN_IF(NS_FAILED(res))) {
return NS_ERROR_FAILURE;
}
-
- CopyUTF8toUTF16(spec, referrer);
- requestInit.mReferrer.Construct(referrer);
}
nsCOMPtr<nsIGlobalObject> global =
do_QueryInterface(mWorklet->GetParentObject());
MOZ_ASSERT(global);
+ // Note: added to infer a default credentials mode in the Request setup,
+ // but we always pass an explicit credentials value in requestInit, so
+ // this has no effect right now. Bug 1887862 covers fixing worklets to behave
+ // the same as "normal" fetch calls.
+ nsIPrincipal* p = global->PrincipalOrNull();
+ CallerType callerType = (p && p->IsSystemPrincipal() ? CallerType::System
+ : CallerType::NonSystem);
IgnoredErrorResult rv;
- SafeRefPtr<Request> request =
- Request::Constructor(global, aCx, requestInput, requestInit, rv);
+ SafeRefPtr<Request> request = Request::Constructor(
+ global, aCx, requestInput, requestInit, callerType, rv);
if (rv.Failed()) {
return NS_ERROR_FAILURE;
}
request->OverrideContentPolicyType(mWorklet->Impl()->ContentPolicyType());
- RequestOrUSVString finalRequestInput;
+ RequestOrUTF8String finalRequestInput;
finalRequestInput.SetAsRequest() = request.unsafeGetRawPtr();
RefPtr<Promise> fetchPromise = FetchRequest(