• Scott Violet's avatar
    weblayer: make it possible to delete tab in OnNavigationFailed... · 7d8ab070
    Scott Violet authored
    and OnNavigationCompleted.
    
    Content does not allow WebContents to be deleted from
    WebContentsObserver::DidFinishNavigation(). Unfortunately we
    keep seeing crashes because of this restriction, so I'm
    inclined to provide some mitigation.
    
    This patch takes the approach of detecting this scenario
    and delaying deletion of the WebContents. All the surrounding
    WebLayer classes are deleted/destroyed and ownership of the
    WebContents is passed to the Profile and deleted from a
    post-task.
    
    Doing this may introduce it's own set of problems. For example,
    if a callback/notification is still in flight from content that gets
    processed before the deletion, and the code assumes there is a Tab
    associated with the WebContents, then there will be problems.
    
    My preference is still to fix this in content, but in the mean
    time this should work.
    
    BUG=1111127
    TEST=covered by test
    
    Change-Id: I9dbd9f90b88cbdbdfbab9aab81840b986fcdc410
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377552
    Commit-Queue: Scott Violet <sky@chromium.org>
    Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#802416}
    7d8ab070
browser_impl.cc 14.8 KB