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 12:21:41 +00:00
committed by tschuster@mozilla.com
parent fd7d2daf6d
commit b9a9491a35
20 changed files with 136 additions and 75 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);