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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1505723005: Null-check GetView before using it in GetFocusedRenderWidgetHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Drop the event instead of giving to main frame. Created 5 years 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 | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 18589f15e14ca89b2a2c84366110b23d7f66114f..5392cf82d6a4f7e7299a71cc22c04c929dd53fb8 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1647,8 +1647,15 @@ RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost(
if (!focused_frame)
return receiving_widget;
- return RenderWidgetHostImpl::From(
- focused_frame->current_frame_host()->GetView()->GetRenderWidgetHost());
+ // The view may be null if a subframe's renderer process has crashed while
+ // the subframe has focus. Drop the event in that case. Do not give
+ // it to the main frame, so that the user doesn't unexpectedly type into the
+ // wrong frame if a focused subframe renderer crashes while they type.
+ RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView();
+ if (!view)
+ return nullptr;
+
+ return RenderWidgetHostImpl::From(view->GetRenderWidgetHost());
}
void WebContentsImpl::EnterFullscreenMode(const GURL& origin) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698