• Danyao Wang's avatar
    [Nav Experiment] Fix crash when WKWebView is removed from nav manager. · 267f0770
    Danyao Wang authored
    CRWWebController removes WKWebView when the web process is evicted
    (crbug/815248). This leaves WKBasedNavigationManager in an inconsistent
    state as previous_item_index_ may not be -1, but GetItemCount() is 0.
    This causes a crash in OnNavigationItemCommitted() when user starts a
    new navigation by typing into the omnibox.
    
    Fix the crash by guarding the pointer dereference with a nullptr check.
    
    Bug: 797756
    Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
    Change-Id: Ie553efbe7bb558a8af955ca6f64e2b8aea58aacd
    Reviewed-on: https://chromium-review.googlesource.com/996436Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
    Commit-Queue: Danyao Wang <danyao@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#548250}
    267f0770
wk_based_navigation_manager_impl.mm 20.2 KB