• ananta's avatar
    Fix a crash which occurs while dragging tabs back to the window where they originated from. · d9b817cc
    ananta authored
    Reason for the crash is the recent change to the WebView::AttachWebContents function to show the
    WebContentsView when the WCV's root window is NULL. This can happen if the tab was detached and
    is being reattched in which case the clipping window is removed, etc.
    
    The actual crash occurs in the RWHVA::WasShown function where we dereference a NULL host pointer
    due to a NULL root window.
    
    Fix is to show the WCV after the attach has happened in the holder. This works correctly and is required for the Legacy window to show up correctly.
    I verified that WC::Show and WC::Hide only get called once and the same is true with RWHVA::WasShown/WasHidden.
    
    I updated the TestWebViewAttachDetachWebContents webview unittest to check for a NULL root window
    when WC::WasShown is fired and we test for the same.
    
    BUG=415509
    
    Review URL: https://codereview.chromium.org/584743004
    
    Cr-Commit-Position: refs/heads/master@{#296072}
    d9b817cc
webview.cc 13.1 KB