mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
* chore: bump chromium in DEPS to 144.0.7543.0 * Pass PipScreenCaptureCoordinatorProxy to ScreenCaptureKitDeviceMac https://chromium-review.googlesource.com/c/chromium/src/+/7157590 * chore: update patches * chore: update filenames.libcxx.gni * 7142359: Spanification of process_singleton_posix.cc https: //chromium-review.googlesource.com/c/chromium/src/+/7142359 Co-Authored-By: Charles Kerr <70381+ckerr@users.noreply.github.com> * Move logging::LoggingSettings to base/logging/logging_settings.h https://chromium-review.googlesource.com/c/chromium/src/+/7173024 * chore: bump chromium in DEPS to 144.0.7545.0 * 7159368: update PluginService API for sync GetPlugins Upstream removed async PluginService APIs: - GetPluginsAsync() removed, use synchronous GetPlugins() - RegisterInternalPlugin() now takes single argument (remove add_at_beginning) - RefreshPlugins() removed entirely Updated ElectronPluginInfoHostImpl to use synchronous plugin loading and simplified ElectronBrowserMainParts internal plugin registration. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159368 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159328 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159056 (cherry picked from commit88cdf50b0a) * 7159184: add missing base/files/file_path.h include Add explicit include for base/files/file_path.h in electron_browser_context.h. After removal of superfluous Mojo includes from content headers, base::FilePath is no longer transitively included via content/public/browser/browser_context.h. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159184 (cherry picked from commit6ca8ea03ec) * 7126479: add ShouldForceRefreshTextCheckService parameter to SpellCheckClient Upstream added a force-refresh parameter to WebTextCheckClient::RequestCheckingOfText to bypass spell check cache. Add the new ShouldForceRefreshTextCheckService parameter to SpellCheckClient's override (currently unused in Electron). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7126479 (cherry picked from commit879c0401c4) * 7083663: remove fingerprinting_protection_ruleset_service override Upstream deleted external references to Fingerprinting Protection Filter (FPF) component. Remove the fingerprinting_protection_ruleset_service() override from BrowserProcessImpl as the method no longer exists in the base class. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7083663 (cherry picked from commit8350d152f9) * 7155287: implement WebContentsView::GetSize and Resize Upstream delegated WebContents::GetSize() and Resize() to WebContentsView, making them pure virtual. Add const qualifier to GetSize() and implement the Resize() override in OffScreenWebContentsView (no-op for offscreen). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7155287 (cherry picked from commit084eaa568e) * 7184238: add OnUnconfirmedTapConvertedToTap override Upstream added OnUnconfirmedTapConvertedToTap as a pure virtual method to RenderWidgetHostViewBase to inform root view when child frame converts an unconfirmed tap. Add empty override for offscreen rendering. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7184238 (cherry picked from commitef03400d9a) * 7143586: add widget parameter to OnCommandsChanged GlobalAcceleratorListener::OnCommandsChanged gained a gfx::AcceleratedWidget parameter for window association in the GlobalShortcutListenerLinux implementation. Pass gfx::kNullAcceleratedWidget for Electron's usage. Ref: : Pass parent handle to GlobalAcceleratorListenerLinux::BindShortcuts | https://chromium-review.googlesource.com/c/chromium/src/+/7143586 (cherry picked from commit38306e2bfc) Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com> * chore: update patches Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com> * chore: bump chromium in DEPS to 144.0.7547.0 * chore: update patches * 7189232: Add support for UnownedUserData in GlobalFeatures https: //chromium-review.googlesource.com/c/chromium/src/+/7189232 * Refactor: Use std::u16string for extension load error messages https://chromium-review.googlesource.com/c/chromium/src/+/7185844 * fixup Add support for UnownedUserData in GlobalFeatures * 7165650: Remove ResourceContext https://chromium-review.googlesource.com/c/chromium/src/+/7165650 * fixup BUILD.gn for lint * 7202164: Reland "Reland "Remove GenericScopedHandle:IsValid"" https://chromium-review.googlesource.com/c/chromium/src/+/7202164 * advance deprecation of v8::ReturnValue<void>::Set(Local<S>). 7168624: [runtime][api] Relax requirements for setter/definer/deleter callbacks | https://chromium-review.googlesource.com/c/v8/v8/+/7168624 * fixup advance deprecation of v8::ReturnValue<void>::Set(Local<S>) * chore: skip setting LPAC ACLs * Revert "chore: skip setting LPAC ACLs" This reverts commite187aec488. * chore: revert Convert to UNSAFE_TODO in sandbox revert https://chromium-review.googlesource.com/c/chromium/src/+/7131661 to see if it fixes the Windows sandbox issue. * Revert "chore: revert Convert to UNSAFE_TODO in sandbox" This reverts commit57afbfefe5. * chore: Revert "Enable network sandbox by default on Windows" see if this fixes the Windows sandbox issue * Enable network sandbox by default on Windows https://chromium-review.googlesource.com/c/chromium/src/+/7204292 * Revert "chore: Revert "Enable network sandbox by default on Windows"" This reverts commit530ab6af82. * fixup! Enable network sandbox by default on Windows | https://chromium-review.googlesource.com/c/chromium/src/+/7204292 * fixup!: Correct flag name, add kLocalNetworkAccessChecks to all platforms --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Charles Kerr <70381+ckerr@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@anthropic.com> Co-authored-by: Samuel Attard <MarshallOfSound@users.noreply.github.com> Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
170 lines
9.0 KiB
Diff
170 lines
9.0 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 dd0ebad1fdcadab06b25df192a85153d1e65e141..7716dca3cdd57d484b8499b80e50e0c8accc510f 100644
|
|
--- a/services/network/public/cpp/resource_request.cc
|
|
+++ b/services/network/public/cpp/resource_request.cc
|
|
@@ -197,6 +197,7 @@ ResourceRequest::TrustedParams& ResourceRequest::TrustedParams::operator=(
|
|
allow_cookies_from_browser = other.allow_cookies_from_browser;
|
|
include_request_cookies_with_response =
|
|
other.include_request_cookies_with_response;
|
|
+ report_raw_headers = other.report_raw_headers;
|
|
enabled_client_hints = other.enabled_client_hints;
|
|
cookie_observer =
|
|
Clone(&const_cast<mojo::PendingRemote<mojom::CookieAccessObserver>&>(
|
|
@@ -232,6 +233,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 &&
|
|
include_request_cookies_with_response ==
|
|
diff --git a/services/network/public/cpp/resource_request.h b/services/network/public/cpp/resource_request.h
|
|
index 3fa1c79443ca23ad6b25e38daf6e95e8a899740c..67c5a7b55569704167fe089d1d3d5c24f666a429 100644
|
|
--- a/services/network/public/cpp/resource_request.h
|
|
+++ b/services/network/public/cpp/resource_request.h
|
|
@@ -98,6 +98,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE) ResourceRequest {
|
|
bool has_user_activation = false;
|
|
bool allow_cookies_from_browser = false;
|
|
bool include_request_cookies_with_response = false;
|
|
+ bool report_raw_headers = false;
|
|
std::optional<EnabledClientHints> enabled_client_hints;
|
|
mojo::PendingRemote<mojom::CookieAccessObserver> cookie_observer;
|
|
mojo::PendingRemote<mojom::TrustTokenAccessObserver> trust_token_observer;
|
|
diff --git a/services/network/public/cpp/url_request_mojom_traits.cc b/services/network/public/cpp/url_request_mojom_traits.cc
|
|
index 646be484e4d5b3b917bed0ee2d0a52fdf57a8291..b49035fab82ddb29e211e1e215c70aab0a625222 100644
|
|
--- a/services/network/public/cpp/url_request_mojom_traits.cc
|
|
+++ b/services/network/public/cpp/url_request_mojom_traits.cc
|
|
@@ -67,6 +67,7 @@ bool StructTraits<network::mojom::TrustedUrlRequestParamsDataView,
|
|
out->allow_cookies_from_browser = data.allow_cookies_from_browser();
|
|
out->include_request_cookies_with_response =
|
|
data.include_request_cookies_with_response();
|
|
+ out->report_raw_headers = data.report_raw_headers();
|
|
if (!data.ReadEnabledClientHints(&out->enabled_client_hints)) {
|
|
return false;
|
|
}
|
|
diff --git a/services/network/public/cpp/url_request_mojom_traits.h b/services/network/public/cpp/url_request_mojom_traits.h
|
|
index 9867e5115459f6d0a074d79183e53c3dba0187db..06ec0cea64750057b67108fbfeb1f9d850b0793f 100644
|
|
--- a/services/network/public/cpp/url_request_mojom_traits.h
|
|
+++ b/services/network/public/cpp/url_request_mojom_traits.h
|
|
@@ -108,6 +108,10 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE)
|
|
const network::ResourceRequest::TrustedParams& trusted_params) {
|
|
return trusted_params.include_request_cookies_with_response;
|
|
}
|
|
+ static bool report_raw_headers(
|
|
+ const network::ResourceRequest::TrustedParams& trusted_params) {
|
|
+ return trusted_params.report_raw_headers;
|
|
+ }
|
|
static const std::optional<
|
|
network::ResourceRequest::TrustedParams::EnabledClientHints>&
|
|
enabled_client_hints(
|
|
diff --git a/services/network/public/mojom/url_request.mojom b/services/network/public/mojom/url_request.mojom
|
|
index affb80d9ffcc8da3f572b1a1461d2cd648ef3376..3f6301b1732171073c5fb072feaf12e3fb55c74c 100644
|
|
--- a/services/network/public/mojom/url_request.mojom
|
|
+++ b/services/network/public/mojom/url_request.mojom
|
|
@@ -111,6 +111,9 @@ struct TrustedUrlRequestParams {
|
|
// client which should not be able to see them.
|
|
bool include_request_cookies_with_response = false;
|
|
|
|
+ // [Electron] Whether to provide unfiltered response headers.
|
|
+ bool report_raw_headers;
|
|
+
|
|
// Enabled Client Hints to be evaluated quickly within the network layer
|
|
// when it receives the AcceptCHFrame.
|
|
EnabledClientHints? enabled_client_hints;
|
|
diff --git a/services/network/public/mojom/url_response_head.mojom b/services/network/public/mojom/url_response_head.mojom
|
|
index 13a211107294e856616d1626fa1dc9c79eb5646c..549a36886d665c1a8100f09b7a86c8dc13c80e84 100644
|
|
--- a/services/network/public/mojom/url_response_head.mojom
|
|
+++ b/services/network/public/mojom/url_response_head.mojom
|
|
@@ -14,6 +14,7 @@ import "services/network/public/mojom/encoded_body_length.mojom";
|
|
import "services/network/public/mojom/fetch_api.mojom";
|
|
import "services/network/public/mojom/http_request_headers.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/load_timing_internal_info.mojom";
|
|
@@ -53,6 +54,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 a28a4bfc26a797dc862c59a337b4ed43b76eb06d..4da33fa9eef14b76f06d2741942fc387b2cde37d 100644
|
|
--- a/services/network/url_loader.cc
|
|
+++ b/services/network/url_loader.cc
|
|
@@ -386,6 +386,9 @@ URLLoader::URLLoader(
|
|
mojo::SimpleWatcher::ArmingPolicy::MANUAL,
|
|
TaskRunner(request.priority)),
|
|
per_factory_orb_state_(context.GetMutableOrbState()),
|
|
+ report_raw_headers_(
|
|
+ request.trusted_params &&
|
|
+ request.trusted_params->report_raw_headers),
|
|
devtools_request_id_(request.devtools_request_id),
|
|
options_(PopulateOptions(options,
|
|
factory_params_->is_orb_enabled,
|
|
@@ -525,7 +528,7 @@ void URLLoader::SetUpUrlRequestCallbacks(
|
|
&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)));
|
|
}
|
|
@@ -1122,6 +1125,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();
|
|
|
|
ad_auction_event_record_request_helper_.HandleResponse(
|
|
diff --git a/services/network/url_loader.h b/services/network/url_loader.h
|
|
index f437df6e20b7d4e28f5e57e2134c5c7fa9da2bdc..661fef04f6b76abef852ba8eef63b1f78b01652c 100644
|
|
--- a/services/network/url_loader.h
|
|
+++ b/services/network/url_loader.h
|
|
@@ -624,6 +624,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;
|
|
scoped_refptr<const net::HttpResponseHeaders> raw_response_headers_;
|
|
|
|
std::unique_ptr<UploadProgressTracker> upload_progress_tracker_;
|