| Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| index fc1a846d6d6379fd01d8e89ad50fd1f2a924087c..096ea24f29cfdebb9b91546495ff251418ef75cb 100644
|
| --- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| +++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
|
| @@ -2246,4 +2246,47 @@ void WebLocalFrameImpl::usageCountChromeLoadTimes(const WebString& metric)
|
| UseCounter::count(frame(), feature);
|
| }
|
|
|
| +void WebLocalFrameImpl::reportContentSecurityPolicyViolation(
|
| + const WebString& directiveText,
|
| + const WebString& effectiveDirective,
|
| + const WebString& consoleMessage,
|
| + const WebURL& blockedURL,
|
| + const WebVector<WebString>& reportEndpoints,
|
| + const WebString& header,
|
| + WebContentSecurityPolicyViolationType violationType,
|
| + bool followedRedirect)
|
| +{
|
| + Vector<String> coreReportEndpoints;
|
| + coreReportEndpoints.reserveInitialCapacity(reportEndpoints.size());
|
| + for (const WebString& reportEndpoint : reportEndpoints)
|
| + coreReportEndpoints.append(reportEndpoint);
|
| +
|
| + auto redirectStatus = followedRedirect
|
| + ? ResourceRequest::RedirectStatus::FollowedRedirect
|
| + : ResourceRequest::RedirectStatus::NoRedirect;
|
| +
|
| + // This method has no |contextLine| parameter, because source information
|
| + // should not be disclosed cross-site and therefore caller of this method
|
| + // (by design) does not have access to the line number associated with this
|
| + // Content Security Policy violation.
|
| + int contextLine = 0;
|
| +
|
| + ContentSecurityPolicy* policy = m_frame->securityContext()->contentSecurityPolicy();
|
| + policy->logToConsole(ConsoleMessage::create(
|
| + SecurityMessageSource,
|
| + ErrorMessageLevel,
|
| + consoleMessage));
|
| + policy->reportViolation(
|
| + directiveText,
|
| + effectiveDirective,
|
| + consoleMessage,
|
| + blockedURL,
|
| + coreReportEndpoints,
|
| + header,
|
| + static_cast<ContentSecurityPolicy::ViolationType>(violationType),
|
| + nullptr, // contextFrame
|
| + redirectStatus,
|
| + contextLine);
|
| +}
|
| +
|
| } // namespace blink
|
|
|