Index: Source/core/frame/csp/CSPDirectiveList.cpp |
diff --git a/Source/core/frame/csp/CSPDirectiveList.cpp b/Source/core/frame/csp/CSPDirectiveList.cpp |
index 3c59b8bea557c69696a2156fa17f08024900930a..adb79ebc5afa74f421f1e44b35f4842970c7b3aa 100644 |
--- a/Source/core/frame/csp/CSPDirectiveList.cpp |
+++ b/Source/core/frame/csp/CSPDirectiveList.cpp |
@@ -5,6 +5,7 @@ |
#include "config.h" |
#include "core/frame/csp/CSPDirectiveList.h" |
+#include "bindings/core/v8/ScriptCallStackFactory.h" |
#include "core/dom/Document.h" |
#include "core/frame/LocalFrame.h" |
#include "platform/ParsingUtilities.h" |
@@ -56,10 +57,10 @@ void CSPDirectiveList::reportViolationWithLocation(const String& directiveText, |
m_policy->reportViolation(directiveText, effectiveDirective, message, blockedURL, m_reportURIs, m_header); |
} |
-void CSPDirectiveList::reportViolationWithState(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, ScriptState* scriptState) const |
+void CSPDirectiveList::reportViolationWithStack(const String& directiveText, const String& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, PassRefPtr<ScriptCallStack> callStack) const |
{ |
String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleMessage; |
- m_policy->executionContext()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, scriptState); |
+ m_policy->executionContext()->addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message, callStack); |
m_policy->reportViolation(directiveText, effectiveDirective, message, blockedURL, m_reportURIs, m_header); |
} |
@@ -129,7 +130,12 @@ bool CSPDirectiveList::checkEvalAndReportViolation(SourceListDirective* directiv |
if (directive == m_defaultSrc) |
suffix = " Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback."; |
- reportViolationWithState(directive->text(), ContentSecurityPolicy::ScriptSrc, consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", KURL(), scriptState); |
+ RefPtr<ScriptCallStack> callStack; |
+ if (scriptState) |
vsevik
2014/07/15 14:40:33
Let's extract this to a separate change
|
+ callStack = createScriptCallStackForConsole(scriptState); |
+ |
+ reportViolationWithStack(directive->text(), ContentSecurityPolicy::ScriptSrc, consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", KURL(), callStack.release()); |
+ |
if (!m_reportOnly) { |
m_policy->reportBlockedScriptExecutionToInspector(directive->text()); |
return false; |