Bug 1967417 - Create a fallible LoadInfo factory. r=smaug,necko-reviewers,places-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D250182
This commit is contained in:
Tom Schuster
2025-05-21 14:54:11 +00:00
committed by tschuster@mozilla.com
parent 6995a90947
commit 3f48655456
21 changed files with 145 additions and 82 deletions

View File

@@ -727,10 +727,13 @@ static bool ShouldLoadCachedImage(imgRequest* aImgRequest,
loadingPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
}
nsCOMPtr<nsILoadInfo> secCheckLoadInfo = new LoadInfo(
Result<RefPtr<LoadInfo>, nsresult> maybeLoadInfo = LoadInfo::Create(
loadingPrincipal, aTriggeringPrincipal, aLoadingDocument,
nsILoadInfo::SEC_ONLY_FOR_EXPLICIT_CONTENTSEC_CHECK, aPolicyType);
if (NS_WARN_IF(maybeLoadInfo.isErr())) {
return false;
}
RefPtr<LoadInfo> secCheckLoadInfo = maybeLoadInfo.unwrap();
secCheckLoadInfo->SetSendCSPViolationEvents(aSendCSPViolationReports);
int16_t decision = nsIContentPolicy::REJECT_REQUEST;