From 94866b720b64a16d2f9420aa2ffc297e7226394f Mon Sep 17 00:00:00 2001 From: Kent Tamura Date: Wed, 25 May 2016 09:49:42 +0900 Subject: [PATCH] Add null checks for NodeEventContext::node() and WindowEventContext::window(). Fix a regressino by crrev.com/393784. This CL has no tests because the code will be removed in a few stable releases. BUG=613752 Review-Url: https://codereview.chromium.org/1997273002 Cr-Commit-Position: refs/heads/master@{#395528} (cherry picked from commit 4565f73d4d2e07d7c961e1572a7002aaa24c510d) Review URL: https://codereview.chromium.org/2013643003 . Cr-Commit-Position: refs/branch-heads/2743@{#45} Cr-Branched-From: 2b3ae3b8090361f8af5a611712fc1a5ab2de53cb-refs/heads/master@{#394939} --- third_party/WebKit/Source/core/events/EventDispatcher.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/WebKit/Source/core/events/EventDispatcher.cpp b/third_party/WebKit/Source/core/events/EventDispatcher.cpp index af33e2aac8023..5f13a7d4a3085 100644 --- a/third_party/WebKit/Source/core/events/EventDispatcher.cpp +++ b/third_party/WebKit/Source/core/events/EventDispatcher.cpp @@ -184,7 +184,7 @@ inline void EventDispatcher::dispatchEventAtBubbling() } else if (m_event->bubbles() && !m_event->cancelBubble()) { m_event->setEventPhase(Event::BUBBLING_PHASE); } else { - if (m_event->bubbles() && m_event->cancelBubble() && eventContext.node()->hasEventListeners(m_event->type())) + if (m_event->bubbles() && m_event->cancelBubble() && eventContext.node() && eventContext.node()->hasEventListeners(m_event->type())) UseCounter::count(eventContext.node()->document(), UseCounter::EventCancelBubbleAffected); continue; } @@ -195,7 +195,7 @@ inline void EventDispatcher::dispatchEventAtBubbling() if (m_event->bubbles() && !m_event->cancelBubble()) { m_event->setEventPhase(Event::BUBBLING_PHASE); m_event->eventPath().windowEventContext().handleLocalEvents(*m_event); - } else if (m_event->bubbles() && m_event->eventPath().windowEventContext().window()->hasEventListeners(m_event->type())) { + } else if (m_event->bubbles() && m_event->eventPath().windowEventContext().window() && m_event->eventPath().windowEventContext().window()->hasEventListeners(m_event->type())) { UseCounter::count(m_event->eventPath().windowEventContext().window()->getExecutionContext(), UseCounter::EventCancelBubbleAffected); } }