Combine AppBannerManager::Did{Start,Finish}Navigation and reset state there.
Resets state_ ABM to INACTIVE in ResetCurrentPageData (called in DidFinishNavigation). This fixes a race possible when there are multiple navigations in quick succession. More info: There is no guarantee about the ordering of Did{Start,Finish}Navigation and DidFinishLoad for multiple navigations [1], so it is possible to get the order: [DidStartNav(url1), DidFinishNav(url1), DidStartNav(url2), DidFinishLoad(url1), DidFinishNav(url2), DidFinishLoad(url2)] The state_ in ABM is reset to INACTIVE on DidStartNavigation and checked (expected to still be INACTIVE) in DidFinishLoad. In the case of unusual call order, the state was no longer INACTIVE (usually it is COMPLETE) in DidFinishLoad(url2). This fix wouldn't help in the even-more-unusual order: [DidFinishNav({url1,url2}), DidFinishLoad({url1,url2})] I'm not sure how possible/likely that is. [1]: https://cs.chromium.org/chromium/src/content/public/browser/web_contents_observer.h?rcl=c954302bbe18174ce8a54242282eace7f25644e3&l=166-168 Bug: 991832 Change-Id: I0f04a5b26ee396557b56d9e1dca7570d3355f0da Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1797527 Commit-Queue: Glen Robertson <glenrob@chromium.org> Reviewed-by:Dominick Ng <dominickn@chromium.org> Cr-Commit-Position: refs/heads/master@{#697027}
Showing
Please register or sign in to comment