2019-05-22 01:43:37 +00:00
|
|
|
// Copyright (c) 2019 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/net/proxying_url_loader_factory.h"
|
2019-05-22 01:43:37 +00:00
|
|
|
|
2021-06-04 04:18:02 +00:00
|
|
|
#include <memory>
|
2019-05-22 01:43:37 +00:00
|
|
|
#include <utility>
|
|
|
|
|
2019-11-26 21:27:33 +00:00
|
|
|
#include "base/command_line.h"
|
2023-02-03 11:43:42 +00:00
|
|
|
#include "base/functional/bind.h"
|
|
|
|
#include "base/functional/callback_helpers.h"
|
2019-12-13 20:13:12 +00:00
|
|
|
#include "base/strings/string_split.h"
|
2019-11-26 21:27:33 +00:00
|
|
|
#include "base/strings/string_util.h"
|
2021-05-04 03:13:46 +00:00
|
|
|
#include "base/strings/stringprintf.h"
|
2019-10-28 22:12:35 +00:00
|
|
|
#include "content/public/browser/browser_context.h"
|
2019-08-13 05:47:35 +00:00
|
|
|
#include "extensions/browser/extension_navigation_ui_data.h"
|
2019-07-22 22:01:45 +00:00
|
|
|
#include "net/base/completion_repeating_callback.h"
|
2019-11-26 21:27:33 +00:00
|
|
|
#include "net/base/load_flags.h"
|
2021-06-04 04:18:02 +00:00
|
|
|
#include "net/http/http_response_headers.h"
|
2021-06-01 01:47:53 +00:00
|
|
|
#include "net/http/http_status_code.h"
|
2019-07-22 22:01:45 +00:00
|
|
|
#include "net/http/http_util.h"
|
2021-06-04 04:18:02 +00:00
|
|
|
#include "net/url_request/redirect_info.h"
|
2020-10-28 00:33:04 +00:00
|
|
|
#include "services/metrics/public/cpp/ukm_source_id.h"
|
2019-07-22 22:01:45 +00:00
|
|
|
#include "services/network/public/cpp/features.h"
|
2021-06-22 19:17:16 +00:00
|
|
|
#include "services/network/public/mojom/early_hints.mojom.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/browser/net/asar/asar_url_loader.h"
|
2019-11-26 21:27:33 +00:00
|
|
|
#include "shell/common/options_switches.h"
|
2021-06-04 04:18:02 +00:00
|
|
|
#include "url/origin.h"
|
2019-05-22 01:43:37 +00:00
|
|
|
|
|
|
|
namespace electron {
|
2020-03-02 01:23:43 +00:00
|
|
|
|
2019-07-22 22:01:45 +00:00
|
|
|
ProxyingURLLoaderFactory::InProgressRequest::FollowRedirectParams::
|
|
|
|
FollowRedirectParams() = default;
|
|
|
|
ProxyingURLLoaderFactory::InProgressRequest::FollowRedirectParams::
|
|
|
|
~FollowRedirectParams() = default;
|
|
|
|
|
|
|
|
ProxyingURLLoaderFactory::InProgressRequest::InProgressRequest(
|
|
|
|
ProxyingURLLoaderFactory* factory,
|
2021-06-14 12:01:36 +00:00
|
|
|
uint64_t web_request_id,
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
int32_t frame_routing_id,
|
2019-07-22 22:01:45 +00:00
|
|
|
int32_t network_service_request_id,
|
|
|
|
uint32_t options,
|
|
|
|
const network::ResourceRequest& request,
|
|
|
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
2020-03-02 01:23:43 +00:00
|
|
|
mojo::PendingReceiver<network::mojom::URLLoader> loader_receiver,
|
2019-12-11 00:22:35 +00:00
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderClient> client)
|
2019-07-22 22:01:45 +00:00
|
|
|
: factory_(factory),
|
|
|
|
request_(request),
|
|
|
|
original_initiator_(request.request_initiator),
|
2019-08-07 00:21:53 +00:00
|
|
|
request_id_(web_request_id),
|
2021-06-04 04:18:02 +00:00
|
|
|
network_service_request_id_(network_service_request_id),
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
frame_routing_id_(frame_routing_id),
|
2019-07-22 22:01:45 +00:00
|
|
|
options_(options),
|
|
|
|
traffic_annotation_(traffic_annotation),
|
2020-03-02 01:23:43 +00:00
|
|
|
proxied_loader_receiver_(this, std::move(loader_receiver)),
|
2019-07-22 22:01:45 +00:00
|
|
|
target_client_(std::move(client)),
|
2019-10-28 22:12:35 +00:00
|
|
|
current_response_(network::mojom::URLResponseHead::New()),
|
2019-11-14 05:51:24 +00:00
|
|
|
// Always use "extraHeaders" mode to be compatible with old APIs, except
|
|
|
|
// when the |request_id_| is zero, which is not supported in Chromium and
|
|
|
|
// only happens in Electron when the request is started from net module.
|
|
|
|
has_any_extra_headers_listeners_(network_service_request_id != 0) {
|
2019-07-22 22:01:45 +00:00
|
|
|
// If there is a client error, clean up the request.
|
2019-12-11 00:22:35 +00:00
|
|
|
target_client_.set_disconnect_handler(base::BindOnce(
|
2019-07-22 22:01:45 +00:00
|
|
|
&ProxyingURLLoaderFactory::InProgressRequest::OnRequestError,
|
|
|
|
weak_factory_.GetWeakPtr(),
|
|
|
|
network::URLLoaderCompletionStatus(net::ERR_ABORTED)));
|
2020-03-02 01:23:43 +00:00
|
|
|
proxied_loader_receiver_.set_disconnect_handler(base::BindOnce(
|
|
|
|
&ProxyingURLLoaderFactory::InProgressRequest::OnRequestError,
|
|
|
|
weak_factory_.GetWeakPtr(),
|
|
|
|
network::URLLoaderCompletionStatus(net::ERR_ABORTED)));
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
|
2020-03-02 01:23:43 +00:00
|
|
|
ProxyingURLLoaderFactory::InProgressRequest::InProgressRequest(
|
|
|
|
ProxyingURLLoaderFactory* factory,
|
|
|
|
uint64_t request_id,
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
int32_t frame_routing_id,
|
2020-03-02 01:23:43 +00:00
|
|
|
const network::ResourceRequest& request)
|
|
|
|
: factory_(factory),
|
|
|
|
request_(request),
|
|
|
|
original_initiator_(request.request_initiator),
|
|
|
|
request_id_(request_id),
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
frame_routing_id_(frame_routing_id),
|
2020-03-02 01:23:43 +00:00
|
|
|
proxied_loader_receiver_(this),
|
|
|
|
for_cors_preflight_(true),
|
|
|
|
has_any_extra_headers_listeners_(true) {}
|
|
|
|
|
2019-08-13 05:47:35 +00:00
|
|
|
ProxyingURLLoaderFactory::InProgressRequest::~InProgressRequest() {
|
2019-11-14 05:51:24 +00:00
|
|
|
// This is important to ensure that no outstanding blocking requests continue
|
|
|
|
// to reference state owned by this object.
|
|
|
|
if (info_) {
|
|
|
|
factory_->web_request_api()->OnRequestWillBeDestroyed(&info_.value());
|
|
|
|
}
|
|
|
|
if (on_before_send_headers_callback_) {
|
|
|
|
std::move(on_before_send_headers_callback_)
|
2024-01-10 22:23:35 +00:00
|
|
|
.Run(net::ERR_ABORTED, std::nullopt);
|
2019-11-14 05:51:24 +00:00
|
|
|
}
|
|
|
|
if (on_headers_received_callback_) {
|
|
|
|
std::move(on_headers_received_callback_)
|
2024-01-10 22:23:35 +00:00
|
|
|
.Run(net::ERR_ABORTED, std::nullopt, std::nullopt);
|
2019-11-14 05:51:24 +00:00
|
|
|
}
|
2019-08-13 05:47:35 +00:00
|
|
|
}
|
2019-07-22 22:01:45 +00:00
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::Restart() {
|
|
|
|
UpdateRequestInfo();
|
|
|
|
RestartInternal();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::UpdateRequestInfo() {
|
2019-08-13 05:47:35 +00:00
|
|
|
// Derive a new WebRequestInfo value any time |Restart()| is called, because
|
|
|
|
// the details in |request_| may have changed e.g. if we've been redirected.
|
|
|
|
// |request_initiator| can be modified on redirects, but we keep the original
|
|
|
|
// for |initiator| in the event. See also
|
|
|
|
// https://developer.chrome.com/extensions/webRequest#event-onBeforeRequest.
|
|
|
|
network::ResourceRequest request_for_info = request_;
|
|
|
|
request_for_info.request_initiator = original_initiator_;
|
|
|
|
info_.emplace(extensions::WebRequestInfoInitParams(
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
request_id_, factory_->render_process_id_, frame_routing_id_,
|
2020-01-22 01:31:10 +00:00
|
|
|
factory_->navigation_ui_data_ ? factory_->navigation_ui_data_->DeepCopy()
|
|
|
|
: nullptr,
|
2022-03-30 18:08:58 +00:00
|
|
|
request_for_info, false,
|
2019-09-18 19:58:00 +00:00
|
|
|
!(options_ & network::mojom::kURLLoadOptionSynchronous),
|
2023-11-28 21:40:12 +00:00
|
|
|
factory_->IsForServiceWorkerScript(), factory_->navigation_id_));
|
2019-08-13 05:47:35 +00:00
|
|
|
|
2019-07-22 22:01:45 +00:00
|
|
|
current_request_uses_header_client_ =
|
2019-09-18 19:58:00 +00:00
|
|
|
factory_->url_loader_header_client_receiver_.is_bound() &&
|
2020-03-02 01:23:43 +00:00
|
|
|
(for_cors_preflight_ || network_service_request_id_ != 0) &&
|
|
|
|
has_any_extra_headers_listeners_;
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::RestartInternal() {
|
2019-08-13 05:47:35 +00:00
|
|
|
DCHECK_EQ(info_->url, request_.url)
|
|
|
|
<< "UpdateRequestInfo must have been called first";
|
2019-07-22 22:01:45 +00:00
|
|
|
|
|
|
|
// If the header client will be used, we start the request immediately, and
|
|
|
|
// OnBeforeSendHeaders and OnSendHeaders will be handled there. Otherwise,
|
|
|
|
// send these events before the request starts.
|
|
|
|
base::RepeatingCallback<void(int)> continuation;
|
|
|
|
if (current_request_uses_header_client_) {
|
|
|
|
continuation = base::BindRepeating(
|
|
|
|
&InProgressRequest::ContinueToStartRequest, weak_factory_.GetWeakPtr());
|
2020-03-02 01:23:43 +00:00
|
|
|
} else if (for_cors_preflight_) {
|
|
|
|
// In this case we do nothing because extensions should see nothing.
|
|
|
|
return;
|
2019-07-22 22:01:45 +00:00
|
|
|
} else {
|
|
|
|
continuation =
|
|
|
|
base::BindRepeating(&InProgressRequest::ContinueToBeforeSendHeaders,
|
|
|
|
weak_factory_.GetWeakPtr());
|
|
|
|
}
|
|
|
|
redirect_url_ = GURL();
|
2019-08-13 05:47:35 +00:00
|
|
|
int result = factory_->web_request_api()->OnBeforeRequest(
|
2019-08-16 01:19:05 +00:00
|
|
|
&info_.value(), request_, continuation, &redirect_url_);
|
2019-07-22 22:01:45 +00:00
|
|
|
if (result == net::ERR_BLOCKED_BY_CLIENT) {
|
|
|
|
// The request was cancelled synchronously. Dispatch an error notification
|
|
|
|
// and terminate the request.
|
|
|
|
network::URLLoaderCompletionStatus status(result);
|
|
|
|
OnRequestError(status);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == net::ERR_IO_PENDING) {
|
|
|
|
// One or more listeners is blocking, so the request must be paused until
|
|
|
|
// they respond. |continuation| above will be invoked asynchronously to
|
|
|
|
// continue or cancel the request.
|
|
|
|
//
|
2021-06-04 04:18:02 +00:00
|
|
|
// We pause the receiver here to prevent further client message processing.
|
2019-12-11 00:22:35 +00:00
|
|
|
if (proxied_client_receiver_.is_bound())
|
|
|
|
proxied_client_receiver_.Pause();
|
2019-07-22 22:01:45 +00:00
|
|
|
|
|
|
|
// Pause the header client, since we want to wait until OnBeforeRequest has
|
|
|
|
// finished before processing any future events.
|
2019-09-18 19:58:00 +00:00
|
|
|
if (header_client_receiver_.is_bound())
|
|
|
|
header_client_receiver_.Pause();
|
2019-07-22 22:01:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
DCHECK_EQ(net::OK, result);
|
|
|
|
|
|
|
|
continuation.Run(net::OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::FollowRedirect(
|
|
|
|
const std::vector<std::string>& removed_headers,
|
|
|
|
const net::HttpRequestHeaders& modified_headers,
|
2020-05-26 20:06:26 +00:00
|
|
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
2024-01-10 22:23:35 +00:00
|
|
|
const std::optional<GURL>& new_url) {
|
2019-07-22 22:01:45 +00:00
|
|
|
if (new_url)
|
|
|
|
request_.url = new_url.value();
|
|
|
|
|
|
|
|
for (const std::string& header : removed_headers)
|
|
|
|
request_.headers.RemoveHeader(header);
|
|
|
|
request_.headers.MergeFrom(modified_headers);
|
|
|
|
|
|
|
|
// Call this before checking |current_request_uses_header_client_| as it
|
|
|
|
// calculates it.
|
|
|
|
UpdateRequestInfo();
|
|
|
|
|
|
|
|
if (target_loader_.is_bound()) {
|
|
|
|
// If header_client_ is used, then we have to call FollowRedirect now as
|
|
|
|
// that's what triggers the network service calling back to
|
|
|
|
// OnBeforeSendHeaders(). Otherwise, don't call FollowRedirect now. Wait for
|
|
|
|
// the onBeforeSendHeaders callback(s) to run as these may modify request
|
|
|
|
// headers and if so we'll pass these modifications to FollowRedirect.
|
|
|
|
if (current_request_uses_header_client_) {
|
|
|
|
target_loader_->FollowRedirect(removed_headers, modified_headers,
|
2020-05-26 20:06:26 +00:00
|
|
|
modified_cors_exempt_headers, new_url);
|
2019-07-22 22:01:45 +00:00
|
|
|
} else {
|
|
|
|
auto params = std::make_unique<FollowRedirectParams>();
|
|
|
|
params->removed_headers = removed_headers;
|
|
|
|
params->modified_headers = modified_headers;
|
2020-05-26 20:06:26 +00:00
|
|
|
params->modified_cors_exempt_headers = modified_cors_exempt_headers;
|
2019-07-22 22:01:45 +00:00
|
|
|
params->new_url = new_url;
|
|
|
|
pending_follow_redirect_params_ = std::move(params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RestartInternal();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::SetPriority(
|
|
|
|
net::RequestPriority priority,
|
|
|
|
int32_t intra_priority_value) {
|
|
|
|
if (target_loader_.is_bound())
|
|
|
|
target_loader_->SetPriority(priority, intra_priority_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::PauseReadingBodyFromNet() {
|
|
|
|
if (target_loader_.is_bound())
|
|
|
|
target_loader_->PauseReadingBodyFromNet();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::ResumeReadingBodyFromNet() {
|
|
|
|
if (target_loader_.is_bound())
|
|
|
|
target_loader_->ResumeReadingBodyFromNet();
|
|
|
|
}
|
|
|
|
|
2021-06-04 04:18:02 +00:00
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveEarlyHints(
|
|
|
|
network::mojom::EarlyHintsPtr early_hints) {
|
|
|
|
target_client_->OnReceiveEarlyHints(std::move(early_hints));
|
|
|
|
}
|
|
|
|
|
2019-07-22 22:01:45 +00:00
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse(
|
2022-02-10 02:58:52 +00:00
|
|
|
network::mojom::URLResponseHeadPtr head,
|
2022-09-07 07:46:37 +00:00
|
|
|
mojo::ScopedDataPipeConsumerHandle body,
|
2024-01-10 22:23:35 +00:00
|
|
|
std::optional<mojo_base::BigBuffer> cached_metadata) {
|
2022-02-10 02:58:52 +00:00
|
|
|
current_body_ = std::move(body);
|
2022-09-07 07:46:37 +00:00
|
|
|
current_cached_metadata_ = std::move(cached_metadata);
|
2019-07-22 22:01:45 +00:00
|
|
|
if (current_request_uses_header_client_) {
|
|
|
|
// Use the headers we got from OnHeadersReceived as that'll contain
|
|
|
|
// Set-Cookie if it existed.
|
2019-10-28 22:12:35 +00:00
|
|
|
auto saved_headers = current_response_->headers;
|
|
|
|
current_response_ = std::move(head);
|
|
|
|
current_response_->headers = saved_headers;
|
2019-07-22 22:01:45 +00:00
|
|
|
ContinueToResponseStarted(net::OK);
|
|
|
|
} else {
|
2019-10-28 22:12:35 +00:00
|
|
|
current_response_ = std::move(head);
|
2019-07-22 22:01:45 +00:00
|
|
|
HandleResponseOrRedirectHeaders(
|
|
|
|
base::BindOnce(&InProgressRequest::ContinueToResponseStarted,
|
|
|
|
weak_factory_.GetWeakPtr()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveRedirect(
|
|
|
|
const net::RedirectInfo& redirect_info,
|
2019-09-18 19:58:00 +00:00
|
|
|
network::mojom::URLResponseHeadPtr head) {
|
2019-07-22 22:01:45 +00:00
|
|
|
// Note: In Electron we don't check IsRedirectSafe.
|
|
|
|
|
|
|
|
if (current_request_uses_header_client_) {
|
|
|
|
// Use the headers we got from OnHeadersReceived as that'll contain
|
|
|
|
// Set-Cookie if it existed.
|
2019-10-28 22:12:35 +00:00
|
|
|
auto saved_headers = current_response_->headers;
|
|
|
|
current_response_ = std::move(head);
|
2019-07-22 22:01:45 +00:00
|
|
|
// If this redirect is from an HSTS upgrade, OnHeadersReceived will not be
|
|
|
|
// called before OnReceiveRedirect, so make sure the saved headers exist
|
|
|
|
// before setting them.
|
|
|
|
if (saved_headers)
|
2019-10-28 22:12:35 +00:00
|
|
|
current_response_->headers = saved_headers;
|
2019-07-22 22:01:45 +00:00
|
|
|
ContinueToBeforeRedirect(redirect_info, net::OK);
|
|
|
|
} else {
|
2019-10-28 22:12:35 +00:00
|
|
|
current_response_ = std::move(head);
|
2019-07-22 22:01:45 +00:00
|
|
|
HandleResponseOrRedirectHeaders(
|
|
|
|
base::BindOnce(&InProgressRequest::ContinueToBeforeRedirect,
|
|
|
|
weak_factory_.GetWeakPtr(), redirect_info));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnUploadProgress(
|
|
|
|
int64_t current_position,
|
|
|
|
int64_t total_size,
|
|
|
|
OnUploadProgressCallback callback) {
|
|
|
|
target_client_->OnUploadProgress(current_position, total_size,
|
|
|
|
std::move(callback));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnTransferSizeUpdated(
|
|
|
|
int32_t transfer_size_diff) {
|
|
|
|
target_client_->OnTransferSizeUpdated(transfer_size_diff);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnComplete(
|
|
|
|
const network::URLLoaderCompletionStatus& status) {
|
|
|
|
if (status.error_code != net::OK) {
|
|
|
|
OnRequestError(status);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
target_client_->OnComplete(status);
|
2019-08-16 01:19:05 +00:00
|
|
|
factory_->web_request_api()->OnCompleted(&info_.value(), request_,
|
|
|
|
status.error_code);
|
2019-07-22 22:01:45 +00:00
|
|
|
|
2019-08-07 00:21:53 +00:00
|
|
|
// Deletes |this|.
|
|
|
|
factory_->RemoveRequest(network_service_request_id_, request_id_);
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
|
2021-06-04 04:18:02 +00:00
|
|
|
bool ProxyingURLLoaderFactory::IsForServiceWorkerScript() const {
|
|
|
|
return loader_factory_type_ == content::ContentBrowserClient::
|
|
|
|
URLLoaderFactoryType::kServiceWorkerScript;
|
|
|
|
}
|
|
|
|
|
2019-07-22 22:01:45 +00:00
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnLoaderCreated(
|
2019-09-18 19:58:00 +00:00
|
|
|
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver) {
|
2021-06-21 05:06:52 +00:00
|
|
|
// When CORS is involved there may be multiple network::URLLoader associated
|
|
|
|
// with this InProgressRequest, because CorsURLLoader may create a new
|
|
|
|
// network::URLLoader for the same request id in redirect handling - see
|
|
|
|
// CorsURLLoader::FollowRedirect. In such a case the old network::URLLoader
|
|
|
|
// is going to be detached fairly soon, so we don't need to take care of it.
|
|
|
|
// We need this explicit reset to avoid a DCHECK failure in mojo::Receiver.
|
|
|
|
header_client_receiver_.reset();
|
|
|
|
|
2019-09-18 19:58:00 +00:00
|
|
|
header_client_receiver_.Bind(std::move(receiver));
|
2020-03-02 01:23:43 +00:00
|
|
|
if (for_cors_preflight_) {
|
|
|
|
// In this case we don't have |target_loader_| and
|
2021-06-04 04:18:02 +00:00
|
|
|
// |proxied_client_receiver_|, and |receiver| is the only connection to the
|
2020-03-02 01:23:43 +00:00
|
|
|
// network service, so we observe mojo connection errors.
|
|
|
|
header_client_receiver_.set_disconnect_handler(base::BindOnce(
|
|
|
|
&ProxyingURLLoaderFactory::InProgressRequest::OnRequestError,
|
|
|
|
weak_factory_.GetWeakPtr(),
|
|
|
|
network::URLLoaderCompletionStatus(net::ERR_FAILED)));
|
|
|
|
}
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnBeforeSendHeaders(
|
|
|
|
const net::HttpRequestHeaders& headers,
|
|
|
|
OnBeforeSendHeadersCallback callback) {
|
|
|
|
if (!current_request_uses_header_client_) {
|
2024-01-10 22:23:35 +00:00
|
|
|
std::move(callback).Run(net::OK, std::nullopt);
|
2019-07-22 22:01:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
request_.headers = headers;
|
|
|
|
on_before_send_headers_callback_ = std::move(callback);
|
|
|
|
ContinueToBeforeSendHeaders(net::OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnHeadersReceived(
|
|
|
|
const std::string& headers,
|
2020-01-22 01:31:10 +00:00
|
|
|
const net::IPEndPoint& remote_endpoint,
|
2019-07-22 22:01:45 +00:00
|
|
|
OnHeadersReceivedCallback callback) {
|
|
|
|
if (!current_request_uses_header_client_) {
|
2024-01-10 22:23:35 +00:00
|
|
|
std::move(callback).Run(net::OK, std::nullopt, GURL());
|
2020-03-02 01:23:43 +00:00
|
|
|
|
|
|
|
if (for_cors_preflight_) {
|
|
|
|
// CORS preflight is supported only when "extraHeaders" is specified.
|
|
|
|
// Deletes |this|.
|
|
|
|
factory_->RemoveRequest(network_service_request_id_, request_id_);
|
|
|
|
}
|
2019-07-22 22:01:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
on_headers_received_callback_ = std::move(callback);
|
2019-10-28 22:12:35 +00:00
|
|
|
current_response_ = network::mojom::URLResponseHead::New();
|
|
|
|
current_response_->headers =
|
2019-07-22 22:01:45 +00:00
|
|
|
base::MakeRefCounted<net::HttpResponseHeaders>(headers);
|
2020-01-22 01:31:10 +00:00
|
|
|
current_response_->remote_endpoint = remote_endpoint;
|
2019-07-22 22:01:45 +00:00
|
|
|
HandleResponseOrRedirectHeaders(
|
|
|
|
base::BindOnce(&InProgressRequest::ContinueToHandleOverrideHeaders,
|
|
|
|
weak_factory_.GetWeakPtr()));
|
|
|
|
}
|
|
|
|
|
2021-06-04 04:18:02 +00:00
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::
|
|
|
|
HandleBeforeRequestRedirect() {
|
|
|
|
// The extension requested a redirect. Close the connection with the current
|
|
|
|
// URLLoader and inform the URLLoaderClient the WebRequest API generated a
|
|
|
|
// redirect. To load |redirect_url_|, a new URLLoader will be recreated
|
|
|
|
// after receiving FollowRedirect().
|
2020-03-02 01:23:43 +00:00
|
|
|
|
2021-06-04 04:18:02 +00:00
|
|
|
// Forgetting to close the connection with the current URLLoader caused
|
|
|
|
// bugs. The latter doesn't know anything about the redirect. Continuing
|
|
|
|
// the load with it gives unexpected results. See
|
|
|
|
// https://crbug.com/882661#c72.
|
|
|
|
proxied_client_receiver_.reset();
|
|
|
|
header_client_receiver_.reset();
|
|
|
|
target_loader_.reset();
|
2020-03-02 01:23:43 +00:00
|
|
|
|
2021-06-04 04:18:02 +00:00
|
|
|
constexpr int kInternalRedirectStatusCode = net::HTTP_TEMPORARY_REDIRECT;
|
|
|
|
|
|
|
|
net::RedirectInfo redirect_info;
|
|
|
|
redirect_info.status_code = kInternalRedirectStatusCode;
|
|
|
|
redirect_info.new_method = request_.method;
|
|
|
|
redirect_info.new_url = redirect_url_;
|
|
|
|
redirect_info.new_site_for_cookies =
|
|
|
|
net::SiteForCookies::FromUrl(redirect_url_);
|
|
|
|
|
|
|
|
auto head = network::mojom::URLResponseHead::New();
|
|
|
|
std::string headers = base::StringPrintf(
|
|
|
|
"HTTP/1.1 %i Internal Redirect\n"
|
|
|
|
"Location: %s\n"
|
|
|
|
"Non-Authoritative-Reason: WebRequest API\n\n",
|
|
|
|
kInternalRedirectStatusCode, redirect_url_.spec().c_str());
|
|
|
|
|
|
|
|
// Cross-origin requests need to modify the Origin header to 'null'. Since
|
|
|
|
// CorsURLLoader sets |request_initiator| to the Origin request header in
|
|
|
|
// NetworkService, we need to modify |request_initiator| here to craft the
|
|
|
|
// Origin header indirectly.
|
|
|
|
// Following checks implement the step 10 of "4.4. HTTP-redirect fetch",
|
|
|
|
// https://fetch.spec.whatwg.org/#http-redirect-fetch
|
|
|
|
if (request_.request_initiator &&
|
|
|
|
(!url::Origin::Create(redirect_url_)
|
|
|
|
.IsSameOriginWith(url::Origin::Create(request_.url)) &&
|
|
|
|
!request_.request_initiator->IsSameOriginWith(
|
|
|
|
url::Origin::Create(request_.url)))) {
|
|
|
|
// Reset the initiator to pretend tainted origin flag of the spec is set.
|
|
|
|
request_.request_initiator = url::Origin();
|
|
|
|
}
|
|
|
|
head->headers = base::MakeRefCounted<net::HttpResponseHeaders>(
|
|
|
|
net::HttpUtil::AssembleRawHeaders(headers));
|
|
|
|
head->encoded_data_length = 0;
|
|
|
|
|
|
|
|
current_response_ = std::move(head);
|
|
|
|
ContinueToBeforeRedirect(redirect_info, net::OK);
|
2020-03-02 01:23:43 +00:00
|
|
|
}
|
|
|
|
|
2019-07-22 22:01:45 +00:00
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::ContinueToBeforeSendHeaders(
|
|
|
|
int error_code) {
|
|
|
|
if (error_code != net::OK) {
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(error_code));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!current_request_uses_header_client_ && !redirect_url_.is_empty()) {
|
2020-03-02 01:23:43 +00:00
|
|
|
if (for_cors_preflight_) {
|
|
|
|
// CORS preflight doesn't support redirect.
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(net::ERR_FAILED));
|
|
|
|
return;
|
|
|
|
}
|
2019-07-22 22:01:45 +00:00
|
|
|
HandleBeforeRequestRedirect();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
if (proxied_client_receiver_.is_bound())
|
|
|
|
proxied_client_receiver_.Resume();
|
2019-07-22 22:01:45 +00:00
|
|
|
|
|
|
|
auto continuation = base::BindRepeating(
|
|
|
|
&InProgressRequest::ContinueToSendHeaders, weak_factory_.GetWeakPtr());
|
|
|
|
// Note: In Electron onBeforeSendHeaders is called for all protocols.
|
2019-08-13 05:47:35 +00:00
|
|
|
int result = factory_->web_request_api()->OnBeforeSendHeaders(
|
2019-08-16 01:19:05 +00:00
|
|
|
&info_.value(), request_, continuation, &request_.headers);
|
2019-07-22 22:01:45 +00:00
|
|
|
|
|
|
|
if (result == net::ERR_BLOCKED_BY_CLIENT) {
|
|
|
|
// The request was cancelled synchronously. Dispatch an error notification
|
|
|
|
// and terminate the request.
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(result));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == net::ERR_IO_PENDING) {
|
|
|
|
// One or more listeners is blocking, so the request must be paused until
|
|
|
|
// they respond. |continuation| above will be invoked asynchronously to
|
|
|
|
// continue or cancel the request.
|
|
|
|
//
|
2019-12-11 00:22:35 +00:00
|
|
|
// We pause the receiver here to prevent further client message processing.
|
|
|
|
if (proxied_client_receiver_.is_bound())
|
|
|
|
proxied_client_receiver_.Resume();
|
2019-07-22 22:01:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
DCHECK_EQ(net::OK, result);
|
|
|
|
|
|
|
|
ContinueToSendHeaders(std::set<std::string>(), std::set<std::string>(),
|
|
|
|
net::OK);
|
|
|
|
}
|
|
|
|
|
2021-06-04 04:18:02 +00:00
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::ContinueToStartRequest(
|
|
|
|
int error_code) {
|
|
|
|
if (error_code != net::OK) {
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(error_code));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current_request_uses_header_client_ && !redirect_url_.is_empty()) {
|
|
|
|
HandleBeforeRequestRedirect();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (proxied_client_receiver_.is_bound())
|
|
|
|
proxied_client_receiver_.Resume();
|
|
|
|
|
|
|
|
if (header_client_receiver_.is_bound())
|
|
|
|
header_client_receiver_.Resume();
|
|
|
|
|
|
|
|
if (for_cors_preflight_) {
|
|
|
|
// For CORS preflight requests, we have already started the request in
|
|
|
|
// the network service. We did block the request by blocking
|
|
|
|
// |header_client_receiver_|, which we unblocked right above.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!target_loader_.is_bound() && factory_->target_factory_.is_bound()) {
|
|
|
|
// No extensions have cancelled us up to this point, so it's now OK to
|
|
|
|
// initiate the real network request.
|
|
|
|
uint32_t options = options_;
|
|
|
|
// Even if this request does not use the header client, future redirects
|
|
|
|
// might, so we need to set the option on the loader.
|
|
|
|
if (has_any_extra_headers_listeners_)
|
|
|
|
options |= network::mojom::kURLLoadOptionUseHeaderClient;
|
|
|
|
factory_->target_factory_->CreateLoaderAndStart(
|
2022-03-25 01:39:03 +00:00
|
|
|
target_loader_.BindNewPipeAndPassReceiver(),
|
|
|
|
network_service_request_id_, options, request_,
|
|
|
|
proxied_client_receiver_.BindNewPipeAndPassRemote(),
|
2021-06-04 04:18:02 +00:00
|
|
|
traffic_annotation_);
|
|
|
|
}
|
|
|
|
|
|
|
|
// From here the lifecycle of this request is driven by subsequent events on
|
|
|
|
// either |proxied_loader_receiver_|, |proxied_client_receiver_|, or
|
|
|
|
// |header_client_receiver_|.
|
|
|
|
}
|
|
|
|
|
2019-07-22 22:01:45 +00:00
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::ContinueToSendHeaders(
|
|
|
|
const std::set<std::string>& removed_headers,
|
|
|
|
const std::set<std::string>& set_headers,
|
|
|
|
int error_code) {
|
|
|
|
if (error_code != net::OK) {
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(error_code));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (current_request_uses_header_client_) {
|
|
|
|
DCHECK(on_before_send_headers_callback_);
|
|
|
|
std::move(on_before_send_headers_callback_)
|
|
|
|
.Run(error_code, request_.headers);
|
|
|
|
} else if (pending_follow_redirect_params_) {
|
|
|
|
pending_follow_redirect_params_->removed_headers.insert(
|
|
|
|
pending_follow_redirect_params_->removed_headers.end(),
|
|
|
|
removed_headers.begin(), removed_headers.end());
|
|
|
|
|
|
|
|
for (auto& set_header : set_headers) {
|
|
|
|
std::string header_value;
|
|
|
|
if (request_.headers.GetHeader(set_header, &header_value)) {
|
|
|
|
pending_follow_redirect_params_->modified_headers.SetHeader(
|
|
|
|
set_header, header_value);
|
|
|
|
} else {
|
|
|
|
NOTREACHED();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (target_loader_.is_bound()) {
|
|
|
|
target_loader_->FollowRedirect(
|
|
|
|
pending_follow_redirect_params_->removed_headers,
|
|
|
|
pending_follow_redirect_params_->modified_headers,
|
2020-05-26 20:06:26 +00:00
|
|
|
pending_follow_redirect_params_->modified_cors_exempt_headers,
|
2019-07-22 22:01:45 +00:00
|
|
|
pending_follow_redirect_params_->new_url);
|
|
|
|
}
|
|
|
|
|
|
|
|
pending_follow_redirect_params_.reset();
|
|
|
|
}
|
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
if (proxied_client_receiver_.is_bound())
|
|
|
|
proxied_client_receiver_.Resume();
|
2019-07-22 22:01:45 +00:00
|
|
|
|
|
|
|
// Note: In Electron onSendHeaders is called for all protocols.
|
2019-08-16 01:19:05 +00:00
|
|
|
factory_->web_request_api()->OnSendHeaders(&info_.value(), request_,
|
|
|
|
request_.headers);
|
2019-07-22 22:01:45 +00:00
|
|
|
|
|
|
|
if (!current_request_uses_header_client_)
|
|
|
|
ContinueToStartRequest(net::OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::
|
|
|
|
ContinueToHandleOverrideHeaders(int error_code) {
|
|
|
|
if (error_code != net::OK) {
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(error_code));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DCHECK(on_headers_received_callback_);
|
2024-01-10 22:23:35 +00:00
|
|
|
std::optional<std::string> headers;
|
2019-07-22 22:01:45 +00:00
|
|
|
if (override_headers_) {
|
|
|
|
headers = override_headers_->raw_headers();
|
|
|
|
if (current_request_uses_header_client_) {
|
|
|
|
// Make sure to update current_response_, since when OnReceiveResponse
|
|
|
|
// is called we will not use its headers as it might be missing the
|
|
|
|
// Set-Cookie line (as that gets stripped over IPC).
|
2019-10-28 22:12:35 +00:00
|
|
|
current_response_->headers = override_headers_;
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-02 01:23:43 +00:00
|
|
|
|
|
|
|
if (for_cors_preflight_ && !redirect_url_.is_empty()) {
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(net::ERR_FAILED));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-07-22 22:01:45 +00:00
|
|
|
std::move(on_headers_received_callback_).Run(net::OK, headers, redirect_url_);
|
|
|
|
override_headers_ = nullptr;
|
|
|
|
|
2020-03-02 01:23:43 +00:00
|
|
|
if (for_cors_preflight_) {
|
2021-06-21 05:06:52 +00:00
|
|
|
// If this is for CORS preflight, there is no associated client.
|
2020-03-02 01:23:43 +00:00
|
|
|
info_->AddResponseInfoFromResourceResponse(*current_response_);
|
2021-06-21 05:06:52 +00:00
|
|
|
// Do not finish proxied preflight requests that require proxy auth.
|
|
|
|
// The request is not finished yet, give control back to network service
|
|
|
|
// which will start authentication process.
|
|
|
|
if (info_->response_code == net::HTTP_PROXY_AUTHENTICATION_REQUIRED)
|
|
|
|
return;
|
|
|
|
// We notify the completion here, and delete |this|.
|
2020-03-02 01:23:43 +00:00
|
|
|
factory_->web_request_api()->OnResponseStarted(&info_.value(), request_);
|
|
|
|
factory_->web_request_api()->OnCompleted(&info_.value(), request_, net::OK);
|
|
|
|
|
|
|
|
factory_->RemoveRequest(network_service_request_id_, request_id_);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
if (proxied_client_receiver_.is_bound())
|
|
|
|
proxied_client_receiver_.Resume();
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::ContinueToResponseStarted(
|
|
|
|
int error_code) {
|
2020-03-02 01:23:43 +00:00
|
|
|
DCHECK(!for_cors_preflight_);
|
2019-07-22 22:01:45 +00:00
|
|
|
if (error_code != net::OK) {
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(error_code));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DCHECK(!current_request_uses_header_client_ || !override_headers_);
|
|
|
|
if (override_headers_)
|
2019-10-28 22:12:35 +00:00
|
|
|
current_response_->headers = override_headers_;
|
2019-07-22 22:01:45 +00:00
|
|
|
|
|
|
|
std::string redirect_location;
|
|
|
|
if (override_headers_ && override_headers_->IsRedirect(&redirect_location)) {
|
|
|
|
// The response headers may have been overridden by an |onHeadersReceived|
|
|
|
|
// handler and may have been changed to a redirect. We handle that here
|
|
|
|
// instead of acting like regular request completion.
|
|
|
|
//
|
|
|
|
// Note that we can't actually change how the Network Service handles the
|
|
|
|
// original request at this point, so our "redirect" is really just
|
|
|
|
// generating an artificial |onBeforeRedirect| event and starting a new
|
|
|
|
// request to the Network Service. Our client shouldn't know the difference.
|
|
|
|
GURL new_url(redirect_location);
|
|
|
|
|
|
|
|
net::RedirectInfo redirect_info;
|
|
|
|
redirect_info.status_code = override_headers_->response_code();
|
|
|
|
redirect_info.new_method = request_.method;
|
|
|
|
redirect_info.new_url = new_url;
|
2020-01-17 18:41:52 +00:00
|
|
|
redirect_info.new_site_for_cookies = net::SiteForCookies::FromUrl(new_url);
|
2019-07-22 22:01:45 +00:00
|
|
|
|
|
|
|
// These will get re-bound if a new request is initiated by
|
|
|
|
// |FollowRedirect()|.
|
2019-12-11 00:22:35 +00:00
|
|
|
proxied_client_receiver_.reset();
|
2019-09-18 19:58:00 +00:00
|
|
|
header_client_receiver_.reset();
|
2019-07-22 22:01:45 +00:00
|
|
|
target_loader_.reset();
|
|
|
|
|
|
|
|
ContinueToBeforeRedirect(redirect_info, net::OK);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-10-28 22:12:35 +00:00
|
|
|
info_->AddResponseInfoFromResourceResponse(*current_response_);
|
2019-08-13 05:47:35 +00:00
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
proxied_client_receiver_.Resume();
|
2019-07-22 22:01:45 +00:00
|
|
|
|
2019-08-16 01:19:05 +00:00
|
|
|
factory_->web_request_api()->OnResponseStarted(&info_.value(), request_);
|
2022-02-10 02:58:52 +00:00
|
|
|
target_client_->OnReceiveResponse(current_response_.Clone(),
|
2022-09-07 07:46:37 +00:00
|
|
|
std::move(current_body_),
|
|
|
|
std::move(current_cached_metadata_));
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::ContinueToBeforeRedirect(
|
|
|
|
const net::RedirectInfo& redirect_info,
|
|
|
|
int error_code) {
|
|
|
|
if (error_code != net::OK) {
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(error_code));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-10-28 22:12:35 +00:00
|
|
|
info_->AddResponseInfoFromResourceResponse(*current_response_);
|
2019-08-13 05:47:35 +00:00
|
|
|
|
2019-12-11 00:22:35 +00:00
|
|
|
if (proxied_client_receiver_.is_bound())
|
|
|
|
proxied_client_receiver_.Resume();
|
2019-07-22 22:01:45 +00:00
|
|
|
|
2019-08-16 01:19:05 +00:00
|
|
|
factory_->web_request_api()->OnBeforeRedirect(&info_.value(), request_,
|
2019-08-13 05:47:35 +00:00
|
|
|
redirect_info.new_url);
|
2020-01-22 01:31:10 +00:00
|
|
|
target_client_->OnReceiveRedirect(redirect_info, current_response_.Clone());
|
2019-07-22 22:01:45 +00:00
|
|
|
request_.url = redirect_info.new_url;
|
|
|
|
request_.method = redirect_info.new_method;
|
|
|
|
request_.site_for_cookies = redirect_info.new_site_for_cookies;
|
|
|
|
request_.referrer = GURL(redirect_info.new_referrer);
|
|
|
|
request_.referrer_policy = redirect_info.new_referrer_policy;
|
|
|
|
|
|
|
|
// The request method can be changed to "GET". In this case we need to
|
|
|
|
// reset the request body manually.
|
|
|
|
if (request_.method == net::HttpRequestHeaders::kGetMethod)
|
|
|
|
request_.request_body = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::
|
|
|
|
HandleResponseOrRedirectHeaders(net::CompletionOnceCallback continuation) {
|
|
|
|
override_headers_ = nullptr;
|
|
|
|
redirect_url_ = GURL();
|
|
|
|
|
2019-10-28 22:12:35 +00:00
|
|
|
info_->AddResponseInfoFromResourceResponse(*current_response_);
|
2019-08-21 02:14:21 +00:00
|
|
|
|
2021-06-16 22:43:51 +00:00
|
|
|
auto callback_pair = base::SplitOnceCallback(std::move(continuation));
|
2019-08-13 05:47:35 +00:00
|
|
|
DCHECK(info_.has_value());
|
|
|
|
int result = factory_->web_request_api()->OnHeadersReceived(
|
2021-06-16 22:43:51 +00:00
|
|
|
&info_.value(), request_, std::move(callback_pair.first),
|
2019-10-28 22:12:35 +00:00
|
|
|
current_response_->headers.get(), &override_headers_, &redirect_url_);
|
2019-07-22 22:01:45 +00:00
|
|
|
if (result == net::ERR_BLOCKED_BY_CLIENT) {
|
|
|
|
OnRequestError(network::URLLoaderCompletionStatus(result));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result == net::ERR_IO_PENDING) {
|
|
|
|
// One or more listeners is blocking, so the request must be paused until
|
|
|
|
// they respond. |continuation| above will be invoked asynchronously to
|
|
|
|
// continue or cancel the request.
|
|
|
|
//
|
2019-12-11 00:22:35 +00:00
|
|
|
// We pause the receiver here to prevent further client message processing.
|
|
|
|
if (proxied_client_receiver_.is_bound())
|
|
|
|
proxied_client_receiver_.Pause();
|
2019-07-22 22:01:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DCHECK_EQ(net::OK, result);
|
|
|
|
|
2021-06-16 22:43:51 +00:00
|
|
|
std::move(callback_pair.second).Run(net::OK);
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::InProgressRequest::OnRequestError(
|
|
|
|
const network::URLLoaderCompletionStatus& status) {
|
2020-03-02 01:23:43 +00:00
|
|
|
if (target_client_)
|
2019-07-22 22:01:45 +00:00
|
|
|
target_client_->OnComplete(status);
|
2020-03-02 01:23:43 +00:00
|
|
|
factory_->web_request_api()->OnErrorOccurred(&info_.value(), request_,
|
|
|
|
status.error_code);
|
2019-07-22 22:01:45 +00:00
|
|
|
|
2019-08-13 05:47:35 +00:00
|
|
|
// Deletes |this|.
|
|
|
|
factory_->RemoveRequest(network_service_request_id_, request_id_);
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
|
2019-05-22 01:43:37 +00:00
|
|
|
ProxyingURLLoaderFactory::ProxyingURLLoaderFactory(
|
2019-08-13 05:47:35 +00:00
|
|
|
WebRequestAPI* web_request_api,
|
2019-07-22 22:01:45 +00:00
|
|
|
const HandlersMap& intercepted_handlers,
|
2019-08-13 05:47:35 +00:00
|
|
|
int render_process_id,
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
int frame_routing_id,
|
2020-02-11 05:56:09 +00:00
|
|
|
uint64_t* request_id_generator,
|
2020-01-22 01:31:10 +00:00
|
|
|
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data,
|
2024-01-10 22:23:35 +00:00
|
|
|
std::optional<int64_t> navigation_id,
|
2022-03-25 01:39:03 +00:00
|
|
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_request,
|
2019-10-28 22:12:35 +00:00
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory_remote,
|
2019-09-18 19:58:00 +00:00
|
|
|
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
|
|
|
header_client_receiver,
|
|
|
|
content::ContentBrowserClient::URLLoaderFactoryType loader_factory_type)
|
2019-08-13 05:47:35 +00:00
|
|
|
: web_request_api_(web_request_api),
|
|
|
|
intercepted_handlers_(intercepted_handlers),
|
|
|
|
render_process_id_(render_process_id),
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
frame_routing_id_(frame_routing_id),
|
2020-02-11 05:56:09 +00:00
|
|
|
request_id_generator_(request_id_generator),
|
2020-01-22 01:31:10 +00:00
|
|
|
navigation_ui_data_(std::move(navigation_ui_data)),
|
2019-12-11 00:22:35 +00:00
|
|
|
navigation_id_(std::move(navigation_id)),
|
2019-09-18 19:58:00 +00:00
|
|
|
loader_factory_type_(loader_factory_type) {
|
2019-10-28 22:12:35 +00:00
|
|
|
target_factory_.Bind(std::move(target_factory_remote));
|
|
|
|
target_factory_.set_disconnect_handler(base::BindOnce(
|
2019-05-22 01:43:37 +00:00
|
|
|
&ProxyingURLLoaderFactory::OnTargetFactoryError, base::Unretained(this)));
|
2019-10-28 22:12:35 +00:00
|
|
|
proxy_receivers_.Add(this, std::move(loader_request));
|
|
|
|
proxy_receivers_.set_disconnect_handler(base::BindRepeating(
|
2019-05-22 01:43:37 +00:00
|
|
|
&ProxyingURLLoaderFactory::OnProxyBindingError, base::Unretained(this)));
|
2019-07-22 22:01:45 +00:00
|
|
|
|
2019-09-18 19:58:00 +00:00
|
|
|
if (header_client_receiver)
|
|
|
|
url_loader_header_client_receiver_.Bind(std::move(header_client_receiver));
|
2019-11-26 21:27:33 +00:00
|
|
|
|
|
|
|
ignore_connections_limit_domains_ = base::SplitString(
|
|
|
|
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
|
|
|
|
switches::kIgnoreConnectionsLimit),
|
|
|
|
",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
|
2019-05-22 01:43:37 +00:00
|
|
|
}
|
|
|
|
|
2019-11-26 21:27:33 +00:00
|
|
|
bool ProxyingURLLoaderFactory::ShouldIgnoreConnectionsLimit(
|
|
|
|
const network::ResourceRequest& request) {
|
|
|
|
for (const auto& domain : ignore_connections_limit_domains_) {
|
|
|
|
if (request.url.DomainIs(domain)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-05-22 01:43:37 +00:00
|
|
|
void ProxyingURLLoaderFactory::CreateLoaderAndStart(
|
2019-11-05 23:41:20 +00:00
|
|
|
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
2019-05-22 01:43:37 +00:00
|
|
|
int32_t request_id,
|
|
|
|
uint32_t options,
|
2019-11-26 21:27:33 +00:00
|
|
|
const network::ResourceRequest& original_request,
|
2019-12-11 00:22:35 +00:00
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
2019-05-22 01:43:37 +00:00
|
|
|
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
|
2019-11-26 21:27:33 +00:00
|
|
|
// Take a copy so we can mutate the request.
|
|
|
|
network::ResourceRequest request = original_request;
|
|
|
|
|
|
|
|
if (ShouldIgnoreConnectionsLimit(request)) {
|
2020-04-20 19:16:34 +00:00
|
|
|
request.priority = net::RequestPriority::MAXIMUM_PRIORITY;
|
2019-11-26 21:27:33 +00:00
|
|
|
request.load_flags |= net::LOAD_IGNORE_LIMITS;
|
|
|
|
}
|
|
|
|
|
2019-05-24 02:28:00 +00:00
|
|
|
// Check if user has intercepted this scheme.
|
2023-03-27 17:00:55 +00:00
|
|
|
bool bypass_custom_protocol_handlers =
|
|
|
|
options & kBypassCustomProtocolHandlers;
|
|
|
|
if (!bypass_custom_protocol_handlers) {
|
2023-07-31 17:47:32 +00:00
|
|
|
auto it = intercepted_handlers_->find(request.url.scheme());
|
|
|
|
if (it != intercepted_handlers_->end()) {
|
2023-03-27 17:00:55 +00:00
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory> loader_remote;
|
|
|
|
this->Clone(loader_remote.InitWithNewPipeAndPassReceiver());
|
|
|
|
|
|
|
|
// <scheme, <type, handler>>
|
|
|
|
it->second.second.Run(
|
|
|
|
request,
|
|
|
|
base::BindOnce(&ElectronURLLoaderFactory::StartLoading,
|
|
|
|
std::move(loader), request_id, options, request,
|
|
|
|
std::move(client), traffic_annotation,
|
|
|
|
std::move(loader_remote), it->second.first));
|
|
|
|
return;
|
|
|
|
}
|
2019-05-24 02:28:00 +00:00
|
|
|
}
|
|
|
|
|
2020-04-01 07:38:40 +00:00
|
|
|
// The loader of ServiceWorker forbids loading scripts from file:// URLs, and
|
|
|
|
// Chromium does not provide a way to override this behavior. So in order to
|
|
|
|
// make ServiceWorker work with file:// URLs, we have to intercept its
|
|
|
|
// requests here.
|
|
|
|
if (IsForServiceWorkerScript() && request.url.SchemeIsFile()) {
|
2021-06-08 02:00:05 +00:00
|
|
|
asar::CreateAsarURLLoader(
|
|
|
|
request, std::move(loader), std::move(client),
|
|
|
|
base::MakeRefCounted<net::HttpResponseHeaders>(""));
|
2019-05-22 01:43:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-20 11:46:20 +00:00
|
|
|
if (!web_request_api()->HasListener()) {
|
|
|
|
// Pass-through to the original factory.
|
chore: bump chromium to 92.0.4475.0 (master) (#28462)
* chore: bump chromium in DEPS to 91.0.4464.0
* chore: rebuild chromium/dcheck.patch with import-patches -3
Mechanical only; no code changes
* chore: remove content_browser_main_loop.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
The function being patched (BrowserMainLoop::MainMessageLoopRun()) no
longer exists.
NB: if removing this introduces regressions the likely fix will be to
add a similar patch for ShellBrowserMainParts::WillRunMainMessageLoop()
which has similar code and was added at the same time this was removed.
* chore: rebuild chromium/put_back_deleted_colors_for_autofill.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/disable_color_correct_rendering.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/eat_allow_disabling_blink_scheduler_throttling_per_renderview.patch with patch
Mechanical only; no code changes
* chore: rebuild chromium/gpu_notify_when_dxdiag_request_fails.patch with import-patches -3
Mechanical only; no code changes
* chore: rebuild chromium/ui_gtk_public_header.patch manually
no code changes
* chore: rebuild chromium/web_contents.patch with import-patches -3
Mechanical only; no code changes
* chore: remove v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch
Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2763874
This patch has been merged upstream
* chore: export patches
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785841
SkColorFromColorId() no longer takes theme, scheme args
* chore: sync chromium/put_back_deleted_colors_for_autofill.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2772143
Change new calls to GetDarkSchemeColor to fit our patched call signature
* chore: update add_trustedauthclient_to_urlloaderfactory.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2757969
Sync with removal of render_frame_id_ in our mojom
* chore: update chromium/frame_host_manager.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update chromium/revert_remove_contentrendererclient_shouldfork.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2755314
Upstream has removed `history_list_length_` which we were comparing to 0
to calculate our `is_initial_navigation` bool when calling ShouldFork().
ShouldFork() is ours and none of the code paths actually use that param,
so this commit removes it altogether.
* chore: update permissions_to_register
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2789074
Replace all uses of APIPermission::ID enum with Mojo type
* refactor: update return type of PreMainMessageLoopRun()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
Used to return void; now returns an int errorcode.
Note: 2725153 also has some nice doc updates about Browser's "stages"
* refactor: sync ElectronBrowserMainParts to MainParts changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
RunMainMessageLoopParts has been replaced with WillRunMainMessageLoop
so `BrowserMainLoop::result_code_` is no longer available to us for our
exit_code_ pointer.
This variable held a dual role: (1) of course, hold the exit code, but
also (2) was a nullptr before the message loop was ready, indicating to
anyone calling SetExitCode() that we were still in startup and could
just exit() without any extra steps. exit_code_ still fulfills these two
roles but is now a base::Optional.
* chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2725153
BrowserMainParts::BrowsePreDefaultMainMesssageLoopRun() has been
removed; move that work to the new WillRunMainMessageLoop().
* refactor: stop using CallbackList; it has been removed.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2785973
* refactor: update use of threadpools.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2773408
The upstream code is still in flux (e.g. reverts and re-lands) but the
tl;dr for this commit is (1) include thread_pool.h if you're using it
and (2) don't instantiate pools directly.
* refactor: remove routing_id from CreateLoaderAndStart
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
NB: One logic branch in ProxyingURLLoaderFactory::CreateLoaderAndStart
calls std::make_unique<InProgressRequest>, which needs a routing_id.
This PR uses the member field `routing_id_` since there's no longer one
being passed into CreateLoaderAndStart.
* refactor: sync to upstream ParittionOptions churn
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
PartitionOptions' enums have changed.
* refactor: update Manifest::Location usage
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
tldr: s/Manifest::FOO/ManifestLocation::kFoo/
* chore: bump chromium in DEPS to 91.0.4465.0
* update patches
* refactor: update extensions::Manifest to upstream
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771320
- extensions::Manifest::COMPONENT
+ extensions::mojom::ManifestLocation::kExternalComponent
* refactor: sync with upstream UrlInfo ctor changes
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2740008
UrlInfo ctor now takes UrlInfo::OriginIsolationRequest instead of a bool
* chore: update invocation of convert_protocol_to_json.py
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2792623
python3 is being used in parts of the upstream build, but the copy of
convert_protocol_to_json.py invoked in v8/third_party/inspector_protocol
is not python3-friendly. Node has a py2+3-friendly version of it in its
tools directory, so call it instead.
* chore: use extensions::mojom::APIPermissionID
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791122
tldr:
- extensions::APIPermission::kFoo
+ extensions::mojom::APIPermissionID::kFoo
* chore: Remove support for TLS1.0/1.1 in SSLVersionMin policy
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2765737
Remove TLS v1.0 & 1.1 from our SSLProtocolVersionFromString() function.
This is the same change made upstream at
https://chromium-review.googlesource.com/c/chromium/src/+/2765737/8/chrome/browser/ssl/ssl_config_service_manager_pref.cc
* fixup! chore: update ElectronBrowserMainParts::PreDefaultMainMessageLoopRun
* chore: Use IDType for permission change subscriptions.
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791431
tldr: {Subscribe,Unsubscribe}PermissionStatusChange's tag type used to
be an int; now it's the new SubscriptionId type (which is an IdType64).
* chore: sync PowerMonitor code to upstream refactor
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2752635
tldr: PowerMonitor has been split into PowerStateObserver,
PowerSuspendObserver, and PowerThermalObserver to reduce number of tasks
posted to consumers who only need notifications for one of those things
instead of all of them.
* chore: use PartitionOptions's new Cookies field
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2771318
* Revert "refactor: remove routing_id from CreateLoaderAndStart"
This reverts commit 8c9773b87a3c84f9073a47089eb2b6889d745245.
8c9773b was only a partial fix; reverting to start & try again.
* update patches
* chore: bump chromium in DEPS to 91.0.4466.0
* chore: update chromium/accelerator.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2795472
tldr: sync patch with upstream renamed variable & macro names.
* chore: update chromium/gtk_visibility.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796200
tldr: no code changes; just updating the diff to apply cleanly.
note: ooh upstream Wayland hacking!
* chore: update chromium/picture-in-picture.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710023
tldr: no code changes; just updating the diff to apply cleanly.
* chore: update chromium/worker_feat_add_hook_to_notify_script_ready.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2775573
tldr: no code changes; just updating the diff to apply cleanly.
* chore: export_all_patches
* chore: update chromium/feat_add_set_theme_source_to_allow_apps_to.patch
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2796511
tldr: NotifyObservers has been renamed to NotifyOnNativeThemeUpdated,
so update the invocation in our patch.
* chore: update ElectronBrowserClient w/upstream API
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797454
tldr: GetDevToolsManagerDelegate() was returning an owned raw pointer.
Replaced it with CreateDevToolsManagerDelegate() which uses unique_ptr<>.
* chore: handle new content::PermissionType::FILE_HANDLING in toV8()
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762201
`file-handling` string confirmed in https://chromium-review.googlesource.com/c/chromium/src/+/2762201/18/chrome/browser/ui/webui/settings/site_settings_helper.cc
* refactor: remove routing_id from CreateLoaderAndStart pt 1
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2762858
Part 1: the easiest ones
* 2796724: Support Python3
https://chromium-review.googlesource.com/c/infra/luci/python-adb/+/2796724
* chore: bump chromium in DEPS to 91.0.4468.0
* 2668974: WebShare: Implement SharingServicePicker
https://chromium-review.googlesource.com/c/chromium/src/+/2668974
* 2802766: Apply modernize-make-unique to media/
https://chromium-review.googlesource.com/c/chromium/src/+/2802766
* 2802823: Apply modernize-make-unique to gpu/
https://chromium-review.googlesource.com/c/chromium/src/+/2802823
* 2803041: Apply modernize-make-unique to remaining files
https://chromium-review.googlesource.com/c/chromium/src/+/2803041
* 2798873: Convert GtkKeyBindingsHandler build checks to runtime checks
https://chromium-review.googlesource.com/c/chromium/src/+/2798873
* 2733595: [ch-r] Parse ACCEPT_CH H2/3 frame and restart with new headers if needed
https://chromium-review.googlesource.com/c/chromium/src/+/2733595
* chore: update patch indices
* 2795107: Remove unused PermissionRequest IDs.
https://chromium-review.googlesource.com/c/chromium/src/+/2795107
* chore: bump chromium in DEPS to 91.0.4469.0
* chore: fixup patch indices
* chore: bump chromium in DEPS to 91.0.4469.5
* PiP 1.5: Add microphone, camera, and hang up buttons to the PiP window
https://chromium-review.googlesource.com/c/chromium/src/+/2710023
* fixup! refactor: remove routing_id from CreateLoaderAndStart
* refactor: use URLLoaderNetworkServiceObserver for auth requests from SimpleURLLoader
* fixup! chore: fixup patch indices
* 2724817: Expand scope of wasm-eval to all URLs
https://chromium-review.googlesource.com/c/chromium/src/+/2724817
* Fixup patch after rebase
* chore: bump chromium in DEPS to 91.0.4472.0
* 2797341: [ozone/x11] Enabled the global shortcut listener.
https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* 2805553: Reland Add GTK ColorMixers to ColorPipeline P1
https://chromium-review.googlesource.com/c/chromium/src/+/2805553
* 2804366: PiP 1.5: Label back to tab button with origin and center it
https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* 2784730: Fix crash on AX mode change in NativeViewHost without a Widget
https://chromium-review.googlesource.com/c/chromium/src/+/2784730
* chore: update patch indices
* 2810174: Add PdfAnnotationsEnabled policy.
https://chromium-review.googlesource.com/c/chromium/src/+/2810174
* 2807829: Allow capturers to indicate if they want a WakeLock or not.
https://chromium-review.googlesource.com/c/chromium/src/+/2807829
* chore: bump chromium in DEPS to 92.0.4473.0
* chore: bump chromium in DEPS to 92.0.4474.0
* chore: bump chromium in DEPS to 92.0.4475.0
* chore: update patches
* chore: updates patches
* chore: update is_media_key patch to handle new ozone impl
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
* fix: ExecuteJavascript requests now need to be flagged as non-bf-aware
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2787195
* chore: icon_util_x11 is now icon_util_linux
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2791362
* build: update sysroots
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2628496
* build: fix missing symbols on linux build
* use_ozone and use_x11 are not exclusive
* new button view to build for pip
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2797341
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2804366
* chore: fix broken gtk_util color patch
* chore: remove patch conflict
* build: update linux manifests
* chore: build bttlb on all platforms for pip
* chore: add thread_pool include for views delegate win
* chore: fix lint
* chore: add node patches for V8 changes
* build: add missing base include on windows
* fix: update frame host manager patch for new state transitions
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2714464
* chore: update windows zip manifests
* chore: update mac zip manifests
* chore: fix patch linting
* refactor: implement missing URLLoaderNetworkServiceObserver methods
It is against The Mojo Rules to leave hanging callbacks. These always
have to be called.
Refs: https://github.com/electron/electron/commit/186528aab9f8e29d658f07d220bb7f627980edda
* spec: fix locale test on local linux
* fix: pass the exit code correctly in new PreMainMessageLoopRun
Refs: https://github.com/electron/electron/commit/2622e91c4493ceb032e2f80cb484885bb8f97475
* fix: ensure we early-exit when request_handler_ is not provided
Refs: https://github.com/electron/electron/commit/93077afbfb6db248a0c0cc447d7ad2c9ccfda1d5
* fix: strongly set result_code in the BrowserMainLoop
* fix: invalid usage of non-targetted PostTask
You must always either use a host threadpool or specify a target
thread. In this case we did neither after this refactor.
Refs: https://github.com/electron/electron/pull/28462/commits/4e33ee0ad35a710bd34641cb0376bdee6aea2d1f
* chore: fix gn check
* chore: remove stray .rej files in patch
* chore: add mojo error code to url loader failure
* build: ensure CI is truthy in arm test env
* fix: handle windowCaptureMacV2 being enabled when fetching media source id
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2709931
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2021-04-15 17:44:35 +00:00
|
|
|
target_factory_->CreateLoaderAndStart(std::move(loader), request_id,
|
|
|
|
options, request, std::move(client),
|
|
|
|
traffic_annotation);
|
2019-08-20 11:46:20 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-08-07 00:21:53 +00:00
|
|
|
|
|
|
|
// The request ID doesn't really matter. It just needs to be unique
|
|
|
|
// per-BrowserContext so extensions can make sense of it. Note that
|
|
|
|
// |network_service_request_id_| by contrast is not necessarily unique, so we
|
|
|
|
// don't use it for identity here.
|
2020-02-11 05:56:09 +00:00
|
|
|
const uint64_t web_request_id = ++(*request_id_generator_);
|
2019-08-07 00:21:53 +00:00
|
|
|
|
2019-11-14 05:51:24 +00:00
|
|
|
// Notes: Chromium assumes that requests with zero-ID would never use the
|
|
|
|
// "extraHeaders" code path, however in Electron requests started from
|
|
|
|
// the net module would have zero-ID because they do not have renderer process
|
|
|
|
// associated.
|
2019-08-07 00:21:53 +00:00
|
|
|
if (request_id)
|
|
|
|
network_request_id_to_web_request_id_.emplace(request_id, web_request_id);
|
|
|
|
|
|
|
|
auto result = requests_.emplace(
|
|
|
|
web_request_id,
|
|
|
|
std::make_unique<InProgressRequest>(
|
2022-03-30 18:08:58 +00:00
|
|
|
this, web_request_id, frame_routing_id_, request_id, options, request,
|
|
|
|
traffic_annotation, std::move(loader), std::move(client)));
|
2019-08-07 00:21:53 +00:00
|
|
|
result.first->second->Restart();
|
2019-05-22 01:43:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::Clone(
|
2019-10-28 22:12:35 +00:00
|
|
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_receiver) {
|
|
|
|
proxy_receivers_.Add(this, std::move(loader_receiver));
|
2019-05-22 01:43:37 +00:00
|
|
|
}
|
|
|
|
|
2019-07-22 22:01:45 +00:00
|
|
|
void ProxyingURLLoaderFactory::OnLoaderCreated(
|
|
|
|
int32_t request_id,
|
2019-09-18 19:58:00 +00:00
|
|
|
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver) {
|
2019-08-07 00:21:53 +00:00
|
|
|
auto it = network_request_id_to_web_request_id_.find(request_id);
|
|
|
|
if (it == network_request_id_to_web_request_id_.end())
|
|
|
|
return;
|
|
|
|
|
|
|
|
auto request_it = requests_.find(it->second);
|
|
|
|
DCHECK(request_it != requests_.end());
|
2019-09-18 19:58:00 +00:00
|
|
|
request_it->second->OnLoaderCreated(std::move(receiver));
|
|
|
|
}
|
|
|
|
|
2021-06-04 04:18:02 +00:00
|
|
|
void ProxyingURLLoaderFactory::OnLoaderForCorsPreflightCreated(
|
|
|
|
const network::ResourceRequest& request,
|
|
|
|
mojo::PendingReceiver<network::mojom::TrustedHeaderClient> receiver) {
|
|
|
|
// Please note that the URLLoader is now starting, without waiting for
|
|
|
|
// additional signals from here. The URLLoader will be blocked before
|
|
|
|
// sending HTTP request headers (TrustedHeaderClient.OnBeforeSendHeaders),
|
|
|
|
// but the connection set up will be done before that. This is acceptable from
|
|
|
|
// Web Request API because the extension has already allowed to set up
|
|
|
|
// a connection to the same URL (i.e., the actual request), and distinguishing
|
|
|
|
// two connections for the actual request and the preflight request before
|
|
|
|
// sending request headers is very difficult.
|
|
|
|
const uint64_t web_request_id = ++(*request_id_generator_);
|
|
|
|
|
|
|
|
auto result = requests_.insert(std::make_pair(
|
|
|
|
web_request_id, std::make_unique<InProgressRequest>(
|
|
|
|
this, web_request_id, frame_routing_id_, request)));
|
|
|
|
|
|
|
|
result.first->second->OnLoaderCreated(std::move(receiver));
|
|
|
|
result.first->second->Restart();
|
2019-07-22 22:01:45 +00:00
|
|
|
}
|
|
|
|
|
2021-06-04 04:18:02 +00:00
|
|
|
ProxyingURLLoaderFactory::~ProxyingURLLoaderFactory() = default;
|
|
|
|
|
2019-05-22 01:43:37 +00:00
|
|
|
void ProxyingURLLoaderFactory::OnTargetFactoryError() {
|
2019-08-07 00:21:53 +00:00
|
|
|
target_factory_.reset();
|
2019-10-28 22:12:35 +00:00
|
|
|
proxy_receivers_.Clear();
|
2019-08-07 00:21:53 +00:00
|
|
|
|
|
|
|
MaybeDeleteThis();
|
2019-05-22 01:43:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::OnProxyBindingError() {
|
2019-10-28 22:12:35 +00:00
|
|
|
if (proxy_receivers_.empty())
|
2019-08-07 00:21:53 +00:00
|
|
|
target_factory_.reset();
|
|
|
|
|
|
|
|
MaybeDeleteThis();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::RemoveRequest(int32_t network_service_request_id,
|
|
|
|
uint64_t request_id) {
|
|
|
|
network_request_id_to_web_request_id_.erase(network_service_request_id);
|
|
|
|
requests_.erase(request_id);
|
|
|
|
|
|
|
|
MaybeDeleteThis();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProxyingURLLoaderFactory::MaybeDeleteThis() {
|
|
|
|
// Even if all URLLoaderFactory pipes connected to this object have been
|
|
|
|
// closed it has to stay alive until all active requests have completed.
|
2020-10-06 07:20:56 +00:00
|
|
|
if (target_factory_.is_bound() || !requests_.empty() ||
|
|
|
|
!proxy_receivers_.empty())
|
2019-08-07 00:21:53 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
delete this;
|
2019-05-22 01:43:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace electron
|