Skip to content

Commit

Permalink
[ MimeHandlerView ] Fix a browser crash
Browse files Browse the repository at this point in the history
Navigations to a MimeHandlerView type could finish without calling
ReadyToCommitNavigation which is when MimeHandlerViewEmbedder sets
its |render_frame_host_| reference (e.g., due to FrameTreeNode
being removed mid navigation). This adds a null check to the
DidFinishNavigation override to avoid browser crashes.

Bug: 969840
Change-Id: I2aa595a9a444cb77c10d124e6e345505b76cc81c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643092
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Reviewed-by: James MacLean <wjmaclean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666048}
  • Loading branch information
ehsan-karamad authored and Commit Bot committed Jun 4, 2019
1 parent 3c5b967 commit 60b6382
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,13 @@ void MimeHandlerViewEmbedder::ReadyToCreateMimeHandlerView(
}

void MimeHandlerViewEmbedder::CheckSandboxFlags() {
if (!render_frame_host_->IsSandboxed(blink::WebSandboxFlags::kPlugins))
// If the FrameTreeNode is deleted while it has ownership of the ongoing
// NavigationRequest, DidFinishNavigation is called before FrameDeleted (see
// https://crbug.com/969840).
if (render_frame_host_ &&
!render_frame_host_->IsSandboxed(blink::WebSandboxFlags::kPlugins)) {
return;
}
// Notify the renderer to load an empty page instead.
GetContainerManager()->LoadEmptyPage(resource_url_);
GetMimeHandlerViewEmbeddersMap()->erase(frame_tree_node_id_);
Expand Down

0 comments on commit 60b6382

Please sign in to comment.