Commit 5fca2df4 authored by wjmaclean's avatar wjmaclean Committed by Commit bot

Speculative fix for ChromeWebViewGuestDelegate crash.

It is possible that when
ChromeWebViewGuestDelegate::HandleContextMenu() attempts to build a
menu to display that it will receive a null pointer (if the associated
web_contents' frame tree does not have a focussed frame). In the
current code this can lead to a crash. In the short term, while we
determine if this lack of a focussed frame is an error or not, early-out
if we receive a null menu.

BUG=487419

Review URL: https://codereview.chromium.org/1139193003

Cr-Commit-Position: refs/heads/master@{#330326}
parent 943d5015
......@@ -49,6 +49,11 @@ bool ChromeWebViewGuestDelegate::HandleContextMenu(
DCHECK(menu_delegate);
pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params);
// It's possible for the returned menu to be null, so early out to avoid
// a crash. TODO(wjmaclean): find out why it's possible for this to happen
// in the first place, and if it's an error.
if (!pending_menu_)
return false;
// Pass it to embedder.
int request_id = ++pending_context_menu_request_id_;
......
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