New issue
Advanced search Search tips

Issue 606627 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: May 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 1
Type: Bug

Blocking:
issue 7648



Sign in to add a comment

Resumption requests should be constructed using the RequestContext from the correct StoragePartition

Project Member Reported by asanka@chromium.org, Apr 26 2016

Issue description

When resuming downloads that were initiated using a non-default StoragePartition, the resumption request should also be created against the same StoragePartition.


 

Comment 1 by creis@chromium.org, May 5 2016

Components: UI>Browser>Downloads UI>Browser>Navigation
Currently non-default StoragePartitions are used to isolate requests originating from WebViews within platform apps (https://developer.chrome.com/apps/tags/webview). Hence, it's possible for a download initiated from within a webview tag to end up using the wrong StoragePartition if it's resumed.

Project Member

Comment 3 by bugdroid1@chromium.org, May 11 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3b4be1260ebe931143425302a867b7e7407d002b

commit 3b4be1260ebe931143425302a867b7e7407d002b
Author: asanka <asanka@chromium.org>
Date: Wed May 11 04:27:57 2016

[Downloads] Use the initiating StoragePartition for resumption.

The URLRequest created for downloads resumption should be created using
the same StoragePartition as the one used to initiate the download.
Downloads used to use the request context returned via
ResourceContext::GetURLRequestContext(), which can yield the wrong
URLRequestContext (and the wrong StoragePartition) when multiple
StoragePartitions are in use.

Currently non-default StoragePartitions are used for implementing
WebView tag in platform apps. Hence a download that's initiated in a
WebView, if resumed, could result in a network request being issued
that's backed by the wrong StoragePartition without this fix.

This change:

  * Adds the site instance URL to the metadata that's persisted for each
    download.

  * Updates history database schema to accommodate site URL.

  * Updates DownloadURLParameters to take a URLRequestContextGetter
    instead of a ResourceContext. The latter can be uniquely determined
    by the DownloadManager.

  * Updates DownloadItemImpl to use the site instance URL to determine
    the correct StoragePartition to use during resumption.

The rest is assorted tests and plumbing.

R=creis@chromium.org,sky@chromium.org,asargent@chromium.org,jam@chromium.org,svaldez@chromium.org
BUG= 606627 

Review-Url: https://codereview.chromium.org/1924473003
Cr-Commit-Position: refs/heads/master@{#392849}

[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/browser/apps/guest_view/web_view_browsertest.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/browser/download/download_history.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/browser/download/download_history_unittest.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/browser/download/download_ui_controller_unittest.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/browser/extensions/api/downloads/downloads_api.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/browser/extensions/webstore_installer.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc
[add] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/background.js
[add] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.html
[add] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.js
[add] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/manifest.json
[add] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/window.html
[add] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/window.js
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/components/history/core/browser/BUILD.gn
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/components/history/core/browser/download_database.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/components/history/core/browser/download_database.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/components/history/core/browser/download_row.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/components/history/core/browser/download_row.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/components/history/core/browser/history_backend_db_unittest.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/components/history/core/browser/history_database.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/components/history/core/test/history_backend_db_base_test.cc
[add] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/components/test/data/history/history.31.sql
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_browsertest.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_create_info.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_item_factory.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_item_impl.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_item_impl.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_item_impl_unittest.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_manager_impl.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_manager_impl.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_manager_impl_unittest.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_request_core.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/download/download_resource_handler.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/loader/resource_dispatcher_host_impl.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/browser/renderer_host/render_message_filter.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/public/browser/download_item.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/public/browser/download_manager.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/public/browser/download_url_parameters.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/public/browser/download_url_parameters.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/public/test/mock_download_item.h
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/public/test/mock_download_manager.cc
[modify] https://crrev.com/3b4be1260ebe931143425302a867b7e7407d002b/content/public/test/mock_download_manager.h

Comment 4 by asanka@chromium.org, May 11 2016

Status: Fixed (was: Assigned)

Comment 5 by asanka@chromium.org, May 13 2016

Labels: Merge-Request-51
Status: Assigned (was: Fixed)
Requesting merge to M51. Baked on Canary without an incident. While the CL touches a lot of files, the non-plumbing, non-test content is small. These changes include:

 * Migrating History DB schema to accommodate new field.
 * Updating history code to query and store new field.
 * Fixing callers of DownloadUrl() to use the correct URLRequestContextGetter.

Comment 6 by asanka@chromium.org, May 13 2016

Status: Fixed (was: Assigned)
(Leaving in Fixed until a merge decision is made)

Comment 7 by tin...@google.com, May 13 2016

Labels: -Merge-Request-51 Merge-Approved-51 Hotlist-Merge-Approved
Your change meets the bar and is auto-approved for M51 (branch: 2704)

Comment 8 by gov...@chromium.org, May 13 2016

Please merge your change to M51 branch 2704 before 5:00 PM PST Monday (05/16).So we can take it for next week LAST M51 beta release. Thank you.
Project Member

Comment 9 by bugdroid1@chromium.org, May 14 2016

Labels: -merge-approved-51 merge-merged-2704
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c846f97aabaf9caee8c51867069b3bcada00c9bb

commit c846f97aabaf9caee8c51867069b3bcada00c9bb
Author: Asanka Herath <asanka@chromium.org>
Date: Sat May 14 01:43:14 2016

[Merge M51][Downloads] Use the initiating StoragePartition for resumption.

The URLRequest created for downloads resumption should be created using
the same StoragePartition as the one used to initiate the download.
Downloads used to use the request context returned via
ResourceContext::GetURLRequestContext(), which can yield the wrong
URLRequestContext (and the wrong StoragePartition) when multiple
StoragePartitions are in use.

Currently non-default StoragePartitions are used for implementing
WebView tag in platform apps. Hence a download that's initiated in a
WebView, if resumed, could result in a network request being issued
that's backed by the wrong StoragePartition without this fix.

This change:

  * Adds the site instance URL to the metadata that's persisted for each
    download.

  * Updates history database schema to accommodate site URL.

  * Updates DownloadURLParameters to take a URLRequestContextGetter
    instead of a ResourceContext. The latter can be uniquely determined
    by the DownloadManager.

  * Updates DownloadItemImpl to use the site instance URL to determine
    the correct StoragePartition to use during resumption.

The rest is assorted tests and plumbing.

R=creis@chromium.org,sky@chromium.org,asargent@chromium.org,jam@chromium.org,svaldez@chromium.org
BUG= 606627 

Review-Url: https://codereview.chromium.org/1924473003
Cr-Commit-Position: refs/heads/master@{#392849}
(cherry picked from commit 3b4be1260ebe931143425302a867b7e7407d002b)

Review URL: https://codereview.chromium.org/1979783002 .

Cr-Commit-Position: refs/branch-heads/2704@{#549}
Cr-Branched-From: 6e53600def8f60d8c632fadc70d7c1939ccea347-refs/heads/master@{#386251}

[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/browser/apps/guest_view/web_view_browsertest.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/browser/download/download_history.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/browser/download/download_history_unittest.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/browser/download/download_ui_controller_unittest.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/browser/extensions/api/downloads/downloads_api.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/browser/extensions/webstore_installer.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/browser/safe_browsing/incident_reporting/last_download_finder_unittest.cc
[add] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/background.js
[add] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.html
[add] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/guest.js
[add] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/manifest.json
[add] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/window.html
[add] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/chrome/test/data/extensions/platform_apps/web_view/download_cookie_isolation/window.js
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/components/history/core/browser/download_database.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/components/history/core/browser/download_database.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/components/history/core/browser/download_row.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/components/history/core/browser/download_row.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/components/history/core/browser/history_backend_db_unittest.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/components/history/core/browser/history_database.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/components/history/core/test/history_backend_db_base_test.cc
[add] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/components/test/data/history/history.31.sql
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_browsertest.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_create_info.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_item_factory.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_item_impl.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_item_impl.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_item_impl_unittest.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_manager_impl.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_manager_impl.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_manager_impl_unittest.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_request_core.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/download/download_resource_handler.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/loader/resource_dispatcher_host_impl.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/browser/renderer_host/render_message_filter.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/public/browser/download_item.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/public/browser/download_manager.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/public/browser/download_url_parameters.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/public/browser/download_url_parameters.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/public/test/mock_download_item.h
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/public/test/mock_download_manager.cc
[modify] https://crrev.com/c846f97aabaf9caee8c51867069b3bcada00c9bb/content/public/test/mock_download_manager.h

Sign in to add a comment