File: | var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp |
Warning: | line 527, column 7 Value stored to 'rv' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
5 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | |
7 | #include "BackgroundUtils.h" |
8 | |
9 | #include "MainThreadUtils.h" |
10 | #include "mozilla/Assertions.h" |
11 | #include "mozilla/BasePrincipal.h" |
12 | #include "mozilla/ContentPrincipal.h" |
13 | #include "mozilla/NullPrincipal.h" |
14 | #include "mozilla/SystemPrincipal.h" |
15 | #include "mozilla/ipc/PBackgroundSharedTypes.h" |
16 | #include "mozilla/ipc/URIUtils.h" |
17 | #include "mozilla/net/CookieJarSettings.h" |
18 | #include "mozilla/net/InterceptionInfo.h" |
19 | #include "mozilla/net/NeckoChannelParams.h" |
20 | #include "ExpandedPrincipal.h" |
21 | #include "nsIScriptSecurityManager.h" |
22 | #include "nsIURI.h" |
23 | #include "nsNetUtil.h" |
24 | #include "mozilla/LoadInfo.h" |
25 | #include "nsContentUtils.h" |
26 | #include "nsString.h" |
27 | #include "nsTArray.h" |
28 | #include "mozilla/nsRedirectHistoryEntry.h" |
29 | #include "mozilla/dom/nsCSPUtils.h" |
30 | #include "mozilla/dom/nsCSPContext.h" |
31 | #include "mozilla/dom/BrowsingContext.h" |
32 | #include "mozilla/dom/CanonicalBrowsingContext.h" |
33 | #include "mozilla/dom/Document.h" |
34 | #include "mozilla/dom/WindowGlobalParent.h" |
35 | #include "mozilla/LoadInfo.h" |
36 | |
37 | using namespace mozilla::dom; |
38 | using namespace mozilla::net; |
39 | |
40 | namespace mozilla { |
41 | |
42 | namespace ipc { |
43 | |
44 | Result<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" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 46); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aPrincipalInfo.type() != PrincipalInfo::T__None" ")"); do { *((volatile int*)__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", "/var/lib/jenkins/workspace/firefox-scan-build/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)", "/var/lib/jenkins/workspace/firefox-scan-build/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)", "/var/lib/jenkins/workspace/firefox-scan-build/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)", "/var/lib/jenkins/workspace/firefox-scan-build/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", "/var/lib/jenkins/workspace/firefox-scan-build/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)", "/var/lib/jenkins/workspace/firefox-scan-build/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)", "/var/lib/jenkins/workspace/firefox-scan-build/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)", "/var/lib/jenkins/workspace/firefox-scan-build/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)" , "/var/lib/jenkins/workspace/firefox-scan-build/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()" , "/var/lib/jenkins/workspace/firefox-scan-build/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 | |
159 | bool 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" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 161); AnnotateMozCrashReason("MOZ_RELEASE_ASSERT" "(" "aLeft.type() == PrincipalInfo::TContentPrincipalInfo || aLeft.type() == PrincipalInfo::TSystemPrincipalInfo" ")"); do { *((volatile int*)__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" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 161); AnnotateMozCrashReason("MOZ_RELEASE_ASSERT" "(" "aLeft.type() == PrincipalInfo::TContentPrincipalInfo || aLeft.type() == PrincipalInfo::TSystemPrincipalInfo" ")"); do { *((volatile int*)__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" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 163); AnnotateMozCrashReason("MOZ_RELEASE_ASSERT" "(" "aRight.type() == PrincipalInfo::TContentPrincipalInfo || aRight.type() == PrincipalInfo::TSystemPrincipalInfo" ")"); do { *((volatile int*)__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" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 163); AnnotateMozCrashReason("MOZ_RELEASE_ASSERT" "(" "aRight.type() == PrincipalInfo::TContentPrincipalInfo || aRight.type() == PrincipalInfo::TSystemPrincipalInfo" ")"); do { *((volatile int*)__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 | |
182 | already_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()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 185); AnnotateMozCrashReason("MOZ_ASSERT" "(" "NS_IsMainThread()" ")"); do { *((volatile int*)__null) = 185; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
186 | |
187 | nsresult stackResult; |
188 | nsresult& rv = aOptionalResult ? *aOptionalResult : stackResult; |
189 | |
190 | RefPtr<nsCSPContext> csp = new 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)", "/var/lib/jenkins/workspace/firefox-scan-build/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()" , "/var/lib/jenkins/workspace/firefox-scan-build/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)", "/var/lib/jenkins/workspace/firefox-scan-build/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)", "/var/lib/jenkins/workspace/firefox-scan-build/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 | |
228 | nsresult 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()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 229); AnnotateMozCrashReason("MOZ_ASSERT" "(" "NS_IsMainThread()" ")"); do { *((volatile int*)__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", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 230); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aCSP" ")"); do { *((volatile int*)__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", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 231); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aCSPInfo" ")" ); do { *((volatile int*)__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)", "/var/lib/jenkins/workspace/firefox-scan-build/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 | nsTArray<ContentSecurityPolicy> policies; |
259 | static_cast<nsCSPContext*>(aCSP)->SerializePolicies(policies); |
260 | |
261 | *aCSPInfo = CSPInfo(std::move(policies), requestingPrincipalInfo, selfURISpec, |
262 | referrer, windowID, skipAllowInlineStyleCheck); |
263 | return NS_OK; |
264 | } |
265 | |
266 | nsresult PrincipalToPrincipalInfo(nsIPrincipal* aPrincipal, |
267 | PrincipalInfo* aPrincipalInfo, |
268 | bool aSkipBaseDomain) { |
269 | 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", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 269); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aPrincipal" ")" ); do { *((volatile int*)__null) = 269; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
270 | 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" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 270); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aPrincipalInfo" ")"); do { *((volatile int*)__null) = 270; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
271 | |
272 | nsresult rv; |
273 | if (aPrincipal->GetIsNullPrincipal()) { |
274 | nsAutoCString spec; |
275 | rv = aPrincipal->GetAsciiSpec(spec); |
276 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 276)) { |
277 | return rv; |
278 | } |
279 | |
280 | *aPrincipalInfo = |
281 | NullPrincipalInfo(aPrincipal->OriginAttributesRef(), spec); |
282 | return NS_OK; |
283 | } |
284 | |
285 | if (aPrincipal->IsSystemPrincipal()) { |
286 | *aPrincipalInfo = SystemPrincipalInfo(); |
287 | return NS_OK; |
288 | } |
289 | |
290 | // might be an expanded principal |
291 | auto* basePrin = BasePrincipal::Cast(aPrincipal); |
292 | if (basePrin->Is<ExpandedPrincipal>()) { |
293 | auto* expanded = basePrin->As<ExpandedPrincipal>(); |
294 | |
295 | nsTArray<PrincipalInfo> allowlistInfo; |
296 | PrincipalInfo info; |
297 | |
298 | for (auto& prin : expanded->AllowList()) { |
299 | rv = PrincipalToPrincipalInfo(prin, &info, aSkipBaseDomain); |
300 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 300)) { |
301 | return rv; |
302 | } |
303 | // append that spec to the allowlist |
304 | allowlistInfo.AppendElement(info); |
305 | } |
306 | |
307 | *aPrincipalInfo = ExpandedPrincipalInfo(aPrincipal->OriginAttributesRef(), |
308 | std::move(allowlistInfo)); |
309 | return NS_OK; |
310 | } |
311 | |
312 | nsAutoCString spec; |
313 | rv = aPrincipal->GetAsciiSpec(spec); |
314 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 314)) { |
315 | return rv; |
316 | } |
317 | |
318 | nsCString originNoSuffix; |
319 | rv = aPrincipal->GetOriginNoSuffix(originNoSuffix); |
320 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 320)) { |
321 | return rv; |
322 | } |
323 | |
324 | nsCOMPtr<nsIURI> domainUri; |
325 | rv = aPrincipal->GetDomain(getter_AddRefs(domainUri)); |
326 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 326)) { |
327 | return rv; |
328 | } |
329 | |
330 | Maybe<nsCString> domain; |
331 | if (domainUri) { |
332 | domain.emplace(); |
333 | rv = domainUri->GetSpec(domain.ref()); |
334 | if (NS_WARN_IF(NS_FAILED(rv))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(rv )), 0))), "NS_FAILED(rv)", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 334)) { |
335 | return rv; |
336 | } |
337 | } |
338 | |
339 | // This attribute is not crucial. |
340 | nsCString baseDomain; |
341 | if (aSkipBaseDomain) { |
342 | baseDomain.SetIsVoid(true); |
343 | } else { |
344 | if (NS_FAILED(aPrincipal->GetBaseDomain(baseDomain))((bool)(__builtin_expect(!!(NS_FAILED_impl(aPrincipal->GetBaseDomain (baseDomain))), 0)))) { |
345 | // No warning here. Some principal URLs do not have a base-domain. |
346 | baseDomain.SetIsVoid(true); |
347 | } |
348 | } |
349 | |
350 | *aPrincipalInfo = |
351 | ContentPrincipalInfo(aPrincipal->OriginAttributesRef(), originNoSuffix, |
352 | spec, domain, baseDomain); |
353 | return NS_OK; |
354 | } |
355 | |
356 | bool IsPrincipalInfoPrivate(const PrincipalInfo& aPrincipalInfo) { |
357 | if (aPrincipalInfo.type() != ipc::PrincipalInfo::TContentPrincipalInfo) { |
358 | return false; |
359 | } |
360 | |
361 | const ContentPrincipalInfo& info = aPrincipalInfo.get_ContentPrincipalInfo(); |
362 | return info.attrs().IsPrivateBrowsing(); |
363 | } |
364 | |
365 | already_AddRefed<nsIRedirectHistoryEntry> RHEntryInfoToRHEntry( |
366 | const RedirectHistoryEntryInfo& aRHEntryInfo) { |
367 | auto principalOrErr = PrincipalInfoToPrincipal(aRHEntryInfo.principalInfo()); |
368 | if (NS_WARN_IF(principalOrErr.isErr())NS_warn_if_impl(principalOrErr.isErr(), "principalOrErr.isErr()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 368)) { |
369 | return nullptr; |
370 | } |
371 | |
372 | nsCOMPtr<nsIPrincipal> principal = principalOrErr.unwrap(); |
373 | nsCOMPtr<nsIURI> referrerUri = DeserializeURI(aRHEntryInfo.referrerUri()); |
374 | |
375 | nsCOMPtr<nsIRedirectHistoryEntry> entry = new nsRedirectHistoryEntry( |
376 | principal, referrerUri, aRHEntryInfo.remoteAddress()); |
377 | |
378 | return entry.forget(); |
379 | } |
380 | |
381 | nsresult RHEntryToRHEntryInfo(nsIRedirectHistoryEntry* aRHEntry, |
382 | RedirectHistoryEntryInfo* aRHEntryInfo) { |
383 | 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", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 383); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aRHEntry" ")" ); do { *((volatile int*)__null) = 383; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
384 | 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", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 384); AnnotateMozCrashReason("MOZ_ASSERT" "(" "aRHEntryInfo" ")"); do { *((volatile int*)__null) = 384; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
385 | |
386 | nsresult rv; |
387 | aRHEntry->GetRemoteAddress(aRHEntryInfo->remoteAddress()); |
388 | |
389 | nsCOMPtr<nsIURI> referrerUri; |
390 | rv = aRHEntry->GetReferrerURI(getter_AddRefs(referrerUri)); |
391 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 391); return rv; } } while (false); |
392 | SerializeURI(referrerUri, aRHEntryInfo->referrerUri()); |
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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 396); return rv; } } while (false); |
397 | |
398 | return PrincipalToPrincipalInfo(principal, &aRHEntryInfo->principalInfo()); |
399 | } |
400 | |
401 | nsresult 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, "/var/lib/jenkins/workspace/firefox-scan-build/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, "/var/lib/jenkins/workspace/firefox-scan-build/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, "/var/lib/jenkins/workspace/firefox-scan-build/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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 428); return rv; } } while (false); |
429 | } |
430 | |
431 | Maybe<URIParams> optionalResultPrincipalURI; |
432 | nsCOMPtr<nsIURI> resultPrincipalURI; |
433 | Unused << aLoadInfo->GetResultPrincipalURI( |
434 | getter_AddRefs(resultPrincipalURI)); |
435 | if (resultPrincipalURI) { |
436 | SerializeURI(resultPrincipalURI, optionalResultPrincipalURI); |
437 | } |
438 | |
439 | nsCString triggeringRemoteType; |
440 | rv = aLoadInfo->GetTriggeringRemoteType(triggeringRemoteType); |
441 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 441); return rv; } } while (false); |
442 | |
443 | nsTArray<RedirectHistoryEntryInfo> redirectChainIncludingInternalRedirects; |
444 | for (const nsCOMPtr<nsIRedirectHistoryEntry>& redirectEntry : |
445 | aLoadInfo->RedirectChainIncludingInternalRedirects()) { |
446 | RedirectHistoryEntryInfo* entry = |
447 | redirectChainIncludingInternalRedirects.AppendElement(); |
448 | rv = RHEntryToRHEntryInfo(redirectEntry, entry); |
449 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 449); return rv; } } while (false); |
450 | } |
451 | |
452 | nsTArray<RedirectHistoryEntryInfo> redirectChain; |
453 | for (const nsCOMPtr<nsIRedirectHistoryEntry>& redirectEntry : |
454 | aLoadInfo->RedirectChain()) { |
455 | RedirectHistoryEntryInfo* entry = redirectChain.AppendElement(); |
456 | rv = RHEntryToRHEntryInfo(redirectEntry, entry); |
457 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 457); return rv; } } while (false); |
458 | } |
459 | |
460 | Maybe<IPCClientInfo> ipcClientInfo; |
461 | const Maybe<ClientInfo>& clientInfo = aLoadInfo->GetClientInfo(); |
462 | if (clientInfo.isSome()) { |
463 | ipcClientInfo.emplace(clientInfo.ref().ToIPC()); |
464 | } |
465 | |
466 | Maybe<IPCClientInfo> ipcReservedClientInfo; |
467 | const Maybe<ClientInfo>& reservedClientInfo = |
468 | aLoadInfo->GetReservedClientInfo(); |
469 | if (reservedClientInfo.isSome()) { |
470 | ipcReservedClientInfo.emplace(reservedClientInfo.ref().ToIPC()); |
471 | } |
472 | |
473 | Maybe<IPCClientInfo> ipcInitialClientInfo; |
474 | const Maybe<ClientInfo>& initialClientInfo = |
475 | aLoadInfo->GetInitialClientInfo(); |
476 | if (initialClientInfo.isSome()) { |
477 | ipcInitialClientInfo.emplace(initialClientInfo.ref().ToIPC()); |
478 | } |
479 | |
480 | Maybe<IPCServiceWorkerDescriptor> ipcController; |
481 | const Maybe<ServiceWorkerDescriptor>& controller = aLoadInfo->GetController(); |
482 | if (controller.isSome()) { |
483 | ipcController.emplace(controller.ref().ToIPC()); |
484 | } |
485 | |
486 | nsAutoString cspNonce; |
487 | Unused << 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))" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 487); |
488 | |
489 | nsAutoString integrityMetadata; |
490 | Unused << NS_WARN_IF(NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(aLoadInfo ->GetIntegrityMetadata(integrityMetadata))), 0))), "NS_FAILED(aLoadInfo->GetIntegrityMetadata(integrityMetadata))" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 491) |
491 | NS_FAILED(aLoadInfo->GetIntegrityMetadata(integrityMetadata)))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(aLoadInfo ->GetIntegrityMetadata(integrityMetadata))), 0))), "NS_FAILED(aLoadInfo->GetIntegrityMetadata(integrityMetadata))" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 491); |
492 | |
493 | nsCOMPtr<nsICookieJarSettings> cookieJarSettings; |
494 | rv = aLoadInfo->GetCookieJarSettings(getter_AddRefs(cookieJarSettings)); |
495 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 495); return rv; } } while (false); |
496 | |
497 | CookieJarSettingsArgs cookieJarSettingsArgs; |
498 | static_cast<CookieJarSettings*>(cookieJarSettings.get()) |
499 | ->Serialize(cookieJarSettingsArgs); |
500 | |
501 | Maybe<CSPInfo> maybeCspToInheritInfo; |
502 | nsCOMPtr<nsIContentSecurityPolicy> cspToInherit = |
503 | aLoadInfo->GetCspToInherit(); |
504 | if (cspToInherit) { |
505 | CSPInfo cspToInheritInfo; |
506 | Unused << NS_WARN_IF(NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(CSPToCSPInfo (cspToInherit, &cspToInheritInfo))), 0))), "NS_FAILED(CSPToCSPInfo(cspToInherit, &cspToInheritInfo))" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 507) |
507 | NS_FAILED(CSPToCSPInfo(cspToInherit, &cspToInheritInfo)))NS_warn_if_impl(((bool)(__builtin_expect(!!(NS_FAILED_impl(CSPToCSPInfo (cspToInherit, &cspToInheritInfo))), 0))), "NS_FAILED(CSPToCSPInfo(cspToInherit, &cspToInheritInfo))" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 507); |
508 | maybeCspToInheritInfo.emplace(cspToInheritInfo); |
509 | } |
510 | |
511 | nsCOMPtr<nsIURI> unstrippedURI; |
512 | Unused << aLoadInfo->GetUnstrippedURI(getter_AddRefs(unstrippedURI)); |
513 | |
514 | Maybe<bool> isThirdPartyContextToTopWindow; |
515 | if (static_cast<LoadInfo*>(aLoadInfo) |
516 | ->HasIsThirdPartyContextToTopWindowSet()) { |
517 | isThirdPartyContextToTopWindow.emplace( |
518 | aLoadInfo->GetIsThirdPartyContextToTopWindow()); |
519 | } |
520 | |
521 | Maybe<InterceptionInfoArg> interceptionInfoArg; |
522 | nsIInterceptionInfo* interceptionInfo = aLoadInfo->InterceptionInfo(); |
523 | if (interceptionInfo) { |
524 | Maybe<PrincipalInfo> triggeringPrincipalInfo; |
525 | if (interceptionInfo->TriggeringPrincipal()) { |
526 | triggeringPrincipalInfo.emplace(); |
527 | rv = PrincipalToPrincipalInfo(interceptionInfo->TriggeringPrincipal(), |
Value stored to 'rv' is never read | |
528 | triggeringPrincipalInfo.ptr()); |
529 | } |
530 | |
531 | nsTArray<RedirectHistoryEntryInfo> redirectChain; |
532 | for (const nsCOMPtr<nsIRedirectHistoryEntry>& redirectEntry : |
533 | interceptionInfo->RedirectChain()) { |
534 | RedirectHistoryEntryInfo* entry = redirectChain.AppendElement(); |
535 | rv = RHEntryToRHEntryInfo(redirectEntry, entry); |
536 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 536); return rv; } } while (false); |
537 | } |
538 | |
539 | interceptionInfoArg = Some(InterceptionInfoArg( |
540 | triggeringPrincipalInfo, interceptionInfo->ContentPolicyType(), |
541 | redirectChain, interceptionInfo->FromThirdParty())); |
542 | } |
543 | |
544 | Maybe<uint64_t> overriddenFingerprintingSettingsArg; |
545 | Maybe<RFPTarget> overriddenFingerprintingSettings = |
546 | aLoadInfo->GetOverriddenFingerprintingSettings(); |
547 | |
548 | if (overriddenFingerprintingSettings) { |
549 | overriddenFingerprintingSettingsArg = |
550 | Some(uint64_t(overriddenFingerprintingSettings.ref())); |
551 | } |
552 | |
553 | *outLoadInfoArgs = LoadInfoArgs( |
554 | loadingPrincipalInfo, triggeringPrincipalInfo, principalToInheritInfo, |
555 | topLevelPrincipalInfo, optionalResultPrincipalURI, triggeringRemoteType, |
556 | aLoadInfo->GetSandboxedNullPrincipalID(), aLoadInfo->GetSecurityFlags(), |
557 | aLoadInfo->GetSandboxFlags(), aLoadInfo->GetTriggeringSandboxFlags(), |
558 | aLoadInfo->GetTriggeringWindowId(), |
559 | aLoadInfo->GetTriggeringStorageAccess(), |
560 | aLoadInfo->InternalContentPolicyType(), |
561 | static_cast<uint32_t>(aLoadInfo->GetTainting()), |
562 | aLoadInfo->GetBlockAllMixedContent(), |
563 | aLoadInfo->GetUpgradeInsecureRequests(), |
564 | aLoadInfo->GetBrowserUpgradeInsecureRequests(), |
565 | aLoadInfo->GetBrowserDidUpgradeInsecureRequests(), |
566 | aLoadInfo->GetBrowserWouldUpgradeInsecureRequests(), |
567 | aLoadInfo->GetForceAllowDataURI(), |
568 | aLoadInfo->GetAllowInsecureRedirectToDataURI(), |
569 | aLoadInfo->GetSkipContentPolicyCheckForWebRequest(), |
570 | aLoadInfo->GetOriginalFrameSrcLoad(), |
571 | aLoadInfo->GetForceInheritPrincipalDropped(), |
572 | aLoadInfo->GetInnerWindowID(), aLoadInfo->GetBrowsingContextID(), |
573 | aLoadInfo->GetFrameBrowsingContextID(), |
574 | aLoadInfo->GetInitialSecurityCheckDone(), |
575 | aLoadInfo->GetIsInThirdPartyContext(), isThirdPartyContextToTopWindow, |
576 | aLoadInfo->GetIsFormSubmission(), aLoadInfo->GetSendCSPViolationEvents(), |
577 | aLoadInfo->GetOriginAttributes(), redirectChainIncludingInternalRedirects, |
578 | redirectChain, aLoadInfo->GetHasInjectedCookieForCookieBannerHandling(), |
579 | aLoadInfo->GetWasSchemelessInput(), aLoadInfo->GetHttpsUpgradeTelemetry(), |
580 | ipcClientInfo, ipcReservedClientInfo, ipcInitialClientInfo, ipcController, |
581 | aLoadInfo->CorsUnsafeHeaders(), aLoadInfo->GetForcePreflight(), |
582 | aLoadInfo->GetIsPreflight(), aLoadInfo->GetLoadTriggeredFromExternal(), |
583 | aLoadInfo->GetServiceWorkerTaintingSynthesized(), |
584 | aLoadInfo->GetDocumentHasUserInteracted(), |
585 | aLoadInfo->GetAllowListFutureDocumentsCreatedFromThisRedirectChain(), |
586 | aLoadInfo->GetNeedForCheckingAntiTrackingHeuristic(), cspNonce, |
587 | integrityMetadata, aLoadInfo->GetSkipContentSniffing(), |
588 | aLoadInfo->GetHttpsOnlyStatus(), aLoadInfo->GetHstsStatus(), |
589 | aLoadInfo->GetHasValidUserGestureActivation(), |
590 | aLoadInfo->GetTextDirectiveUserActivation(), |
591 | aLoadInfo->GetAllowDeprecatedSystemRequests(), |
592 | aLoadInfo->GetIsInDevToolsContext(), aLoadInfo->GetParserCreatedScript(), |
593 | aLoadInfo->GetIsFromProcessingFrameAttributes(), |
594 | aLoadInfo->GetIsMediaRequest(), aLoadInfo->GetIsMediaInitialRequest(), |
595 | aLoadInfo->GetIsFromObjectOrEmbed(), cookieJarSettingsArgs, |
596 | aLoadInfo->GetRequestBlockingReason(), maybeCspToInheritInfo, |
597 | aLoadInfo->GetStoragePermission(), overriddenFingerprintingSettingsArg, |
598 | aLoadInfo->GetIsMetaRefresh(), aLoadInfo->GetLoadingEmbedderPolicy(), |
599 | aLoadInfo->GetIsOriginTrialCoepCredentiallessEnabledForTopLevel(), |
600 | unstrippedURI, interceptionInfoArg, aLoadInfo->GetIsNewWindowTarget()); |
601 | |
602 | return NS_OK; |
603 | } |
604 | |
605 | nsresult LoadInfoArgsToLoadInfo(const LoadInfoArgs& aLoadInfoArgs, |
606 | const nsACString& aOriginRemoteType, |
607 | nsILoadInfo** outLoadInfo) { |
608 | return LoadInfoArgsToLoadInfo(aLoadInfoArgs, aOriginRemoteType, nullptr, |
609 | outLoadInfo); |
610 | } |
611 | nsresult LoadInfoArgsToLoadInfo(const LoadInfoArgs& aLoadInfoArgs, |
612 | const nsACString& aOriginRemoteType, |
613 | nsINode* aCspToInheritLoadingContext, |
614 | nsILoadInfo** outLoadInfo) { |
615 | RefPtr<LoadInfo> loadInfo; |
616 | nsresult rv = LoadInfoArgsToLoadInfo(aLoadInfoArgs, aOriginRemoteType, |
617 | aCspToInheritLoadingContext, |
618 | getter_AddRefs(loadInfo)); |
619 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 619); return rv; } } while (false); |
620 | |
621 | loadInfo.forget(outLoadInfo); |
622 | return NS_OK; |
623 | } |
624 | |
625 | nsresult LoadInfoArgsToLoadInfo(const LoadInfoArgs& aLoadInfoArgs, |
626 | const nsACString& aOriginRemoteType, |
627 | LoadInfo** outLoadInfo) { |
628 | return LoadInfoArgsToLoadInfo(aLoadInfoArgs, aOriginRemoteType, nullptr, |
629 | outLoadInfo); |
630 | } |
631 | nsresult LoadInfoArgsToLoadInfo(const LoadInfoArgs& loadInfoArgs, |
632 | const nsACString& aOriginRemoteType, |
633 | nsINode* aCspToInheritLoadingContext, |
634 | LoadInfo** outLoadInfo) { |
635 | nsCOMPtr<nsIPrincipal> loadingPrincipal; |
636 | if (loadInfoArgs.requestingPrincipalInfo().isSome()) { |
637 | auto loadingPrincipalOrErr = |
638 | PrincipalInfoToPrincipal(loadInfoArgs.requestingPrincipalInfo().ref()); |
639 | if (NS_WARN_IF(loadingPrincipalOrErr.isErr())NS_warn_if_impl(loadingPrincipalOrErr.isErr(), "loadingPrincipalOrErr.isErr()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 639)) { |
640 | return loadingPrincipalOrErr.unwrapErr(); |
641 | } |
642 | loadingPrincipal = loadingPrincipalOrErr.unwrap(); |
643 | } |
644 | |
645 | auto triggeringPrincipalOrErr = |
646 | PrincipalInfoToPrincipal(loadInfoArgs.triggeringPrincipalInfo()); |
647 | if (NS_WARN_IF(triggeringPrincipalOrErr.isErr())NS_warn_if_impl(triggeringPrincipalOrErr.isErr(), "triggeringPrincipalOrErr.isErr()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 647)) { |
648 | return triggeringPrincipalOrErr.unwrapErr(); |
649 | } |
650 | nsCOMPtr<nsIPrincipal> triggeringPrincipal = |
651 | triggeringPrincipalOrErr.unwrap(); |
652 | |
653 | nsCOMPtr<nsIPrincipal> principalToInherit; |
654 | nsCOMPtr<nsIPrincipal> flattenedPrincipalToInherit; |
655 | if (loadInfoArgs.principalToInheritInfo().isSome()) { |
656 | auto principalToInheritOrErr = |
657 | PrincipalInfoToPrincipal(loadInfoArgs.principalToInheritInfo().ref()); |
658 | if (NS_WARN_IF(principalToInheritOrErr.isErr())NS_warn_if_impl(principalToInheritOrErr.isErr(), "principalToInheritOrErr.isErr()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 658)) { |
659 | return principalToInheritOrErr.unwrapErr(); |
660 | } |
661 | flattenedPrincipalToInherit = principalToInheritOrErr.unwrap(); |
662 | } |
663 | |
664 | if (XRE_IsContentProcess()) { |
665 | auto targetBrowsingContextId = loadInfoArgs.frameBrowsingContextID() |
666 | ? loadInfoArgs.frameBrowsingContextID() |
667 | : loadInfoArgs.browsingContextID(); |
668 | if (RefPtr<BrowsingContext> bc = |
669 | BrowsingContext::Get(targetBrowsingContextId)) { |
670 | auto [originalTriggeringPrincipal, originalPrincipalToInherit] = |
671 | bc->GetTriggeringAndInheritPrincipalsForCurrentLoad(); |
672 | |
673 | if (originalTriggeringPrincipal && |
674 | originalTriggeringPrincipal->Equals(triggeringPrincipal)) { |
675 | triggeringPrincipal = originalTriggeringPrincipal; |
676 | } |
677 | if (originalPrincipalToInherit && |
678 | (loadInfoArgs.securityFlags() & |
679 | nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL) && |
680 | originalPrincipalToInherit->Equals(flattenedPrincipalToInherit)) { |
681 | principalToInherit = originalPrincipalToInherit; |
682 | } |
683 | } |
684 | } |
685 | if (!principalToInherit && loadInfoArgs.principalToInheritInfo().isSome()) { |
686 | principalToInherit = flattenedPrincipalToInherit; |
687 | } |
688 | |
689 | nsCOMPtr<nsIPrincipal> topLevelPrincipal; |
690 | if (loadInfoArgs.topLevelPrincipalInfo().isSome()) { |
691 | auto topLevelPrincipalOrErr = |
692 | PrincipalInfoToPrincipal(loadInfoArgs.topLevelPrincipalInfo().ref()); |
693 | if (NS_WARN_IF(topLevelPrincipalOrErr.isErr())NS_warn_if_impl(topLevelPrincipalOrErr.isErr(), "topLevelPrincipalOrErr.isErr()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 693)) { |
694 | return topLevelPrincipalOrErr.unwrapErr(); |
695 | } |
696 | topLevelPrincipal = topLevelPrincipalOrErr.unwrap(); |
697 | } |
698 | |
699 | nsCOMPtr<nsIURI> resultPrincipalURI; |
700 | if (loadInfoArgs.resultPrincipalURI().isSome()) { |
701 | resultPrincipalURI = DeserializeURI(loadInfoArgs.resultPrincipalURI()); |
702 | NS_ENSURE_TRUE(resultPrincipalURI, NS_ERROR_UNEXPECTED)do { if ((__builtin_expect(!!(!(resultPrincipalURI)), 0))) { NS_DebugBreak (NS_DEBUG_WARNING, "NS_ENSURE_TRUE(" "resultPrincipalURI" ") failed" , nullptr, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 702); return NS_ERROR_UNEXPECTED; } } while (false); |
703 | } |
704 | |
705 | // If we received this message from a content process, reset |
706 | // triggeringRemoteType to the process which sent us the message. If the |
707 | // parent sent us the message, we trust it to provide the correct triggering |
708 | // remote type. |
709 | // |
710 | // This means that the triggering remote type will be reset if a LoadInfo is |
711 | // bounced through a content process, as the LoadInfo can no longer be |
712 | // validated to be coming from the originally specified remote type. |
713 | nsCString triggeringRemoteType = loadInfoArgs.triggeringRemoteType(); |
714 | if (aOriginRemoteType != NOT_REMOTE_TYPEVoidCString() && |
715 | aOriginRemoteType != triggeringRemoteType) { |
716 | triggeringRemoteType = aOriginRemoteType; |
717 | } |
718 | |
719 | RedirectHistoryArray redirectChainIncludingInternalRedirects; |
720 | for (const RedirectHistoryEntryInfo& entryInfo : |
721 | loadInfoArgs.redirectChainIncludingInternalRedirects()) { |
722 | nsCOMPtr<nsIRedirectHistoryEntry> redirectHistoryEntry = |
723 | RHEntryInfoToRHEntry(entryInfo); |
724 | NS_ENSURE_TRUE(redirectHistoryEntry, NS_ERROR_UNEXPECTED)do { if ((__builtin_expect(!!(!(redirectHistoryEntry)), 0))) { NS_DebugBreak(NS_DEBUG_WARNING, "NS_ENSURE_TRUE(" "redirectHistoryEntry" ") failed", nullptr, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 724); return NS_ERROR_UNEXPECTED; } } while (false); |
725 | redirectChainIncludingInternalRedirects.AppendElement( |
726 | redirectHistoryEntry.forget()); |
727 | } |
728 | |
729 | RedirectHistoryArray redirectChain; |
730 | for (const RedirectHistoryEntryInfo& entryInfo : |
731 | loadInfoArgs.redirectChain()) { |
732 | nsCOMPtr<nsIRedirectHistoryEntry> redirectHistoryEntry = |
733 | RHEntryInfoToRHEntry(entryInfo); |
734 | NS_ENSURE_TRUE(redirectHistoryEntry, NS_ERROR_UNEXPECTED)do { if ((__builtin_expect(!!(!(redirectHistoryEntry)), 0))) { NS_DebugBreak(NS_DEBUG_WARNING, "NS_ENSURE_TRUE(" "redirectHistoryEntry" ") failed", nullptr, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 734); return NS_ERROR_UNEXPECTED; } } while (false); |
735 | redirectChain.AppendElement(redirectHistoryEntry.forget()); |
736 | } |
737 | nsTArray<nsCOMPtr<nsIPrincipal>> ancestorPrincipals; |
738 | nsTArray<uint64_t> ancestorBrowsingContextIDs; |
739 | if (XRE_IsParentProcess() && |
740 | (nsContentUtils::InternalContentPolicyTypeToExternal( |
741 | loadInfoArgs.contentPolicyType()) != |
742 | ExtContentPolicy::TYPE_DOCUMENT)) { |
743 | // Only fill out ancestor principals and browsing context IDs when we |
744 | // are deserializing LoadInfoArgs to be LoadInfo for a subresource |
745 | RefPtr<BrowsingContext> parentBC = |
746 | BrowsingContext::Get(loadInfoArgs.browsingContextID()); |
747 | if (parentBC) { |
748 | LoadInfo::ComputeAncestors(parentBC->Canonical(), ancestorPrincipals, |
749 | ancestorBrowsingContextIDs); |
750 | } |
751 | } |
752 | |
753 | Maybe<ClientInfo> clientInfo; |
754 | if (loadInfoArgs.clientInfo().isSome()) { |
755 | clientInfo.emplace(ClientInfo(loadInfoArgs.clientInfo().ref())); |
756 | } |
757 | |
758 | Maybe<ClientInfo> reservedClientInfo; |
759 | if (loadInfoArgs.reservedClientInfo().isSome()) { |
760 | reservedClientInfo.emplace( |
761 | ClientInfo(loadInfoArgs.reservedClientInfo().ref())); |
762 | } |
763 | |
764 | Maybe<ClientInfo> initialClientInfo; |
765 | if (loadInfoArgs.initialClientInfo().isSome()) { |
766 | initialClientInfo.emplace( |
767 | ClientInfo(loadInfoArgs.initialClientInfo().ref())); |
768 | } |
769 | |
770 | // We can have an initial client info or a reserved client info, but not both. |
771 | 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()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 772); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "reservedClientInfo.isNothing() || initialClientInfo.isNothing()" ")"); do { *((volatile int*)__null) = 772; __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
772 | 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()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 772); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "reservedClientInfo.isNothing() || initialClientInfo.isNothing()" ")"); do { *((volatile int*)__null) = 772; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
773 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 775); return NS_ERROR_UNEXPECTED; } } while (false) |
774 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 775); return NS_ERROR_UNEXPECTED; } } while (false) |
775 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 775); return NS_ERROR_UNEXPECTED; } } while (false); |
776 | |
777 | Maybe<ServiceWorkerDescriptor> controller; |
778 | if (loadInfoArgs.controller().isSome()) { |
779 | controller.emplace( |
780 | ServiceWorkerDescriptor(loadInfoArgs.controller().ref())); |
781 | } |
782 | |
783 | nsCOMPtr<nsICookieJarSettings> cookieJarSettings; |
784 | CookieJarSettings::Deserialize(loadInfoArgs.cookieJarSettings(), |
785 | getter_AddRefs(cookieJarSettings)); |
786 | |
787 | Maybe<RFPTarget> overriddenFingerprintingSettings; |
788 | if (loadInfoArgs.overriddenFingerprintingSettings().isSome()) { |
789 | overriddenFingerprintingSettings.emplace( |
790 | RFPTarget(loadInfoArgs.overriddenFingerprintingSettings().ref())); |
791 | } |
792 | |
793 | nsCOMPtr<nsIContentSecurityPolicy> cspToInherit; |
794 | Maybe<mozilla::ipc::CSPInfo> cspToInheritInfo = |
795 | loadInfoArgs.cspToInheritInfo(); |
796 | if (cspToInheritInfo.isSome()) { |
797 | nsCOMPtr<Document> doc = do_QueryInterface(aCspToInheritLoadingContext); |
798 | cspToInherit = CSPInfoToCSP(cspToInheritInfo.ref(), doc); |
799 | } |
800 | |
801 | // Restore the loadingContext for frames using the BrowsingContext's |
802 | // embedder element. Note that this only works if the embedder is |
803 | // same-process, so won't be fission compatible. |
804 | nsCOMPtr<nsINode> loadingContext; |
805 | RefPtr<BrowsingContext> frameBrowsingContext = |
806 | BrowsingContext::Get(loadInfoArgs.frameBrowsingContextID()); |
807 | if (frameBrowsingContext) { |
808 | loadingContext = frameBrowsingContext->GetEmbedderElement(); |
809 | } |
810 | |
811 | Maybe<bool> isThirdPartyContextToTopWindow; |
812 | if (loadInfoArgs.isThirdPartyContextToTopWindow().isSome()) { |
813 | isThirdPartyContextToTopWindow.emplace( |
814 | loadInfoArgs.isThirdPartyContextToTopWindow().ref()); |
815 | } |
816 | |
817 | nsCOMPtr<nsIInterceptionInfo> interceptionInfo; |
818 | if (loadInfoArgs.interceptionInfo().isSome()) { |
819 | const InterceptionInfoArg& interceptionInfoArg = |
820 | loadInfoArgs.interceptionInfo().ref(); |
821 | nsCOMPtr<nsIPrincipal> triggeringPrincipal; |
822 | if (interceptionInfoArg.triggeringPrincipalInfo().isSome()) { |
823 | auto triggeringPrincipalOrErr = PrincipalInfoToPrincipal( |
824 | interceptionInfoArg.triggeringPrincipalInfo().ref()); |
825 | if (NS_WARN_IF(triggeringPrincipalOrErr.isErr())NS_warn_if_impl(triggeringPrincipalOrErr.isErr(), "triggeringPrincipalOrErr.isErr()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 825)) { |
826 | return triggeringPrincipalOrErr.unwrapErr(); |
827 | } |
828 | triggeringPrincipal = triggeringPrincipalOrErr.unwrap(); |
829 | } |
830 | |
831 | RedirectHistoryArray redirectChain; |
832 | for (const RedirectHistoryEntryInfo& entryInfo : |
833 | interceptionInfoArg.redirectChain()) { |
834 | nsCOMPtr<nsIRedirectHistoryEntry> redirectHistoryEntry = |
835 | RHEntryInfoToRHEntry(entryInfo); |
836 | NS_ENSURE_TRUE(redirectHistoryEntry, NS_ERROR_UNEXPECTED)do { if ((__builtin_expect(!!(!(redirectHistoryEntry)), 0))) { NS_DebugBreak(NS_DEBUG_WARNING, "NS_ENSURE_TRUE(" "redirectHistoryEntry" ") failed", nullptr, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 836); return NS_ERROR_UNEXPECTED; } } while (false); |
837 | redirectChain.AppendElement(redirectHistoryEntry.forget()); |
838 | } |
839 | |
840 | interceptionInfo = new InterceptionInfo( |
841 | triggeringPrincipal, interceptionInfoArg.contentPolicyType(), |
842 | redirectChain, interceptionInfoArg.fromThirdParty()); |
843 | } |
844 | |
845 | RefPtr<mozilla::net::LoadInfo> loadInfo = new mozilla::net::LoadInfo( |
846 | loadingPrincipal, triggeringPrincipal, principalToInherit, |
847 | topLevelPrincipal, resultPrincipalURI, cookieJarSettings, cspToInherit, |
848 | triggeringRemoteType, loadInfoArgs.sandboxedNullPrincipalID(), clientInfo, |
849 | reservedClientInfo, initialClientInfo, controller, |
850 | loadInfoArgs.securityFlags(), loadInfoArgs.sandboxFlags(), |
851 | loadInfoArgs.triggeringSandboxFlags(), loadInfoArgs.triggeringWindowId(), |
852 | loadInfoArgs.triggeringStorageAccess(), loadInfoArgs.contentPolicyType(), |
853 | static_cast<LoadTainting>(loadInfoArgs.tainting()), |
854 | loadInfoArgs.blockAllMixedContent(), |
855 | loadInfoArgs.upgradeInsecureRequests(), |
856 | loadInfoArgs.browserUpgradeInsecureRequests(), |
857 | loadInfoArgs.browserDidUpgradeInsecureRequests(), |
858 | loadInfoArgs.browserWouldUpgradeInsecureRequests(), |
859 | loadInfoArgs.forceAllowDataURI(), |
860 | loadInfoArgs.allowInsecureRedirectToDataURI(), |
861 | loadInfoArgs.skipContentPolicyCheckForWebRequest(), |
862 | loadInfoArgs.originalFrameSrcLoad(), |
863 | loadInfoArgs.forceInheritPrincipalDropped(), loadInfoArgs.innerWindowID(), |
864 | loadInfoArgs.browsingContextID(), loadInfoArgs.frameBrowsingContextID(), |
865 | loadInfoArgs.initialSecurityCheckDone(), |
866 | loadInfoArgs.isInThirdPartyContext(), isThirdPartyContextToTopWindow, |
867 | loadInfoArgs.isFormSubmission(), loadInfoArgs.sendCSPViolationEvents(), |
868 | loadInfoArgs.originAttributes(), |
869 | std::move(redirectChainIncludingInternalRedirects), |
870 | std::move(redirectChain), std::move(ancestorPrincipals), |
871 | ancestorBrowsingContextIDs, loadInfoArgs.corsUnsafeHeaders(), |
872 | loadInfoArgs.forcePreflight(), loadInfoArgs.isPreflight(), |
873 | loadInfoArgs.loadTriggeredFromExternal(), |
874 | loadInfoArgs.serviceWorkerTaintingSynthesized(), |
875 | loadInfoArgs.documentHasUserInteracted(), |
876 | loadInfoArgs.allowListFutureDocumentsCreatedFromThisRedirectChain(), |
877 | loadInfoArgs.needForCheckingAntiTrackingHeuristic(), |
878 | loadInfoArgs.cspNonce(), loadInfoArgs.integrityMetadata(), |
879 | loadInfoArgs.skipContentSniffing(), loadInfoArgs.httpsOnlyStatus(), |
880 | loadInfoArgs.hstsStatus(), loadInfoArgs.hasValidUserGestureActivation(), |
881 | loadInfoArgs.textDirectiveUserActivation(), |
882 | // This function is only called for moving LoadInfo across processes. |
883 | // Same-document navigation won't cross process boundaries. |
884 | /* aIsSameDocumentNavigation */ false, |
885 | loadInfoArgs.allowDeprecatedSystemRequests(), |
886 | loadInfoArgs.isInDevToolsContext(), loadInfoArgs.parserCreatedScript(), |
887 | loadInfoArgs.storagePermission(), overriddenFingerprintingSettings, |
888 | loadInfoArgs.isMetaRefresh(), loadInfoArgs.requestBlockingReason(), |
889 | loadingContext, loadInfoArgs.loadingEmbedderPolicy(), |
890 | loadInfoArgs.originTrialCoepCredentiallessEnabledForTopLevel(), |
891 | loadInfoArgs.unstrippedURI(), interceptionInfo, |
892 | loadInfoArgs.hasInjectedCookieForCookieBannerHandling(), |
893 | loadInfoArgs.wasSchemelessInput(), loadInfoArgs.httpsUpgradeTelemetry(), |
894 | loadInfoArgs.isNewWindowTarget()); |
895 | |
896 | if (loadInfoArgs.isFromProcessingFrameAttributes()) { |
897 | loadInfo->SetIsFromProcessingFrameAttributes(); |
898 | } |
899 | |
900 | if (loadInfoArgs.isMediaRequest()) { |
901 | loadInfo->SetIsMediaRequest(true); |
902 | |
903 | if (loadInfoArgs.isMediaInitialRequest()) { |
904 | loadInfo->SetIsMediaInitialRequest(true); |
905 | } |
906 | } |
907 | |
908 | if (loadInfoArgs.isFromObjectOrEmbed()) { |
909 | loadInfo->SetIsFromObjectOrEmbed(true); |
910 | } |
911 | |
912 | loadInfo.forget(outLoadInfo); |
913 | return NS_OK; |
914 | } |
915 | |
916 | void LoadInfoToParentLoadInfoForwarder( |
917 | nsILoadInfo* aLoadInfo, ParentLoadInfoForwarderArgs* aForwarderArgsOut) { |
918 | Maybe<IPCServiceWorkerDescriptor> ipcController; |
919 | Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController()); |
920 | if (controller.isSome()) { |
921 | ipcController.emplace(controller.ref().ToIPC()); |
922 | } |
923 | |
924 | uint32_t tainting = nsILoadInfo::TAINTING_BASIC; |
925 | Unused << aLoadInfo->GetTainting(&tainting); |
926 | |
927 | Maybe<CookieJarSettingsArgs> cookieJarSettingsArgs; |
928 | |
929 | nsCOMPtr<nsICookieJarSettings> cookieJarSettings; |
930 | nsresult rv = |
931 | aLoadInfo->GetCookieJarSettings(getter_AddRefs(cookieJarSettings)); |
932 | CookieJarSettings* cs = |
933 | static_cast<CookieJarSettings*>(cookieJarSettings.get()); |
934 | if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1))) && cookieJarSettings && cs->HasBeenChanged()) { |
935 | CookieJarSettingsArgs args; |
936 | cs->Serialize(args); |
937 | cookieJarSettingsArgs = Some(args); |
938 | } |
939 | |
940 | nsCOMPtr<nsIURI> unstrippedURI; |
941 | Unused << aLoadInfo->GetUnstrippedURI(getter_AddRefs(unstrippedURI)); |
942 | |
943 | Maybe<bool> isThirdPartyContextToTopWindow; |
944 | if (static_cast<LoadInfo*>(aLoadInfo) |
945 | ->HasIsThirdPartyContextToTopWindowSet()) { |
946 | isThirdPartyContextToTopWindow.emplace( |
947 | aLoadInfo->GetIsThirdPartyContextToTopWindow()); |
948 | } |
949 | |
950 | Maybe<uint64_t> overriddenFingerprintingSettingsArg; |
951 | Maybe<RFPTarget> overriddenFingerprintingSettings = |
952 | aLoadInfo->GetOverriddenFingerprintingSettings(); |
953 | |
954 | if (overriddenFingerprintingSettings) { |
955 | overriddenFingerprintingSettingsArg = |
956 | Some(uint64_t(overriddenFingerprintingSettings.ref())); |
957 | } |
958 | |
959 | *aForwarderArgsOut = ParentLoadInfoForwarderArgs( |
960 | aLoadInfo->GetAllowInsecureRedirectToDataURI(), ipcController, tainting, |
961 | aLoadInfo->GetSkipContentSniffing(), aLoadInfo->GetHttpsOnlyStatus(), |
962 | aLoadInfo->GetWasSchemelessInput(), aLoadInfo->GetHttpsUpgradeTelemetry(), |
963 | aLoadInfo->GetHstsStatus(), aLoadInfo->GetHasValidUserGestureActivation(), |
964 | aLoadInfo->GetTextDirectiveUserActivation(), |
965 | aLoadInfo->GetAllowDeprecatedSystemRequests(), |
966 | aLoadInfo->GetIsInDevToolsContext(), aLoadInfo->GetParserCreatedScript(), |
967 | aLoadInfo->GetTriggeringSandboxFlags(), |
968 | aLoadInfo->GetTriggeringWindowId(), |
969 | aLoadInfo->GetTriggeringStorageAccess(), |
970 | aLoadInfo->GetServiceWorkerTaintingSynthesized(), |
971 | aLoadInfo->GetDocumentHasUserInteracted(), |
972 | aLoadInfo->GetAllowListFutureDocumentsCreatedFromThisRedirectChain(), |
973 | cookieJarSettingsArgs, aLoadInfo->GetContainerFeaturePolicyInfo(), |
974 | aLoadInfo->GetRequestBlockingReason(), aLoadInfo->GetStoragePermission(), |
975 | overriddenFingerprintingSettingsArg, aLoadInfo->GetIsMetaRefresh(), |
976 | isThirdPartyContextToTopWindow, aLoadInfo->GetIsInThirdPartyContext(), |
977 | unstrippedURI); |
978 | } |
979 | |
980 | nsresult MergeParentLoadInfoForwarder( |
981 | ParentLoadInfoForwarderArgs const& aForwarderArgs, nsILoadInfo* aLoadInfo) { |
982 | nsresult rv; |
983 | |
984 | rv = aLoadInfo->SetAllowInsecureRedirectToDataURI( |
985 | aForwarderArgs.allowInsecureRedirectToDataURI()); |
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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 986); return rv; } } while (false); |
987 | |
988 | aLoadInfo->ClearController(); |
989 | auto& controller = aForwarderArgs.controller(); |
990 | if (controller.isSome()) { |
991 | aLoadInfo->SetController(ServiceWorkerDescriptor(controller.ref())); |
992 | } |
993 | |
994 | if (aForwarderArgs.serviceWorkerTaintingSynthesized()) { |
995 | aLoadInfo->SynthesizeServiceWorkerTainting( |
996 | static_cast<LoadTainting>(aForwarderArgs.tainting())); |
997 | } else { |
998 | aLoadInfo->MaybeIncreaseTainting(aForwarderArgs.tainting()); |
999 | } |
1000 | rv = aLoadInfo->SetTextDirectiveUserActivation( |
1001 | aForwarderArgs.textDirectiveUserActivation()); |
1002 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1002); return rv; } } while (false); |
1003 | |
1004 | rv = aLoadInfo->SetSkipContentSniffing(aForwarderArgs.skipContentSniffing()); |
1005 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1005); return rv; } } while (false); |
1006 | |
1007 | rv = aLoadInfo->SetHttpsOnlyStatus(aForwarderArgs.httpsOnlyStatus()); |
1008 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1008); return rv; } } while (false); |
1009 | |
1010 | rv = aLoadInfo->SetWasSchemelessInput(aForwarderArgs.wasSchemelessInput()); |
1011 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1011); return rv; } } while (false); |
1012 | |
1013 | rv = aLoadInfo->SetHttpsUpgradeTelemetry( |
1014 | aForwarderArgs.httpsUpgradeTelemetry()); |
1015 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1015); return rv; } } while (false); |
1016 | |
1017 | rv = aLoadInfo->SetHstsStatus(aForwarderArgs.hstsStatus()); |
1018 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1018); return rv; } } while (false); |
1019 | |
1020 | rv = aLoadInfo->SetTriggeringSandboxFlags( |
1021 | aForwarderArgs.triggeringSandboxFlags()); |
1022 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1022); return rv; } } while (false); |
1023 | |
1024 | rv = aLoadInfo->SetTriggeringWindowId(aForwarderArgs.triggeringWindowId()); |
1025 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1025); return rv; } } while (false); |
1026 | |
1027 | rv = aLoadInfo->SetTriggeringStorageAccess( |
1028 | aForwarderArgs.triggeringStorageAccess()); |
1029 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1029); return rv; } } while (false); |
1030 | |
1031 | rv = aLoadInfo->SetHasValidUserGestureActivation( |
1032 | aForwarderArgs.hasValidUserGestureActivation()); |
1033 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1033); return rv; } } while (false); |
1034 | |
1035 | rv = aLoadInfo->SetAllowDeprecatedSystemRequests( |
1036 | aForwarderArgs.allowDeprecatedSystemRequests()); |
1037 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1037); return rv; } } while (false); |
1038 | |
1039 | rv = aLoadInfo->SetIsInDevToolsContext(aForwarderArgs.isInDevToolsContext()); |
1040 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1040); return rv; } } while (false); |
1041 | |
1042 | rv = aLoadInfo->SetParserCreatedScript(aForwarderArgs.parserCreatedScript()); |
1043 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1043); return rv; } } while (false); |
1044 | |
1045 | MOZ_ALWAYS_SUCCEEDS(aLoadInfo->SetDocumentHasUserInteracted(do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl (aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted ()))), 1)))), 1))) { } else { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(false)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("false" " (" "NS_SUCCEEDED(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted()))" ")", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1046); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "false" ") (" "NS_SUCCEEDED(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted()))" ")"); do { *((volatile int*)__null) = 1046; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
1046 | aForwarderArgs.documentHasUserInteracted()))do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl (aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted ()))), 1)))), 1))) { } else { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(false)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("false" " (" "NS_SUCCEEDED(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted()))" ")", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1046); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "false" ") (" "NS_SUCCEEDED(aLoadInfo->SetDocumentHasUserInteracted( aForwarderArgs.documentHasUserInteracted()))" ")"); do { *((volatile int*)__null) = 1046; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
1047 | MOZ_ALWAYS_SUCCEEDS(do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl (aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain ( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain ()))), 1)))), 1))) { } else { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(false)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("false" " (" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))" ")", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1050); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "false" ") (" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))" ")"); do { *((volatile int*)__null) = 1050; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
1048 | aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain(do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl (aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain ( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain ()))), 1)))), 1))) { } else { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(false)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("false" " (" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))" ")", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1050); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "false" ") (" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))" ")"); do { *((volatile int*)__null) = 1050; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
1049 | aForwarderArgsdo { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl (aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain ( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain ()))), 1)))), 1))) { } else { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(false)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("false" " (" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))" ")", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1050); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "false" ") (" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))" ")"); do { *((volatile int*)__null) = 1050; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
1050 | .allowListFutureDocumentsCreatedFromThisRedirectChain()))do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl (aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain ( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain ()))), 1)))), 1))) { } else { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(false)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("false" " (" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))" ")", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1050); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "false" ") (" "NS_SUCCEEDED(aLoadInfo->SetAllowListFutureDocumentsCreatedFromThisRedirectChain( aForwarderArgs .allowListFutureDocumentsCreatedFromThisRedirectChain()))" ")"); do { *((volatile int*)__null) = 1050; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
1051 | MOZ_ALWAYS_SUCCEEDS(aLoadInfo->SetRequestBlockingReason(do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl (aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason ()))), 1)))), 1))) { } else { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(false)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("false" " (" "NS_SUCCEEDED(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason()))" ")", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1052); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "false" ") (" "NS_SUCCEEDED(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason()))" ")"); do { *((volatile int*)__null) = 1052; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false) |
1052 | aForwarderArgs.requestBlockingReason()))do { if ((__builtin_expect(!!(((bool)(__builtin_expect(!!(!NS_FAILED_impl (aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason ()))), 1)))), 1))) { } else { do { static_assert( mozilla::detail ::AssertionConditionType<decltype(false)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(false))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("false" " (" "NS_SUCCEEDED(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason()))" ")", "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1052); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "false" ") (" "NS_SUCCEEDED(aLoadInfo->SetRequestBlockingReason( aForwarderArgs.requestBlockingReason()))" ")"); do { *((volatile int*)__null) = 1052; __attribute__((nomerge )) ::abort(); } while (false); } } while (false); } } while ( false); |
1053 | |
1054 | const Maybe<CookieJarSettingsArgs>& cookieJarSettingsArgs = |
1055 | aForwarderArgs.cookieJarSettings(); |
1056 | if (cookieJarSettingsArgs.isSome()) { |
1057 | nsCOMPtr<nsICookieJarSettings> cookieJarSettings; |
1058 | nsresult rv = |
1059 | aLoadInfo->GetCookieJarSettings(getter_AddRefs(cookieJarSettings)); |
1060 | if (NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1))) && cookieJarSettings) { |
1061 | static_cast<CookieJarSettings*>(cookieJarSettings.get()) |
1062 | ->Merge(cookieJarSettingsArgs.ref()); |
1063 | } |
1064 | } |
1065 | |
1066 | rv = aLoadInfo->SetStoragePermission(aForwarderArgs.storagePermission()); |
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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1067); return rv; } } while (false); |
1068 | |
1069 | rv = aLoadInfo->SetIsMetaRefresh(aForwarderArgs.isMetaRefresh()); |
1070 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1070); return rv; } } while (false); |
1071 | |
1072 | const Maybe<uint64_t> overriddenFingerprintingSettings = |
1073 | aForwarderArgs.overriddenFingerprintingSettings(); |
1074 | if (overriddenFingerprintingSettings.isSome()) { |
1075 | aLoadInfo->SetOverriddenFingerprintingSettings( |
1076 | RFPTarget(overriddenFingerprintingSettings.ref())); |
1077 | } |
1078 | |
1079 | static_cast<LoadInfo*>(aLoadInfo)->ClearIsThirdPartyContextToTopWindow(); |
1080 | if (aForwarderArgs.isThirdPartyContextToTopWindow().isSome()) { |
1081 | rv = aLoadInfo->SetIsThirdPartyContextToTopWindow( |
1082 | aForwarderArgs.isThirdPartyContextToTopWindow().ref()); |
1083 | } |
1084 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1084); return rv; } } while (false); |
1085 | |
1086 | rv = aLoadInfo->SetIsInThirdPartyContext( |
1087 | aForwarderArgs.isInThirdPartyContext()); |
1088 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1088); return rv; } } while (false); |
1089 | |
1090 | rv = aLoadInfo->SetUnstrippedURI(aForwarderArgs.unstrippedURI()); |
1091 | 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, "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1091); return rv; } } while (false); |
1092 | |
1093 | if (aForwarderArgs.containerFeaturePolicyInfo()) { |
1094 | aLoadInfo->SetContainerFeaturePolicyInfo( |
1095 | *aForwarderArgs.containerFeaturePolicyInfo()); |
1096 | } |
1097 | |
1098 | return NS_OK; |
1099 | } |
1100 | |
1101 | void LoadInfoToChildLoadInfoForwarder( |
1102 | nsILoadInfo* aLoadInfo, ChildLoadInfoForwarderArgs* aForwarderArgsOut) { |
1103 | Maybe<IPCClientInfo> ipcReserved; |
1104 | Maybe<ClientInfo> reserved(aLoadInfo->GetReservedClientInfo()); |
1105 | if (reserved.isSome()) { |
1106 | ipcReserved.emplace(reserved.ref().ToIPC()); |
1107 | } |
1108 | |
1109 | Maybe<IPCClientInfo> ipcInitial; |
1110 | Maybe<ClientInfo> initial(aLoadInfo->GetInitialClientInfo()); |
1111 | if (initial.isSome()) { |
1112 | ipcInitial.emplace(initial.ref().ToIPC()); |
1113 | } |
1114 | |
1115 | Maybe<IPCServiceWorkerDescriptor> ipcController; |
1116 | Maybe<ServiceWorkerDescriptor> controller(aLoadInfo->GetController()); |
1117 | if (controller.isSome()) { |
1118 | ipcController.emplace(controller.ref().ToIPC()); |
1119 | } |
1120 | |
1121 | *aForwarderArgsOut = |
1122 | ChildLoadInfoForwarderArgs(ipcReserved, ipcInitial, ipcController, |
1123 | aLoadInfo->GetRequestBlockingReason()); |
1124 | } |
1125 | |
1126 | nsresult MergeChildLoadInfoForwarder( |
1127 | const ChildLoadInfoForwarderArgs& aForwarderArgs, nsILoadInfo* aLoadInfo) { |
1128 | Maybe<ClientInfo> reservedClientInfo; |
1129 | auto& ipcReserved = aForwarderArgs.reservedClientInfo(); |
1130 | if (ipcReserved.isSome()) { |
1131 | reservedClientInfo.emplace(ClientInfo(ipcReserved.ref())); |
1132 | } |
1133 | |
1134 | Maybe<ClientInfo> initialClientInfo; |
1135 | auto& ipcInitial = aForwarderArgs.initialClientInfo(); |
1136 | if (ipcInitial.isSome()) { |
1137 | initialClientInfo.emplace(ClientInfo(ipcInitial.ref())); |
1138 | } |
1139 | |
1140 | // There should only be at most one reserved or initial ClientInfo. |
1141 | if (NS_WARN_IF(reservedClientInfo.isSome() && initialClientInfo.isSome())NS_warn_if_impl(reservedClientInfo.isSome() && initialClientInfo .isSome(), "reservedClientInfo.isSome() && initialClientInfo.isSome()" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1141)) { |
1142 | return NS_ERROR_FAILURE; |
1143 | } |
1144 | |
1145 | // If we received no reserved or initial ClientInfo, then we must not |
1146 | // already have one set. There are no use cases where this should |
1147 | // happen and we don't have a way to clear the current value. |
1148 | 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())" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1151) |
1149 | 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())" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1151) |
1150 | (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())" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1151) |
1151 | 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())" , "/var/lib/jenkins/workspace/firefox-scan-build/ipc/glue/BackgroundUtils.cpp" , 1151)) { |
1152 | return NS_ERROR_FAILURE; |
1153 | } |
1154 | |
1155 | if (reservedClientInfo.isSome()) { |
1156 | // We need to override here instead of simply set the value. This |
1157 | // allows us to change the reserved client. This is necessary when |
1158 | // the ClientChannelHelper created a new reserved client in the |
1159 | // child-side of the redirect. |
1160 | aLoadInfo->OverrideReservedClientInfoInParent(reservedClientInfo.ref()); |
1161 | } else if (initialClientInfo.isSome()) { |
1162 | aLoadInfo->SetInitialClientInfo(initialClientInfo.ref()); |
1163 | } |
1164 | |
1165 | aLoadInfo->ClearController(); |
1166 | auto& controller = aForwarderArgs.controller(); |
1167 | if (controller.isSome()) { |
1168 | aLoadInfo->SetController(ServiceWorkerDescriptor(controller.ref())); |
1169 | } |
1170 | |
1171 | uint32_t blockingReason = aForwarderArgs.requestBlockingReason(); |
1172 | if (blockingReason) { |
1173 | // We only want to override when non-null, so that any earlier set non-null |
1174 | // value is not reverted to 0. |
1175 | aLoadInfo->SetRequestBlockingReason(blockingReason); |
1176 | } |
1177 | |
1178 | return NS_OK; |
1179 | } |
1180 | |
1181 | } // namespace ipc |
1182 | } // namespace mozilla |