mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
* chore: bump chromium in DEPS to 123.0.6273.0 * chore: update patches * chore: bump chromium in DEPS to 123.0.6274.0 * chore: update patches * chore: bump chromium in DEPS to 123.0.6276.0 * chore: update patches * WIP: 5239586: Change View::Layout() to take a PassKey. https://chromium-review.googlesource.com/c/chromium/src/+/5239586 * WIP: 5239586: Change View::Layout() to take a PassKey. https://chromium-review.googlesource.com/c/chromium/src/+/5239586 * chore: bump chromium in DEPS to 123.0.6278.0 * chore: bump chromium in DEPS to 123.0.6280.0 * chore: update patches * chore: use net::CanonicalCookie::SecureAttribute() renamed from IsSecure() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5245913 * refactor: handle multiple requested device ids Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5132210 * refactor: trigger View layouts async with View::InvalidateLayout() Upstream has introduced a PassKey to restrict who can call Layout() directly. I've opted for calling `InvalidateLayout()` which is the approach that upstream recommends. If for some reason this approach doesn't work for us, we could use `DeprecatedLayoutImmediately()` as a stopgap. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5239586 Xref: https://chromium.googlesource.com/chromium/src/+/main/ui/views/view.h#809 Xref: https://chromium.googlesource.com/chromium/src/+/main/docs/ui/learn/bestpractices/layout.md?pli=1#don_t-invoke-layout_directly * chore: bump chromium in DEPS to 123.0.6282.0 * chore: bump chromium in DEPS to 123.0.6284.0 * chore: update patches * refactor: remove use of blink::MainThreadIsolate() pt 1/3 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5249640 * refactor: remove use of blink::MainThreadIsolate() pt 2/3 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5249640 * refactor: remove use of blink::MainThreadIsolate() pt 3/3 Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5249640 * chore: update enum name to ui::AXMode::kPDFPrinting Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5270301 * chore: rebuild filenames.libcxx.gni * chore: sync with upstream rename of PortProvider.TaskForHandle() Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5259103 * chore: bump chromium in DEPS to 123.0.6286.0 * chore: bump chromium in DEPS to 123.0.6288.0 * WebPreferences: Initialize in declaration. Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5277099 * chore: update webview_fullscreen.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5053508 Simple update to fix patch shear * chore: update feat_configure_launch_options_for_service_process.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5254861 Simple update to fix patch shear * chore: add IWC::Delegate::RecordResize() stub to fix FTBFS https://chromium-review.googlesource.com/c/chromium/src/+/5268963 * chore: add FormControlType::kButtonPopover to the FormControlType converter Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5230929 * chore: e patches all * chore: node script/gen-libc++-filenames.js * chore: bump chromium in DEPS to 123.0.6290.0 * chore: bump chromium in DEPS to 123.0.6291.0 * chore: bump chromium in DEPS to 123.0.6292.0 * chore: bump chromium in DEPS to 123.0.6294.0 * chore: update fix_aspect_ratio_with_max_size.patch Xref: fix_aspect_ratio_with_max_size.patch note: simple absl::optional -> std::optional conversion * chore: update feat_filter_out_non-shareable_windows_in_the_current_application_in.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5272337 * chore: update add_maximized_parameter_to_linuxui_getwindowframeprovider.patch No manual changes; just adjusting line patch offsets Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5258688 * chore: update feat_configure_launch_options_for_service_process.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5281322 * chore: update fix_select_The_first_menu_item_when_opened_via_keyboard.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5279376 note: simple absl::optional -> std::optional conversion * chore: update feat_allow_code_cache_in_custom_schemes.patch Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5268792 * chore: script/export_all_patches.py * chore: bump chromium in DEPS to 123.0.6296.0 * chore: update patches * fixup! chore: update feat_allow_code_cache_in_custom_schemes.patch * fix: restore MessagePort close event * spec: fix CORB testing Refs https://chromium-review.googlesource.com/c/chromium/src/+/5231506 * fix: use sync layout when content view changes * fixup! chore: update feat_configure_launch_options_for_service_process.patch * Add remote-cocoa support for context menus. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5259806 * Rename //net/base/mac directory to //net/base/apple (1/n) Refs https://chromium-review.googlesource.com/c/chromium/src/+/5211389 * fixup! Add remote-cocoa support for context menus. * [Clipboard] Don't add meta charset tag for async write() method on Mac. Refs https://chromium-review.googlesource.com/c/chromium/src/+/5187335 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: clavin <clavin@electronjs.org> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
168 lines
8.9 KiB
Diff
168 lines
8.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: deepak1556 <hop2deep@gmail.com>
|
|
Date: Tue, 17 Aug 2021 22:42:42 -0700
|
|
Subject: feat: expose raw response headers from URLLoader
|
|
|
|
With https://chromium-review.googlesource.com/c/chromium/src/+/2856099
|
|
unfiltered response headers are only available via trusted channel
|
|
through //services/network/public/mojom/devtools_observer.mojom.
|
|
https://github.com/electron/electron/pull/30503/commits/28f4da1582d046e96cb58f3cbb590503e89dfd0d
|
|
was an attempt to use this interface but given the original response is
|
|
signalled on a different interface via URLLoaderClient::OnReceiveResponse
|
|
it is harder to sync these data from two different channels for a synchronous
|
|
event emitted on the SimpleURLLoaderWrapper::OnResponseStarted.
|
|
|
|
This patch does the minimal approach to add back the raw response
|
|
headers, moving forward we should find a way in upstream to provide
|
|
access to these headers for loader clients created on the browser process.
|
|
|
|
diff --git a/services/network/public/cpp/resource_request.cc b/services/network/public/cpp/resource_request.cc
|
|
index 4dd6f8a62e42c9442ba439240f45fffb43b4871e..6e6affff213b92e40aec0c0a1a4e6bba5a83421e 100644
|
|
--- a/services/network/public/cpp/resource_request.cc
|
|
+++ b/services/network/public/cpp/resource_request.cc
|
|
@@ -151,6 +151,7 @@ ResourceRequest::TrustedParams& ResourceRequest::TrustedParams::operator=(
|
|
disable_secure_dns = other.disable_secure_dns;
|
|
has_user_activation = other.has_user_activation;
|
|
allow_cookies_from_browser = other.allow_cookies_from_browser;
|
|
+ report_raw_headers = other.report_raw_headers;
|
|
cookie_observer =
|
|
Clone(&const_cast<mojo::PendingRemote<mojom::CookieAccessObserver>&>(
|
|
other.cookie_observer));
|
|
@@ -177,6 +178,7 @@ bool ResourceRequest::TrustedParams::EqualsForTesting(
|
|
const TrustedParams& other) const {
|
|
return isolation_info.IsEqualForTesting(other.isolation_info) &&
|
|
disable_secure_dns == other.disable_secure_dns &&
|
|
+ report_raw_headers == other.report_raw_headers &&
|
|
has_user_activation == other.has_user_activation &&
|
|
allow_cookies_from_browser == other.allow_cookies_from_browser &&
|
|
client_security_state == other.client_security_state;
|
|
diff --git a/services/network/public/cpp/resource_request.h b/services/network/public/cpp/resource_request.h
|
|
index 461aa40ed0bfc35c59dbd002ed4c4ab3bc65b031..3f5a872b473f27e1af3e1861bbec6be6790cf526 100644
|
|
--- a/services/network/public/cpp/resource_request.h
|
|
+++ b/services/network/public/cpp/resource_request.h
|
|
@@ -70,6 +70,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
|
|
bool disable_secure_dns = false;
|
|
bool has_user_activation = false;
|
|
bool allow_cookies_from_browser = false;
|
|
+ bool report_raw_headers = false;
|
|
mojo::PendingRemote<mojom::CookieAccessObserver> cookie_observer;
|
|
mojo::PendingRemote<mojom::TrustTokenAccessObserver> trust_token_observer;
|
|
mojo::PendingRemote<mojom::URLLoaderNetworkServiceObserver>
|
|
diff --git a/services/network/public/cpp/url_request_mojom_traits.cc b/services/network/public/cpp/url_request_mojom_traits.cc
|
|
index e08518981fd1bac068327eb122b96b52fbfe23c6..c6770e680e180a29bb1155267dbc56a0f5d3e125 100644
|
|
--- a/services/network/public/cpp/url_request_mojom_traits.cc
|
|
+++ b/services/network/public/cpp/url_request_mojom_traits.cc
|
|
@@ -93,6 +93,7 @@ bool StructTraits<network::mojom::TrustedUrlRequestParamsDataView,
|
|
out->disable_secure_dns = data.disable_secure_dns();
|
|
out->has_user_activation = data.has_user_activation();
|
|
out->allow_cookies_from_browser = data.allow_cookies_from_browser();
|
|
+ out->report_raw_headers = data.report_raw_headers();
|
|
out->cookie_observer = data.TakeCookieObserver<
|
|
mojo::PendingRemote<network::mojom::CookieAccessObserver>>();
|
|
out->trust_token_observer = data.TakeTrustTokenObserver<
|
|
diff --git a/services/network/public/cpp/url_request_mojom_traits.h b/services/network/public/cpp/url_request_mojom_traits.h
|
|
index c5f22e5010de7e359c92810b4eb229d5f37da415..eb6e9d643075689b93bee4828ee066bdec48be63 100644
|
|
--- a/services/network/public/cpp/url_request_mojom_traits.h
|
|
+++ b/services/network/public/cpp/url_request_mojom_traits.h
|
|
@@ -73,6 +73,10 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
|
|
const network::ResourceRequest::TrustedParams& trusted_params) {
|
|
return trusted_params.allow_cookies_from_browser;
|
|
}
|
|
+ static bool report_raw_headers(
|
|
+ const network::ResourceRequest::TrustedParams& trusted_params) {
|
|
+ return trusted_params.report_raw_headers;
|
|
+ }
|
|
static mojo::PendingRemote<network::mojom::CookieAccessObserver>
|
|
cookie_observer(
|
|
const network::ResourceRequest::TrustedParams& trusted_params) {
|
|
diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom
|
|
index 627a3df2debbc2a66be14556641f29232820ccf7..2a6a6e23244d9e1bc1b1f63279766e61f3962180 100644
|
|
--- a/services/network/public/mojom/url_request.mojom
|
|
+++ b/services/network/public/mojom/url_request.mojom
|
|
@@ -74,6 +74,9 @@ struct TrustedUrlRequestParams {
|
|
// FollowRedirect().
|
|
bool allow_cookies_from_browser;
|
|
|
|
+ // [Electron] Whether to provide unfiltered response headers.
|
|
+ bool report_raw_headers;
|
|
+
|
|
// Observer which should be notified when this URLRequest reads or writes
|
|
// a cookie. If this is set to non-null, the observer passed to
|
|
// URLLoaderFactory will be ignored.
|
|
diff --git a/services/network/public/mojom/url_response_head.mojom b/services/network/public/mojom/url_response_head.mojom
|
|
index 5803d57c1c85f219a1ee4675d1fc4bb0c5ee81d0..880d360cfd58f368eafbabd8c3abdb361dcfbc6f 100644
|
|
--- a/services/network/public/mojom/url_response_head.mojom
|
|
+++ b/services/network/public/mojom/url_response_head.mojom
|
|
@@ -12,6 +12,7 @@ import "services/network/public/mojom/encoded_body_length.mojom";
|
|
import "services/network/public/mojom/attribution.mojom";
|
|
import "services/network/public/mojom/fetch_api.mojom";
|
|
import "services/network/public/mojom/ip_address_space.mojom";
|
|
+import "services/network/public/mojom/http_raw_headers.mojom";
|
|
import "services/network/public/mojom/ip_endpoint.mojom";
|
|
import "services/network/public/mojom/load_timing_info.mojom";
|
|
import "services/network/public/mojom/network_param.mojom";
|
|
@@ -42,6 +43,9 @@ struct URLResponseHead {
|
|
// The response headers or NULL if the URL type does not support headers.
|
|
HttpResponseHeaders headers;
|
|
|
|
+ // Actual response headers, as obtained from the network stack.
|
|
+ array<HttpRawHeaderPair> raw_response_headers;
|
|
+
|
|
// The mime type of the response. This may be a derived value.
|
|
string mime_type;
|
|
|
|
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc
|
|
index 89027aee8f1e704eb8a032bd3f1ad28369898575..0909f6e2a1fe6244ea590fd0f8261e2ecb064522 100644
|
|
--- a/services/network/url_loader.cc
|
|
+++ b/services/network/url_loader.cc
|
|
@@ -673,6 +673,7 @@ URLLoader::URLLoader(
|
|
has_user_activation_ = request.trusted_params->has_user_activation;
|
|
allow_cookies_from_browser_ =
|
|
request.trusted_params->allow_cookies_from_browser;
|
|
+ report_raw_headers_ = request.trusted_params->report_raw_headers;
|
|
}
|
|
|
|
// Store any cookies passed from the browser process to later attach them to
|
|
@@ -711,7 +712,7 @@ URLLoader::URLLoader(
|
|
&URLLoader::IsSharedDictionaryReadAllowed, base::Unretained(this)));
|
|
}
|
|
|
|
- if (devtools_request_id()) {
|
|
+ if (devtools_request_id() || report_raw_headers_) {
|
|
url_request_->SetResponseHeadersCallback(base::BindRepeating(
|
|
&URLLoader::SetRawResponseHeaders, base::Unretained(this)));
|
|
}
|
|
@@ -1646,6 +1647,19 @@ void URLLoader::OnResponseStarted(net::URLRequest* url_request, int net_error) {
|
|
}
|
|
|
|
response_ = BuildResponseHead();
|
|
+ if (raw_response_headers_ && report_raw_headers_) {
|
|
+ std::vector<network::mojom::HttpRawHeaderPairPtr> header_array;
|
|
+ size_t iterator = 0;
|
|
+ std::string name, value;
|
|
+ while (raw_response_headers_->EnumerateHeaderLines(&iterator, &name, &value)) {
|
|
+ network::mojom::HttpRawHeaderPairPtr pair =
|
|
+ network::mojom::HttpRawHeaderPair::New();
|
|
+ pair->key = name;
|
|
+ pair->value = value;
|
|
+ header_array.push_back(std::move(pair));
|
|
+ }
|
|
+ response_->raw_response_headers = std::move(header_array);
|
|
+ }
|
|
DispatchOnRawResponse();
|
|
|
|
// Parse and remove the Trust Tokens response headers, if any are expected,
|
|
diff --git a/services/network/url_loader.h b/services/network/url_loader.h
|
|
index 97e1f35642fa5b2f8589220f3fbcaa3385c3726b..756b824df48bc361e3a9243c6a5ae1b9a1c03ef4 100644
|
|
--- a/services/network/url_loader.h
|
|
+++ b/services/network/url_loader.h
|
|
@@ -648,6 +648,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader
|
|
std::unique_ptr<ResourceScheduler::ScheduledResourceRequest>
|
|
resource_scheduler_request_handle_;
|
|
|
|
+ // Whether client requested raw headers.
|
|
+ bool report_raw_headers_ = false;
|
|
bool enable_reporting_raw_headers_ = false;
|
|
bool seen_raw_request_headers_ = false;
|
|
scoped_refptr<const net::HttpResponseHeaders> raw_response_headers_;
|