| Index: Source/core/frame/csp/ContentSecurityPolicy.cpp
|
| diff --git a/Source/core/frame/csp/ContentSecurityPolicy.cpp b/Source/core/frame/csp/ContentSecurityPolicy.cpp
|
| index cdd5d063a27a8209e4e2fb288da86cdb7096524b..3775ccb028a34a9eeca5ac508b0e1b9cf504b93f 100644
|
| --- a/Source/core/frame/csp/ContentSecurityPolicy.cpp
|
| +++ b/Source/core/frame/csp/ContentSecurityPolicy.cpp
|
| @@ -474,8 +474,7 @@ bool ContentSecurityPolicy::allowChildContextFromSource(const KURL& url, Content
|
| bool ContentSecurityPolicy::allowWorkerContextFromSource(const KURL& url, ContentSecurityPolicy::ReportingStatus reportingStatus) const
|
| {
|
| // CSP 1.1 moves workers from 'script-src' to the new 'child-src'. Measure the impact of this backwards-incompatible change.
|
| - if (m_executionContext->isDocument()) {
|
| - Document* document = static_cast<Document*>(m_executionContext);
|
| + if (Document* document = this->document()) {
|
| UseCounter::count(*document, UseCounter::WorkerSubjectToCSP);
|
| if (isAllowedByAllWithURL<&CSPDirectiveList::allowChildContextFromSource>(m_policies, url, SuppressReport) && !isAllowedByAllWithURL<&CSPDirectiveList::allowScriptFromSource>(m_policies, url, SuppressReport))
|
| UseCounter::count(*document, UseCounter::WorkerAllowedByChildBlockedByScript);
|
| @@ -588,10 +587,10 @@ static void gatherSecurityPolicyViolationEventData(SecurityPolicyViolationEventI
|
| void ContentSecurityPolicy::reportViolation(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header)
|
| {
|
| // FIXME: Support sending reports from worker.
|
| - if (!m_executionContext->isDocument())
|
| + Document* document = this->document();
|
| + if (!document)
|
| return;
|
|
|
| - Document* document = this->document();
|
| LocalFrame* frame = document->frame();
|
| if (!frame)
|
| return;
|
|
|