summaryrefslogtreecommitdiff
path: root/www/chromium-uc/patches/core/inox-patchset/0003-disable-autofill-download-manager.patch
blob: b3f1614c9b6f990f858ed50ff00cf0977b5350b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
--- components/autofill/core/browser/autofill_download_manager.cc.orig
+++ components/autofill/core/browser/autofill_download_manager.cc
@@ -824,96 +824,6 @@ std::tuple<GURL, std::string> AutofillDo
 }
 
 bool AutofillDownloadManager::StartRequest(FormRequestData request_data) {
-  scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory =
-      driver_->GetURLLoaderFactory();
-  DCHECK(url_loader_factory);
-
-  // Get the URL and method to use for this request.
-  std::string method;
-  GURL request_url;
-  std::tie(request_url, method) = GetRequestURLAndMethod(request_data);
-
-  // Track the URL length for GET queries because the URL length can be in the
-  // thousands when rich metadata is enabled.
-  if (request_data.request_type == AutofillDownloadManager::REQUEST_QUERY &&
-      method == "GET") {
-    UMA_HISTOGRAM_COUNTS_100000("Autofill.Query.GetUrlLength",
-                                request_url.spec().length());
-  }
-
-  auto resource_request = std::make_unique<network::ResourceRequest>();
-  resource_request->url = request_url;
-  resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit;
-  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)
-  // Do not call IsolationInfo() for REQUEST_UPLOADs because Password Manager
-  // uploads when RenderFrameHostImpl::DidCommitNavigation() is called, in which
-  // case IsolationInfo() may crash because there is no committing
-  // NavigationRequest. This is safe because no information about the response
-  // is passed to the renderer, or is otherwise visible to a page.
-  // crbug/1176635#c22
-  if (request_data.request_type != AutofillDownloadManager::REQUEST_UPLOAD) {
-    resource_request->trusted_params =
-        network::ResourceRequest::TrustedParams();
-    resource_request->trusted_params->isolation_info = driver_->IsolationInfo();
-  }
-#endif
-
-  // Add Chrome experiment state to the request headers.
-  variations::AppendVariationsHeaderUnknownSignedIn(
-      request_url,
-      driver_->IsIncognito() ? variations::InIncognito::kYes
-                             : variations::InIncognito::kNo,
-      resource_request.get());
-
-  // Set headers specific to the API.
-  // Encode response serialized proto in base64 for safety.
-  resource_request->headers.SetHeader(kGoogEncodeResponseIfExecutable,
-                                      "base64");
-
-  // Put API key in request's header if a key exists, and the endpoint is
-  // trusted by Google.
-  if (!api_key_.empty() && request_url.SchemeIs(url::kHttpsScheme) &&
-      google_util::IsGoogleAssociatedDomainUrl(request_url)) {
-    resource_request->headers.SetHeader(kGoogApiKey, api_key_);
-  }
-
-  auto simple_loader = network::SimpleURLLoader::Create(
-      std::move(resource_request),
-      GetNetworkTrafficAnnotation(request_data.request_type));
-
-  // This allows reading the error message within the API response when status
-  // is not 200 (e.g., 400). Otherwise, URL loader will not give any content in
-  // the response when there is a failure, which makes debugging hard.
-  simple_loader->SetAllowHttpErrorResults(true);
-
-  if (method == "POST") {
-    const std::string content_type = "application/x-protobuf";
-    std::string payload;
-    if (!GetAPIBodyPayload(request_data.payload, request_data.request_type,
-                           &payload)) {
-      return false;
-    }
-
-    // Attach payload data and add data format header.
-    simple_loader->AttachStringForUpload(payload, content_type);
-  }
-
-  // Transfer ownership of the loader into url_loaders_. Temporarily hang
-  // onto the raw pointer to use it as a key and to kick off the request;
-  // transferring ownership (std::move) invalidates the |simple_loader|
-  // variable.
-  auto* raw_simple_loader = simple_loader.get();
-  url_loaders_.push_back(std::move(simple_loader));
-  raw_simple_loader->DownloadToStringOfUnboundedSizeUntilCrashAndDie(
-      url_loader_factory.get(),
-      base::BindOnce(&AutofillDownloadManager::OnSimpleLoaderComplete,
-                     base::Unretained(this), std::move(--url_loaders_.end()),
-                     std::move(request_data), AutofillTickClock::NowTicks()));
   return true;
 }