• Eugene But's avatar
    Fix GetPendingItemIndex() for new navigations. · 30381c30
    Eugene But authored
    Before this CL, GetPendingItemIndex() used to return last committed item
    index for the new navigations (none-reload, none-back-forward).
    Presumably this was done before CRWSessionController implemented
    pendingItemIndex support, when CRWSessionController immediately changed committed item
    during back-forward navigations. pendingItemIndex support design doc: https://docs.google.com/document/d/1GvsaoNtMO7d87FzoysOW5GqH6XErI5g2cinKhkPk7bQ/edit
    
    This CL returns -1 for new navigations, which matches //content.
    
    There are 3 places where GetPendingItemIndex is used outside of ios/web:
     - IOSLiveTab::GetPendingEntryIndex (new implementation matches content,
       which is the right approach)
     - GetPossiblyPendingItemAtIndex (new implementation should have no
       effect because index should be in [0;size] bounds, but this is just
       an assumption and it's actually unclear if GetPossiblyPendingItemAtIndex
       relied on undocumented and incorrect behavior).
     - ReadingListWebStateObserver::LoadOfflineReadingListEntry (new
       implementation should make the whole block of code obsolete, but
       it should be fine to leave it as it is because
       ReadingListWebStateObserver is going to be removed soon).
    
    Bug: 665189, 899827
    Change-Id: I9538b693c924790620140b37d6c4fea6cce26fde
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1504231
    Commit-Queue: Eugene But <eugenebut@chromium.org>
    Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
    Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#638637}
    30381c30
navigation_manager_impl_unittest.mm 125 KB