| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/frame/csp/CSPDirectiveList.h" | 6 #include "core/frame/csp/CSPDirectiveList.h" |
| 7 | 7 |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/inspector/ConsoleMessage.h" | 10 #include "core/inspector/ConsoleMessage.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 void CSPDirectiveList::reportViolationWithLocation(const String& directiveText,
const String& effectiveDirective, const String& consoleMessage, const KURL& bloc
kedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine) const | 53 void CSPDirectiveList::reportViolationWithLocation(const String& directiveText,
const String& effectiveDirective, const String& consoleMessage, const KURL& bloc
kedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine) const |
| 54 { | 54 { |
| 55 String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleM
essage; | 55 String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleM
essage; |
| 56 m_policy->executionContext()->addConsoleMessage(ConsoleMessage::create(Secur
ityMessageSource, ErrorMessageLevel, message, contextURL, contextLine.oneBasedIn
t())); | 56 m_policy->executionContext()->addConsoleMessage(ConsoleMessage::create(Secur
ityMessageSource, ErrorMessageLevel, message, contextURL, contextLine.oneBasedIn
t())); |
| 57 m_policy->reportViolation(directiveText, effectiveDirective, message, blocke
dURL, m_reportURIs, m_header); | 57 m_policy->reportViolation(directiveText, effectiveDirective, message, blocke
dURL, m_reportURIs, m_header); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void CSPDirectiveList::reportViolationWithState(const String& directiveText, con
st String& effectiveDirective, const String& message, const KURL& blockedURL, Sc
riptState* scriptState) const | 60 void CSPDirectiveList::reportViolationWithState(const String& directiveText, con
st String& effectiveDirective, const String& message, const KURL& blockedURL, Sc
riptState* scriptState) const |
| 61 { | 61 { |
| 62 String reportMessage = m_reportOnly ? "[Report Only] " + message : message; | 62 String reportMessage = m_reportOnly ? "[Report Only] " + message : message; |
| 63 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(SecurityMessa
geSource, ErrorMessageLevel, reportMessage); | 63 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(S
ecurityMessageSource, ErrorMessageLevel, reportMessage); |
| 64 consoleMessage->setScriptState(scriptState); | 64 consoleMessage->setScriptState(scriptState); |
| 65 m_policy->executionContext()->addConsoleMessage(consoleMessage.release()); | 65 m_policy->executionContext()->addConsoleMessage(consoleMessage.release()); |
| 66 m_policy->reportViolation(directiveText, effectiveDirective, message, blocke
dURL, m_reportURIs, m_header); | 66 m_policy->reportViolation(directiveText, effectiveDirective, message, blocke
dURL, m_reportURIs, m_header); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool CSPDirectiveList::checkEval(SourceListDirective* directive) const | 69 bool CSPDirectiveList::checkEval(SourceListDirective* directive) const |
| 70 { | 70 { |
| 71 return !directive || directive->allowEval(); | 71 return !directive || directive->allowEval(); |
| 72 } | 72 } |
| 73 | 73 |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 parseReferrer(name, value); | 674 parseReferrer(name, value); |
| 675 else | 675 else |
| 676 m_policy->reportUnsupportedDirective(name); | 676 m_policy->reportUnsupportedDirective(name); |
| 677 } else { | 677 } else { |
| 678 m_policy->reportUnsupportedDirective(name); | 678 m_policy->reportUnsupportedDirective(name); |
| 679 } | 679 } |
| 680 } | 680 } |
| 681 | 681 |
| 682 | 682 |
| 683 } // namespace blink | 683 } // namespace blink |
| OLD | NEW |