In-memory download service does not properly populate the response URL chain & headers |
|||||||||
Issue descriptionI've got a download::Client that uses the URL chain and response headers provided to the OnDownloadStarted() method. https://cs.chromium.org/chromium/src/components/download/public/background_service/client.h?q=OnDownloadStarted&sq=package:chromium&dr=CSs&l=91 When I use a service created by download::BuildDownloadService(), this method is called with valid values for the |url_chain| and |headers| arguments. When I use a service created by download::BuildInMemoryDownloadService(), both arguments are empty and thus invalid. Could the in-memory download service be amended to provide them? :)
,
Jul 16
I can add those, SimpleUrlLoader now expose the response headers. url_chain is added in Oct.2017, I probably missed that.
,
Jul 16
,
Jul 18
,
Jul 19
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5c9266c5f89cd6b808e1b00a417dba9bc8e7a535 commit 5c9266c5f89cd6b808e1b00a417dba9bc8e7a535 Author: Xing Liu <xingliu@chromium.org> Date: Thu Jul 19 00:40:26 2018 Background download: Propagates URL chain and response headers. This CL propagates URL chain and response headers for in memory download backend that is used in incognito mode for background fetch. Bug: 863949 Change-Id: I07baff393111aaa2bd2ce2ef9965a78d299be125 Reviewed-on: https://chromium-review.googlesource.com/1142466 Reviewed-by: Min Qin <qinmin@chromium.org> Commit-Queue: Xing Liu <xingliu@chromium.org> Cr-Commit-Position: refs/heads/master@{#576282} [modify] https://crrev.com/5c9266c5f89cd6b808e1b00a417dba9bc8e7a535/components/download/internal/background_service/in_memory_download.cc [modify] https://crrev.com/5c9266c5f89cd6b808e1b00a417dba9bc8e7a535/components/download/internal/background_service/in_memory_download.h [modify] https://crrev.com/5c9266c5f89cd6b808e1b00a417dba9bc8e7a535/components/download/internal/background_service/in_memory_download_driver_unittest.cc [modify] https://crrev.com/5c9266c5f89cd6b808e1b00a417dba9bc8e7a535/components/download/internal/background_service/in_memory_download_unittest.cc
,
Jul 20
,
Aug 9
I don't think this is fixed, I'm still getting the same issue. OnResponseStarted, which sets the headers (https://cs.chromium.org/chromium/src/components/download/internal/background_service/in_memory_download.cc?g=0&l=204) is being called after the client is notified (https://cs.chromium.org/chromium/src/components/download/internal/background_service/in_memory_download_driver.cc?g=0&l=111).
,
Aug 9
,
Aug 10
,
Aug 10
Good catch, this should be called after getting server response to match non incognito download.
,
Aug 14
Hi, is there any URL that we can test background fetch?
,
Aug 15
,
Aug 16
Hey, you can use https://rayankans.github.io/bgf/bgf.html (but you will need to build chrome from head for it to work) You will also need to enable this flag: chrome://flags/#enable-experimental-web-platform-features
,
Sep 4
Test website has been moved to https://kanslulz.co.uk/bgf
,
Sep 4
Currently I have a CL for this https://chromium-review.googlesource.com/c/chromium/src/+/1171594, but some webkit layout test for background fetch will fail and hit a DCHECK. This is probably due to BackgroundFetchDelegateProxy::OnDownloadComplete can be called without BackgroundFetchDelegateProxy::Core::OnDownloadStarted if the request fails at the very beginning on Mac with this fix.
,
Sep 4
Having OnDownloadStarted being called before OnDownloadComplete seems like a reasonable contract to me. Are you planning to fix that or do you think some changes need to be made from our end?
,
Sep 4
Currently OnDownloadStarted is triggered by network::SimpleURLLoader(SimpleURLLoader::SetOnResponseStartedCallback), we just plumb this event. Let me try to remove the DCHECK hit in BackgroundFetchCrossOriginFilter to see if that works.
,
Sep 4
OnDownloadStarted is supposed to call after we get the server response, so if the connection is dropped before response kicked in, the network layer will directly call OnResponseComplete with an error code. I feel this is slightly better than tweaking the call contract in download service layer or background fetch layer.
,
Sep 4
per #17, I just double checked the download code path for normal profile, it seems we actually tweaked the call contract in https://cs.chromium.org/chromium/src/content/browser/download/download_request_core.cc?type=cs&g=0&l=431 https://cs.chromium.org/chromium/src/components/download/internal/common/download_response_handler.cc?type=cs&q=download_response&g=0&l=218 Probably do the same thing in InMemoryDownload is the correct fix for this.
,
Sep 5
Just confirmed this is working. Thanks!
,
Sep 5
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8d9f363ef54cf1debdade0ac5e84b497c0e814c6 commit 8d9f363ef54cf1debdade0ac5e84b497c0e814c6 Author: Xing Liu <xingliu@chromium.org> Date: Wed Sep 05 17:27:42 2018 Background download: Propagate OnDownloadCreated after server response. In the download backend used by incognito mode in background download service, OnDownloadCreated is called before receiving the server response, that the URL chain and the server response headers are not correctly propagate to clients. TBR=peter@chromium.org Bug: 863949 Change-Id: Ic5f4dabe1c312a8c949bfb5edbc4e17e3e1081be Reviewed-on: https://chromium-review.googlesource.com/1171594 Commit-Queue: Xing Liu <xingliu@chromium.org> Reviewed-by: Rayan Kanso <rayankans@chromium.org> Reviewed-by: Shakti Sahu <shaktisahu@chromium.org> Reviewed-by: Min Qin <qinmin@chromium.org> Cr-Commit-Position: refs/heads/master@{#588914} [modify] https://crrev.com/8d9f363ef54cf1debdade0ac5e84b497c0e814c6/components/download/internal/background_service/in_memory_download.cc [modify] https://crrev.com/8d9f363ef54cf1debdade0ac5e84b497c0e814c6/components/download/internal/background_service/in_memory_download.h [modify] https://crrev.com/8d9f363ef54cf1debdade0ac5e84b497c0e814c6/components/download/internal/background_service/in_memory_download_driver.cc [modify] https://crrev.com/8d9f363ef54cf1debdade0ac5e84b497c0e814c6/components/download/internal/background_service/in_memory_download_driver.h [modify] https://crrev.com/8d9f363ef54cf1debdade0ac5e84b497c0e814c6/components/download/internal/background_service/in_memory_download_driver_unittest.cc [modify] https://crrev.com/8d9f363ef54cf1debdade0ac5e84b497c0e814c6/components/download/internal/background_service/in_memory_download_unittest.cc [modify] https://crrev.com/8d9f363ef54cf1debdade0ac5e84b497c0e814c6/content/shell/browser/layout_test/layout_test_background_fetch_delegate.cc |
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 by peter@chromium.org
, Jul 16