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

Unified Diff: third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp

Issue 2450833002: Verify that an event queue is present before firing an event. (Closed)
Patch Set: Comment. 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
index 10c3665d7f81fa19c4a74df0672861de564d469d..4bf8c546801c00d1199a650c011a9898902ec592 100644
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -1252,7 +1252,9 @@ void ContentSecurityPolicy::dispatchViolationEvents(
const SecurityPolicyViolationEventInit& violationData,
Element* element,
Document* document) {
- if (!document->domWindow())
+ // If the document is detached or closed (thus clearing its event queue)
+ // between the violation occuring and this event dispatch, exit early.
+ if (!document->domWindow() || !document->domWindow()->getEventQueue())
return;
SecurityPolicyViolationEvent* event = SecurityPolicyViolationEvent::create(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698