Bug Summary

File:root/firefox-clang/obj-x86_64-pc-linux-gnu/ipc/glue/./../../../ipc/glue/BackgroundUtils.cpp
Warning:line 512, column 7
Value stored to 'rv' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -O2 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name Unified_cpp_ipc_glue0.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -relaxed-aliasing -ffp-contract=off -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/ipc/glue -fcoverage-compilation-dir=/root/firefox-clang/obj-x86_64-pc-linux-gnu/ipc/glue -resource-dir /usr/lib/llvm-23/lib/clang/23 -include /root/firefox-clang/config/gcc_hidden.h -include /root/firefox-clang/obj-x86_64-pc-linux-gnu/mozilla-config.h -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -D _GLIBCXX_ASSERTIONS=1 -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/system_wrappers -U _FORTIFY_SOURCE -D _FORTIFY_SOURCE=2 -D DEBUG=1 -D HAVE_UINT64_T -D WEBRTC_MOZILLA_BUILD -D RTC_ENABLE_VP9 -D WEBRTC_POSIX -D WEBRTC_BUILD_LIBEVENT -D WEBRTC_LINUX -D WEBRTC_USE_PIPEWIRE -D WEBRTC_USE_X11 -D MOZ_CHILD_PROCESS_NAME="plugin-container" -D MOZ_CHILD_PROCESS_BUNDLENAME="None" -D MOZ_EME_PROCESS_NAME_BRANDED="None" -D MOZ_EME_PROCESS_BUNDLENAME="None" -D MOZ_GPU_PROCESS_NAME_BRANDED="None" -D MOZ_GPU_PROCESS_BUNDLENAME="None" -D MOZ_PKCS11_PROCESS_NAME_BRANDED="None" -D MOZ_PKCS11_PROCESS_BUNDLENAME="None" -D MOZ_HAS_MOZGLUE -D MOZILLA_INTERNAL_API -D IMPL_LIBXUL -D MOZ_SUPPORT_LEAKCHECKING -D STATIC_EXPORTABLE_JS_API -I /root/firefox-clang/ipc/glue -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/ipc/glue -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/libwebrtc_overrides -I /root/firefox-clang/caps -I /root/firefox-clang/dom/broadcastchannel -I /root/firefox-clang/dom/indexedDB -I /root/firefox-clang/dom/storage -I /root/firefox-clang/netwerk/base -I /root/firefox-clang/third_party/abseil-cpp -I /root/firefox-clang/third_party/libwebrtc -I /root/firefox-clang/tools/fuzzing/ipc -I /root/firefox-clang/xpcom/build -I /root/firefox-clang/dom/ipc -I /root/firefox-clang/toolkit/crashreporter -I /root/firefox-clang/toolkit/xre -I /root/firefox-clang/xpcom/base -I /root/firefox-clang/xpcom/threads -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I /root/firefox-clang/ipc/chromium/src -I /root/firefox-clang/third_party/abseil-cpp -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nspr -I /root/firefox-clang/obj-x86_64-pc-linux-gnu/dist/include/nss -D MOZILLA_CLIENT -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/x86_64-linux-gnu/c++/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/backward -internal-isystem /usr/lib/llvm-23/lib/clang/23/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-error=pessimizing-move -Wno-error=large-by-value-copy=128 -Wno-error=implicit-int-float-conversion -Wno-error=thread-safety-analysis -Wno-error=tautological-type-limit-compare -Wno-invalid-offsetof -Wno-range-loop-analysis -Wno-deprecated-anon-enum-enum-conversion -Wno-deprecated-enum-enum-conversion -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-vla-cxx-extension -Wno-unknown-warning-option -Wno-character-conversion -std=gnu++20 -fdeprecated-macro -ferror-limit 19 -fstrict-flex-arrays=1 -stack-protector 2 -fstack-clash-protection -ftrivial-auto-var-init=pattern -fno-rtti -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fno-sized-deallocation -fno-aligned-allocation -fdiagnostics-absolute-paths -vectorize-loops -vectorize-slp -analyzer-checker optin.performance.Padding -analyzer-output=html -analyzer-config stable-report-filename=true -mllvm -dwarf-linkage-names=Abstract -faddrsig -fdwarf2-cfi-asm -o /tmp/scan-build-2026-11-12-001017-1011516-1 -x c++ Unified_cpp_ipc_glue0.cpp
1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#include "BackgroundUtils.h"
6
7#include "MainThreadUtils.h"
8#include "mozilla/Assertions.h"
9#include "mozilla/BasePrincipal.h"
10#include "mozilla/ContentPrincipal.h"
11#include "mozilla/NullPrincipal.h"
12#include "mozilla/SystemPrincipal.h"
13#include "mozilla/ipc/PBackgroundSharedTypes.h"
14#include "mozilla/ipc/URIUtils.h"
15#include "mozilla/net/CookieJarSettings.h"
16#include "mozilla/net/InterceptionInfo.h"
17#include "mozilla/net/NeckoChannelParams.h"
18#include "ExpandedPrincipal.h"
19#include "nsIContentPolicy.h"
20#include "nsIScriptSecurityManager.h"
21#include "nsIURI.h"
22#include "nsNetUtil.h"
23#include "mozilla/LoadInfo.h"
24#include "nsContentUtils.h"
25#include "nsString.h"
26#include "nsTArray.h"
27#include "mozilla/nsRedirectHistoryEntry.h"
28#include "mozilla/dom/nsCSPUtils.h"
29#include "mozilla/dom/nsCSPContext.h"
30#include "mozilla/dom/BrowsingContext.h"
31#include "mozilla/dom/CanonicalBrowsingContext.h"
32#include "mozilla/dom/Document.h"
33#include "mozilla/dom/PolicyContainer.h"
34#include "mozilla/dom/WindowGlobalParent.h"
35#include "mozilla/LoadInfo.h"
36
37using namespace mozilla::dom;
38using namespace mozilla::net;
39
40namespace mozilla {
41
42namespace ipc {
43
44Result<nsCOMPtr<nsIPrincipal>, nsresult> PrincipalInfoToPrincipal(
45 const PrincipalInfo& aPrincipalInfo) {
46 MOZ_ASSERT(aPrincipalInfo.type() != PrincipalInfo::T__None)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aPrincipalInfo.type() != PrincipalInfo::T__None)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(aPrincipalInfo.type() != PrincipalInfo::T__None))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("aPrincipalInfo.type() != PrincipalInfo::T__None"
, "./../../../ipc/glue/BackgroundUtils.cpp", 46); AnnotateMozCrashReason
("MOZ_ASSERT" "(" "aPrincipalInfo.type() != PrincipalInfo::T__None"
")"); do { MOZ_CrashSequence(__null, 46); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
47
48 nsCOMPtr<nsIPrincipal> principal;
49 nsresult rv;
50
51 switch (aPrincipalInfo.type()) {
52 case PrincipalInfo::TSystemPrincipalInfo: {
53 principal = SystemPrincipal::Get();
54 if (NS_WARN_IF(!principal)NS_warn_if_impl(!principal, "!principal", "./../../../ipc/glue/BackgroundUtils.cpp"
, 54)
) {
55 return Err(NS_ERROR_NOT_INITIALIZED);
56 }
57
58 return principal;
59 }
60
61 case PrincipalInfo::TNullPrincipalInfo: {
62 const NullPrincipalInfo& info = aPrincipalInfo.get_NullPrincipalInfo();
63
64 nsCOMPtr<nsIURI> uri;
65 rv = NS_NewURI(getter_AddRefs(uri), info.spec());
66 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 66)
) {
67 return Err(rv);
68 }
69
70 if (!uri->SchemeIs(NS_NULLPRINCIPAL_SCHEME"moz-nullprincipal")) {
71 return Err(NS_ERROR_ILLEGAL_VALUE);
72 }
73
74 principal = NullPrincipal::Create(info.attrs(), uri);
75 return principal;
76 }
77
78 case PrincipalInfo::TContentPrincipalInfo: {
79 const ContentPrincipalInfo& info =
80 aPrincipalInfo.get_ContentPrincipalInfo();
81
82 nsCOMPtr<nsIURI> uri;
83 rv = NS_NewURI(getter_AddRefs(uri), info.spec());
84 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 84)
) {
85 return Err(rv);
86 }
87
88 nsCOMPtr<nsIURI> domain;
89 if (info.domain()) {
90 rv = NS_NewURI(getter_AddRefs(domain), *info.domain());
91 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 91)
) {
92 return Err(rv);
93 }
94 }
95
96 principal =
97 BasePrincipal::CreateContentPrincipal(uri, info.attrs(), domain);
98 if (NS_WARN_IF(!principal)NS_warn_if_impl(!principal, "!principal", "./../../../ipc/glue/BackgroundUtils.cpp"
, 98)
) {
99 return Err(NS_ERROR_NULL_POINTER);
100 }
101
102 // Origin must match what the_new_principal.getOrigin returns.
103 nsAutoCString originNoSuffix;
104 rv = principal->GetOriginNoSuffix(originNoSuffix);
105 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 105)
) {
106 return Err(rv);
107 }
108
109 if (NS_WARN_IF(!info.originNoSuffix().Equals(originNoSuffix))NS_warn_if_impl(!info.originNoSuffix().Equals(originNoSuffix)
, "!info.originNoSuffix().Equals(originNoSuffix)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 109)
) {
110 return Err(NS_ERROR_FAILURE);
111 }
112
113 if (!info.baseDomain().IsVoid()) {
114 nsAutoCString baseDomain;
115 rv = principal->GetBaseDomain(baseDomain);
116 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 116)
) {
117 return Err(rv);
118 }
119
120 if (NS_WARN_IF(!info.baseDomain().Equals(baseDomain))NS_warn_if_impl(!info.baseDomain().Equals(baseDomain), "!info.baseDomain().Equals(baseDomain)"
, "./../../../ipc/glue/BackgroundUtils.cpp", 120)
) {
121 return Err(NS_ERROR_FAILURE);
122 }
123 }
124 return principal;
125 }
126
127 case PrincipalInfo::TExpandedPrincipalInfo: {
128 const ExpandedPrincipalInfo& info =
129 aPrincipalInfo.get_ExpandedPrincipalInfo();
130
131 nsTArray<nsCOMPtr<nsIPrincipal>> allowlist;
132 nsCOMPtr<nsIPrincipal> alPrincipal;
133
134 for (uint32_t i = 0; i < info.allowlist().Length(); i++) {
135 auto principalOrErr = PrincipalInfoToPrincipal(info.allowlist()[i]);
136 if (NS_WARN_IF(principalOrErr.isErr())NS_warn_if_impl(principalOrErr.isErr(), "principalOrErr.isErr()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 136)
) {
137 nsresult ret = principalOrErr.unwrapErr();
138 return Err(ret);
139 }
140 // append that principal to the allowlist
141 allowlist.AppendElement(principalOrErr.unwrap());
142 }
143
144 RefPtr<ExpandedPrincipal> expandedPrincipal =
145 ExpandedPrincipal::Create(allowlist, info.attrs());
146 if (!expandedPrincipal) {
147 return Err(NS_ERROR_FAILURE);
148 }
149
150 principal = expandedPrincipal;
151 return principal;
152 }
153
154 default:
155 return Err(NS_ERROR_FAILURE);
156 }
157}
158
159bool StorageKeysEqual(const PrincipalInfo& aLeft, const PrincipalInfo& aRight) {
160 MOZ_RELEASE_ASSERT(aLeft.type() == PrincipalInfo::TContentPrincipalInfo ||do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aLeft.type() == PrincipalInfo::TContentPrincipalInfo
|| aLeft.type() == PrincipalInfo::TSystemPrincipalInfo)>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(aLeft.type() == PrincipalInfo::TContentPrincipalInfo
|| aLeft.type() == PrincipalInfo::TSystemPrincipalInfo))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("aLeft.type() == PrincipalInfo::TContentPrincipalInfo || aLeft.type() == PrincipalInfo::TSystemPrincipalInfo"
, "./../../../ipc/glue/BackgroundUtils.cpp", 161); AnnotateMozCrashReason
("MOZ_RELEASE_ASSERT" "(" "aLeft.type() == PrincipalInfo::TContentPrincipalInfo || aLeft.type() == PrincipalInfo::TSystemPrincipalInfo"
")"); do { MOZ_CrashSequence(__null, 161); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
161 aLeft.type() == PrincipalInfo::TSystemPrincipalInfo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aLeft.type() == PrincipalInfo::TContentPrincipalInfo
|| aLeft.type() == PrincipalInfo::TSystemPrincipalInfo)>::
isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(aLeft.type() == PrincipalInfo::TContentPrincipalInfo
|| aLeft.type() == PrincipalInfo::TSystemPrincipalInfo))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("aLeft.type() == PrincipalInfo::TContentPrincipalInfo || aLeft.type() == PrincipalInfo::TSystemPrincipalInfo"
, "./../../../ipc/glue/BackgroundUtils.cpp", 161); AnnotateMozCrashReason
("MOZ_RELEASE_ASSERT" "(" "aLeft.type() == PrincipalInfo::TContentPrincipalInfo || aLeft.type() == PrincipalInfo::TSystemPrincipalInfo"
")"); do { MOZ_CrashSequence(__null, 161); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
162 MOZ_RELEASE_ASSERT(aRight.type() == PrincipalInfo::TContentPrincipalInfo ||do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aRight.type() == PrincipalInfo::TContentPrincipalInfo
|| aRight.type() == PrincipalInfo::TSystemPrincipalInfo)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(aRight.type() == PrincipalInfo::TContentPrincipalInfo
|| aRight.type() == PrincipalInfo::TSystemPrincipalInfo))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("aRight.type() == PrincipalInfo::TContentPrincipalInfo || aRight.type() == PrincipalInfo::TSystemPrincipalInfo"
, "./../../../ipc/glue/BackgroundUtils.cpp", 163); AnnotateMozCrashReason
("MOZ_RELEASE_ASSERT" "(" "aRight.type() == PrincipalInfo::TContentPrincipalInfo || aRight.type() == PrincipalInfo::TSystemPrincipalInfo"
")"); do { MOZ_CrashSequence(__null, 163); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
163 aRight.type() == PrincipalInfo::TSystemPrincipalInfo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aRight.type() == PrincipalInfo::TContentPrincipalInfo
|| aRight.type() == PrincipalInfo::TSystemPrincipalInfo)>
::isValid, "invalid assertion condition"); if ((__builtin_expect
(!!(!(!!(aRight.type() == PrincipalInfo::TContentPrincipalInfo
|| aRight.type() == PrincipalInfo::TSystemPrincipalInfo))), 0
))) { do { } while (false); MOZ_ReportAssertionFailure("aRight.type() == PrincipalInfo::TContentPrincipalInfo || aRight.type() == PrincipalInfo::TSystemPrincipalInfo"
, "./../../../ipc/glue/BackgroundUtils.cpp", 163); AnnotateMozCrashReason
("MOZ_RELEASE_ASSERT" "(" "aRight.type() == PrincipalInfo::TContentPrincipalInfo || aRight.type() == PrincipalInfo::TSystemPrincipalInfo"
")"); do { MOZ_CrashSequence(__null, 163); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
164
165 if (aLeft.type() != aRight.type()) {
166 return false;
167 }
168
169 if (aLeft.type() == PrincipalInfo::TContentPrincipalInfo) {
170 const ContentPrincipalInfo& leftContent = aLeft.get_ContentPrincipalInfo();
171 const ContentPrincipalInfo& rightContent =
172 aRight.get_ContentPrincipalInfo();
173
174 return leftContent.attrs() == rightContent.attrs() &&
175 leftContent.originNoSuffix() == rightContent.originNoSuffix();
176 }
177
178 // Storage keys for the System principal always equal.
179 return true;
180}
181
182already_AddRefed<nsIContentSecurityPolicy> CSPInfoToCSP(
183 const CSPInfo& aCSPInfo, Document* aRequestingDoc,
184 nsresult* aOptionalResult) {
185 MOZ_ASSERT(NS_IsMainThread())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(NS_IsMainThread())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(NS_IsMainThread()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("NS_IsMainThread()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 185); AnnotateMozCrashReason
("MOZ_ASSERT" "(" "NS_IsMainThread()" ")"); do { MOZ_CrashSequence
(__null, 185); __attribute__((nomerge)) ::abort(); } while (false
); } } while (false)
;
186
187 nsresult stackResult;
188 nsresult& rv = aOptionalResult ? *aOptionalResult : stackResult;
189
190 RefPtr csp = MakeRefPtr<nsCSPContext>();
191
192 if (aRequestingDoc) {
193 rv = csp->SetRequestContextWithDocument(aRequestingDoc);
194 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 194)
) {
195 return nullptr;
196 }
197 } else {
198 auto principalOrErr =
199 PrincipalInfoToPrincipal(aCSPInfo.requestPrincipalInfo());
200 if (NS_WARN_IF(principalOrErr.isErr())NS_warn_if_impl(principalOrErr.isErr(), "principalOrErr.isErr()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 200)
) {
201 return nullptr;
202 }
203
204 nsCOMPtr<nsIURI> selfURI;
205 if (!aCSPInfo.selfURISpec().IsEmpty()) {
206 rv = NS_NewURI(getter_AddRefs(selfURI), aCSPInfo.selfURISpec());
207 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 207)
) {
208 return nullptr;
209 }
210 }
211
212 nsCOMPtr<nsIPrincipal> principal = principalOrErr.unwrap();
213
214 rv = csp->SetRequestContextWithPrincipal(
215 principal, selfURI, aCSPInfo.referrer(), aCSPInfo.innerWindowID());
216 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 216)
) {
217 return nullptr;
218 }
219 }
220 csp->SetSkipAllowInlineStyleCheck(aCSPInfo.skipAllowInlineStyleCheck());
221
222 for (uint32_t i = 0; i < aCSPInfo.policyInfos().Length(); i++) {
223 csp->AddIPCPolicy(aCSPInfo.policyInfos()[i]);
224 }
225 return csp.forget();
226}
227
228nsresult CSPToCSPInfo(nsIContentSecurityPolicy* aCSP, CSPInfo* aCSPInfo) {
229 MOZ_ASSERT(NS_IsMainThread())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(NS_IsMainThread())>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(NS_IsMainThread()))), 0))) {
do { } while (false); MOZ_ReportAssertionFailure("NS_IsMainThread()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 229); AnnotateMozCrashReason
("MOZ_ASSERT" "(" "NS_IsMainThread()" ")"); do { MOZ_CrashSequence
(__null, 229); __attribute__((nomerge)) ::abort(); } while (false
); } } while (false)
;
230 MOZ_ASSERT(aCSP)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aCSP)>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(aCSP))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("aCSP", "./../../../ipc/glue/BackgroundUtils.cpp"
, 230); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aCSP" ")"); do
{ MOZ_CrashSequence(__null, 230); __attribute__((nomerge)) ::
abort(); } while (false); } } while (false)
;
231 MOZ_ASSERT(aCSPInfo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aCSPInfo)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aCSPInfo))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("aCSPInfo", "./../../../ipc/glue/BackgroundUtils.cpp"
, 231); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aCSPInfo" ")"
); do { MOZ_CrashSequence(__null, 231); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
232
233 if (!aCSP || !aCSPInfo) {
234 return NS_ERROR_FAILURE;
235 }
236
237 nsCOMPtr<nsIPrincipal> requestPrincipal = aCSP->GetRequestPrincipal();
238
239 PrincipalInfo requestingPrincipalInfo;
240 nsresult rv =
241 PrincipalToPrincipalInfo(requestPrincipal, &requestingPrincipalInfo);
242 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 242)
) {
243 return rv;
244 }
245
246 nsCOMPtr<nsIURI> selfURI = aCSP->GetSelfURI();
247 nsAutoCString selfURISpec;
248 if (selfURI) {
249 selfURI->GetSpec(selfURISpec);
250 }
251
252 nsAutoCString referrer;
253 aCSP->GetReferrer(referrer);
254
255 uint64_t windowID = aCSP->GetInnerWindowID();
256 bool skipAllowInlineStyleCheck = aCSP->GetSkipAllowInlineStyleCheck();
257
258 RequireTrustedTypesForDirectiveState requireTrustedTypesForDirectiveState =
259 aCSP->GetRequireTrustedTypesForDirectiveState();
260
261 nsTArray<ContentSecurityPolicy> policies;
262 static_cast<nsCSPContext*>(aCSP)->SerializePolicies(policies);
263
264 *aCSPInfo = CSPInfo(std::move(policies), requestingPrincipalInfo, selfURISpec,
265 referrer, windowID, requireTrustedTypesForDirectiveState,
266 skipAllowInlineStyleCheck);
267 return NS_OK;
268}
269
270nsresult PrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
271 PrincipalInfo* aPrincipalInfo,
272 bool aSkipBaseDomain) {
273 MOZ_ASSERT(aPrincipal)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aPrincipal)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aPrincipal))), 0))) { do { }
while (false); MOZ_ReportAssertionFailure("aPrincipal", "./../../../ipc/glue/BackgroundUtils.cpp"
, 273); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aPrincipal" ")"
); do { MOZ_CrashSequence(__null, 273); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
274 MOZ_ASSERT(aPrincipalInfo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aPrincipalInfo)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aPrincipalInfo))), 0))) { do
{ } while (false); MOZ_ReportAssertionFailure("aPrincipalInfo"
, "./../../../ipc/glue/BackgroundUtils.cpp", 274); AnnotateMozCrashReason
("MOZ_ASSERT" "(" "aPrincipalInfo" ")"); do { MOZ_CrashSequence
(__null, 274); __attribute__((nomerge)) ::abort(); } while (false
); } } while (false)
;
275
276 nsresult rv;
277 if (aPrincipal->GetIsNullPrincipal()) {
278 nsAutoCString spec;
279 rv = aPrincipal->GetAsciiSpec(spec);
280 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 280)
) {
281 return rv;
282 }
283
284 *aPrincipalInfo =
285 NullPrincipalInfo(aPrincipal->OriginAttributesRef(), spec);
286 return NS_OK;
287 }
288
289 if (aPrincipal->IsSystemPrincipal()) {
290 *aPrincipalInfo = SystemPrincipalInfo();
291 return NS_OK;
292 }
293
294 // might be an expanded principal
295 auto* basePrin = BasePrincipal::Cast(aPrincipal);
296 if (basePrin->Is<ExpandedPrincipal>()) {
297 auto* expanded = basePrin->As<ExpandedPrincipal>();
298
299 nsTArray<PrincipalInfo> allowlistInfo;
300 PrincipalInfo info;
301
302 for (auto& prin : expanded->AllowList()) {
303 rv = PrincipalToPrincipalInfo(prin, &info, aSkipBaseDomain);
304 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 304)
) {
305 return rv;
306 }
307 // append that spec to the allowlist
308 allowlistInfo.AppendElement(info);
309 }
310
311 *aPrincipalInfo = ExpandedPrincipalInfo(aPrincipal->OriginAttributesRef(),
312 std::move(allowlistInfo));
313 return NS_OK;
314 }
315
316 nsAutoCString spec;
317 rv = aPrincipal->GetAsciiSpec(spec);
318 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 318)
) {
319 return rv;
320 }
321
322 nsCString originNoSuffix;
323 rv = aPrincipal->GetOriginNoSuffix(originNoSuffix);
324 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 324)
) {
325 return rv;
326 }
327
328 nsCOMPtr<nsIURI> domainUri;
329 rv = aPrincipal->GetDomain(getter_AddRefs(domainUri));
330 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 330)
) {
331 return rv;
332 }
333
334 Maybe<nsCString> domain;
335 if (domainUri) {
336 domain.emplace();
337 rv = domainUri->GetSpec(domain.ref());
338 if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv
)), 0))), "NS_FAILED(rv)", "./../../../ipc/glue/BackgroundUtils.cpp"
, 338)
) {
339 return rv;
340 }
341 }
342
343 // This attribute is not crucial.
344 nsCString baseDomain;
345 if (aSkipBaseDomain) {
346 baseDomain.SetIsVoid(true);
347 } else {
348 if (NS_FAILED(aPrincipal->GetBaseDomain(baseDomain))((bool)(__builtin_expect(!!(NS_FAILED_impl(aPrincipal->GetBaseDomain
(baseDomain))), 0)))
) {
349 // No warning here. Some principal URLs do not have a base-domain.
350 baseDomain.SetIsVoid(true);
351 }
352 }
353
354 *aPrincipalInfo =
355 ContentPrincipalInfo(aPrincipal->OriginAttributesRef(), originNoSuffix,
356 spec, domain, baseDomain);
357 return NS_OK;
358}
359
360bool IsPrincipalInfoPrivate(const PrincipalInfo& aPrincipalInfo) {
361 if (aPrincipalInfo.type() != ipc::PrincipalInfo::TContentPrincipalInfo) {
362 return false;
363 }
364
365 const ContentPrincipalInfo& info = aPrincipalInfo.get_ContentPrincipalInfo();
366 return info.attrs().IsPrivateBrowsing();
367}
368
369already_AddRefed<nsIRedirectHistoryEntry> RHEntryInfoToRHEntry(
370 const RedirectHistoryEntryInfo& aRHEntryInfo) {
371 auto principalOrErr = PrincipalInfoToPrincipal(aRHEntryInfo.principalInfo());
372 if (NS_WARN_IF(principalOrErr.isErr())NS_warn_if_impl(principalOrErr.isErr(), "principalOrErr.isErr()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 372)
) {
373 return nullptr;
374 }
375
376 nsCOMPtr<nsIPrincipal> principal = principalOrErr.unwrap();
377 nsCOMPtr<nsIRedirectHistoryEntry> entry = new nsRedirectHistoryEntry(
378 principal, aRHEntryInfo.referrerUri(), aRHEntryInfo.remoteAddress());
379
380 return entry.forget();
381}
382
383nsresult RHEntryToRHEntryInfo(nsIRedirectHistoryEntry* aRHEntry,
384 RedirectHistoryEntryInfo* aRHEntryInfo) {
385 MOZ_ASSERT(aRHEntry)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aRHEntry)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aRHEntry))), 0))) { do { } while
(false); MOZ_ReportAssertionFailure("aRHEntry", "./../../../ipc/glue/BackgroundUtils.cpp"
, 385); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aRHEntry" ")"
); do { MOZ_CrashSequence(__null, 385); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
386 MOZ_ASSERT(aRHEntryInfo)do { static_assert( mozilla::detail::AssertionConditionType<
decltype(aRHEntryInfo)>::isValid, "invalid assertion condition"
); if ((__builtin_expect(!!(!(!!(aRHEntryInfo))), 0))) { do {
} while (false); MOZ_ReportAssertionFailure("aRHEntryInfo", "./../../../ipc/glue/BackgroundUtils.cpp"
, 386); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aRHEntryInfo"
")"); do { MOZ_CrashSequence(__null, 386); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
387
388 nsresult rv;
389 aRHEntry->GetRemoteAddress(aRHEntryInfo->remoteAddress());
390
391 rv = aRHEntry->GetReferrerURI(getter_AddRefs(aRHEntryInfo->referrerUri()));
392 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 392); return rv; } } while (false)
;
393
394 nsCOMPtr<nsIPrincipal> principal;
395 rv = aRHEntry->GetPrincipal(getter_AddRefs(principal));
396 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 396); return rv; } } while (false)
;
397
398 return PrincipalToPrincipalInfo(principal, &aRHEntryInfo->principalInfo());
399}
400
401nsresult LoadInfoToLoadInfoArgs(nsILoadInfo* aLoadInfo,
402 LoadInfoArgs* outLoadInfoArgs) {
403 nsresult rv = NS_OK;
404 Maybe<PrincipalInfo> loadingPrincipalInfo;
405 if (nsIPrincipal* loadingPrin = aLoadInfo->GetLoadingPrincipal()) {
406 loadingPrincipalInfo.emplace();
407 rv = PrincipalToPrincipalInfo(loadingPrin, loadingPrincipalInfo.ptr());
408 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 408); return rv; } } while (false)
;
409 }
410
411 PrincipalInfo triggeringPrincipalInfo;
412 rv = PrincipalToPrincipalInfo(aLoadInfo->TriggeringPrincipal(),
413 &triggeringPrincipalInfo);
414 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 414); return rv; } } while (false)
;
415
416 Maybe<PrincipalInfo> principalToInheritInfo;
417 if (nsIPrincipal* principalToInherit = aLoadInfo->PrincipalToInherit()) {
418 principalToInheritInfo.emplace();
419 rv = PrincipalToPrincipalInfo(principalToInherit,
420 principalToInheritInfo.ptr());
421 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 421); return rv; } } while (false)
;
422 }
423
424 Maybe<PrincipalInfo> topLevelPrincipalInfo;
425 if (nsIPrincipal* topLevenPrin = aLoadInfo->GetTopLevelPrincipal()) {
426 topLevelPrincipalInfo.emplace();
427 rv = PrincipalToPrincipalInfo(topLevenPrin, topLevelPrincipalInfo.ptr());
428 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 428); return rv; } } while (false)
;
429 }
430
431 nsCOMPtr<nsIURI> resultPrincipalURI;
432 (void)aLoadInfo->GetResultPrincipalURI(getter_AddRefs(resultPrincipalURI));
433
434 RemoteType triggeringRemoteType;
435 rv = aLoadInfo->GetTriggeringRemoteType(triggeringRemoteType);
436 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 436); return rv; } } while (false)
;
437
438 nsTArray<RedirectHistoryEntryInfo> redirectChainIncludingInternalRedirects;
439 for (const nsCOMPtr<nsIRedirectHistoryEntry>& redirectEntry :
440 aLoadInfo->RedirectChainIncludingInternalRedirects()) {
441 RedirectHistoryEntryInfo* entry =
442 redirectChainIncludingInternalRedirects.AppendElement();
443 rv = RHEntryToRHEntryInfo(redirectEntry, entry);
444 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 444); return rv; } } while (false)
;
445 }
446
447 nsTArray<RedirectHistoryEntryInfo> redirectChain;
448 for (const nsCOMPtr<nsIRedirectHistoryEntry>& redirectEntry :
449 aLoadInfo->RedirectChain()) {
450 RedirectHistoryEntryInfo* entry = redirectChain.AppendElement();
451 rv = RHEntryToRHEntryInfo(redirectEntry, entry);
452 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 452); return rv; } } while (false)
;
453 }
454
455 Maybe<IPCClientInfo> ipcClientInfo;
456 const Maybe<ClientInfo>& clientInfo = aLoadInfo->GetClientInfo();
457 if (clientInfo.isSome()) {
458 ipcClientInfo.emplace(clientInfo.ref().ToIPC());
459 }
460
461 Maybe<IPCClientInfo> ipcReservedClientInfo;
462 const Maybe<ClientInfo>& reservedClientInfo =
463 aLoadInfo->GetReservedClientInfo();
464 if (reservedClientInfo.isSome()) {
465 ipcReservedClientInfo.emplace(reservedClientInfo.ref().ToIPC());
466 }
467
468 Maybe<IPCClientInfo> ipcInitialClientInfo;
469 const Maybe<ClientInfo>& initialClientInfo =
470 aLoadInfo->GetInitialClientInfo();
471 if (initialClientInfo.isSome()) {
472 ipcInitialClientInfo.emplace(initialClientInfo.ref().ToIPC());
473 }
474
475 Maybe<IPCServiceWorkerDescriptor> ipcController;
476 const Maybe<ServiceWorkerDescriptor>& controller = aLoadInfo->GetController();
477 if (controller.isSome()) {
478 ipcController.emplace(controller.ref().ToIPC());
479 }
480
481 nsAutoString cspNonce;
482 (void)NS_WARN_IF(NS_FAILED(aLoadInfo->GetCspNonce(cspNonce)))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(aLoadInfo
->GetCspNonce(cspNonce))), 0))), "NS_FAILED(aLoadInfo->GetCspNonce(cspNonce))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 482)
;
483
484 nsAutoString integrityMetadata;
485 (void)NS_WARN_IF(NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(aLoadInfo
->GetIntegrityMetadata(integrityMetadata))), 0))), "NS_FAILED(aLoadInfo->GetIntegrityMetadata(integrityMetadata))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 486)
486 NS_FAILED(aLoadInfo->GetIntegrityMetadata(integrityMetadata)))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(aLoadInfo
->GetIntegrityMetadata(integrityMetadata))), 0))), "NS_FAILED(aLoadInfo->GetIntegrityMetadata(integrityMetadata))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 486)
;
487
488 nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
489 rv = aLoadInfo->GetCookieJarSettings(getter_AddRefs(cookieJarSettings));
490 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 490); return rv; } } while (false)
;
491
492 CookieJarSettingsArgs cookieJarSettingsArgs;
493 static_cast<CookieJarSettings*>(cookieJarSettings.get())
494 ->Serialize(cookieJarSettingsArgs);
495
496 nsCOMPtr<nsIURI> unstrippedURI;
497 (void)aLoadInfo->GetUnstrippedURI(getter_AddRefs(unstrippedURI));
498
499 Maybe<bool> isThirdPartyContextToTopWindow;
500 if (static_cast<LoadInfo*>(aLoadInfo)
501 ->HasIsThirdPartyContextToTopWindowSet()) {
502 isThirdPartyContextToTopWindow.emplace(
503 aLoadInfo->GetIsThirdPartyContextToTopWindow());
504 }
505
506 Maybe<InterceptionInfoArg> interceptionInfoArg;
507 nsIInterceptionInfo* interceptionInfo = aLoadInfo->InterceptionInfo();
508 if (interceptionInfo) {
509 Maybe<PrincipalInfo> triggeringPrincipalInfo;
510 if (interceptionInfo->TriggeringPrincipal()) {
511 triggeringPrincipalInfo.emplace();
512 rv = PrincipalToPrincipalInfo(interceptionInfo->TriggeringPrincipal(),
Value stored to 'rv' is never read
513 triggeringPrincipalInfo.ptr());
514 }
515
516 nsTArray<RedirectHistoryEntryInfo> redirectChain;
517 for (const nsCOMPtr<nsIRedirectHistoryEntry>& redirectEntry :
518 interceptionInfo->RedirectChain()) {
519 RedirectHistoryEntryInfo* entry = redirectChain.AppendElement();
520 rv = RHEntryToRHEntryInfo(redirectEntry, entry);
521 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 521); return rv; } } while (false)
;
522 }
523
524 interceptionInfoArg = Some(InterceptionInfoArg(
525 triggeringPrincipalInfo, interceptionInfo->ContentPolicyType(),
526 redirectChain, interceptionInfo->FromThirdParty()));
527 }
528
529 Maybe<RFPTargetSet> overriddenFingerprintingSettingsArg;
530 Maybe<RFPTargetSet> overriddenFingerprintingSettings =
531 aLoadInfo->GetOverriddenFingerprintingSettings();
532
533 if (overriddenFingerprintingSettings) {
534 overriddenFingerprintingSettingsArg =
535 Some(overriddenFingerprintingSettings.ref());
536 }
537
538 Maybe<RequestMode> requestMode;
539 aLoadInfo->GetRequestMode(&requestMode);
540
541 Maybe<PolicyContainerArgs> maybePolicyContainerToInherit;
542 nsCOMPtr<nsIPolicyContainer> policyContainerToInherit =
543 aLoadInfo->GetPolicyContainerToInherit();
544 if (policyContainerToInherit) {
545 PolicyContainerArgs args;
546 PolicyContainer::ToArgs(PolicyContainer::Cast(policyContainerToInherit),
547 args);
548 maybePolicyContainerToInherit.emplace(args);
549 }
550
551 *outLoadInfoArgs = LoadInfoArgs(
552 loadingPrincipalInfo, triggeringPrincipalInfo, principalToInheritInfo,
553 topLevelPrincipalInfo, resultPrincipalURI, triggeringRemoteType,
554 aLoadInfo->GetSandboxedNullPrincipalID(), aLoadInfo->GetSecurityFlags(),
555 aLoadInfo->GetSandboxFlags(), aLoadInfo->GetTriggeringSandboxFlags(),
556 aLoadInfo->GetTriggeringWindowId(),
557 aLoadInfo->GetTriggeringFirstPartyClassificationFlags(),
558 aLoadInfo->GetTriggeringThirdPartyClassificationFlags(),
559 aLoadInfo->InternalContentPolicyType(),
560 static_cast<uint32_t>(aLoadInfo->GetTainting()),
561 aLoadInfo->GetBlockAllMixedContent(),
562 aLoadInfo->GetUpgradeInsecureRequests(),
563 aLoadInfo->GetBrowserUpgradeInsecureRequests(),
564 aLoadInfo->GetBrowserDidUpgradeInsecureRequests(),
565 aLoadInfo->GetBrowserWouldUpgradeInsecureRequests(),
566 aLoadInfo->GetForceAllowDataURI(),
567 aLoadInfo->GetAllowInsecureRedirectToDataURI(),
568 aLoadInfo->GetForceMediaDocument(),
569 aLoadInfo->GetSkipContentPolicyCheckForWebRequest(),
570 aLoadInfo->GetOriginalFrameSrcLoad(),
571 aLoadInfo->GetForceInheritPrincipalDropped(),
572 aLoadInfo->GetInnerWindowID(), aLoadInfo->GetBrowsingContextID(),
573 aLoadInfo->GetAssociatedBrowsingContextID(),
574 aLoadInfo->GetFrameBrowsingContextID(),
575 aLoadInfo->GetInitialSecurityCheckDone(),
576 aLoadInfo->GetIsInThirdPartyContext(), isThirdPartyContextToTopWindow,
577 aLoadInfo->GetIsOn3PCBExceptionList(), aLoadInfo->GetIsFormSubmission(),
578 aLoadInfo->GetIsGETRequest(), aLoadInfo->GetSendCSPViolationEvents(),
579 aLoadInfo->GetOriginAttributes(), redirectChainIncludingInternalRedirects,
580 redirectChain, aLoadInfo->GetSchemelessInput(),
581 aLoadInfo->GetHttpsUpgradeTelemetry(), ipcClientInfo,
582 ipcReservedClientInfo, ipcInitialClientInfo, ipcController,
583 aLoadInfo->CorsUnsafeHeaders(), aLoadInfo->GetForcePreflight(),
584 aLoadInfo->GetIsPreflight(), aLoadInfo->GetLoadTriggeredFromExternal(),
585 aLoadInfo->GetServiceWorkerTaintingSynthesized(),
586 aLoadInfo->GetDocumentHasUserInteracted(),
587 aLoadInfo->GetAllowListFutureDocumentsCreatedFromThisRedirectChain(),
588 aLoadInfo->GetNeedForCheckingAntiTrackingHeuristic(), cspNonce,
589 integrityMetadata, aLoadInfo->GetSkipContentSniffing(),
590 aLoadInfo->GetHttpsOnlyStatus(), aLoadInfo->GetHstsStatus(),
591 aLoadInfo->GetHasValidUserGestureActivation(),
592 aLoadInfo->GetTextDirectiveUserActivation(),
593 aLoadInfo->GetAllowDeprecatedSystemRequests(),
594 aLoadInfo->GetIsInDevToolsContext(), aLoadInfo->GetParserCreatedScript(),
595 requestMode, aLoadInfo->GetIsFromProcessingFrameAttributes(),
596 aLoadInfo->GetIsMediaRequest(), cookieJarSettingsArgs,
597 aLoadInfo->GetRequestBlockingReason(), maybePolicyContainerToInherit,
598 aLoadInfo->GetStoragePermission(), aLoadInfo->GetParentIpAddressSpace(),
599 aLoadInfo->GetIpAddressSpace(), overriddenFingerprintingSettingsArg,
600 aLoadInfo->GetIsMetaRefresh(),
601 aLoadInfo->GetActivatedFromNavigationalPrefetch(),
602 aLoadInfo->GetPrefetchCandidateMatched(),
603 aLoadInfo->GetLoadingEmbedderPolicy(),
604 aLoadInfo->GetIsOriginTrialCoepCredentiallessEnabledForTopLevel(),
605 unstrippedURI, interceptionInfoArg, aLoadInfo->GetIsNewWindowTarget(),
606 aLoadInfo->GetUserNavigationInvolvement(),
607 aLoadInfo->GetContainerPermissionsPolicyInfo(), {});
608
609 return NS_OK;
610}
611
612nsresult LoadInfoArgsToLoadInfo(const LoadInfoArgs& aLoadInfoArgs,
613 const RemoteType& aOriginRemoteType,
614 nsILoadInfo** outLoadInfo) {
615 return LoadInfoArgsToLoadInfo(aLoadInfoArgs, aOriginRemoteType, nullptr,
616 outLoadInfo);
617}
618nsresult LoadInfoArgsToLoadInfo(const LoadInfoArgs& aLoadInfoArgs,
619 const RemoteType& aOriginRemoteType,
620 nsINode* aCspToInheritLoadingContext,
621 nsILoadInfo** outLoadInfo) {
622 RefPtr<LoadInfo> loadInfo;
623 nsresult rv = LoadInfoArgsToLoadInfo(aLoadInfoArgs, aOriginRemoteType,
624 aCspToInheritLoadingContext,
625 getter_AddRefs(loadInfo));
626 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 626); return rv; } } while (false)
;
627
628 loadInfo.forget(outLoadInfo);
629 return NS_OK;
630}
631
632nsresult LoadInfoArgsToLoadInfo(const LoadInfoArgs& aLoadInfoArgs,
633 const RemoteType& aOriginRemoteType,
634 LoadInfo** outLoadInfo) {
635 return LoadInfoArgsToLoadInfo(aLoadInfoArgs, aOriginRemoteType, nullptr,
636 outLoadInfo);
637}
638nsresult LoadInfoArgsToLoadInfo(const LoadInfoArgs& loadInfoArgs,
639 const RemoteType& aOriginRemoteType,
640 nsINode* aCspToInheritLoadingContext,
641 LoadInfo** outLoadInfo) {
642 nsCOMPtr<nsIPrincipal> loadingPrincipal;
643 if (loadInfoArgs.requestingPrincipalInfo().isSome()) {
644 auto loadingPrincipalOrErr =
645 PrincipalInfoToPrincipal(loadInfoArgs.requestingPrincipalInfo().ref());
646 if (NS_WARN_IF(loadingPrincipalOrErr.isErr())NS_warn_if_impl(loadingPrincipalOrErr.isErr(), "loadingPrincipalOrErr.isErr()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 646)
) {
647 return loadingPrincipalOrErr.unwrapErr();
648 }
649 loadingPrincipal = loadingPrincipalOrErr.unwrap();
650 }
651
652 auto triggeringPrincipalOrErr =
653 PrincipalInfoToPrincipal(loadInfoArgs.triggeringPrincipalInfo());
654 if (NS_WARN_IF(triggeringPrincipalOrErr.isErr())NS_warn_if_impl(triggeringPrincipalOrErr.isErr(), "triggeringPrincipalOrErr.isErr()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 654)
) {
655 return triggeringPrincipalOrErr.unwrapErr();
656 }
657 nsCOMPtr<nsIPrincipal> triggeringPrincipal =
658 triggeringPrincipalOrErr.unwrap();
659
660 nsCOMPtr<nsIPrincipal> principalToInherit;
661 nsCOMPtr<nsIPrincipal> flattenedPrincipalToInherit;
662 if (loadInfoArgs.principalToInheritInfo().isSome()) {
663 auto principalToInheritOrErr =
664 PrincipalInfoToPrincipal(loadInfoArgs.principalToInheritInfo().ref());
665 if (NS_WARN_IF(principalToInheritOrErr.isErr())NS_warn_if_impl(principalToInheritOrErr.isErr(), "principalToInheritOrErr.isErr()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 665)
) {
666 return principalToInheritOrErr.unwrapErr();
667 }
668 flattenedPrincipalToInherit = principalToInheritOrErr.unwrap();
669 }
670
671 if (XRE_IsContentProcess()) {
672 auto targetBrowsingContextId = loadInfoArgs.frameBrowsingContextID()
673 ? loadInfoArgs.frameBrowsingContextID()
674 : loadInfoArgs.browsingContextID();
675 if (RefPtr<BrowsingContext> bc =
676 BrowsingContext::Get(targetBrowsingContextId)) {
677 auto [originalTriggeringPrincipal, originalPrincipalToInherit] =
678 bc->GetTriggeringAndInheritPrincipalsForCurrentLoad();
679
680 if (originalTriggeringPrincipal &&
681 originalTriggeringPrincipal->Equals(triggeringPrincipal)) {
682 triggeringPrincipal = originalTriggeringPrincipal;
683 }
684 if (originalPrincipalToInherit &&
685 (loadInfoArgs.securityFlags() &
686 nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL) &&
687 originalPrincipalToInherit->Equals(flattenedPrincipalToInherit)) {
688 principalToInherit = originalPrincipalToInherit;
689 }
690 }
691 }
692 if (!principalToInherit && loadInfoArgs.principalToInheritInfo().isSome()) {
693 principalToInherit = flattenedPrincipalToInherit;
694 }
695
696 nsCOMPtr<nsIPrincipal> topLevelPrincipal;
697 if (loadInfoArgs.topLevelPrincipalInfo().isSome()) {
698 auto topLevelPrincipalOrErr =
699 PrincipalInfoToPrincipal(loadInfoArgs.topLevelPrincipalInfo().ref());
700 if (NS_WARN_IF(topLevelPrincipalOrErr.isErr())NS_warn_if_impl(topLevelPrincipalOrErr.isErr(), "topLevelPrincipalOrErr.isErr()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 700)
) {
701 return topLevelPrincipalOrErr.unwrapErr();
702 }
703 topLevelPrincipal = topLevelPrincipalOrErr.unwrap();
704 }
705
706 nsCOMPtr<nsIURI> resultPrincipalURI(loadInfoArgs.resultPrincipalURI());
707
708 // If we received this message from a content process, reset
709 // triggeringRemoteType to the process which sent us the message. If the
710 // parent sent us the message, we trust it to provide the correct triggering
711 // remote type.
712 //
713 // This means that the triggering remote type will be reset if a LoadInfo is
714 // bounced through a content process, as the LoadInfo can no longer be
715 // validated to be coming from the originally specified remote type.
716 RemoteType triggeringRemoteType = loadInfoArgs.triggeringRemoteType();
717 if (!aOriginRemoteType.IsNotRemote() &&
718 aOriginRemoteType != triggeringRemoteType) {
719 triggeringRemoteType = aOriginRemoteType;
720 }
721
722 RedirectHistoryArray redirectChainIncludingInternalRedirects;
723 for (const RedirectHistoryEntryInfo& entryInfo :
724 loadInfoArgs.redirectChainIncludingInternalRedirects()) {
725 nsCOMPtr<nsIRedirectHistoryEntry> redirectHistoryEntry =
726 RHEntryInfoToRHEntry(entryInfo);
727 NS_ENSURE_TRUE(redirectHistoryEntry, NS_ERROR_UNEXPECTED)do { if ((__builtin_expect(!!(!(redirectHistoryEntry)), 0))) {
NS_DebugBreak(NS_DEBUG_WARNING, "NS_ENSURE_TRUE(" "redirectHistoryEntry"
") failed", nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 727); return NS_ERROR_UNEXPECTED; } } while (false)
;
728 redirectChainIncludingInternalRedirects.AppendElement(
729 redirectHistoryEntry.forget());
730 }
731
732 RedirectHistoryArray redirectChain;
733 for (const RedirectHistoryEntryInfo& entryInfo :
734 loadInfoArgs.redirectChain()) {
735 nsCOMPtr<nsIRedirectHistoryEntry> redirectHistoryEntry =
736 RHEntryInfoToRHEntry(entryInfo);
737 NS_ENSURE_TRUE(redirectHistoryEntry, NS_ERROR_UNEXPECTED)do { if ((__builtin_expect(!!(!(redirectHistoryEntry)), 0))) {
NS_DebugBreak(NS_DEBUG_WARNING, "NS_ENSURE_TRUE(" "redirectHistoryEntry"
") failed", nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 737); return NS_ERROR_UNEXPECTED; } } while (false)
;
738 redirectChain.AppendElement(redirectHistoryEntry.forget());
739 }
740 nsTArray<nsCOMPtr<nsIPrincipal>> ancestorPrincipals;
741 nsTArray<uint64_t> ancestorBrowsingContextIDs;
742 if (XRE_IsParentProcess() &&
743 (nsContentUtils::InternalContentPolicyTypeToExternal(
744 loadInfoArgs.contentPolicyType()) !=
745 ExtContentPolicy::TYPE_DOCUMENT)) {
746 // Only fill out ancestor principals and browsing context IDs when we
747 // are deserializing LoadInfoArgs to be LoadInfo for a subresource
748 RefPtr<BrowsingContext> parentBC =
749 BrowsingContext::Get(loadInfoArgs.browsingContextID());
750 if (parentBC) {
751 LoadInfo::ComputeAncestors(parentBC->Canonical(), ancestorPrincipals,
752 ancestorBrowsingContextIDs);
753 }
754 } else {
755 // Fill out (possibly redacted) ancestor principals for
756 // Location.ancestorOrigins
757 for (const auto& principalInfo : loadInfoArgs.ancestorOrigins()) {
758 if (principalInfo.isNothing()) {
759 ancestorPrincipals.AppendElement(nullptr);
760 } else {
761 auto principal = PrincipalInfoToPrincipal(principalInfo.value());
762 // If this operation fail, we censor the origin.
763 ancestorPrincipals.AppendElement(principal.unwrapOr(nullptr));
764 }
765 }
766 }
767
768 Maybe<ClientInfo> clientInfo;
769 if (loadInfoArgs.clientInfo().isSome()) {
770 clientInfo.emplace(ClientInfo(loadInfoArgs.clientInfo().ref()));
771 }
772
773 Maybe<ClientInfo> reservedClientInfo;
774 if (loadInfoArgs.reservedClientInfo().isSome()) {
775 reservedClientInfo.emplace(
776 ClientInfo(loadInfoArgs.reservedClientInfo().ref()));
777 }
778
779 Maybe<ClientInfo> initialClientInfo;
780 if (loadInfoArgs.initialClientInfo().isSome()) {
781 initialClientInfo.emplace(
782 ClientInfo(loadInfoArgs.initialClientInfo().ref()));
783 }
784
785 // We can have an initial client info or a reserved client info, but not both.
786 MOZ_DIAGNOSTIC_ASSERT(reservedClientInfo.isNothing() ||do { static_assert( mozilla::detail::AssertionConditionType<
decltype(reservedClientInfo.isNothing() || initialClientInfo.
isNothing())>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(reservedClientInfo.isNothing() ||
initialClientInfo.isNothing()))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("reservedClientInfo.isNothing() || initialClientInfo.isNothing()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 787); AnnotateMozCrashReason
("MOZ_DIAGNOSTIC_ASSERT" "(" "reservedClientInfo.isNothing() || initialClientInfo.isNothing()"
")"); do { MOZ_CrashSequence(__null, 787); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
787 initialClientInfo.isNothing())do { static_assert( mozilla::detail::AssertionConditionType<
decltype(reservedClientInfo.isNothing() || initialClientInfo.
isNothing())>::isValid, "invalid assertion condition"); if
((__builtin_expect(!!(!(!!(reservedClientInfo.isNothing() ||
initialClientInfo.isNothing()))), 0))) { do { } while (false
); MOZ_ReportAssertionFailure("reservedClientInfo.isNothing() || initialClientInfo.isNothing()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 787); AnnotateMozCrashReason
("MOZ_DIAGNOSTIC_ASSERT" "(" "reservedClientInfo.isNothing() || initialClientInfo.isNothing()"
")"); do { MOZ_CrashSequence(__null, 787); __attribute__((nomerge
)) ::abort(); } while (false); } } while (false)
;
788 NS_ENSURE_TRUE(do { if ((__builtin_expect(!!(!(reservedClientInfo.isNothing(
) || initialClientInfo.isNothing())), 0))) { NS_DebugBreak(NS_DEBUG_WARNING
, "NS_ENSURE_TRUE(" "reservedClientInfo.isNothing() || initialClientInfo.isNothing()"
") failed", nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 790); return NS_ERROR_UNEXPECTED; } } while (false)
789 reservedClientInfo.isNothing() || initialClientInfo.isNothing(),do { if ((__builtin_expect(!!(!(reservedClientInfo.isNothing(
) || initialClientInfo.isNothing())), 0))) { NS_DebugBreak(NS_DEBUG_WARNING
, "NS_ENSURE_TRUE(" "reservedClientInfo.isNothing() || initialClientInfo.isNothing()"
") failed", nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 790); return NS_ERROR_UNEXPECTED; } } while (false)
790 NS_ERROR_UNEXPECTED)do { if ((__builtin_expect(!!(!(reservedClientInfo.isNothing(
) || initialClientInfo.isNothing())), 0))) { NS_DebugBreak(NS_DEBUG_WARNING
, "NS_ENSURE_TRUE(" "reservedClientInfo.isNothing() || initialClientInfo.isNothing()"
") failed", nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 790); return NS_ERROR_UNEXPECTED; } } while (false)
;
791
792 Maybe<ServiceWorkerDescriptor> controller;
793 if (loadInfoArgs.controller().isSome()) {
794 controller.emplace(
795 ServiceWorkerDescriptor(loadInfoArgs.controller().ref()));
796 }
797
798 nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
799 CookieJarSettings::Deserialize(loadInfoArgs.cookieJarSettings(),
800 getter_AddRefs(cookieJarSettings));
801
802 Maybe<RFPTargetSet> overriddenFingerprintingSettings;
803 if (loadInfoArgs.overriddenFingerprintingSettings().isSome()) {
804 overriddenFingerprintingSettings.emplace(
805 loadInfoArgs.overriddenFingerprintingSettings().ref());
806 }
807
808 // Restore the loadingContext for frames using the BrowsingContext's
809 // embedder element. Note that this only works if the embedder is
810 // same-process, so won't be fission compatible.
811 nsCOMPtr<nsINode> loadingContext;
812 RefPtr<BrowsingContext> frameBrowsingContext =
813 BrowsingContext::Get(loadInfoArgs.frameBrowsingContextID());
814 if (frameBrowsingContext) {
815 loadingContext = frameBrowsingContext->GetEmbedderElement();
816 }
817
818 Maybe<bool> isThirdPartyContextToTopWindow;
819 if (loadInfoArgs.isThirdPartyContextToTopWindow().isSome()) {
820 isThirdPartyContextToTopWindow.emplace(
821 loadInfoArgs.isThirdPartyContextToTopWindow().ref());
822 }
823
824 nsCOMPtr<nsIInterceptionInfo> interceptionInfo;
825 if (loadInfoArgs.interceptionInfo().isSome()) {
826 const InterceptionInfoArg& interceptionInfoArg =
827 loadInfoArgs.interceptionInfo().ref();
828 nsCOMPtr<nsIPrincipal> triggeringPrincipal;
829 if (interceptionInfoArg.triggeringPrincipalInfo().isSome()) {
830 auto triggeringPrincipalOrErr = PrincipalInfoToPrincipal(
831 interceptionInfoArg.triggeringPrincipalInfo().ref());
832 if (NS_WARN_IF(triggeringPrincipalOrErr.isErr())NS_warn_if_impl(triggeringPrincipalOrErr.isErr(), "triggeringPrincipalOrErr.isErr()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 832)
) {
833 return triggeringPrincipalOrErr.unwrapErr();
834 }
835 triggeringPrincipal = triggeringPrincipalOrErr.unwrap();
836 }
837
838 RedirectHistoryArray redirectChain;
839 for (const RedirectHistoryEntryInfo& entryInfo :
840 interceptionInfoArg.redirectChain()) {
841 nsCOMPtr<nsIRedirectHistoryEntry> redirectHistoryEntry =
842 RHEntryInfoToRHEntry(entryInfo);
843 NS_ENSURE_TRUE(redirectHistoryEntry, NS_ERROR_UNEXPECTED)do { if ((__builtin_expect(!!(!(redirectHistoryEntry)), 0))) {
NS_DebugBreak(NS_DEBUG_WARNING, "NS_ENSURE_TRUE(" "redirectHistoryEntry"
") failed", nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 843); return NS_ERROR_UNEXPECTED; } } while (false)
;
844 redirectChain.AppendElement(redirectHistoryEntry.forget());
845 }
846
847 interceptionInfo = new InterceptionInfo(
848 triggeringPrincipal, interceptionInfoArg.contentPolicyType(),
849 redirectChain, interceptionInfoArg.fromThirdParty());
850 }
851
852 RefPtr<PolicyContainer> policyContainerToInherit;
853 const auto& policyContainerToInheritArgs =
854 loadInfoArgs.policyContainerToInherit();
855 if (policyContainerToInheritArgs.isSome()) {
856 nsCOMPtr<Document> doc = do_QueryInterface(aCspToInheritLoadingContext);
857 PolicyContainer::FromArgs(policyContainerToInheritArgs.ref(), doc,
858 getter_AddRefs(policyContainerToInherit));
859 }
860
861 RefPtr<mozilla::net::LoadInfo> loadInfo = new mozilla::net::LoadInfo(
862 loadingPrincipal, triggeringPrincipal, principalToInherit,
863 topLevelPrincipal, resultPrincipalURI, cookieJarSettings,
864 policyContainerToInherit, loadInfoArgs.containerPermissionsPolicyInfo(),
865 triggeringRemoteType, loadInfoArgs.sandboxedNullPrincipalID(), clientInfo,
866 reservedClientInfo, initialClientInfo, controller,
867 loadInfoArgs.securityFlags(), loadInfoArgs.sandboxFlags(),
868 loadInfoArgs.contentPolicyType(),
869 loadInfoArgs.serviceWorkerTaintingSynthesized(),
870 static_cast<LoadTainting>(loadInfoArgs.tainting()),
871
872#define DEFINE_ARGUMENT(_t, _n, name, _d) loadInfoArgs.name(),
873 LOADINFO_FOR_EACH_FIELD(DEFINE_ARGUMENT, LOADINFO_DUMMY_SETTER)DEFINE_ARGUMENT(uint32_t, TriggeringSandboxFlags, triggeringSandboxFlags
, 0) DEFINE_ARGUMENT(uint64_t, TriggeringWindowId, triggeringWindowId
, 0) DEFINE_ARGUMENT(uint32_t, TriggeringFirstPartyClassificationFlags
, triggeringFirstPartyClassificationFlags, 0) DEFINE_ARGUMENT
(uint32_t, TriggeringThirdPartyClassificationFlags, triggeringThirdPartyClassificationFlags
, 0) DEFINE_ARGUMENT(bool, BlockAllMixedContent, blockAllMixedContent
, false) DEFINE_ARGUMENT(bool, UpgradeInsecureRequests, upgradeInsecureRequests
, false) DEFINE_ARGUMENT(bool, BrowserUpgradeInsecureRequests
, browserUpgradeInsecureRequests, false) DEFINE_ARGUMENT(bool
, BrowserDidUpgradeInsecureRequests, browserDidUpgradeInsecureRequests
, false) DEFINE_ARGUMENT(bool, BrowserWouldUpgradeInsecureRequests
, browserWouldUpgradeInsecureRequests, false) DEFINE_ARGUMENT
(bool, ForceAllowDataURI, forceAllowDataURI, false) DEFINE_ARGUMENT
(bool, AllowInsecureRedirectToDataURI, allowInsecureRedirectToDataURI
, false) DEFINE_ARGUMENT(dom::ForceMediaDocument, ForceMediaDocument
, forceMediaDocument, dom::ForceMediaDocument(0)) DEFINE_ARGUMENT
(bool, SkipContentPolicyCheckForWebRequest, skipContentPolicyCheckForWebRequest
, false) DEFINE_ARGUMENT(bool, OriginalFrameSrcLoad, originalFrameSrcLoad
, false) DEFINE_ARGUMENT(bool, ForceInheritPrincipalDropped, forceInheritPrincipalDropped
, false) DEFINE_ARGUMENT(uint64_t, InnerWindowID, innerWindowID
, 0) DEFINE_ARGUMENT(uint64_t, BrowsingContextID, browsingContextID
, 0) DEFINE_ARGUMENT(uint64_t, AssociatedBrowsingContextID, associatedBrowsingContextID
, 0) DEFINE_ARGUMENT(uint64_t, FrameBrowsingContextID, frameBrowsingContextID
, 0) DEFINE_ARGUMENT(bool, IsOn3PCBExceptionList, isOn3PCBExceptionList
, false) DEFINE_ARGUMENT(bool, IsFormSubmission, isFormSubmission
, false) DEFINE_ARGUMENT(bool, IsGETRequest, isGETRequest, true
) DEFINE_ARGUMENT(bool, SendCSPViolationEvents, sendCSPViolationEvents
, true) DEFINE_ARGUMENT(uint32_t, RequestBlockingReason, requestBlockingReason
, BLOCKING_REASON_NONE) DEFINE_ARGUMENT(bool, ForcePreflight,
forcePreflight, false) DEFINE_ARGUMENT(bool, IsPreflight, isPreflight
, false) DEFINE_ARGUMENT(bool, DocumentHasUserInteracted, documentHasUserInteracted
, false) DEFINE_ARGUMENT(bool, AllowListFutureDocumentsCreatedFromThisRedirectChain
, allowListFutureDocumentsCreatedFromThisRedirectChain, false
) DEFINE_ARGUMENT(bool, NeedForCheckingAntiTrackingHeuristic,
needForCheckingAntiTrackingHeuristic, false) DEFINE_ARGUMENT
(bool, SkipContentSniffing, skipContentSniffing, false) DEFINE_ARGUMENT
(uint32_t, HttpsOnlyStatus, httpsOnlyStatus, nsILoadInfo::HTTPS_ONLY_UNINITIALIZED
) DEFINE_ARGUMENT(bool, HstsStatus, httpsOnlyStatus, false) DEFINE_ARGUMENT
(bool, HasValidUserGestureActivation, hasValidUserGestureActivation
, false) DEFINE_ARGUMENT(bool, TextDirectiveUserActivation, textDirectiveUserActivation
, false) DEFINE_ARGUMENT(bool, AllowDeprecatedSystemRequests,
allowDeprecatedSystemRequests, false) DEFINE_ARGUMENT(bool, IsInDevToolsContext
, isInDevToolsContext, false) DEFINE_ARGUMENT(bool, ParserCreatedScript
, parserCreatedScript, false) DEFINE_ARGUMENT(Maybe<dom::RequestMode
>, RequestMode, requestMode, Nothing()) DEFINE_ARGUMENT(nsILoadInfo
::StoragePermissionState, StoragePermission, storagePermission
, nsILoadInfo::NoStoragePermission) DEFINE_ARGUMENT(nsILoadInfo
::IPAddressSpace, ParentIpAddressSpace, parentIPAddressSpace,
nsILoadInfo::Unknown) DEFINE_ARGUMENT(nsILoadInfo::IPAddressSpace
, IpAddressSpace, ipAddressSpace, nsILoadInfo::Unknown) DEFINE_ARGUMENT
(bool, IsMetaRefresh, isMetaRefresh, false) DEFINE_ARGUMENT(bool
, ActivatedFromNavigationalPrefetch, activatedFromNavigationalPrefetch
, false) DEFINE_ARGUMENT(bool, PrefetchCandidateMatched, prefetchCandidateMatched
, false) DEFINE_ARGUMENT(bool, IsFromProcessingFrameAttributes
, isFromProcessingFrameAttributes, false) DEFINE_ARGUMENT(bool
, IsMediaRequest, isMediaRequest, false) DEFINE_ARGUMENT(nsILoadInfo
::CrossOriginEmbedderPolicy, LoadingEmbedderPolicy, loadingEmbedderPolicy
, nsILoadInfo::EMBEDDER_POLICY_NULL) DEFINE_ARGUMENT(bool, IsOriginTrialCoepCredentiallessEnabledForTopLevel
, originTrialCoepCredentiallessEnabledForTopLevel, false) DEFINE_ARGUMENT
(nsILoadInfo::HTTPSUpgradeTelemetryType, HttpsUpgradeTelemetry
, httpsUpgradeTelemetry, nsILoadInfo::NOT_INITIALIZED) DEFINE_ARGUMENT
(bool, IsNewWindowTarget, isNewWindowTarget, false)
874#undef DEFINE_ARGUMENT
875
876 loadInfoArgs.initialSecurityCheckDone(),
877 loadInfoArgs.isInThirdPartyContext(), isThirdPartyContextToTopWindow,
878 loadInfoArgs.originAttributes(),
879 std::move(redirectChainIncludingInternalRedirects),
880 std::move(redirectChain), std::move(ancestorPrincipals),
881 ancestorBrowsingContextIDs, loadInfoArgs.corsUnsafeHeaders(),
882 loadInfoArgs.loadTriggeredFromExternal(), loadInfoArgs.cspNonce(),
883 loadInfoArgs.integrityMetadata(),
884 // This function is only called for moving LoadInfo across processes.
885 // Same-document navigation won't cross process boundaries.
886 /* aIsSameDocumentNavigation */ false, overriddenFingerprintingSettings,
887 loadingContext, loadInfoArgs.unstrippedURI(), interceptionInfo,
888 loadInfoArgs.schemelessInput(), loadInfoArgs.userNavigationInvolvement());
889
890 loadInfo.forget(outLoadInfo);
891 return NS_OK;
892}
893
894void LoadInfoToParentLoadInfoForwarder(
895 nsILoadInfo* aLoadInfo, ParentLoadInfoForwarderArgs* aForwarderArgsOut) {
896 Maybe<IPCServiceWorkerDescriptor> ipcController;
897 Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController());
898 if (controller.isSome()) {
899 ipcController.emplace(controller.ref().ToIPC());
900 }
901
902 uint32_t tainting = nsILoadInfo::TAINTING_BASIC;
903 (void)aLoadInfo->GetTainting(&tainting);
904
905 Maybe<CookieJarSettingsArgs> cookieJarSettingsArgs;
906
907 nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
908 nsresult rv =
909 aLoadInfo->GetCookieJarSettings(getter_AddRefs(cookieJarSettings));
910 CookieJarSettings* cs =
911 static_cast<CookieJarSettings*>(cookieJarSettings.get());
912 if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1))) && cookieJarSettings && cs->HasBeenChanged()) {
913 CookieJarSettingsArgs args;
914 cs->Serialize(args);
915 cookieJarSettingsArgs = Some(args);
916 }
917
918 nsCOMPtr<nsIURI> unstrippedURI;
919 (void)aLoadInfo->GetUnstrippedURI(getter_AddRefs(unstrippedURI));
920
921 Maybe<bool> isThirdPartyContextToTopWindow;
922 if (static_cast<LoadInfo*>(aLoadInfo)
923 ->HasIsThirdPartyContextToTopWindowSet()) {
924 isThirdPartyContextToTopWindow.emplace(
925 aLoadInfo->GetIsThirdPartyContextToTopWindow());
926 }
927
928 Maybe<RFPTargetSet> overriddenFingerprintingSettingsArg;
929 Maybe<RFPTargetSet> overriddenFingerprintingSettings =
930 aLoadInfo->GetOverriddenFingerprintingSettings();
931
932 if (overriddenFingerprintingSettings) {
933 overriddenFingerprintingSettingsArg =
934 Some(overriddenFingerprintingSettings.ref());
935 }
936
937 Maybe<RequestMode> requestMode;
938 aLoadInfo->GetRequestMode(&requestMode);
939
940 *aForwarderArgsOut = ParentLoadInfoForwarderArgs(
941 aLoadInfo->GetAllowInsecureRedirectToDataURI(), ipcController, tainting,
942 aLoadInfo->GetSkipContentSniffing(), aLoadInfo->GetHttpsOnlyStatus(),
943 aLoadInfo->GetSchemelessInput(), aLoadInfo->GetHttpsUpgradeTelemetry(),
944 aLoadInfo->GetHstsStatus(), aLoadInfo->GetHasValidUserGestureActivation(),
945 aLoadInfo->GetTextDirectiveUserActivation(),
946 aLoadInfo->GetAllowDeprecatedSystemRequests(),
947 aLoadInfo->GetIsInDevToolsContext(), aLoadInfo->GetParserCreatedScript(),
948 requestMode, aLoadInfo->GetTriggeringSandboxFlags(),
949 aLoadInfo->GetTriggeringWindowId(),
950 aLoadInfo->GetServiceWorkerTaintingSynthesized(),
951 aLoadInfo->GetDocumentHasUserInteracted(),
952 aLoadInfo->GetAllowListFutureDocumentsCreatedFromThisRedirectChain(),
953 cookieJarSettingsArgs, aLoadInfo->GetContainerPermissionsPolicyInfo(),
954 aLoadInfo->GetRequestBlockingReason(), aLoadInfo->GetStoragePermission(),
955 overriddenFingerprintingSettingsArg, aLoadInfo->GetIsMetaRefresh(),
956 isThirdPartyContextToTopWindow, aLoadInfo->GetIsInThirdPartyContext(),
957 aLoadInfo->GetIsOn3PCBExceptionList(), unstrippedURI,
958 aLoadInfo->GetUserNavigationInvolvement());
959}
960
961nsresult MergeParentLoadInfoForwarder(
962 ParentLoadInfoForwarderArgs const& aForwarderArgs, nsILoadInfo* aLoadInfo) {
963 nsresult rv;
964
965 rv = aLoadInfo->SetAllowInsecureRedirectToDataURI(
966 aForwarderArgs.allowInsecureRedirectToDataURI());
967 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 967); return rv; } } while (false)
;
968
969 aLoadInfo->ClearController();
970 auto& controller = aForwarderArgs.controller();
971 if (controller.isSome()) {
972 aLoadInfo->SetController(ServiceWorkerDescriptor(controller.ref()));
973 }
974
975 if (aForwarderArgs.serviceWorkerTaintingSynthesized()) {
976 aLoadInfo->SynthesizeServiceWorkerTainting(
977 static_cast<LoadTainting>(aForwarderArgs.tainting()));
978 } else {
979 aLoadInfo->MaybeIncreaseTainting(aForwarderArgs.tainting());
980 }
981 rv = aLoadInfo->SetTextDirectiveUserActivation(
982 aForwarderArgs.textDirectiveUserActivation());
983 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 983); return rv; } } while (false)
;
984
985 rv = aLoadInfo->SetSkipContentSniffing(aForwarderArgs.skipContentSniffing());
986 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 986); return rv; } } while (false)
;
987
988 rv = aLoadInfo->SetHttpsOnlyStatus(aForwarderArgs.httpsOnlyStatus());
989 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 989); return rv; } } while (false)
;
990
991 rv = aLoadInfo->SetSchemelessInput(aForwarderArgs.schemelessInput());
992 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 992); return rv; } } while (false)
;
993
994 rv = aLoadInfo->SetHttpsUpgradeTelemetry(
995 aForwarderArgs.httpsUpgradeTelemetry());
996 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 996); return rv; } } while (false)
;
997
998 rv = aLoadInfo->SetHstsStatus(aForwarderArgs.hstsStatus());
999 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 999); return rv; } } while (false)
;
1000
1001 rv = aLoadInfo->SetTriggeringSandboxFlags(
1002 aForwarderArgs.triggeringSandboxFlags());
1003 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1003); return rv; } } while (false)
;
1004
1005 rv = aLoadInfo->SetTriggeringWindowId(aForwarderArgs.triggeringWindowId());
1006 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1006); return rv; } } while (false)
;
1007
1008 rv = aLoadInfo->SetHasValidUserGestureActivation(
1009 aForwarderArgs.hasValidUserGestureActivation());
1010 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1010); return rv; } } while (false)
;
1011
1012 rv = aLoadInfo->SetAllowDeprecatedSystemRequests(
1013 aForwarderArgs.allowDeprecatedSystemRequests());
1014 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1014); return rv; } } while (false)
;
1015
1016 rv = aLoadInfo->SetIsInDevToolsContext(aForwarderArgs.isInDevToolsContext());
1017 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1017); return rv; } } while (false)
;
1018
1019 rv = aLoadInfo->SetParserCreatedScript(aForwarderArgs.parserCreatedScript());
1020 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1020); return rv; } } while (false)
;
1021
1022 rv = aLoadInfo->SetRequestMode(aForwarderArgs.requestMode());
1023 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1023); return rv; } } while (false)
;
1024
1025 MOZ_ALWAYS_SUCCEEDS(aLoadInfo->SetDocumentHasUserInteracted(do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl
(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted
()))), 1)))), 1))) { } else { do { do { } while (false); MOZ_ReportCrash
("" "NS_SUCCEEDED(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted()))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1026); AnnotateMozCrashReason
("MOZ_CRASH(" "NS_SUCCEEDED(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted()))"
")"); do { MOZ_CrashSequence(__null, 1026); __attribute__((nomerge
)) ::abort(); } while (false); } while (false); } } while (false
)
1026 aForwarderArgs.documentHasUserInteracted()))do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl
(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted
()))), 1)))), 1))) { } else { do { do { } while (false); MOZ_ReportCrash
("" "NS_SUCCEEDED(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted()))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1026); AnnotateMozCrashReason
("MOZ_CRASH(" "NS_SUCCEEDED(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted()))"
")"); do { MOZ_CrashSequence(__null, 1026); __attribute__((nomerge
)) ::abort(); } while (false); } while (false); } } while (false
)
;
1027 MOZ_ALWAYS_SUCCEEDS(do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl
(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain
( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain
()))), 1)))), 1))) { } else { do { do { } while (false); MOZ_ReportCrash
("" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1030); AnnotateMozCrashReason
("MOZ_CRASH(" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))"
")"); do { MOZ_CrashSequence(__null, 1030); __attribute__((nomerge
)) ::abort(); } while (false); } while (false); } } while (false
)
1028 aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain(do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl
(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain
( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain
()))), 1)))), 1))) { } else { do { do { } while (false); MOZ_ReportCrash
("" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1030); AnnotateMozCrashReason
("MOZ_CRASH(" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))"
")"); do { MOZ_CrashSequence(__null, 1030); __attribute__((nomerge
)) ::abort(); } while (false); } while (false); } } while (false
)
1029 aForwarderArgsdo { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl
(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain
( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain
()))), 1)))), 1))) { } else { do { do { } while (false); MOZ_ReportCrash
("" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1030); AnnotateMozCrashReason
("MOZ_CRASH(" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))"
")"); do { MOZ_CrashSequence(__null, 1030); __attribute__((nomerge
)) ::abort(); } while (false); } while (false); } } while (false
)
1030 .allowListFutureDocumentsCreatedFromThisRedirectChain()))do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl
(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain
( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain
()))), 1)))), 1))) { } else { do { do { } while (false); MOZ_ReportCrash
("" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1030); AnnotateMozCrashReason
("MOZ_CRASH(" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))"
")"); do { MOZ_CrashSequence(__null, 1030); __attribute__((nomerge
)) ::abort(); } while (false); } while (false); } } while (false
)
;
1031 MOZ_ALWAYS_SUCCEEDS(aLoadInfo->SetRequestBlockingReason(do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl
(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason
()))), 1)))), 1))) { } else { do { do { } while (false); MOZ_ReportCrash
("" "NS_SUCCEEDED(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason()))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1032); AnnotateMozCrashReason
("MOZ_CRASH(" "NS_SUCCEEDED(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason()))"
")"); do { MOZ_CrashSequence(__null, 1032); __attribute__((nomerge
)) ::abort(); } while (false); } while (false); } } while (false
)
1032 aForwarderArgs.requestBlockingReason()))do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl
(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason
()))), 1)))), 1))) { } else { do { do { } while (false); MOZ_ReportCrash
("" "NS_SUCCEEDED(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason()))"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1032); AnnotateMozCrashReason
("MOZ_CRASH(" "NS_SUCCEEDED(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason()))"
")"); do { MOZ_CrashSequence(__null, 1032); __attribute__((nomerge
)) ::abort(); } while (false); } while (false); } } while (false
)
;
1033
1034 const Maybe<CookieJarSettingsArgs>& cookieJarSettingsArgs =
1035 aForwarderArgs.cookieJarSettings();
1036 if (cookieJarSettingsArgs.isSome()) {
1037 nsCOMPtr<nsICookieJarSettings> cookieJarSettings;
1038 nsresult rv =
1039 aLoadInfo->GetCookieJarSettings(getter_AddRefs(cookieJarSettings));
1040 if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1))) && cookieJarSettings) {
1041 nsCOMPtr<nsICookieJarSettings> mergedCookieJarSettings;
1042 mergedCookieJarSettings =
1043 static_cast<CookieJarSettings*>(cookieJarSettings.get())
1044 ->Merge(cookieJarSettingsArgs.ref());
1045 aLoadInfo->SetCookieJarSettings(mergedCookieJarSettings);
1046 }
1047 }
1048
1049 rv = aLoadInfo->SetStoragePermission(aForwarderArgs.storagePermission());
1050 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1050); return rv; } } while (false)
;
1051
1052 rv = aLoadInfo->SetIsMetaRefresh(aForwarderArgs.isMetaRefresh());
1053 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1053); return rv; } } while (false)
;
1054
1055 const Maybe<RFPTargetSet>& overriddenFingerprintingSettings =
1056 aForwarderArgs.overriddenFingerprintingSettings();
1057 if (overriddenFingerprintingSettings.isSome()) {
1058 aLoadInfo->SetOverriddenFingerprintingSettings(
1059 overriddenFingerprintingSettings.ref());
1060 }
1061
1062 static_cast<LoadInfo*>(aLoadInfo)->ClearIsThirdPartyContextToTopWindow();
1063 if (aForwarderArgs.isThirdPartyContextToTopWindow().isSome()) {
1064 rv = aLoadInfo->SetIsThirdPartyContextToTopWindow(
1065 aForwarderArgs.isThirdPartyContextToTopWindow().ref());
1066 }
1067 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1067); return rv; } } while (false)
;
1068
1069 rv = aLoadInfo->SetIsInThirdPartyContext(
1070 aForwarderArgs.isInThirdPartyContext());
1071 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1071); return rv; } } while (false)
;
1072
1073 rv = aLoadInfo->SetIsOn3PCBExceptionList(
1074 aForwarderArgs.isOn3PCBExceptionList());
1075 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1075); return rv; } } while (false)
;
1076
1077 rv = aLoadInfo->SetUnstrippedURI(aForwarderArgs.unstrippedURI());
1078 NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl
(__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName
(__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with "
"result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t
>(__rv), name ? " (" : "", name ? name : "", name ? ")" : ""
); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../ipc/glue/BackgroundUtils.cpp"
, 1078); return rv; } } while (false)
;
1079
1080 if (aForwarderArgs.containerPermissionsPolicyInfo()) {
1081 aLoadInfo->SetContainerPermissionsPolicyInfo(
1082 *aForwarderArgs.containerPermissionsPolicyInfo());
1083 }
1084
1085 aLoadInfo->SetUserNavigationInvolvement(
1086 uint8_t(aForwarderArgs.userNavigationInvolvement()));
1087
1088 return NS_OK;
1089}
1090
1091void LoadInfoToChildLoadInfoForwarder(
1092 nsILoadInfo* aLoadInfo, ChildLoadInfoForwarderArgs* aForwarderArgsOut) {
1093 Maybe<IPCClientInfo> ipcReserved;
1094 Maybe<ClientInfo> reserved(aLoadInfo->GetReservedClientInfo());
1095 if (reserved.isSome()) {
1096 ipcReserved.emplace(reserved.ref().ToIPC());
1097 }
1098
1099 Maybe<IPCClientInfo> ipcInitial;
1100 Maybe<ClientInfo> initial(aLoadInfo->GetInitialClientInfo());
1101 if (initial.isSome()) {
1102 ipcInitial.emplace(initial.ref().ToIPC());
1103 }
1104
1105 Maybe<IPCServiceWorkerDescriptor> ipcController;
1106 Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController());
1107 if (controller.isSome()) {
1108 ipcController.emplace(controller.ref().ToIPC());
1109 }
1110
1111 *aForwarderArgsOut =
1112 ChildLoadInfoForwarderArgs(ipcReserved, ipcInitial, ipcController,
1113 aLoadInfo->GetRequestBlockingReason());
1114}
1115
1116nsresult MergeChildLoadInfoForwarder(
1117 const ChildLoadInfoForwarderArgs& aForwarderArgs, nsILoadInfo* aLoadInfo) {
1118 Maybe<ClientInfo> reservedClientInfo;
1119 auto& ipcReserved = aForwarderArgs.reservedClientInfo();
1120 if (ipcReserved.isSome()) {
1121 reservedClientInfo.emplace(ClientInfo(ipcReserved.ref()));
1122 }
1123
1124 Maybe<ClientInfo> initialClientInfo;
1125 auto& ipcInitial = aForwarderArgs.initialClientInfo();
1126 if (ipcInitial.isSome()) {
1127 initialClientInfo.emplace(ClientInfo(ipcInitial.ref()));
1128 }
1129
1130 // There should only be at most one reserved or initial ClientInfo.
1131 if (NS_WARN_IF(reservedClientInfo.isSome() && initialClientInfo.isSome())NS_warn_if_impl(reservedClientInfo.isSome() && initialClientInfo
.isSome(), "reservedClientInfo.isSome() && initialClientInfo.isSome()"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1131)
) {
1132 return NS_ERROR_FAILURE;
1133 }
1134
1135 // If we received no reserved or initial ClientInfo, then we must not
1136 // already have one set. There are no use cases where this should
1137 // happen and we don't have a way to clear the current value.
1138 if (NS_WARN_IF(reservedClientInfo.isNothing() &&NS_warn_if_impl(reservedClientInfo.isNothing() && initialClientInfo
.isNothing() && (aLoadInfo->GetReservedClientInfo(
).isSome() || aLoadInfo->GetInitialClientInfo().isSome()),
"reservedClientInfo.isNothing() && initialClientInfo.isNothing() && (aLoadInfo->GetReservedClientInfo().isSome() || aLoadInfo->GetInitialClientInfo().isSome())"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1141)
1139 initialClientInfo.isNothing() &&NS_warn_if_impl(reservedClientInfo.isNothing() && initialClientInfo
.isNothing() && (aLoadInfo->GetReservedClientInfo(
).isSome() || aLoadInfo->GetInitialClientInfo().isSome()),
"reservedClientInfo.isNothing() && initialClientInfo.isNothing() && (aLoadInfo->GetReservedClientInfo().isSome() || aLoadInfo->GetInitialClientInfo().isSome())"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1141)
1140 (aLoadInfo->GetReservedClientInfo().isSome() ||NS_warn_if_impl(reservedClientInfo.isNothing() && initialClientInfo
.isNothing() && (aLoadInfo->GetReservedClientInfo(
).isSome() || aLoadInfo->GetInitialClientInfo().isSome()),
"reservedClientInfo.isNothing() && initialClientInfo.isNothing() && (aLoadInfo->GetReservedClientInfo().isSome() || aLoadInfo->GetInitialClientInfo().isSome())"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1141)
1141 aLoadInfo->GetInitialClientInfo().isSome()))NS_warn_if_impl(reservedClientInfo.isNothing() && initialClientInfo
.isNothing() && (aLoadInfo->GetReservedClientInfo(
).isSome() || aLoadInfo->GetInitialClientInfo().isSome()),
"reservedClientInfo.isNothing() && initialClientInfo.isNothing() && (aLoadInfo->GetReservedClientInfo().isSome() || aLoadInfo->GetInitialClientInfo().isSome())"
, "./../../../ipc/glue/BackgroundUtils.cpp", 1141)
) {
1142 return NS_ERROR_FAILURE;
1143 }
1144
1145 if (reservedClientInfo.isSome()) {
1146 // We need to override here instead of simply set the value. This
1147 // allows us to change the reserved client. This is necessary when
1148 // the ClientChannelHelper created a new reserved client in the
1149 // child-side of the redirect.
1150 aLoadInfo->OverrideReservedClientInfoInParent(reservedClientInfo.ref());
1151 } else if (initialClientInfo.isSome()) {
1152 aLoadInfo->SetInitialClientInfo(initialClientInfo.ref());
1153 }
1154
1155 aLoadInfo->ClearController();
1156 auto& controller = aForwarderArgs.controller();
1157 if (controller.isSome()) {
1158 aLoadInfo->SetController(ServiceWorkerDescriptor(controller.ref()));
1159 }
1160
1161 uint32_t blockingReason = aForwarderArgs.requestBlockingReason();
1162 if (blockingReason) {
1163 // We only want to override when non-null, so that any earlier set non-null
1164 // value is not reverted to 0.
1165 aLoadInfo->SetRequestBlockingReason(blockingReason);
1166 }
1167
1168 return NS_OK;
1169}
1170
1171} // namespace ipc
1172} // namespace mozilla