Skip to content

merge_pr_64252

Choose a tag to compare

@github-actions github-actions released this 28 Oct 22:50

Omit unknown source code location in inspector CSP issue

When GatherSecurityPolicyViolationEventData() collects the CSP
violation event data into SecurityPolicyViolationEventInit, it
treats the received source location as unknown if its line number
is zero, so ContentSecurityPolicy::ReportViolation dispatches and
reports the violation without a source location.

But GatherSecurityPolicyViolationEventData() returned the source
location as is, so the inspector CSP issue got a source code location
with a non-empty URL and an unknown line number (-1 in the protocol)
for the violation (e.g. a CSS background image fetched by style
recalculation after the document is parsed).

Return null when GatherSecurityPolicyViolationEventData() receives an
unknown source location, so that the inspector CSP issue omits the
sourceCodeLocation field for the violation.

Bug: 577884869
Change-Id: I367817ded6f794c16d77b1e449bd7d61e355e5da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8657479
Reviewed-by: Antonio Sartori antoniosartori@chromium.org
Commit-Queue: Byungwoo Lee blee@igalia.com
Cr-Commit-Position: refs/heads/main@{#1728711}