Skip to content

Commit 7aef2f0

Browse files
committed
1 parent 8deba32 commit 7aef2f0

File tree

1 file changed

+34
-35
lines changed

1 file changed

+34
-35
lines changed

patches/chromium/feat_expose_raw_response_headers_from_urlloader.patch

+34-35
Original file line numberDiff line numberDiff line change
@@ -17,71 +17,70 @@ headers, moving forward we should find a way in upstream to provide
1717
access to these headers for loader clients created on the browser process.
1818

1919
diff --git a/services/network/public/cpp/resource_request.cc b/services/network/public/cpp/resource_request.cc
20-
index 4e698635af5ac40fddfb2cf46b01be01e7a7e7cd..a9a92de4b9d5c67474d8bd98304f56b72d648666 100644
20+
index 3d4cc0dbf277edd29cb2dddbd5cb37b6b5fa4c26..ea85b63e87ee38619dedf609c0b95c39698c7657 100644
2121
--- a/services/network/public/cpp/resource_request.cc
2222
+++ b/services/network/public/cpp/resource_request.cc
23-
@@ -153,6 +153,7 @@ ResourceRequest::TrustedParams& ResourceRequest::TrustedParams::operator=(
24-
disable_secure_dns = other.disable_secure_dns;
25-
has_user_activation = other.has_user_activation;
23+
@@ -155,6 +155,7 @@ ResourceRequest::TrustedParams& ResourceRequest::TrustedParams::operator=(
2624
allow_cookies_from_browser = other.allow_cookies_from_browser;
25+
include_request_cookies_with_response =
26+
other.include_request_cookies_with_response;
2727
+ report_raw_headers = other.report_raw_headers;
2828
cookie_observer =
2929
Clone(&const_cast<mojo::PendingRemote<mojom::CookieAccessObserver>&>(
3030
other.cookie_observer));
31-
@@ -183,6 +184,7 @@ bool ResourceRequest::TrustedParams::EqualsForTesting(
31+
@@ -185,6 +186,7 @@ bool ResourceRequest::TrustedParams::EqualsForTesting(
3232
const TrustedParams& other) const {
3333
return isolation_info.IsEqualForTesting(other.isolation_info) &&
3434
disable_secure_dns == other.disable_secure_dns &&
3535
+ report_raw_headers == other.report_raw_headers &&
3636
has_user_activation == other.has_user_activation &&
3737
allow_cookies_from_browser == other.allow_cookies_from_browser &&
38-
client_security_state == other.client_security_state;
38+
include_request_cookies_with_response ==
3939
diff --git a/services/network/public/cpp/resource_request.h b/services/network/public/cpp/resource_request.h
40-
index 44ad1e89f20263b180f0a2c0388e9ef036875593..1d61b5c9008b47db9623c731ef6d5f70f8dd534b 100644
40+
index 7e84c5373d432512a7543430db49022b5f89cc99..1df3a8c178981391856c611e5a78c7d9d1e2c5bd 100644
4141
--- a/services/network/public/cpp/resource_request.h
4242
+++ b/services/network/public/cpp/resource_request.h
43-
@@ -72,6 +72,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
44-
bool disable_secure_dns = false;
43+
@@ -73,6 +73,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
4544
bool has_user_activation = false;
4645
bool allow_cookies_from_browser = false;
46+
bool include_request_cookies_with_response = false;
4747
+ bool report_raw_headers = false;
4848
mojo::PendingRemote<mojom::CookieAccessObserver> cookie_observer;
4949
mojo::PendingRemote<mojom::TrustTokenAccessObserver> trust_token_observer;
5050
mojo::PendingRemote<mojom::URLLoaderNetworkServiceObserver>
5151
diff --git a/services/network/public/cpp/url_request_mojom_traits.cc b/services/network/public/cpp/url_request_mojom_traits.cc
52-
index aa3d03142152af6e3ce8d0eafa8193221dac8687..bea0ddcdf60f249a0fe57ff7ec8f37b1ee4c3d69 100644
52+
index d147b20dfea8928f9d5fded8037cf4f873d5b8e9..a7cbff37d1ebfd6b2ba8b248282e0dd50b95e63e 100644
5353
--- a/services/network/public/cpp/url_request_mojom_traits.cc
5454
+++ b/services/network/public/cpp/url_request_mojom_traits.cc
55-
@@ -93,6 +93,7 @@ bool StructTraits<network::mojom::TrustedUrlRequestParamsDataView,
56-
out->disable_secure_dns = data.disable_secure_dns();
57-
out->has_user_activation = data.has_user_activation();
55+
@@ -95,6 +95,7 @@ bool StructTraits<network::mojom::TrustedUrlRequestParamsDataView,
5856
out->allow_cookies_from_browser = data.allow_cookies_from_browser();
57+
out->include_request_cookies_with_response =
58+
data.include_request_cookies_with_response();
5959
+ out->report_raw_headers = data.report_raw_headers();
6060
out->cookie_observer = data.TakeCookieObserver<
6161
mojo::PendingRemote<network::mojom::CookieAccessObserver>>();
6262
out->trust_token_observer = data.TakeTrustTokenObserver<
6363
diff --git a/services/network/public/cpp/url_request_mojom_traits.h b/services/network/public/cpp/url_request_mojom_traits.h
64-
index 1dadf5b4cac21033b096757f1bb52e0d74966a54..d52d6e48d70bf162c5022cc991c2371d1482f4bc 100644
64+
index 32218c469a135fe903b8fc02d6388258e144bd03..86b824dd3345bb812a24621d4b27bda7b9c07630 100644
6565
--- a/services/network/public/cpp/url_request_mojom_traits.h
6666
+++ b/services/network/public/cpp/url_request_mojom_traits.h
67-
@@ -73,6 +73,10 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
67+
@@ -76,6 +76,9 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
68+
static bool include_request_cookies_with_response(
6869
const network::ResourceRequest::TrustedParams& trusted_params) {
69-
return trusted_params.allow_cookies_from_browser;
70-
}
70+
return trusted_params.include_request_cookies_with_response;
7171
+ static bool report_raw_headers(
7272
+ const network::ResourceRequest::TrustedParams& trusted_params) {
7373
+ return trusted_params.report_raw_headers;
74-
+ }
74+
}
7575
static mojo::PendingRemote<network::mojom::CookieAccessObserver>
7676
cookie_observer(
77-
const network::ResourceRequest::TrustedParams& trusted_params) {
7877
diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom
79-
index 15942d6eceaa9c3ef565d35cc8e08633ea4d66b0..4622e39e0791e024ff9bfd49e8ca5fe7e1f92184 100644
78+
index 1d510b64f480ba516009cb1d995fbe9ca29ec164..d6d17abbb058c2e4109ab98a3db1bdf7734ba4c9 100644
8079
--- a/services/network/public/mojom/url_request.mojom
8180
+++ b/services/network/public/mojom/url_request.mojom
82-
@@ -74,6 +74,9 @@ struct TrustedUrlRequestParams {
83-
// FollowRedirect().
84-
bool allow_cookies_from_browser;
81+
@@ -80,6 +80,9 @@ struct TrustedUrlRequestParams {
82+
// client which should not be able to see them.
83+
bool include_request_cookies_with_response = false;
8584

8685
+ // [Electron] Whether to provide unfiltered response headers.
8786
+ bool report_raw_headers;
@@ -90,18 +89,18 @@ index 15942d6eceaa9c3ef565d35cc8e08633ea4d66b0..4622e39e0791e024ff9bfd49e8ca5fe7
9089
// a cookie. If this is set to non-null, the observer passed to
9190
// URLLoaderFactory will be ignored.
9291
diff --git a/services/network/public/mojom/url_response_head.mojom b/services/network/public/mojom/url_response_head.mojom
93-
index 20c923eeca30aeba71f97a2d45ccec8a65986325..1f8fa3705e67abbe665062bad8ed97d48717d3cc 100644
92+
index 64ec7b5a4bfb08a2bbd75ce03a602b36e6b0f278..f726e1ccf33dee59a131f881fa000f506a772e65 100644
9493
--- a/services/network/public/mojom/url_response_head.mojom
9594
+++ b/services/network/public/mojom/url_response_head.mojom
96-
@@ -12,6 +12,7 @@ import "services/network/public/mojom/encoded_body_length.mojom";
97-
import "services/network/public/mojom/attribution.mojom";
95+
@@ -13,6 +13,7 @@ import "services/network/public/mojom/attribution.mojom";
9896
import "services/network/public/mojom/fetch_api.mojom";
97+
import "services/network/public/mojom/http_request_headers.mojom";
9998
import "services/network/public/mojom/ip_address_space.mojom";
10099
+import "services/network/public/mojom/http_raw_headers.mojom";
101100
import "services/network/public/mojom/ip_endpoint.mojom";
102101
import "services/network/public/mojom/load_timing_info.mojom";
103102
import "services/network/public/mojom/network_param.mojom";
104-
@@ -42,6 +43,9 @@ struct URLResponseHead {
103+
@@ -44,6 +45,9 @@ struct URLResponseHead {
105104
// The response headers or NULL if the URL type does not support headers.
106105
HttpResponseHeaders headers;
107106

@@ -112,18 +111,18 @@ index 20c923eeca30aeba71f97a2d45ccec8a65986325..1f8fa3705e67abbe665062bad8ed97d4
112111
string mime_type;
113112

114113
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc
115-
index 11d8e6c2d2917edab70486983f24952f510f6999..95c7d4a18290f8a02fe3d86b86a0ce9ed3ff71ae 100644
114+
index 451d4025f7bbdccd27842d61e11d631ae2fd5894..8ea2281668c77631e47ddfee64b82c020c2cf2f9 100644
116115
--- a/services/network/url_loader.cc
117116
+++ b/services/network/url_loader.cc
118-
@@ -705,6 +705,7 @@ URLLoader::URLLoader(
119-
has_user_activation_ = request.trusted_params->has_user_activation;
120-
allow_cookies_from_browser_ =
117+
@@ -707,6 +707,7 @@ URLLoader::URLLoader(
121118
request.trusted_params->allow_cookies_from_browser;
119+
include_request_cookies_with_response_ =
120+
request.trusted_params->include_request_cookies_with_response;
122121
+ report_raw_headers_ = request.trusted_params->report_raw_headers;
123122
}
124123

125124
// Store any cookies passed from the browser process to later attach them to
126-
@@ -743,7 +744,7 @@ URLLoader::URLLoader(
125+
@@ -745,7 +746,7 @@ URLLoader::URLLoader(
127126
&URLLoader::IsSharedDictionaryReadAllowed, base::Unretained(this)));
128127
}
129128

@@ -132,7 +131,7 @@ index 11d8e6c2d2917edab70486983f24952f510f6999..95c7d4a18290f8a02fe3d86b86a0ce9e
132131
url_request_->SetResponseHeadersCallback(base::BindRepeating(
133132
&URLLoader::SetRawResponseHeaders, base::Unretained(this)));
134133
}
135-
@@ -1682,6 +1683,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) {
134+
@@ -1690,6 +1691,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) {
136135
}
137136

138137
response_ = BuildResponseHead();
@@ -153,10 +152,10 @@ index 11d8e6c2d2917edab70486983f24952f510f6999..95c7d4a18290f8a02fe3d86b86a0ce9e
153152

154153
// Parse and remove the Trust Tokens response headers, if any are expected,
155154
diff --git a/services/network/url_loader.h b/services/network/url_loader.h
156-
index 946af13aec973a4650ffaf13cd35e31524199e65..bf8bdae3c88f455edf68c6d20c6377ca8aae3d8e 100644
155+
index d4d72e186dc16d73ee0beabff89a7875bd91da03..068ced0a8d72bf8a4179b88dfab1a5377307fc6c 100644
157156
--- a/services/network/url_loader.h
158157
+++ b/services/network/url_loader.h
159-
@@ -656,6 +656,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader
158+
@@ -657,6 +657,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader
160159
std::unique_ptr<ResourceScheduler::ScheduledResourceRequest>
161160
resource_scheduler_request_handle_;
162161

0 commit comments

Comments
 (0)