Fix multiple download protection for <a download> x-origin redirect
The bug: multiple downloads protection is bypassed when there are multiple <a download> download attempts and they end up triggering a x-origin redirect to another download. The cause: Each x-origin redirect following the <a download> is being treated as a navigation. (See DownloadManagerImpl::InterceptDownload() (NetworkService enabled), DownloadResourceHandler::OnRequestRedirected() (NetworkService disabled)). The navigation will hit DownloadRequestLimiter::TabDownloadState::DidStartNavigation that resets some state of the limiter, and future downloads won't be prevented. The solution: plumb |from_download_cross_origin_redirect| to NavigationRequest, and skip resetting the limiter state when the flag is true. Bug: 959640 Change-Id: I7d8aca09670be5258e149e34e3e6f2f3107442ff Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1627209Reviewed-by:Jochen Eisinger <jochen@chromium.org> Reviewed-by:
Min Qin <qinmin@chromium.org> Commit-Queue: Yao Xiao <yaoxia@chromium.org> Cr-Commit-Position: refs/heads/master@{#665973}
Showing
Please register or sign in to comment