• Kurt Horimoto's avatar
    [iOS] Check against |presented_request_| when capabilities change. · 910e0efa
    Kurt Horimoto authored
    When an OverlayPresentationContext's capabilities are updated,
    OverlayPresenter will hide the currently-presented overlay UI if the
    new capabilities are insufficient to present it.  However, the previous
    implementation mistakenly checked against GetActiveRequest() rather
    than |presented_request_| to handle this logic.  GetActiveRequest()
    returns the front request of the active WebState's queue, which is
    often, but not always the presented request when |presenting_| is true.
    |presented_request_| is more accurate, as there are two points in time
    where it differs from GetActiveRequest():
    - When presented overlay UI is being dismissed due to request
      cancellation.  At this point, the request will have already been
      removed from the active WebState's queue.
    - When presented overlay UI is being dismissed due to a change in the
      active WebState.  The request still belongs to the previously-
      active WebState, so will not be returned by GetActiveRequest().
    
    Bug: 1065564
    Change-Id: I4c7eec8ba28311f520cff482d316bb4ac8e24a23
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212520Reviewed-by: default avatarChris Lu <thegreenfrog@chromium.org>
    Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
    Auto-Submit: Kurt Horimoto <kkhorimoto@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#772276}
    910e0efa
overlay_presenter_impl_unittest.mm 26.3 KB