Commit 8a569e0a authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Fix crash after HandleMouseUp.

Looking at crash reports where the LocalRootImpl is null it is clear
that the HandleMouseUp can detach the frame and the GetPage accessor
will then be null.

Change-Id: If856e914135b833bfacbce84be5c15b242acd09f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533021
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826381}
parent e1040182
...@@ -546,6 +546,9 @@ void WebFrameWidgetBase::HandleMouseDown(LocalFrame& main_frame, ...@@ -546,6 +546,9 @@ void WebFrameWidgetBase::HandleMouseDown(LocalFrame& main_frame,
} }
PageWidgetEventHandler::HandleMouseDown(main_frame, event); PageWidgetEventHandler::HandleMouseDown(main_frame, event);
// PageWidgetEventHandler may have detached the frame.
if (!LocalRootImpl())
return;
if (view_impl->GetPagePopup() && page_popup && if (view_impl->GetPagePopup() && page_popup &&
view_impl->GetPagePopup()->HasSamePopupClient(page_popup.get())) { view_impl->GetPagePopup()->HasSamePopupClient(page_popup.get())) {
...@@ -606,6 +609,9 @@ WebInputEventResult WebFrameWidgetBase::HandleMouseUp( ...@@ -606,6 +609,9 @@ WebInputEventResult WebFrameWidgetBase::HandleMouseUp(
const WebMouseEvent& event) { const WebMouseEvent& event) {
WebInputEventResult result = WebInputEventResult result =
PageWidgetEventHandler::HandleMouseUp(main_frame, event); PageWidgetEventHandler::HandleMouseUp(main_frame, event);
// PageWidgetEventHandler may have detached the frame.
if (!LocalRootImpl())
return result;
if (GetPage()->GetSettings().GetShowContextMenuOnMouseUp()) { if (GetPage()->GetSettings().GetShowContextMenuOnMouseUp()) {
// Dispatch the contextmenu event regardless of if the click was swallowed. // Dispatch the contextmenu event regardless of if the click was swallowed.
...@@ -621,6 +627,7 @@ WebInputEventResult WebFrameWidgetBase::HandleMouseWheel( ...@@ -621,6 +627,7 @@ WebInputEventResult WebFrameWidgetBase::HandleMouseWheel(
const WebMouseWheelEvent& event) { const WebMouseWheelEvent& event) {
View()->CancelPagePopup(); View()->CancelPagePopup();
return PageWidgetEventHandler::HandleMouseWheel(frame, event); return PageWidgetEventHandler::HandleMouseWheel(frame, event);
// PageWidgetEventHandler may have detached the frame.
} }
WebInputEventResult WebFrameWidgetBase::HandleCharEvent( WebInputEventResult WebFrameWidgetBase::HandleCharEvent(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment