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

@@ -477,11 +477,11 @@ nsresult ScriptLoader::CheckContentPolicy(nsIScriptElement* aElement,
if (aElement) {
requestingNode = do_QueryInterface(aElement);
}
nsCOMPtr<nsILoadInfo> secCheckLoadInfo = new net::LoadInfo(
nsCOMPtr<nsILoadInfo> secCheckLoadInfo = MOZ_TRY(net::LoadInfo::Create(
mDocument->NodePrincipal(), // loading principal
mDocument->NodePrincipal(), // triggering principal
requestingNode, nsILoadInfo::SEC_ONLY_FOR_EXPLICIT_CONTENTSEC_CHECK,
contentPolicyType);
contentPolicyType));
secCheckLoadInfo->SetParserCreatedScript(aElement &&
aElement->GetParserCreated() !=
mozilla::dom::NOT_FROM_PARSER);