• Jered Gray's avatar
    Prevent top-level whitelisting of RESOURCE_LOADING_HINTS · 68b5a64d
    Jered Gray authored
    Top-level whitelisting for a URL with a PreviewsType of
    RESOURCE_LOADING_HINTS doesn't make much sense as the optimizations come
    from the page hints and the page hints themselves can provide more
    accurate whitelisting data. Because of this, the existence of top-level
    whitelisting with a PreviewType of RESOURCE_LOADING_HINTS indicates a
    bug with the component's hints.
    
    We're now DCHECKing if the component's hints include top-level
    RESOURCE_LOADING_HINTS whitelisting.
    
    IsWhitelisted() itself has been split into IsWhitelistedAtTopLevel()
    and IsWhitelistedInPageHints(). IsWhitelistedAtTopLevel() is skipped if
    the type is PreviewsType::RESOURCE_LOADING_HINTS.
    
    Additionally, some const-related cleanup was done with function calls in
    PreviewHints and HintCache.
    
    Lastly, ResourceLoadingHintsBrowserTest has been modified to test the
    full hint flow where it sets and uses page hints. Doing this exposed an
    issue with ResourceLoadingHintsHttpsWhitelistedRedirectToHttps, which
    was incorrectly passing as a result of some faked data (redirects don't
    currently work with hints). The test has been disabled until hints are
    made to work with redirects.
    
    Change-Id: I165ccb9ffeba742840a9def15e283a0e254dbb86
    Reviewed-on: https://chromium-review.googlesource.com/c/1256007
    Commit-Queue: Jered Gray <jegray@chromium.org>
    Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
    Reviewed-by: default avatarDoug Arnett <dougarnett@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#596455}
    68b5a64d
previews_browsertest.cc 13.7 KB