forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the navigation IsolationInfo for downloading an opened PDF
What: When downloading a PDF that is already opened, use the original navigation isolation info. Why: When a subframe PDF is opened and then is manually downloaded, the network isolation key for the 2 requests are inconsistent. The navigation request is using <top frame origin, subframe origin>, whereas the download request is using the <pdf url origin (== subframe origin), pdf url origin>. This not only has the typical performance & privacy problem, but also could give the user an unexpected cached PDF instead of the latest PDF opened -- if there are 2 PDFs opened with the same URL but different contents, and we try to save the latest one. (Note that the fundamental issue is not solvable by fixing the isolation info per https://bugs.chromium.org/p/chromium/issues/detail?id=1171524#c20, but making it download the latest opened PDF is still more desirable than making it download an old one). How: Add a |rfh| parameter in WebContents::SaveFrame(WithHeaders), to denote the original navigation targeted frame, so that we can recover the origin navigation isolation info from there. Fill in this info in the caller sites: 1. PDFWebContentsHelper::SaveUrlAs 2. RenderViewContextMenu::ExecSaveAs 3. WebContentsImpl::OnSavePage Specifically, if we have an inner-web-contents PDF, we will pass its outer-web-contents-frame; otherwise, pass the current frame host. In download_utils.cc::CreateResourceRequest, if the isolation_info is already filled in, use the given isolation info & site-for-cookies; otherwise, keep the existing behavior i.e. use <url origin, url origin> as the isolation key. Bug: 1174216 Change-Id: Ibba85358a4da9efedaa5510b70f7279412685d56 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2689861 Reviewed-by: Nasko Oskov <nasko@chromium.org> Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org> Reviewed-by: K. Moon <kmoon@chromium.org> Reviewed-by: Matt Menke <mmenke@chromium.org> Reviewed-by: Min Qin <qinmin@chromium.org> Commit-Queue: Yao Xiao <yaoxia@chromium.org> Cr-Commit-Position: refs/heads/master@{#857983}
- Loading branch information
1 parent
63570e9
commit e500704
Showing
15 changed files
with
451 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.