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

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: 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 | « no previous file | 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..77bb05a7d55c8633b863ed15219a714c1677de49 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1647,8 +1647,13 @@ 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. Give the event to the main frame in this case.
Charlie Reis 2015/12/07 22:47:24 Sanity check: What will the main frame do with it?
alexmos 2015/12/07 23:12:59 That's a good point. It's going to go to the main
Charlie Reis 2015/12/07 23:16:52 Yes, let's do that. Thanks!
alexmos 2015/12/07 23:21:50 Done. Please take a look.
+ RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView();
+ if (!view)
+ return receiving_widget;
+
+ return RenderWidgetHostImpl::From(view->GetRenderWidgetHost());
}
void WebContentsImpl::EnterFullscreenMode(const GURL& origin) {
« 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