Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit d811886

Browse files
committed
Backed out changeset 0abd871c4920 (bug 1542194) for xpcshell failures on test_ext_contentscript_triggeringPrincipal.js. CLOSED TREE
1 parent 44c81ed commit d811886

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

dom/security/nsCSPService.cpp

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -172,29 +172,11 @@ bool subjectToCSP(nsIURI* aURI, nsContentPolicyType aContentType) {
172172
nsCOMPtr<nsIContentSecurityPolicy> csp = aLoadInfo->GetCsp();
173173

174174
if (csp) {
175-
// Generally aOriginalURI denotes the URI before a redirect and hence
176-
// will always be a nullptr here. Only exception are frame navigations
177-
// which we want to treat as a redirect for the purpose of CSP reporting
178-
// and in particular the `blocked-uri` in the CSP report where we want
179-
// to report the prePath information.
180-
nsCOMPtr<nsIURI> originalURI = nullptr;
181-
ExtContentPolicyType extType =
182-
nsContentUtils::InternalContentPolicyTypeToExternal(contentType);
183-
if (extType == ExtContentPolicy::TYPE_SUBDOCUMENT &&
184-
!aLoadInfo->GetOriginalFrameSrcLoad()) {
185-
nsAutoCString prePathStr;
186-
nsresult rv = aContentLocation->GetPrePath(prePathStr);
187-
NS_ENSURE_SUCCESS(rv, rv);
188-
rv = NS_NewURI(getter_AddRefs(originalURI), prePathStr);
189-
NS_ENSURE_SUCCESS(rv, rv);
190-
}
191-
192175
// obtain the enforcement decision
193-
rv = csp->ShouldLoad(
194-
contentType, cspEventListener, aContentLocation,
195-
originalURI, // no redirect, unless it's a frame navigation.
196-
!isPreload && aLoadInfo->GetSendCSPViolationEvents(), cspNonce,
197-
parserCreatedScript, aDecision);
176+
rv = csp->ShouldLoad(contentType, cspEventListener, aContentLocation,
177+
nullptr, // no redirect, aOriginal URL is null.
178+
!isPreload && aLoadInfo->GetSendCSPViolationEvents(),
179+
cspNonce, parserCreatedScript, aDecision);
198180

199181
if (NS_CP_REJECTED(*aDecision)) {
200182
NS_SetRequestBlockingReason(

0 commit comments

Comments
 (0)