Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2421473004: CSP: Fire 'SecurityPolicyViolation' on the offending element. (Closed)
Patch Set: Test. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 11f5f6195d2fef8f83d6e1439ef6cbdc663640f5..469ed7c601189db519cb0e7f46fe917e6a9e7c36 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -5393,9 +5393,10 @@ bool Document::allowInlineEventHandler(Node* node,
EventListener* listener,
const String& contextURL,
const WTF::OrdinalNumber& contextLine) {
+ Element* element = node && node->isElementNode() ? toElement(node) : nullptr;
if (!ContentSecurityPolicy::shouldBypassMainWorld(this) &&
!contentSecurityPolicy()->allowInlineEventHandler(
- listener->code(), contextURL, contextLine))
+ element, listener->code(), contextURL, contextLine))
return false;
// HTML says that inline script needs browsing context to create its execution
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698