Commit 87d33b5b authored by Dominic Battre's avatar Dominic Battre Committed by Commit Bot

Fix communication with autofill server on iOS

This CL restores the communication of Chrome on iOS with the Autofill
server. It broke by commit fc59bb21
which assigned trusted_params to the network request. However, the
URLLoaderFactory originated from BrowserState and was therefore shared
and not trusted. As per the documentaiton of trusted_params:
"Setting these from an untrusted URLLoader will cause the request to
fail."

This CL removes the trusted_params to bring Autofill back to a working
situation. Maybe the iOS or network stack folks can see whether
we want to have special URLLoaderFactories for components on iOS.
I don't see a precedence for that.

Bug: 1031136
Change-Id: Ic2e04f37f3a30e8adb98e23f19205be09fa5375a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1953707Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Commit-Queue: Dominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722493}
parent 9b4ea6a5
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "components/autofill/core/browser/autofill_driver.h" #include "components/autofill/core/browser/autofill_driver.h"
#include "components/autofill/core/browser/autofill_metrics.h" #include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/form_structure.h" #include "components/autofill/core/browser/form_structure.h"
...@@ -852,9 +853,15 @@ bool AutofillDownloadManager::StartRequest(FormRequestData request_data) { ...@@ -852,9 +853,15 @@ bool AutofillDownloadManager::StartRequest(FormRequestData request_data) {
resource_request->url = request_url; resource_request->url = request_url;
resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit;
resource_request->method = method; resource_request->method = method;
// On iOS we have a single, shared URLLoaderFactory provided by BrowserState.
// As it is shared, it is not trusted and we cannot assign trusted_params
// to the network request.
#if !defined(OS_IOS)
resource_request->trusted_params = network::ResourceRequest::TrustedParams(); resource_request->trusted_params = network::ResourceRequest::TrustedParams();
resource_request->trusted_params->network_isolation_key = resource_request->trusted_params->network_isolation_key =
driver_->NetworkIsolationKey(); driver_->NetworkIsolationKey();
#endif
// Add Chrome experiment state to the request headers. // Add Chrome experiment state to the request headers.
variations::AppendVariationsHeaderUnknownSignedIn( variations::AppendVariationsHeaderUnknownSignedIn(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment