• Ali Juma's avatar
    [iOS] Associate SB allow list decisions with navigation URL · 5c18b499
    Ali Juma authored
    This CL introduces SafeBrowsingQueryManager, which manages URL
    queries on the IO thread and notifies observers on the UI thread
    when they are finished.  This was created to have a model object
    that stored the NavigationItem ID associated with a particular
    URL check request.  The previous approach assumed that when a
    sub frame UnsafeResource was encountered, it was always from the
    last-committed NavigationItem, but this heuristic is not always
    correct, so the ID is stored in the query.
    
    Using the query manager, UnsafeResource.navigation_url can be
    reliably set to the correct value and used to drive the allow-
    list decisions for those resources. In particular, the
    navigation_url for main frame queries is simply the query url,
    but the navigation_url for subframe queries is the url of the
    corresponding main frame, obtained from the main frame's
    NavigationItem. This means that a user decision to allow a
    navigation to an unsafe subframe is associated with the
    main frame URL rather than the subframe URL, matching other
    platforms.
    
    Patch originally by kkhorimoto@chromium.org, rebased and
    landed by ajuma@.
    
    Bug: 1084741, 1084735
    Change-Id: I789535991a6ec05ec635d93b878a3cadd20dfc7f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217092
    Commit-Queue: Ali Juma <ajuma@chromium.org>
    Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
    Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
    Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#814899}
    5c18b499
BUILD.gn 6.44 KB