From 5defd96ecde160f8a17ecc49a4990649aa324728 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 4 Mar 2021 13:51:14 -0800 Subject: [PATCH 01/85] chore: bump chromium in DEPS to 91.0.4435.3 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 1d07810b2832..aab7eb43f29b 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '90.0.4415.0', + '91.0.4435.3', 'node_version': 'v14.16.0', 'nan_version': From b820b4078dc84e1de23408f6d9e6694d7c689145 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 4 Mar 2021 14:33:36 -0800 Subject: [PATCH 02/85] build: add 'use_rts' definition Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2694187 --- DEPS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DEPS b/DEPS index aab7eb43f29b..bc21aefe21a0 100644 --- a/DEPS +++ b/DEPS @@ -48,6 +48,8 @@ vars = { # It's only needed to parse the native tests configurations. 'checkout_pyyaml': False, + 'use_rts': False, + 'mac_xcode_version': 'default', # To allow running hooks without parsing the DEPS tree From 55e50a0879b7dc9633cacf1bf11a49b93ae61c7e Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 4 Mar 2021 15:46:13 -0800 Subject: [PATCH 03/85] chore: update patches --- patches/boringssl/expose_aes-cfb.patch | 2 +- ...client_precreatemessageloop_callback.patch | 6 +- .../add_didinstallconditionalfeatures.patch | 30 ++--- patches/chromium/add_realloc.patch | 8 +- ...rustedauthclient_to_urlloaderfactory.patch | 65 +++++----- patches/chromium/blink_local_frame.patch | 12 +- patches/chromium/blink_world_context.patch | 10 +- patches/chromium/can_create_window.patch | 42 +++--- ..._v8_initialization_isolate_callbacks.patch | 2 +- ...screationoverridden_with_full_params.patch | 40 +++--- ...esources_not_chrome_for_spellchecker.patch | 4 +- patches/chromium/chrome_key_systems.patch | 4 +- patches/chromium/dcheck.patch | 10 +- ...ay_lock_the_protocol_scheme_registry.patch | 12 +- patches/chromium/desktop_media_list.patch | 30 ++--- .../disable_color_correct_rendering.patch | 40 +++--- .../disable_compositor_recycling.patch | 4 +- patches/chromium/disable_hidden.patch | 16 +-- patches/chromium/disable_unload_metrics.patch | 6 +- ...ll_getwebframe_-_view_when_get_blink.patch | 2 +- .../chromium/enable_reset_aspect_ratio.patch | 4 +- ...xpose_setuseragent_on_networkcontext.patch | 16 +-- ...dd_set_theme_source_to_allow_apps_to.patch | 16 +-- ..._scheduler_throttling_per_renderview.patch | 20 +-- ...screen_rendering_with_viz_compositor.patch | 16 +-- ...chdir_np_and_pthread_chdir_np_in_mas.patch | 8 +- ...out_profile_refs_in_accessibility_ui.patch | 10 +- ..._properly_honor_printing_page_ranges.patch | 2 +- ...ns_through_the_web_contents_delegate.patch | 4 +- patches/chromium/frame_host_manager.patch | 44 +++---- ...gpu_notify_when_dxdiag_request_fails.patch | 4 +- .../chromium/gritsettings_resource_ids.patch | 4 +- patches/chromium/gtk_visibility.patch | 4 +- .../mas_disable_remote_accessibility.patch | 32 ++--- patches/chromium/mas_no_private_api.patch | 121 +++++++++--------- ...emote_certificate_verification_logic.patch | 14 +- .../chromium/notification_provenance.patch | 2 +- patches/chromium/picture-in-picture.patch | 16 +-- patches/chromium/printing.patch | 28 ++-- ...put_back_deleted_colors_for_autofill.patch | 52 ++++---- ...r_changes_to_the_webcontentsobserver.patch | 14 +- ..._some_deps_that_do_not_work_on_arm64.patch | 18 +-- .../render_widget_host_view_base.patch | 8 +- .../render_widget_host_view_mac.patch | 8 +- ...ove_contentrendererclient_shouldfork.patch | 16 +-- patches/chromium/scroll_bounce_flag.patch | 4 +- .../ssl_security_state_tab_helper.patch | 21 ++- .../support_mixed_sandbox_with_zygote.patch | 10 +- patches/chromium/ui_gtk_public_header.patch | 6 +- ...andboxed_ppapi_processes_skip_zygote.patch | 2 +- patches/chromium/web_contents.patch | 12 +- patches/chromium/webview_cross_drag.patch | 4 +- .../worker_context_will_destroy.patch | 18 +-- ...feat_add_hook_to_notify_script_ready.patch | 22 ++-- ..._some_deps_that_do_not_work_on_arm64.patch | 16 +-- patches/v8/add_realloc.patch | 8 +- patches/v8/build_gn.patch | 6 +- ...disallow_copying_cppheapcreateparams.patch | 14 +- patches/v8/dcheck.patch | 4 +- ...export_private_v8_symbols_on_windows.patch | 4 +- ...ort_symbols_needed_for_windows_build.patch | 4 +- patches/v8/expose_mksnapshot.patch | 4 +- ...workaround_an_undefined_symbol_error.patch | 4 +- 63 files changed, 487 insertions(+), 502 deletions(-) diff --git a/patches/boringssl/expose_aes-cfb.patch b/patches/boringssl/expose_aes-cfb.patch index 253dc7267932..9db69edbe398 100644 --- a/patches/boringssl/expose_aes-cfb.patch +++ b/patches/boringssl/expose_aes-cfb.patch @@ -57,7 +57,7 @@ index 53cb9d2dc8f1962a70dc12b648d27c32be8aca4b..84af06fc56e4aa72d4d48801d7c037ad callback(EVP_aes_192_ctr(), "aes-192-ctr", NULL, arg); callback(EVP_aes_256_ctr(), "aes-256-ctr", NULL, arg); diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h -index c6bec489b51ca2e71b7f81e64a8e59b534e2e91a..512a9003164e65bd4ab896ef75b173dab3a8d1db 100644 +index 3feadea85aa2f60b3c4e2956040cf015a72aa5b1..988f98fb7cdc564cafc4d0d3fe1dd777e278b26e 100644 --- a/include/openssl/cipher.h +++ b/include/openssl/cipher.h @@ -430,6 +430,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void); diff --git a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch index 58b1f5d929bc..80b0cf0f4ba2 100644 --- a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch +++ b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch @@ -10,10 +10,10 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set. This should be upstreamed. diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc -index 5bcbb68864ed193a519b34a37f1e50c29422235a..c33f108158538c49f9d4d27b8fa89852e829c787 100644 +index c6fada5cefbf9ca359be880c5ab747884c7ba4ce..fc4f434c8cb7e231edbf257410f7cc1dab75b0d0 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc -@@ -261,6 +261,10 @@ int GpuMain(const MainFunctionParams& parameters) { +@@ -260,6 +260,10 @@ int GpuMain(const MainFunctionParams& parameters) { // to the GpuProcessHost once the GpuServiceImpl has started. viz::GpuServiceImpl::InstallPreInitializeLogHandler(); @@ -24,7 +24,7 @@ index 5bcbb68864ed193a519b34a37f1e50c29422235a..c33f108158538c49f9d4d27b8fa89852 // We are experiencing what appear to be memory-stomp issues in the GPU // process. These issues seem to be impacting the task executor and listeners // registered to it. Create the task executor on the heap to guard against -@@ -398,7 +402,6 @@ int GpuMain(const MainFunctionParams& parameters) { +@@ -397,7 +401,6 @@ int GpuMain(const MainFunctionParams& parameters) { } #endif diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 3c4f2fb2a837..e0bb10ab6a23 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -10,10 +10,10 @@ DidCreateScriptContext is called, not all JS APIs are available in the context, which can cause some preload scripts to trip. diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index 7d2ebf0d8a14fd89e32e35631428f43aed259c16..8efabb6b7825f6fab019d7f83e185a953bb589f1 100644 +index 68b45e8311053222bda00a43de469d707f566539..aea37e280b490ba29e263403e019454d1bb0bf18 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h -@@ -126,6 +126,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, +@@ -127,6 +127,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, virtual void DidHandleOnloadEvents() {} virtual void DidCreateScriptContext(v8::Local context, int32_t world_id) {} @@ -23,10 +23,10 @@ index 7d2ebf0d8a14fd89e32e35631428f43aed259c16..8efabb6b7825f6fab019d7f83e185a95 int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index f1d33694d94b7a0c8f839b512b7680fc9493e5f2..49b0d9012c43661a4fb4b9b8b8a68c156c7a76b6 100644 +index cddf3397e3149cb6192871dbac94b4914a216220..adac4b9b2b73be64495dbbb858af5402523bb59b 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4543,6 +4543,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, +@@ -4542,6 +4542,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index f1d33694d94b7a0c8f839b512b7680fc9493e5f2..49b0d9012c43661a4fb4b9b8b8a68c15 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index 64d7f76d2b1570ba8a4ad51362ad6932eb50c7cd..0fcd2204f09c512da27632dcbfd366ac330b1f0a 100644 +index bc6ba9e052143dae239248cfbe585249a5e541a0..5dbd5e061009dd4360b54e9f24ec76c6592c5b6f 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -589,6 +589,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -593,6 +593,8 @@ class CONTENT_EXPORT RenderFrameImpl blink::WebLocalFrameClient::LazyLoadBehavior lazy_load_behavior) override; void DidCreateScriptContext(v8::Local context, int world_id) override; @@ -53,10 +53,10 @@ index 64d7f76d2b1570ba8a4ad51362ad6932eb50c7cd..0fcd2204f09c512da27632dcbfd366ac int world_id) override; void DidChangeScrollOffset() override; diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h -index 609eb34fcde080491f9f6a1b10a71daf7c46e11e..e22da080595a7474e1277d5c7526a92461417357 100644 +index ea4b3ed3bacf4b65776f654de49f30825ba38e16..fdb2973d1123a94b0322b3fee874536f7851c05f 100644 --- a/third_party/blink/public/web/web_local_frame_client.h +++ b/third_party/blink/public/web/web_local_frame_client.h -@@ -567,6 +567,9 @@ class BLINK_EXPORT WebLocalFrameClient { +@@ -566,6 +566,9 @@ class BLINK_EXPORT WebLocalFrameClient { virtual void DidCreateScriptContext(v8::Local, int32_t world_id) {} @@ -79,10 +79,10 @@ index be5cf4457cd379d5abc119d209d2df6520ad1022..8a0baac5bb8cb403324fb8156be62b92 if (World().IsMainWorld()) { GetFrame()->Loader().DispatchDidClearWindowObjectInMainWorld(); diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h -index 9a526ac4808171693146870909e058f41fe56a50..a15e379ee951504fd77b27af61b318d266274b3d 100644 +index 59bae1425ae816c727ea8da5b15ef171b8947520..d748d8cae61c7523568d7855bd7677abff9638e8 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client.h +++ b/third_party/blink/renderer/core/frame/local_frame_client.h -@@ -294,6 +294,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient { +@@ -295,6 +295,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient { virtual void DidCreateScriptContext(v8::Local, int32_t world_id) = 0; @@ -92,10 +92,10 @@ index 9a526ac4808171693146870909e058f41fe56a50..a15e379ee951504fd77b27af61b318d2 int32_t world_id) = 0; virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index e7e9fa3faf605bea1bf90d31d699c5b2c5510502..03fdd09c6dc23f21f7f52ccf30ee8202e304f355 100644 +index ef047d63ce4d1b72f85f1ddceeef44e80719c102..74a9c38e4cbe900f1c2da21d7357da3bafec7175 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -@@ -273,6 +273,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( +@@ -274,6 +274,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( web_frame_->Client()->DidCreateScriptContext(context, world_id); } @@ -110,7 +110,7 @@ index e7e9fa3faf605bea1bf90d31d699c5b2c5510502..03fdd09c6dc23f21f7f52ccf30ee8202 v8::Local context, int32_t world_id) { diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h -index 28d83f87c1582c8df6209f5d0a9aef130f0a4bea..3822c88091dfc803c4c57256e04bbc3946f8a869 100644 +index ef43b90303b7546d1163209cbade473b8cf17091..246ec76f84219390753b72778a18c8e2dec8bfdc 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h @@ -76,6 +76,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient { @@ -123,10 +123,10 @@ index 28d83f87c1582c8df6209f5d0a9aef130f0a4bea..3822c88091dfc803c4c57256e04bbc39 int32_t world_id) override; diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h -index 3e442a5ddf1dd775febd433e2adb4795a3e5edec..22b5d7fbc3f09ea677444adbd8cae2ecd205b037 100644 +index 26520031e93bb4de9b0e12faed1cd67da5660a26..e90550d6f60b8d91701aa1a16524ed28849dda3d 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h -@@ -337,6 +337,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { +@@ -348,6 +348,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { void DidCreateScriptContext(v8::Local, int32_t world_id) override {} diff --git a/patches/chromium/add_realloc.patch b/patches/chromium/add_realloc.patch index b6a1875819a2..7692f2c4ce73 100644 --- a/patches/chromium/add_realloc.patch +++ b/patches/chromium/add_realloc.patch @@ -39,10 +39,10 @@ index 086371af29bd8c7520485125deddca411e8b978b..2c6886ddcc47019be4d552d4fddfc1c3 GIN_EXPORT static ArrayBufferAllocator* SharedInstance(); diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index 056108a5a6f795d3971e1e808bbefe1058e3c512..50965d4f30b6ae233dab18d0a86f520bf1df8b10 100644 +index b7509d4f4a47987ac8f4e2ae3fdcb29d20b3d484..c05209010570867a8c08a60c2b32f853906bd03d 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -@@ -704,6 +704,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { +@@ -699,6 +699,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { return result; } @@ -54,10 +54,10 @@ index 056108a5a6f795d3971e1e808bbefe1058e3c512..50965d4f30b6ae233dab18d0a86f520b if (max_allocation_ != 0 && data) total_allocation_.fetch_sub(size, std::memory_order_relaxed); diff --git a/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc b/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc -index 686806bcafa0939d29bbc6775748a115130feb96..20f7a9a594cf379b2dac6970bc8c02aebc3be360 100644 +index ec217020077613d72eee4b5c408bd5e9eda2ae47..7ab2fa4d00eca9d4896653e29c98654ff75d4306 100644 --- a/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc +++ b/third_party/blink/renderer/core/typed_arrays/array_buffer/array_buffer_contents.cc -@@ -127,6 +127,11 @@ void* ArrayBufferContents::AllocateMemoryOrNull(size_t size, +@@ -149,6 +149,11 @@ void* ArrayBufferContents::AllocateMemoryOrNull(size_t size, return AllocateMemoryWithFlags(size, policy, base::PartitionAllocReturnNull); } diff --git a/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch b/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch index bc0b380e8888..c62965bd034d 100644 --- a/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch +++ b/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch @@ -10,10 +10,10 @@ WebContents, and cancels the authentication if there's no WebContents available, which there isn't in the case of the 'net' module. diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 84ab373ac9472bba739ca98c52b1f97c71169e88..0bcc7e95109fea4ff1b25672ac007b926ae52984 100644 +index cfa9d0c197ca9851f13b088ecae4aba614c7ac55..d93a6ce481630535b75d858e5b7b04e50f81e2f8 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -222,6 +222,26 @@ struct CTPolicy { +@@ -192,6 +192,26 @@ struct CTPolicy { array excluded_legacy_spkis; }; @@ -40,7 +40,7 @@ index 84ab373ac9472bba739ca98c52b1f97c71169e88..0bcc7e95109fea4ff1b25672ac007b92 interface CertVerifierClient { Verify( int32 default_error, -@@ -653,6 +673,8 @@ struct URLLoaderFactoryParams { +@@ -623,6 +643,8 @@ struct URLLoaderFactoryParams { // impact because of the extra process hops, so use should be minimized. pending_remote? header_client; @@ -50,10 +50,10 @@ index 84ab373ac9472bba739ca98c52b1f97c71169e88..0bcc7e95109fea4ff1b25672ac007b92 // cookies) and to shard network resources, like the cache. If set, takes // precedence over ResourceRequest::TrustedParams::IsolationInfo field diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index a6ea05b42fce15d576c029afa086a3007282ee71..14c17ccbc0e184f03c4ca6a9833ae83db386a011 100644 +index ce483753dff0130c5ac20258c0cf7e399c0d1c51..dea741c526f10616c3779f76a6d9cf8aece4210a 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc -@@ -462,6 +462,7 @@ URLLoader::URLLoader( +@@ -463,6 +463,7 @@ URLLoader::URLLoader( base::WeakPtr keepalive_statistics_recorder, base::WeakPtr network_usage_accumulator, mojom::TrustedURLLoaderHeaderClient* url_loader_header_client, @@ -61,7 +61,7 @@ index a6ea05b42fce15d576c029afa086a3007282ee71..14c17ccbc0e184f03c4ca6a9833ae83d mojom::OriginPolicyManager* origin_policy_manager, std::unique_ptr trust_token_helper_factory, const cors::OriginAccessList& origin_access_list, -@@ -529,6 +530,11 @@ URLLoader::URLLoader( +@@ -533,6 +534,11 @@ URLLoader::URLLoader( header_client_.set_disconnect_handler( base::BindOnce(&URLLoader::OnMojoDisconnect, base::Unretained(this))); } @@ -73,42 +73,43 @@ index a6ea05b42fce15d576c029afa086a3007282ee71..14c17ccbc0e184f03c4ca6a9833ae83d if (want_raw_headers_) { options_ |= mojom::kURLLoadOptionSendSSLInfoWithResponse | mojom::kURLLoadOptionSendSSLInfoForCertificateError; -@@ -1187,7 +1193,7 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, +@@ -1189,7 +1195,7 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, // |this| may have been deleted. return; } -- if (!network_context_client_) { -+ if (!network_context_client_ && !auth_client_) { +- if (!auth_cert_observer_) { ++ if (!auth_cert_observer_ && !auth_client_) { OnAuthCredentials(base::nullopt); return; } -@@ -1203,11 +1209,19 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, - if (url_request->response_headers()) - head->headers = url_request->response_headers(); - head->auth_challenge_info = auth_info; -- network_context_client_->OnAuthRequired( -- fetch_window_id_, factory_params_->process_id, render_frame_id_, -- request_id_, url_request_->url(), first_auth_attempt_, auth_info, -- std::move(head), +@@ -1201,10 +1207,21 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, + + DCHECK(!auth_challenge_responder_receiver_.is_bound()); + +- auth_cert_observer_->OnAuthRequired( +- fetch_window_id_, request_id_, url_request_->url(), first_auth_attempt_, +- auth_info, url_request->response_headers(), - auth_challenge_responder_receiver_.BindNewPipeAndPassRemote()); ++ auto head = mojom::URLResponseHead::New(); ++ if (url_request->response_headers()) ++ head->headers = url_request->response_headers(); ++ head->auth_challenge_info = auth_info; + if (auth_client_) { + auth_client_->OnAuthRequired( -+ fetch_window_id_, factory_params_->process_id, render_frame_id_, -+ request_id_, url_request_->url(), first_auth_attempt_, auth_info, -+ std::move(head), ++ fetch_window_id_, request_id_, url_request_->url(), first_auth_attempt_, ++ auth_info, url_request->response_headers(), + auth_challenge_responder_receiver_.BindNewPipeAndPassRemote()); + } else { -+ network_context_client_->OnAuthRequired( -+ fetch_window_id_, factory_params_->process_id, render_frame_id_, -+ request_id_, url_request_->url(), first_auth_attempt_, auth_info, -+ std::move(head), ++ auth_cert_observer_->OnAuthRequired( ++ fetch_window_id_, request_id_, url_request_->url(), first_auth_attempt_, ++ auth_info, url_request->response_headers(), + auth_challenge_responder_receiver_.BindNewPipeAndPassRemote()); + } auth_challenge_responder_receiver_.set_disconnect_handler( base::BindOnce(&URLLoader::DeleteSelf, base::Unretained(this))); diff --git a/services/network/url_loader.h b/services/network/url_loader.h -index e35076146d1b2205c851f815de943eef47bcdbc6..fa2beab3a2358da8a089cee78a4294af81352d2a 100644 +index 21ec3b43cd58c738b281b3d51dde6879bb7619df..7c607c68ec27af31238537fd1943015d72c30a18 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h @@ -130,6 +130,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader @@ -119,7 +120,7 @@ index e35076146d1b2205c851f815de943eef47bcdbc6..fa2beab3a2358da8a089cee78a4294af mojom::OriginPolicyManager* origin_policy_manager, std::unique_ptr trust_token_helper_factory, -@@ -497,6 +498,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader +@@ -500,6 +501,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader base::Optional fetch_window_id_; mojo::Remote header_client_; @@ -128,7 +129,7 @@ index e35076146d1b2205c851f815de943eef47bcdbc6..fa2beab3a2358da8a089cee78a4294af std::unique_ptr file_opener_for_upload_; diff --git a/services/network/url_loader_factory.cc b/services/network/url_loader_factory.cc -index e72645de2bd9073966e3f220d3663f157d29650e..6b12fb88c25d506494e8d2b8cab950dedf89ce0c 100644 +index af9e13bb4f1fefbda57182069d5d677e23eaed56..5651380c7296eea4a520a0ef4d97ebe1f89ef0e5 100644 --- a/services/network/url_loader_factory.cc +++ b/services/network/url_loader_factory.cc @@ -77,6 +77,7 @@ URLLoaderFactory::URLLoaderFactory( @@ -138,20 +139,20 @@ index e72645de2bd9073966e3f220d3663f157d29650e..6b12fb88c25d506494e8d2b8cab950de + auth_client_(std::move(params_->auth_client)), cors_url_loader_factory_(cors_url_loader_factory), cookie_observer_(std::move(params_->cookie_observer)), - auth_cert_observer_(std::move(params_->auth_cert_observer)) { -@@ -296,6 +297,7 @@ void URLLoaderFactory::CreateLoaderAndStart( + auth_cert_observer_(std::move(params_->auth_cert_observer)), +@@ -305,6 +306,7 @@ void URLLoaderFactory::CreateLoaderAndStart( std::move(keepalive_statistics_recorder), std::move(network_usage_accumulator), header_client_.is_bound() ? header_client_.get() : nullptr, + auth_client_.is_bound() ? auth_client_.get() : nullptr, context_->origin_policy_manager(), std::move(trust_token_factory), context_->cors_origin_access_list(), std::move(cookie_observer), - std::move(auth_cert_observer)); + std::move(auth_cert_observer), std::move(devtools_observer)); diff --git a/services/network/url_loader_factory.h b/services/network/url_loader_factory.h -index 14bf9839d142531e4e7f6dc6a461d97713d435ed..e5bca17b40fad7a553ef1b70fa6c4eacbb3cd1a9 100644 +index 36978ccde84b7575c11035e9efb352b057e3cd1a..f68889501d243cc21b0e58567b63fbc02dd747e8 100644 --- a/services/network/url_loader_factory.h +++ b/services/network/url_loader_factory.h -@@ -74,6 +74,7 @@ class URLLoaderFactory : public mojom::URLLoaderFactory { +@@ -76,6 +76,7 @@ class URLLoaderFactory : public mojom::URLLoaderFactory { scoped_refptr resource_scheduler_client_; mojo::Remote header_client_; mojo::Remote coep_reporter_; diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index c897343b02e5..6d0519157063 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -15,10 +15,10 @@ Refs changes in: This patch reverts the changes to fix associated crashes in Electron. diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc -index 9305b576b06a8020583939f357cd42902302b543..d772a31a436bf8f0617d87b5fcf5bd960bf871d9 100644 +index cc24d583ac920c5d7f0d667b0890fd323c58280a..ae12f5f18eccacf0377511aa8f1f99123168a6a5 100644 --- a/third_party/blink/renderer/core/frame/frame.cc +++ b/third_party/blink/renderer/core/frame/frame.cc -@@ -135,14 +135,6 @@ bool Frame::Detach(FrameDetachType type) { +@@ -117,14 +117,6 @@ bool Frame::Detach(FrameDetachType type) { DCHECK(!IsDetached()); @@ -33,7 +33,7 @@ index 9305b576b06a8020583939f357cd42902302b543..d772a31a436bf8f0617d87b5fcf5bd96 if (type == FrameDetachType::kRemove) { if (provisional_frame_) { provisional_frame_->Detach(FrameDetachType::kRemove); -@@ -165,6 +157,14 @@ bool Frame::Detach(FrameDetachType type) { +@@ -147,6 +139,14 @@ bool Frame::Detach(FrameDetachType type) { GetWindowProxyManager()->ClearForSwap(); } @@ -49,10 +49,10 @@ index 9305b576b06a8020583939f357cd42902302b543..d772a31a436bf8f0617d87b5fcf5bd96 // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 3051ca0d16f64447aecb18e119c84e4a6cce9bac..7584828fda17f6b497ed9a87ff1cd6993aacf569 100644 +index e1353cf55aa63b6ec6bd5470b92269193313a6a7..867e66291ce43cd744269c68f4f7ee90c054c8a3 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -672,10 +672,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -671,10 +671,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { } DCHECK(!view_ || !view_->IsAttached()); @@ -63,7 +63,7 @@ index 3051ca0d16f64447aecb18e119c84e4a6cce9bac..7584828fda17f6b497ed9a87ff1cd699 if (!Client()) return false; -@@ -717,6 +713,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -716,6 +712,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { DCHECK(!view_->IsAttached()); Client()->WillBeDetached(); diff --git a/patches/chromium/blink_world_context.patch b/patches/chromium/blink_world_context.patch index 34875c8f3946..f7a59b180862 100644 --- a/patches/chromium/blink_world_context.patch +++ b/patches/chromium/blink_world_context.patch @@ -7,7 +7,7 @@ This exposes a method for obtaining a reference to an isolated world, which is otherwise not available in the Blink API. diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h -index 3e0f38d60b48817790edeca17c72b06cd07f412f..34133a5a1fcbfea0580683aea7655b7cb7a612d2 100644 +index 9484e7c7944b0f0602d4f230854e45ed716fb884..96325d07de4690ab5ee03c538fd6dccc0cf3de96 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h @@ -368,6 +368,8 @@ class WebLocalFrame : public WebFrame { @@ -20,10 +20,10 @@ index 3e0f38d60b48817790edeca17c72b06cd07f412f..34133a5a1fcbfea0580683aea7655b7c // Executes script in the context of the current page and returns the value // that the script evaluated to with callback. Script execution can be diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index 0513215ab03f4d55cca5144da1b3107343bc5c58..63aa333b5f16e3565b702ab1455736c0df972e17 100644 +index 0a880c510a1901d2c59226df0fa807f55ed2edc0..2fbbe5d1bb7d515dad97b8805448729fe00d4ed1 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -@@ -1038,6 +1038,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { +@@ -1036,6 +1036,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { return MainWorldScriptContext()->Global(); } @@ -38,10 +38,10 @@ index 0513215ab03f4d55cca5144da1b3107343bc5c58..63aa333b5f16e3565b702ab1455736c0 return BindingSecurity::ShouldAllowAccessToFrame( CurrentDOMWindow(V8PerIsolateData::MainThreadIsolate()), diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h -index 49893b427ff1d5f7c7784461c476b903433db980..bc39ee72865f406b93f33f87998a0a3145dbc3bc 100644 +index c0119afcd891087844f6d4d42b0c7d071278d52b..f39db84eea9ae29c039f578cfde7cea201433e23 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h -@@ -165,6 +165,8 @@ class CORE_EXPORT WebLocalFrameImpl final +@@ -166,6 +166,8 @@ class CORE_EXPORT WebLocalFrameImpl final v8::Local MainWorldScriptContext() const override; int32_t GetScriptContextWorldId( v8::Local script_context) const override; diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index c4b767054512..7a0ce3221065 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index b820fbf20860ee9809278053947ea5e32f24131f..f6a51a0d4844bcf8aba6ad19e128a5625f7fe838 100644 +index 7d498c0568cddd3a91ab5b6ee84676e50bf0ef1a..2f8111fda3400b01b29c09d6f3d256aac1e69020 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -5285,6 +5285,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -5287,6 +5287,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index b820fbf20860ee9809278053947ea5e32f24131f..f6a51a0d4844bcf8aba6ad19e128a562 &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 2e461e4a61ff0556960a5448e2aa8ee645f05346..a21877e24ddfdefbccbf3bdafb2132cf244655e8 100644 +index fe4a5571e3ffd587dd8b566f07be41953e220a0a..c36d614a237077e5dedb4450ec51316b0fd2a990 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3610,6 +3610,14 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( +@@ -3619,6 +3619,14 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( } auto* new_contents_impl = new_contents.get(); @@ -39,7 +39,7 @@ index 2e461e4a61ff0556960a5448e2aa8ee645f05346..a21877e24ddfdefbccbf3bdafb2132cf new_contents_impl->GetController().SetSessionStorageNamespace( partition_id, session_storage_namespace); -@@ -3651,12 +3659,6 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( +@@ -3661,12 +3669,6 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -53,10 +53,10 @@ index 2e461e4a61ff0556960a5448e2aa8ee645f05346..a21877e24ddfdefbccbf3bdafb2132cf new_contents_impl, opener, params.target_url, params.referrer.To(), params.disposition, diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index 9cf07bc99472729050b7743b7cd85a92e6af3683..0fd0a88c29ba75633af6201b3e1d498043caaf44 100644 +index 92e4ff63cb65e06a3d6dc8af521691aed7119bfd..23b5a2266433182c494bdd1cf3c0aed01a1d6fa2 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom -@@ -323,6 +323,10 @@ struct CreateNewWindowParams { +@@ -529,6 +529,10 @@ struct CreateNewWindowParams { // The impression associated with the navigation in the new window, if // one is specified. Impression? impression; @@ -68,10 +68,10 @@ index 9cf07bc99472729050b7743b7cd85a92e6af3683..0fd0a88c29ba75633af6201b3e1d4980 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 7433b453ee4a0b5c836a15971c179c555901e8b6..343fc9aa93967500f313809f825ac01122852dfe 100644 +index c8926e0e832d2edabbfda9416ec95bc701776387..523084f820e841bbf8b8fa3974f94a4e938db81b 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -554,6 +554,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -562,6 +562,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -81,10 +81,10 @@ index 7433b453ee4a0b5c836a15971c179c555901e8b6..343fc9aa93967500f313809f825ac011 bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 49da693f8e214ea669257886bdaa6fbfc1f9ddd6..b1f955f30528077ab0aea5a343781b3221113249 100644 +index 3aed911c525b7e100fae096994212c3e7d4ee308..b1c4ad7a48f760d2ba7908c9611b5f894af575d6 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -154,6 +154,7 @@ class NetworkService; +@@ -158,6 +158,7 @@ class NetworkService; class TrustedURLLoaderHeaderClient; } // namespace mojom struct ResourceRequest; @@ -92,7 +92,7 @@ index 49da693f8e214ea669257886bdaa6fbfc1f9ddd6..b1f955f30528077ab0aea5a343781b32 } // namespace network namespace sandbox { -@@ -903,6 +904,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -916,6 +917,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -102,7 +102,7 @@ index 49da693f8e214ea669257886bdaa6fbfc1f9ddd6..b1f955f30528077ab0aea5a343781b32 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 11ff10f2f8a1479f045be6295d7fe7476eb3a28a..bf8e1830f3a394b611e592a1cdfc60c0f8bbcaca 100644 +index 22de0f5ed42f6fd641220e7bc5f20a1c60e107fc..15226ca43d1e1f0e5b89eaecd2029f7be8e802fa 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -27,6 +27,17 @@ namespace content { @@ -124,7 +124,7 @@ index 11ff10f2f8a1479f045be6295d7fe7476eb3a28a..bf8e1830f3a394b611e592a1cdfc60c0 const OpenURLParams& params) { return nullptr; diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 39349ef0c0223f632bddd3b82fd6055344af9fb4..6aba9de130ed9abd81ecc7cae370ed5b5f2fa188 100644 +index e752b5bd6893bc991f9c5628d4b46a6f616ceb5e..d33903b54130cc9deffce09472e9ac2d8329d82d 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -17,6 +17,7 @@ @@ -150,10 +150,10 @@ index 39349ef0c0223f632bddd3b82fd6055344af9fb4..6aba9de130ed9abd81ecc7cae370ed5b // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc -index bf1cf31da503c4ec7dd0348ff8d6ba22f95c66cd..e3536ce02346aa60ef5e1dd36d82ace362a3c022 100644 +index bcc333b8d17ec931db3585407d4cf8b15bf7c236..605f15acc3b6221870e6bb9467d182127f82fe84 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc -@@ -27,6 +27,7 @@ +@@ -28,6 +28,7 @@ #include "third_party/blink/public/platform/impression_conversions.h" #include "third_party/blink/public/platform/modules/video_capture/web_video_capture_impl_manager.h" #include "third_party/blink/public/platform/url_conversion.h" @@ -161,7 +161,7 @@ index bf1cf31da503c4ec7dd0348ff8d6ba22f95c66cd..e3536ce02346aa60ef5e1dd36d82ace3 #include "third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h" #include "third_party/blink/public/web/web_frame_widget.h" #include "third_party/blink/public/web/web_local_frame.h" -@@ -345,6 +346,10 @@ WebView* RenderViewImpl::CreateView( +@@ -344,6 +345,10 @@ WebView* RenderViewImpl::CreateView( params->impression = blink::ConvertWebImpressionToImpression(*impression); } @@ -173,7 +173,7 @@ index bf1cf31da503c4ec7dd0348ff8d6ba22f95c66cd..e3536ce02346aa60ef5e1dd36d82ace3 // moved on send. bool is_background_tab = diff --git a/content/web_test/browser/web_test_content_browser_client.cc b/content/web_test/browser/web_test_content_browser_client.cc -index 03167c25e9b201ea770489179d2e4ff76feceea9..53909672f57e2af2acc58492273e0b2de68c30a9 100644 +index 5b9926d436d85f4019a4311d247f24ca44cde192..e4f8517948ec79c6ceb0571c625cbe80cef1651d 100644 --- a/content/web_test/browser/web_test_content_browser_client.cc +++ b/content/web_test/browser/web_test_content_browser_client.cc @@ -443,6 +443,8 @@ bool WebTestContentBrowserClient::CanCreateWindow( @@ -186,7 +186,7 @@ index 03167c25e9b201ea770489179d2e4ff76feceea9..53909672f57e2af2acc58492273e0b2d bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/web_test/browser/web_test_content_browser_client.h b/content/web_test/browser/web_test_content_browser_client.h -index 08b5a0fd69b2ba2364e90fa66342880e4f284671..8ea32fadf0962ce87de5f107e5c0996684d5d2b7 100644 +index c65d30c9187dd275488ed74bcc3a4eb918d2cbce..e4c6c828150e91f555b1b42e1988a1013ab1a1f0 100644 --- a/content/web_test/browser/web_test_content_browser_client.h +++ b/content/web_test/browser/web_test_content_browser_client.h @@ -83,6 +83,8 @@ class WebTestContentBrowserClient : public ShellContentBrowserClient { @@ -221,10 +221,10 @@ index 4f735ad0d97eaac9a57dad137e479f8a7ec33a36..0a3c5821962c85609b64b3625fa6b8d6 } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 17e2e87e0ceef4c1cfba34ba8f3ee222ac8b4ca1..0d7dc9553c24d67b0ff25fa86260689cfeff5bbe 100644 +index 664fd015bc9e7f36078e131c036b88074d4756a0..cfd8e88a8bb6311002f45ba2b1ce40fa56301e26 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2019,6 +2019,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -2027,6 +2027,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, } WebWindowFeatures window_features = GetWindowFeaturesFromString(features); diff --git a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch index 8e49c48c1625..b16c7c336015 100644 --- a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch +++ b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch @@ -9,7 +9,7 @@ we're running with contextIsolation enabled, we should be falling back to Blink's logic. This will be upstreamed in some form. diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index 50965d4f30b6ae233dab18d0a86f520bf1df8b10..3dfc10c1dafced96a6e61d117aaf2fd039359e62 100644 +index c05209010570867a8c08a60c2b32f853906bd03d..e6f849589acce264df002ff5dd3c37f8aadc8df4 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc @@ -450,7 +450,7 @@ CodeGenerationCheckCallbackInMainThread(v8::Local context, diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 3d3b1f45cbfb..b12ac9cf4292 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -35,7 +35,7 @@ index 5b4d70991e19edcdfee731c56251932bf43e535f..fe1977c5e6ce0f5b30e8be529b9efa51 #endif // CHROME_BROWSER_ANDROID_DOCUMENT_DOCUMENT_WEB_CONTENTS_DELEGATE_H_ diff --git a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc -index 46322975b9eed687569df3f89f6503513caffbcd..f196c0cf671a4969015219478c58c3a175b70832 100644 +index 362b3d7486198109626344e46d29e4446bd00d44..442281b1c7b7f45ffaaa245232975e07fc1edfd9 100644 --- a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc +++ b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc @@ -123,8 +123,7 @@ class DriveWebContentsManager : public content::WebContentsObserver, @@ -126,10 +126,10 @@ index 07014765f33bdddebcc5bc32a2713d6523faf394..f866f69f9c810d89f1a0e9e4952293f6 content::WebContents* source, const content::OpenURLParams& params) override; diff --git a/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc b/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc -index d80b6e5d7112cd5c50d719569e4222ad36a2b124..0e9878873d60948484bff36a6ee895541140a157 100644 +index 33f1168f834d138aefb190b7718271d6962b3532..aeb30a22349e0682586bd1bad20dc5e21fd0b08d 100644 --- a/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc +++ b/chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc -@@ -64,8 +64,7 @@ class ChromeKeyboardContentsDelegate : public content::WebContentsDelegate, +@@ -65,8 +65,7 @@ class ChromeKeyboardContentsDelegate : public content::WebContentsDelegate, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -140,7 +140,7 @@ index d80b6e5d7112cd5c50d719569e4222ad36a2b124..0e9878873d60948484bff36a6ee89554 } diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 5af69ac9d2362bff8a2a1dd854f484f5dc17aa82..42d131060744ab938d07b3f8e78fc38efa1d5878 100644 +index 2f2862c426124556e1109dd243475d8514c814d8..7456a84ea0cf7be69ac8f84140f11c68a429ed6f 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -1762,12 +1762,11 @@ bool Browser::IsWebContentsCreationOverridden( @@ -159,7 +159,7 @@ index 5af69ac9d2362bff8a2a1dd854f484f5dc17aa82..42d131060744ab938d07b3f8e78fc38e WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 1701a29a3170fcc48eb5caa276509562f7869083..adc0d6865b8873870b2b3c76e74aa430a04459be 100644 +index 3a0202c2139b3a6d62f10d9ce965e689dc96bf4a..0e45b455daee1e1ddb8ad3ab263d70db3a7b675d 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -797,8 +797,7 @@ class Browser : public TabStripModelObserver, @@ -264,10 +264,10 @@ index c5c5a7b63b5b3b62a9517cbef3ae23ce57a3c89c..4f1b7e88d6d2ae89a60311c8aeb1fcee void AddNewContents(content::WebContents* source, std::unique_ptr new_contents, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 13bd9fc314ff85ac8ce7876f9f5f8a1507d4c7d3..e137e4e16941a539346cd248a51c872159765d32 100644 +index 6a044db477fc5b20e3ab6e14fda3c21162d112cb..f3884caf2320fb17bed8d84f342b5f8cc3b0b4c1 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3562,8 +3562,7 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( +@@ -3571,8 +3571,7 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( source_site_instance, params.window_container_type, @@ -278,10 +278,10 @@ index 13bd9fc314ff85ac8ce7876f9f5f8a1507d4c7d3..e137e4e16941a539346cd248a51c8721 opener, source_site_instance, is_new_browsing_instance, opener->GetLastCommittedURL(), params.frame_name, params.target_url, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index bf8e1830f3a394b611e592a1cdfc60c0f8bbcaca..12f8b5b86311eef6c9025bb170111a9334bab455 100644 +index 15226ca43d1e1f0e5b89eaecd2029f7be8e802fa..5565c3238ce555e3702b27697babed74394e4d0a 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc -@@ -139,8 +139,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( +@@ -135,8 +135,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -292,7 +292,7 @@ index bf8e1830f3a394b611e592a1cdfc60c0f8bbcaca..12f8b5b86311eef6c9025bb170111a93 } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 6aba9de130ed9abd81ecc7cae370ed5b5f2fa188..d19b7ba1cbb686f72ce6989052e5f91d54a086e6 100644 +index d33903b54130cc9deffce09472e9ac2d8329d82d..dbbf35be27c5e14acca88bcb22598962966375f0 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -316,8 +316,7 @@ class CONTENT_EXPORT WebContentsDelegate { @@ -334,10 +334,10 @@ index 97273c32a05acf325fd0de22c4f79c1746aa23bc..4b357acd069387963347d35d82371b95 content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc -index 8f4c53f3f3cae0efb507b9c8951e5e50883d5dc7..9239b5da0adb3a55c37b41a4b06d2a8ca0b88659 100644 +index e910810ff0de768dba372cbe43c8ee851d5b430b..59813e3162e41db0a7e6e5519a7b42d2f50e4bec 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc -@@ -381,8 +381,7 @@ bool MimeHandlerViewGuest::IsWebContentsCreationOverridden( +@@ -382,8 +382,7 @@ bool MimeHandlerViewGuest::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -348,10 +348,10 @@ index 8f4c53f3f3cae0efb507b9c8951e5e50883d5dc7..9239b5da0adb3a55c37b41a4b06d2a8c } diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h -index d9e22ce31927da93f38f6a5a153222f91580f2c2..e6c8be2ad8175cd4a5b00e69f5072ff359ad862a 100644 +index bdba06b3d493a3ecf6d96ebabc336179b35feada..44e8c6e0e31831c29f8463ded1b640ec6c86b3da 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h -@@ -155,8 +155,7 @@ class MimeHandlerViewGuest +@@ -157,8 +157,7 @@ class MimeHandlerViewGuest content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -362,7 +362,7 @@ index d9e22ce31927da93f38f6a5a153222f91580f2c2..e6c8be2ad8175cd4a5b00e69f5072ff3 content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/fuchsia/engine/browser/frame_impl.cc b/fuchsia/engine/browser/frame_impl.cc -index 4be34546653082c6d479db7bf87d2c84a84e2b5c..a9ec63085731aea19164be50649e701cd5b560f0 100644 +index 781cdcb53ae6bb60f807d3a80293739568ce8f71..a8305998edac476bec47b531be7aa20db1982df2 100644 --- a/fuchsia/engine/browser/frame_impl.cc +++ b/fuchsia/engine/browser/frame_impl.cc @@ -372,8 +372,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( @@ -376,7 +376,7 @@ index 4be34546653082c6d479db7bf87d2c84a84e2b5c..a9ec63085731aea19164be50649e701c // can catch bad client behavior while not interfering with normal operation. constexpr size_t kMaxPendingWebContentsCount = 10; diff --git a/fuchsia/engine/browser/frame_impl.h b/fuchsia/engine/browser/frame_impl.h -index ae33b07dcc38359bef27f043ec6d3d8e498ac2ad..a9854747a113e35ecfef644e824610640dc592de 100644 +index 9bdcbcc9fedf490c93d4765f2ff0e9d664245038..be92c446edec096921e4c61053d8f9f9321c0e78 100644 --- a/fuchsia/engine/browser/frame_impl.h +++ b/fuchsia/engine/browser/frame_impl.h @@ -234,8 +234,7 @@ class FrameImpl : public fuchsia::web::Frame, @@ -404,10 +404,10 @@ index 4fdbf1c7030bb2b3765780d1e8c5a502679745de..5b59ce27eaa03897e5cbb3115b485a3e ->options() ->block_new_web_contents(); diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc -index 39a58363e717a0b9d71b7e3ca26578f81f8fb453..4372cf1e383ef3884048fb2a06c72888abcac9e3 100644 +index d5730f111981ca06835aeec44389920d1d000786..904f4a215cc3e5f7ac0037e05b79a0f4501f951e 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc -@@ -427,8 +427,7 @@ bool WebDialogView::IsWebContentsCreationOverridden( +@@ -431,8 +431,7 @@ bool WebDialogView::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -418,10 +418,10 @@ index 39a58363e717a0b9d71b7e3ca26578f81f8fb453..4372cf1e383ef3884048fb2a06c72888 return delegate_->HandleShouldOverrideWebContentsCreation(); return false; diff --git a/ui/views/controls/webview/web_dialog_view.h b/ui/views/controls/webview/web_dialog_view.h -index 97142bc886e1bbf05871fb6603342ed0cd15dcf8..94206bb4674e696093a5cfc027281254c3bf37ff 100644 +index d4cb57f0f043d48906d75a46873de6bb0108266e..19bb92a54134d18c695c9fa6a090f1be4c9469dd 100644 --- a/ui/views/controls/webview/web_dialog_view.h +++ b/ui/views/controls/webview/web_dialog_view.h -@@ -153,8 +153,7 @@ class WEBVIEW_EXPORT WebDialogView : public ClientView, +@@ -160,8 +160,7 @@ class WEBVIEW_EXPORT WebDialogView : public ClientView, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, diff --git a/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch b/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch index 744aeeada5e8..80389b5250e6 100644 --- a/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch +++ b/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch @@ -7,10 +7,10 @@ spellchecker uses a few IDS_ resources. We need to load these from Electrons grit header instead of Chromes diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 0666cf8912fe0dca6483190f626619a0401d064e..244df419c989f27bda950747ad06cc9c4271c9a7 100644 +index b46c00260b5e9431f6465c8ff8cdddff217ab517..a7f1c10650505e16d89d60a409372b98096544bb 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -6238,6 +6238,7 @@ static_library("browser") { +@@ -6234,6 +6234,7 @@ static_library("browser") { deps += [ "//components/spellcheck/browser", "//components/spellcheck/common", diff --git a/patches/chromium/chrome_key_systems.patch b/patches/chromium/chrome_key_systems.patch index fad186b73409..ea3c39bc9929 100644 --- a/patches/chromium/chrome_key_systems.patch +++ b/patches/chromium/chrome_key_systems.patch @@ -7,7 +7,7 @@ Disable persiste licence support check for widevine cdm, as its not supported in the current version of chrome. diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc -index d0c14fb475f870cd14797c051629e629d197919c..c25f1e3770bb653168b56f877bb92369bc0416b1 100644 +index 31c97e3781818e424001f7f3b1bde6596123dc4b..e146262f3d4533388b8e2866c6008fe9dca5cfc3 100644 --- a/chrome/renderer/media/chrome_key_systems.cc +++ b/chrome/renderer/media/chrome_key_systems.cc @@ -16,7 +16,9 @@ @@ -20,7 +20,7 @@ index d0c14fb475f870cd14797c051629e629d197919c..c25f1e3770bb653168b56f877bb92369 #include "components/cdm/renderer/external_clear_key_key_system_properties.h" #include "components/cdm/renderer/widevine_key_system_properties.h" #include "content/public/renderer/render_thread.h" -@@ -201,12 +203,14 @@ static SupportedCodecs GetSupportedCodecs( +@@ -203,12 +205,14 @@ static SupportedCodecs GetSupportedCodecs( // Returns persistent-license session support. static EmeSessionTypeSupport GetPersistentLicenseSupport( bool supported_by_the_cdm) { diff --git a/patches/chromium/dcheck.patch b/patches/chromium/dcheck.patch index 192017ad7ed4..da77ab582a55 100644 --- a/patches/chromium/dcheck.patch +++ b/patches/chromium/dcheck.patch @@ -17,10 +17,10 @@ only one or two specific checks fail. Then it's better to simply comment out the failing checks and allow the rest of the target to have them enabled. diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc -index 055f4bc95fffd1ccf3dcc9e5f7c20bcc141559eb..9bf5f1fb04ce91659b0f629c1a0d71f661081671 100644 +index 7cd8a4d740413a9d1d4687a7a05e98d432ba58c0..335d5b6f9a296f793a8b5e6ca08b3585d28582fe 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc -@@ -1319,8 +1319,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( +@@ -1326,8 +1326,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( return NAVIGATION_TYPE_NEW_SUBFRAME; } @@ -33,7 +33,7 @@ index 055f4bc95fffd1ccf3dcc9e5f7c20bcc141559eb..9bf5f1fb04ce91659b0f629c1a0d71f6 if (rfh->GetParent()) { // All manual subframes would be did_create_new_entry and handled above, so -@@ -1611,7 +1613,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewEntry( +@@ -1618,7 +1620,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewEntry( new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon(); } @@ -46,10 +46,10 @@ index 055f4bc95fffd1ccf3dcc9e5f7c20bcc141559eb..9bf5f1fb04ce91659b0f629c1a0d71f6 // navigation. Now we know that the renderer has updated its state accordingly // and it is safe to also clear the browser side history. diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc -index 948c1ffcd2cf59326e4149817bd193ba3289bfa8..25921940846bd29988c3e885c18cc254f82f3d74 100644 +index 84071dbb29c4394d9199132c403a416745a9adfa..10e895128ba8f32768e3aa5a2386fc91a02a8771 100644 --- a/ui/base/clipboard/clipboard_win.cc +++ b/ui/base/clipboard/clipboard_win.cc -@@ -823,10 +823,10 @@ SkBitmap ClipboardWin::ReadImageInternal(ClipboardBuffer buffer) const { +@@ -924,10 +924,10 @@ SkBitmap ClipboardWin::ReadImageInternal(ClipboardBuffer buffer) const { void ClipboardWin::WriteToClipboard(ClipboardFormatType format, HANDLE handle) { UINT cf_format = format.ToFormatEtc().cfFormat; diff --git a/patches/chromium/delay_lock_the_protocol_scheme_registry.patch b/patches/chromium/delay_lock_the_protocol_scheme_registry.patch index 098ad44b4747..722d5d453f87 100644 --- a/patches/chromium/delay_lock_the_protocol_scheme_registry.patch +++ b/patches/chromium/delay_lock_the_protocol_scheme_registry.patch @@ -19,10 +19,10 @@ https://chromium-review.googlesource.com/c/chromium/src/+/1901591, we should try re-submitting the patch. diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc -index fc2b90e1f7230049e0e0bb5ff753f1fab0630bd3..33ab8ce6fc56ec6fccaa4588b16c7d37c0e2350c 100644 +index 7873fad0a61ba34a860c1dccd368f1920f5011ee..c4b97ae887f5923c006abdda88aaccd330cfe0ad 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc -@@ -651,7 +651,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { +@@ -721,7 +721,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { } #endif @@ -68,12 +68,12 @@ index 3038f9d25798f36811b6398f8cc0e7d83ecc41b0..68189c36c47ef85b345b0ccc40c456f8 // Re-initializes schemes for tests. CONTENT_EXPORT void ReRegisterContentSchemesForTests(); diff --git a/content/public/app/content_main_delegate.cc b/content/public/app/content_main_delegate.cc -index e6379748886956da819523200aa35f8f95d523ee..46110a92ba9849112889f3e93c1dccbbd4911dda 100644 +index 17d256b852b6e7615cf4e52e4a2d7fa326a4df44..bd0512902df4484e8714cda9ab1352b1c672a1cd 100644 --- a/content/public/app/content_main_delegate.cc +++ b/content/public/app/content_main_delegate.cc -@@ -36,6 +36,10 @@ int ContentMainDelegate::TerminateForFatalInitializationError() { - return 0; +@@ -42,6 +42,10 @@ bool ContentMainDelegate::ShouldHandleConsoleControlEvents() { } + #endif +bool ContentMainDelegate::ShouldLockSchemeRegistry() { + return true; @@ -83,7 +83,7 @@ index e6379748886956da819523200aa35f8f95d523ee..46110a92ba9849112889f3e93c1dccbb return true; } diff --git a/content/public/app/content_main_delegate.h b/content/public/app/content_main_delegate.h -index abb46995385fccddf8363296fb0253624a4111c7..715d0818c03cfa7e5b9877b3ab83d1488f2f040f 100644 +index 4162083f789b6cf5e29e52e4bd498c377cab1a20..d6010bc0e4dba560d10c3ed4729d77b5a60eddcd 100644 --- a/content/public/app/content_main_delegate.h +++ b/content/public/app/content_main_delegate.h @@ -65,6 +65,20 @@ class CONTENT_EXPORT ContentMainDelegate { diff --git a/patches/chromium/desktop_media_list.patch b/patches/chromium/desktop_media_list.patch index f46074ebda15..24edda676860 100644 --- a/patches/chromium/desktop_media_list.patch +++ b/patches/chromium/desktop_media_list.patch @@ -7,10 +7,10 @@ Subject: desktop_media_list.patch * Free the one-time use capturer after thumbnails are fetched diff --git a/chrome/browser/media/webrtc/desktop_media_list.h b/chrome/browser/media/webrtc/desktop_media_list.h -index a489bf6ea2179059f53e53563e993db9c7cd123b..93e237569fe94ec8526f67d915e1a7352d586b16 100644 +index cf7deb678217727e7fe0deed1663b5174164f040..d947051b1cdb36e20a3d9ed29b2172b83eaedf9d 100644 --- a/chrome/browser/media/webrtc/desktop_media_list.h +++ b/chrome/browser/media/webrtc/desktop_media_list.h -@@ -38,6 +38,9 @@ class DesktopMediaList { +@@ -52,6 +52,9 @@ class DesktopMediaList { virtual ~DesktopMediaList() {} @@ -20,21 +20,21 @@ index a489bf6ea2179059f53e53563e993db9c7cd123b..93e237569fe94ec8526f67d915e1a735 // Sets time interval between updates. By default list of sources and their // thumbnail are updated once per second. If called after StartUpdating() then // it will take effect only after the next update. -@@ -69,6 +72,7 @@ class DesktopMediaList { +@@ -83,6 +86,7 @@ class DesktopMediaList { virtual int GetSourceCount() const = 0; virtual const Source& GetSource(int index) const = 0; + virtual const std::vector& GetSources() const = 0; - virtual content::DesktopMediaID::Type GetMediaListType() const = 0; + virtual Type GetMediaListType() const = 0; }; diff --git a/chrome/browser/media/webrtc/desktop_media_list_base.cc b/chrome/browser/media/webrtc/desktop_media_list_base.cc -index 147d5be9f7f56fb71468b56e86eb33b59d51cd66..5930fe95e33a9e5a3108c31e8c34daa9c724511c 100644 +index bce801e2538ec1391e067822f7fda1248cd7c516..4efcf50745b27e66c8f544072993c9bd4490782e 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_base.cc +++ b/chrome/browser/media/webrtc/desktop_media_list_base.cc -@@ -20,6 +20,11 @@ DesktopMediaListBase::DesktopMediaListBase(base::TimeDelta update_period) +@@ -24,6 +24,11 @@ DesktopMediaListBase::DesktopMediaListBase(base::TimeDelta update_period, - DesktopMediaListBase::~DesktopMediaListBase() {} + DesktopMediaListBase::~DesktopMediaListBase() = default; +void DesktopMediaListBase::AddObserver(DesktopMediaListObserver* observer) { + DCHECK(!observer_); @@ -44,7 +44,7 @@ index 147d5be9f7f56fb71468b56e86eb33b59d51cd66..5930fe95e33a9e5a3108c31e8c34daa9 void DesktopMediaListBase::SetUpdatePeriod(base::TimeDelta period) { DCHECK(!observer_); update_period_ = period; -@@ -54,7 +59,7 @@ void DesktopMediaListBase::Update(UpdateCallback callback) { +@@ -58,7 +63,7 @@ void DesktopMediaListBase::Update(UpdateCallback callback) { DCHECK(sources_.empty()); DCHECK(!refresh_callback_); refresh_callback_ = std::move(callback); @@ -53,7 +53,7 @@ index 147d5be9f7f56fb71468b56e86eb33b59d51cd66..5930fe95e33a9e5a3108c31e8c34daa9 } int DesktopMediaListBase::GetSourceCount() const { -@@ -68,6 +73,11 @@ const DesktopMediaList::Source& DesktopMediaListBase::GetSource( +@@ -72,6 +77,11 @@ const DesktopMediaList::Source& DesktopMediaListBase::GetSource( return sources_[index]; } @@ -62,10 +62,10 @@ index 147d5be9f7f56fb71468b56e86eb33b59d51cd66..5930fe95e33a9e5a3108c31e8c34daa9 + return sources_; +} + - DesktopMediaID::Type DesktopMediaListBase::GetMediaListType() const { + DesktopMediaList::Type DesktopMediaListBase::GetMediaListType() const { return type_; } -@@ -79,6 +89,12 @@ DesktopMediaListBase::SourceDescription::SourceDescription( +@@ -83,6 +93,12 @@ DesktopMediaListBase::SourceDescription::SourceDescription( void DesktopMediaListBase::UpdateSourcesList( const std::vector& new_sources) { @@ -79,7 +79,7 @@ index 147d5be9f7f56fb71468b56e86eb33b59d51cd66..5930fe95e33a9e5a3108c31e8c34daa9 SourceSet new_source_set; for (size_t i = 0; i < new_sources.size(); ++i) { diff --git a/chrome/browser/media/webrtc/desktop_media_list_base.h b/chrome/browser/media/webrtc/desktop_media_list_base.h -index 3c09ec3111d54cb4f0b74f16a81292b779009eae..5c3667822afd47a22878b508b844a615c24f3162 100644 +index 0c2b98182a8397d2fb0334ea9619f65222c59467..3340c0060ee7475a8c64de3a1cee9dba24d4a732 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_base.h +++ b/chrome/browser/media/webrtc/desktop_media_list_base.h @@ -27,6 +27,7 @@ class DesktopMediaListBase : public DesktopMediaList { @@ -95,7 +95,7 @@ index 3c09ec3111d54cb4f0b74f16a81292b779009eae..5c3667822afd47a22878b508b844a615 int GetSourceCount() const override; const Source& GetSource(int index) const override; + const std::vector& GetSources() const override; - content::DesktopMediaID::Type GetMediaListType() const override; + DesktopMediaList::Type GetMediaListType() const override; static uint32_t GetImageHash(const gfx::Image& image); diff --git a/chrome/browser/media/webrtc/desktop_media_list_observer.h b/chrome/browser/media/webrtc/desktop_media_list_observer.h @@ -111,7 +111,7 @@ index ad7f766a36b1b6b2a8bc0f96369f1aaadf6681f7..f6c6c14a0937430df62c9b9c1132c591 protected: virtual ~DesktopMediaListObserver() {} diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc -index 63ee95a80309357293afa0684c2a1cec6a3ba105..a0098e9450b48f03b98008e0e81fe48cc2a7b293 100644 +index 8958de11bc10fc50929a552e9a454b6c143d5713..c2d223f527014ecdcccee78194577a31514fc0c9 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc @@ -10,14 +10,15 @@ @@ -131,7 +131,7 @@ index 63ee95a80309357293afa0684c2a1cec6a3ba105..a0098e9450b48f03b98008e0e81fe48c #include "media/base/video_util.h" #include "third_party/libyuv/include/libyuv/scale_argb.h" #include "third_party/skia/include/core/SkBitmap.h" -@@ -257,6 +258,8 @@ void NativeDesktopMediaList::Worker::RefreshNextThumbnail() { +@@ -259,6 +260,8 @@ void NativeDesktopMediaList::Worker::RefreshNextThumbnail() { FROM_HERE, base::BindOnce(&NativeDesktopMediaList::UpdateNativeThumbnailsFinished, media_list_)); diff --git a/patches/chromium/disable_color_correct_rendering.patch b/patches/chromium/disable_color_correct_rendering.patch index 4ac27f6845c1..207b222fab93 100644 --- a/patches/chromium/disable_color_correct_rendering.patch +++ b/patches/chromium/disable_color_correct_rendering.patch @@ -20,10 +20,10 @@ to deal with color spaces. That is being tracked at https://crbug.com/634542 and https://crbug.com/711107. diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc -index 413c765988dcaac6b5788248bd84d9571c3f5a00..8623bee1308ca6ac91931b270eeedc9880db4b5f 100644 +index 711f6264fd94139897a074ff421bef73f61e3975..85d1c9a83c5d62f5ca943c1b5f1ec7426eb14763 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc -@@ -1771,6 +1771,10 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw( +@@ -1785,6 +1785,10 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw( gfx::ColorSpace LayerTreeHostImpl::GetRasterColorSpace( gfx::ContentColorUsage content_color_usage) const { @@ -35,7 +35,7 @@ index 413c765988dcaac6b5788248bd84d9571c3f5a00..8623bee1308ca6ac91931b270eeedc98 // If we are likely to software composite the resource, we use sRGB because diff --git a/cc/trees/layer_tree_settings.h b/cc/trees/layer_tree_settings.h -index 63f087b74b93efe884df3833865e9aa7af912508..eb41d143ed1dd622a362b0f008a725034d6e1a97 100644 +index c02eb016dc3f772ccafcd8099b41a4aca4d8236a..317275b6315253f5f317a09b478b566536522f82 100644 --- a/cc/trees/layer_tree_settings.h +++ b/cc/trees/layer_tree_settings.h @@ -97,6 +97,8 @@ class CC_EXPORT LayerTreeSettings { @@ -81,7 +81,7 @@ index 4dbfd138a467462bae4ff062d9a8062b76ecaa4c..cc7c95bb0f4e6ec6b3579ced90a0f103 !command_line->HasSwitch(switches::kUIDisablePartialSwap); #if defined(OS_APPLE) diff --git a/components/viz/service/display/gl_renderer.cc b/components/viz/service/display/gl_renderer.cc -index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4ec9599b9 100644 +index a0fc635ce92491cc3df706e3e52bd8b0cacb2f15..32c497ca0b40517d70639cb16829a6283363e85a 100644 --- a/components/viz/service/display/gl_renderer.cc +++ b/components/viz/service/display/gl_renderer.cc @@ -88,6 +88,9 @@ @@ -94,7 +94,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 namespace viz { namespace { -@@ -677,8 +680,9 @@ void GLRenderer::DoDrawQuad(const DrawQuad* quad, +@@ -678,8 +681,9 @@ void GLRenderer::DoDrawQuad(const DrawQuad* quad, void GLRenderer::DrawDebugBorderQuad(const DebugBorderDrawQuad* quad) { SetBlendEnabled(quad->ShouldDrawWithBlending()); @@ -106,7 +106,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 // Use the full quad_rect for debug quads to not move the edges based on // partial swaps. -@@ -1664,7 +1668,8 @@ void GLRenderer::ChooseRPDQProgram(DrawRenderPassDrawQuadParams* params, +@@ -1666,7 +1670,8 @@ void GLRenderer::ChooseRPDQProgram(DrawRenderPassDrawQuadParams* params, params->use_color_matrix, tint_gl_composited_content_, params->apply_shader_based_rounded_corner && ShouldApplyRoundedCorner(params->quad)), @@ -116,7 +116,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 } void GLRenderer::UpdateRPDQUniforms(DrawRenderPassDrawQuadParams* params) { -@@ -2137,15 +2142,16 @@ void GLRenderer::DrawSolidColorQuad(const SolidColorDrawQuad* quad, +@@ -2139,15 +2144,16 @@ void GLRenderer::DrawSolidColorQuad(const SolidColorDrawQuad* quad, SetUseProgram(ProgramKey::SolidColor(use_aa ? USE_AA : NO_AA, tint_gl_composited_content_, ShouldApplyRoundedCorner(quad)), @@ -136,7 +136,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 gfx::ColorTransform::TriStim col(color_f.fR, color_f.fG, color_f.fB); color_transform->Transform(&col, 1); color_f.fR = col.x(); -@@ -2367,7 +2373,8 @@ void GLRenderer::DrawContentQuadAA(const ContentDrawQuadBase* quad, +@@ -2369,7 +2375,8 @@ void GLRenderer::DrawContentQuadAA(const ContentDrawQuadBase* quad, : NON_PREMULTIPLIED_ALPHA, false, false, tint_gl_composited_content_, ShouldApplyRoundedCorner(quad)), @@ -146,7 +146,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 if (current_program_->tint_color_matrix_location() != -1) { auto matrix = cc::DebugColors::TintCompositedContentColorTransformMatrix(); -@@ -2466,7 +2473,8 @@ void GLRenderer::DrawContentQuadNoAA(const ContentDrawQuadBase* quad, +@@ -2468,7 +2475,8 @@ void GLRenderer::DrawContentQuadNoAA(const ContentDrawQuadBase* quad, !quad->ShouldDrawWithBlending(), has_tex_clamp_rect, tint_gl_composited_content_, ShouldApplyRoundedCorner(quad)), @@ -156,7 +156,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 if (current_program_->tint_color_matrix_location() != -1) { auto matrix = cc::DebugColors::TintCompositedContentColorTransformMatrix(); -@@ -2576,7 +2584,8 @@ void GLRenderer::DrawYUVVideoQuad(const YUVVideoDrawQuad* quad, +@@ -2578,7 +2586,8 @@ void GLRenderer::DrawYUVVideoQuad(const YUVVideoDrawQuad* quad, // The source color space should never be RGB. DCHECK_NE(src_color_space, src_color_space.GetAsFullRangeRGB()); @@ -166,7 +166,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 #if defined(OS_WIN) // Force sRGB output on Windows for overlay candidate video quads to match -@@ -2756,7 +2765,8 @@ void GLRenderer::DrawStreamVideoQuad(const StreamVideoDrawQuad* quad, +@@ -2759,7 +2768,8 @@ void GLRenderer::DrawStreamVideoQuad(const StreamVideoDrawQuad* quad, SetUseProgram(ProgramKey::VideoStream(tex_coord_precision, ShouldApplyRoundedCorner(quad)), @@ -176,7 +176,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); gl_->BindTexture(GL_TEXTURE_EXTERNAL_OES, lock.texture_id()); -@@ -2827,8 +2837,8 @@ void GLRenderer::FlushTextureQuadCache(BoundGeometry flush_binding) { +@@ -2830,8 +2840,8 @@ void GLRenderer::FlushTextureQuadCache(BoundGeometry flush_binding) { draw_cache_.nearest_neighbor ? GL_NEAREST : GL_LINEAR); // Bind the program to the GL state. @@ -187,7 +187,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 /*adjust_src_white_level=*/draw_cache_.is_video_frame); if (current_program_->rounded_corner_rect_location() != -1) { -@@ -3655,7 +3665,9 @@ void GLRenderer::SetUseProgram(const ProgramKey& program_key_no_color, +@@ -3659,7 +3669,9 @@ void GLRenderer::SetUseProgram(const ProgramKey& program_key_no_color, const gfx::ColorSpace& src_color_space, const gfx::ColorSpace& dst_color_space, bool adjust_src_white_level) { @@ -198,7 +198,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 gfx::ColorSpace adjusted_src_color_space = src_color_space; if (adjust_src_white_level) { // If the input color space is HDR, and it did not specify a white level, -@@ -4035,9 +4047,9 @@ void GLRenderer::CopyRenderPassDrawQuadToOverlayResource( +@@ -4037,9 +4049,9 @@ void GLRenderer::CopyRenderPassDrawQuadToOverlayResource( cc::MathUtil::CheckedRoundUp(iosurface_height, iosurface_multiple); } @@ -211,7 +211,7 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 *new_bounds = gfx::RectF(updated_dst_rect.origin(), gfx::SizeF((*overlay_texture)->texture.size())); -@@ -4257,8 +4269,8 @@ void GLRenderer::FlushOverdrawFeedback(const gfx::Rect& output_rect) { +@@ -4259,8 +4271,8 @@ void GLRenderer::FlushOverdrawFeedback(const gfx::Rect& output_rect) { PrepareGeometry(SHARED_BINDING); @@ -222,14 +222,14 @@ index ca43fd244812f22242aafb3abcf5d74fe1d145ad..2e577e69472998d8ff6859bd925b72a4 gfx::Transform render_matrix; render_matrix.Translate(0.5 * output_rect.width() + output_rect.x(), -@@ -4448,3 +4460,5 @@ GLRenderer::OverlayTexture::OverlayTexture() = default; +@@ -4450,3 +4462,5 @@ GLRenderer::OverlayTexture::OverlayTexture() = default; GLRenderer::OverlayTexture::~OverlayTexture() = default; } // namespace viz + +#undef PATCH_CS diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc -index 01d39c67a40567f49d8bd90e00c11034028c4895..2d30ca0c184453467ddf8415b5081c22d404af3e 100644 +index 80ab092b8480b90210c55a6f630485b7cce51d88..2435a17e914867db1583a24d410b45007043c2a1 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -223,6 +223,7 @@ GpuTerminationStatus ConvertToGpuTerminationStatus( @@ -241,10 +241,10 @@ index 01d39c67a40567f49d8bd90e00c11034028c4895..2d30ca0c184453467ddf8415b5081c22 sandbox::policy::switches::kGpuSandboxAllowSysVShm, sandbox::policy::switches::kGpuSandboxFailuresFatal, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index cddd153328e3e1e4154aa61e9786b3eaef3f4a05..a8885dffd9c78567f0052e490d17b427e03a74fb 100644 +index 1b93f610a23c1e1c1ec5a90bfcc9958ec06aad65..8d5f60f36ff4cd92722458049d41836522e90262 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -218,6 +218,7 @@ +@@ -213,6 +213,7 @@ #include "ui/accessibility/accessibility_switches.h" #include "ui/base/ui_base_switches.h" #include "ui/display/display_switches.h" @@ -252,7 +252,7 @@ index cddd153328e3e1e4154aa61e9786b3eaef3f4a05..a8885dffd9c78567f0052e490d17b427 #include "ui/gl/gl_switches.h" #include "ui/native_theme/native_theme_features.h" #include "url/origin.h" -@@ -3240,6 +3241,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( +@@ -3220,6 +3221,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( // Propagate the following switches to the renderer command line (along // with any associated values) if present in the browser command line. static const char* const kSwitchNames[] = { diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index 332d82177bdd..e2df42239ec5 100644 --- a/patches/chromium/disable_compositor_recycling.patch +++ b/patches/chromium/disable_compositor_recycling.patch @@ -6,10 +6,10 @@ Subject: fix: disabling compositor recycling Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index bfa99980776b9aa216644ea146fbb1d1a085a85d..7ab2cd43c5383a778261998bd433f37d312f6966 100644 +index 7d2426379b8c7b72b735ab936c529596e46dd9d1..c834d63e13136734bf6ad2ada60b3d75ceeb52a0 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -476,7 +476,11 @@ +@@ -487,7 +487,11 @@ return; host()->WasHidden(); diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 3298be03fdbb..960ba28f0d7d 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,10 +6,10 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index a0e730813c10f3fbb662590d81fb467ba32c3747..c50126455356bbe34b3f126b652aa098d2e0758c 100644 +index 75d7780ab829ec817d8f956fc1cef3d161849179..c4db072350e60db8323e9d275a28222ac9d18b3e 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -734,6 +734,9 @@ void RenderWidgetHostImpl::WasHidden() { +@@ -709,6 +709,9 @@ void RenderWidgetHostImpl::WasHidden() { if (is_hidden_) return; @@ -20,12 +20,12 @@ index a0e730813c10f3fbb662590d81fb467ba32c3747..c50126455356bbe34b3f126b652aa098 blink::mojom::PointerLockResult::kWrongDocument); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index 4ecd272b7fe070d0ae7a34faf1f5d007e1cf078a..1929617dcc595b5aca9ed5e981be684302f8da1f 100644 +index 25b10d1d867a7d4052e0daba7b83f62e4e522638..1d7a6bf0994b6529a42b3db505cd28fd33fe579a 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -826,6 +826,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl - - base::Optional LastComputedVisualProperties() const; +@@ -834,6 +834,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl + mojom::CreateFrameWidgetParamsPtr + BindAndGenerateCreateFrameWidgetParamsForNewWindow(); + // Electron: Prevents the widget from getting hidden. + bool disable_hidden_ = false; @@ -34,10 +34,10 @@ index 4ecd272b7fe070d0ae7a34faf1f5d007e1cf078a..1929617dcc595b5aca9ed5e981be6843 // |routing_id| must not be MSG_ROUTING_NONE. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index ea9d026a80b3b26eeb9adde81ebb03b5dfcb1535..ff813b3dfcc793f000ca4438eb3ba6eedfe50220 100644 +index 351e15aeabf320951681646251a04802cda79bde..60263de834e57311ba1e506f6a3eed104a550792 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -595,7 +595,7 @@ void RenderWidgetHostViewAura::HideImpl() { +@@ -597,7 +597,7 @@ void RenderWidgetHostViewAura::HideImpl() { DCHECK(visibility_ == Visibility::HIDDEN || visibility_ == Visibility::OCCLUDED); diff --git a/patches/chromium/disable_unload_metrics.patch b/patches/chromium/disable_unload_metrics.patch index d059ce8c8cf1..4da0e2dd54eb 100644 --- a/patches/chromium/disable_unload_metrics.patch +++ b/patches/chromium/disable_unload_metrics.patch @@ -24,10 +24,10 @@ This patch temporarily disables the metrics so we can have green CI, and we should continue seeking for a real fix. diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc -index 6013468ed431d43d635840a8a157f763a4647711..1747d257a2bdd9230e387d931fb45a4d71f4532f 100644 +index 5894c68f14fd3b4a843055e418d8521f526a4c48..bffb4b73103e68632e56d4fd5cc106e2828f84c1 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc -@@ -1058,6 +1058,7 @@ void Navigator::RecordNavigationMetrics( +@@ -1025,6 +1025,7 @@ void Navigator::RecordNavigationMetrics( .InMilliseconds()); } @@ -35,7 +35,7 @@ index 6013468ed431d43d635840a8a157f763a4647711..1747d257a2bdd9230e387d931fb45a4d // If this is a same-process navigation and we have timestamps for unload // durations, fill those metrics out as well. if (params.unload_start && params.unload_end && -@@ -1104,6 +1105,7 @@ void Navigator::RecordNavigationMetrics( +@@ -1071,6 +1072,7 @@ void Navigator::RecordNavigationMetrics( first_before_unload_start_time) .InMilliseconds()); } diff --git a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch index b91708b69a7a..cfb3761803a5 100644 --- a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch +++ b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch @@ -11,7 +11,7 @@ This regressed in https://chromium-review.googlesource.com/c/chromium/src/+/2572 Upstream: https://chromium-review.googlesource.com/c/chromium/src/+/2598393 diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index db038990188455fc645c3c769a71e01af1ad3f0b..992086aa121623cd59ffa6f768559fd57e3f97d2 100644 +index d497f3aac9bee9d5738bc50b5650dc2142870e2a..44e234fb8d4332f0f4d5966a141561c283c6626b 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -2643,7 +2643,7 @@ blink::WebLocalFrame* RenderFrameImpl::GetWebFrame() { diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index 7486e4bec982..e79e3a986a06 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -6,10 +6,10 @@ Subject: feat: enable setting aspect ratio to 0 Make SetAspectRatio accept 0 as valid input, which would reset to null. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 31db3cdbfad4d97b3cd9aa3bd884ea4e1dc6e564..5787a24deaefd177ddc0ed1b2f897b36a2f84d64 100644 +index 7476de34aa6ecf7759492e871db82a35bf1a2288..896de263c09b0c0b74f4be472d5d1ce9a3854429 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -484,7 +484,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { +@@ -483,7 +483,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { } void DesktopWindowTreeHostWin::SetAspectRatio(const gfx::SizeF& aspect_ratio) { diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index 061806427fdd..f9f69d0f10df 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,10 +33,10 @@ index 0ccfe130f00ec3b6c75cd8ee04d5a2777e1fd00c..653829457d58bf92057cc36aa8a28970 DISALLOW_COPY_AND_ASSIGN(StaticHttpUserAgentSettings); }; diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 67986e284434115debf6a638b62c9585ac207c1d..ef64b8ab03b39066e1332cb6859c0012dc86e551 100644 +index d39671bacc738e9185632bdebac31191d1a0c159..2465a053da8f95c3f643a908bbfe06143fa7d78d 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc -@@ -1128,6 +1128,13 @@ void NetworkContext::SetNetworkConditions( +@@ -1158,6 +1158,13 @@ void NetworkContext::SetNetworkConditions( std::move(network_conditions)); } @@ -51,10 +51,10 @@ index 67986e284434115debf6a638b62c9585ac207c1d..ef64b8ab03b39066e1332cb6859c0012 // This may only be called on NetworkContexts created with the constructor // that calls MakeURLRequestContext(). diff --git a/services/network/network_context.h b/services/network/network_context.h -index 34281acc5a2dece3b84666b25f4af423a04bf8df..c4198cc21721f6c88074a1144618022a59689541 100644 +index 23bbc41ddfee63dacd622a1aa3cf750682501c76..68888f46623667f00ac6b6f1f7fb7d33965333a0 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h -@@ -251,6 +251,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -254,6 +254,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext void CloseIdleConnections(CloseIdleConnectionsCallback callback) override; void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id, mojom::NetworkConditionsPtr conditions) override; @@ -63,10 +63,10 @@ index 34281acc5a2dece3b84666b25f4af423a04bf8df..c4198cc21721f6c88074a1144618022a void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CHROMEOS_ASH) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index efe52249cbbcfed616d3190714ef037bdbde1621..84ab373ac9472bba739ca98c52b1f97c71169e88 100644 +index b1e73dc3250bb8402d4becfd673fd9aa54ecd7fb..cfa9d0c197ca9851f13b088ecae4aba614c7ac55 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1083,6 +1083,9 @@ interface NetworkContext { +@@ -964,6 +964,9 @@ interface NetworkContext { SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id, NetworkConditions? conditions); @@ -77,10 +77,10 @@ index efe52249cbbcfed616d3190714ef037bdbde1621..84ab373ac9472bba739ca98c52b1f97c SetAcceptLanguage(string new_accept_language); diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index e3f7acf5e828287f47eb3ba0d048a026a53f8a08..1d7bc55a002313ae8bc7e61c453f7aa113d35d8a 100644 +index feecbe157692fe205d176e3782b24c17b85f4e18..2bd5713a46616231a5af19a5357bfbd851105582 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h -@@ -114,6 +114,7 @@ class TestNetworkContext : public mojom::NetworkContext { +@@ -117,6 +117,7 @@ class TestNetworkContext : public mojom::NetworkContext { void CloseIdleConnections(CloseIdleConnectionsCallback callback) override {} void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id, mojom::NetworkConditionsPtr conditions) override {} diff --git a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch index a10a08da9433..e6275ac018a3 100644 --- a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch +++ b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch @@ -13,11 +13,11 @@ uses internally for things like menus and devtools. We can remove this patch once it has in some shape been upstreamed. diff --git a/ui/native_theme/native_theme.cc b/ui/native_theme/native_theme.cc -index 6f9221b95d5609d6bc3395bd3a3c81670877fdd0..bd4cd7cf50ea7f8816b35b3150bea8c459571231 100644 +index 2855ee596225d70f2ef7027073406f2c9f60ea62..7cff1321dc8af524db12be4ca0777ed049c2f918 100644 --- a/ui/native_theme/native_theme.cc +++ b/ui/native_theme/native_theme.cc -@@ -257,6 +257,8 @@ NativeTheme::NativeTheme(bool should_use_dark_colors) - NativeTheme::~NativeTheme() = default; +@@ -268,6 +268,8 @@ base::Optional NativeTheme::GetColorProviderColor( + } bool NativeTheme::ShouldUseDarkColors() const { + if (theme_source() == ThemeSource::kForcedLight) return false; @@ -26,10 +26,10 @@ index 6f9221b95d5609d6bc3395bd3a3c81670877fdd0..bd4cd7cf50ea7f8816b35b3150bea8c4 } diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h -index 20943ab98c28b2689d3e4f548dba95ad0e40b2da..a9364d386d42315e1fca52e4eb316569d3c7a9e0 100644 +index c0f051e820b134b003f23d8d7bc93024cf76d3d1..6b4c5e82797f383230b60772ff4b2fb462252d59 100644 --- a/ui/native_theme/native_theme.h +++ b/ui/native_theme/native_theme.h -@@ -402,6 +402,22 @@ class NATIVE_THEME_EXPORT NativeTheme { +@@ -397,6 +397,22 @@ class NATIVE_THEME_EXPORT NativeTheme { ColorId color_id, ColorScheme color_scheme = ColorScheme::kDefault) const; @@ -52,7 +52,7 @@ index 20943ab98c28b2689d3e4f548dba95ad0e40b2da..a9364d386d42315e1fca52e4eb316569 // Returns a shared instance of the native theme that should be used for web // rendering. Do not use it in a normal application context (i.e. browser). // The returned object should not be deleted by the caller. This function is -@@ -552,6 +568,7 @@ class NATIVE_THEME_EXPORT NativeTheme { +@@ -551,6 +567,7 @@ class NATIVE_THEME_EXPORT NativeTheme { bool forced_colors_ = false; PreferredColorScheme preferred_color_scheme_ = PreferredColorScheme::kLight; PreferredContrast preferred_contrast_ = PreferredContrast::kNoPreference; @@ -61,10 +61,10 @@ index 20943ab98c28b2689d3e4f548dba95ad0e40b2da..a9364d386d42315e1fca52e4eb316569 DISALLOW_COPY_AND_ASSIGN(NativeTheme); }; diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc -index f4dff8de98066ea0ee4fb30ce832b27707791743..3d8c850111c0bbcd724c752e5b717ee46cfd5852 100644 +index e3962d04553dcdf27bbb878f39a47e279dc4959f..9c2b87278dc090da48082483aee331202a56ecc2 100644 --- a/ui/native_theme/native_theme_win.cc +++ b/ui/native_theme/native_theme_win.cc -@@ -741,6 +741,8 @@ bool NativeThemeWin::ShouldUseDarkColors() const { +@@ -740,6 +740,8 @@ bool NativeThemeWin::ShouldUseDarkColors() const { // ...unless --force-dark-mode was specified in which case caveat emptor. if (InForcedColorsMode() && !IsForcedDarkMode()) return false; diff --git a/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch index 27d62b13f0b3..9393f60338c7 100644 --- a/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -6,10 +6,10 @@ Subject: feat: allow disabling blink scheduler throttling per RenderView This allows us to disable throttling for hidden windows. diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc -index 8d3e54fc773b1de7083e0630bac39c211973cd17..7acb88e44627804e356ffec3a3f3e6c06437d606 100644 +index 517ee0e43e83da558964ae00b9c80219e5978ea2..c8e05b7e97b15170a7f3d41a673ec16a630d8feb 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc -@@ -581,6 +581,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { +@@ -601,6 +601,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque); } @@ -22,10 +22,10 @@ index 8d3e54fc773b1de7083e0630bac39c211973cd17..7acb88e44627804e356ffec3a3f3e6c0 return is_active(); } diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h -index 9ac4773bb3600395b7e360b7c42aeb5e240607fc..cf7515a7c36cc394c37f851dd8c1371ebfeaa844 100644 +index 1af9066790af8f8b32186313e5c620908260e0eb..ab87e44fbaba1ad5d9cdaa00ee567b2ab414b2bf 100644 --- a/content/browser/renderer_host/render_view_host_impl.h +++ b/content/browser/renderer_host/render_view_host_impl.h -@@ -132,6 +132,7 @@ class CONTENT_EXPORT RenderViewHostImpl +@@ -133,6 +133,7 @@ class CONTENT_EXPORT RenderViewHostImpl RenderViewHostDelegate* GetDelegate() override; bool IsRenderViewLive() override; @@ -85,10 +85,10 @@ index e8212d4566666683d67590ef0fe11e452d71b6fc..b19500d4af881c795e84baff16e9973e // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index a730ed9b13fc355542b7520b66fa015ac7ca58c4..fb994344ea53e17df84f176ad7d8722793b72cfd 100644 +index 51dc16be3019edba22bfcd0c735f49337574dd59..87e81332dc8f81772facd93bae7ffd3f967b64cd 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -3516,6 +3516,13 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -3524,6 +3524,13 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -102,7 +102,7 @@ index a730ed9b13fc355542b7520b66fa015ac7ca58c4..fb994344ea53e17df84f176ad7d87227 void WebViewImpl::SetVisibilityState( mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) { -@@ -3528,7 +3535,8 @@ void WebViewImpl::SetVisibilityState( +@@ -3536,7 +3543,8 @@ void WebViewImpl::SetVisibilityState( } GetPage()->SetVisibilityState(visibility_state, is_initial_state); GetPage()->GetPageScheduler()->SetPageVisible( @@ -113,10 +113,10 @@ index a730ed9b13fc355542b7520b66fa015ac7ca58c4..fb994344ea53e17df84f176ad7d87227 mojom::blink::PageVisibilityState WebViewImpl::GetVisibilityState() { diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index a76b09c9226e45742847fbeac18bab6d8b7b7b7e..f1f878e483c9f7185c621cd803ac4855cb5e2067 100644 +index 297d3e515abe14dec4909d94117ba64f91e43b44..8d7c16f677c63aea437d16ed1d5e35bfd82608fc 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h -@@ -368,6 +368,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -369,6 +369,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, LocalDOMWindow* PagePopupWindow() const; PageScheduler* Scheduler() const override; @@ -124,7 +124,7 @@ index a76b09c9226e45742847fbeac18bab6d8b7b7b7e..f1f878e483c9f7185c621cd803ac4855 void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) override; mojom::blink::PageVisibilityState GetVisibilityState() override; -@@ -764,11 +765,18 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -765,11 +766,18 @@ class CORE_EXPORT WebViewImpl final : public WebView, SkColor background_color_override_ = Color::kTransparent; float zoom_factor_override_ = 0.f; diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index fbf67aae9960..b6c892c2ffd3 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -81,7 +81,7 @@ index 1026b739d283f0fc252fa2af83a6d4cf51bc8553..fe562ab60ce98b8bb0c5080a6428deb3 private: const HWND hwnd_; diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index 85a18008a1344ab7c76d8df1338f8c7ab12850f8..3cc6f722fb63d47535fb91cfc2b1362c3328df2a 100644 +index 8985715274291f6e847a5188bf30339e60f07aa3..00322d1fd7d94f2091aca5460644e122374e5c19 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn @@ -129,6 +129,8 @@ viz_component("service") { @@ -497,7 +497,7 @@ index 2bb30e5318b6b48c2e6d4b1f64a6a36c68f963d1..9e805f27a9d7d1c0aa68cdf9f48895c0 waiting_on_draw_ack_ = true; diff --git a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc -index 8112abf9ca0bf214721f5996bb59f7458d9347d2..8b3c2a4cce0c4789fadd555b360dea2c145ae1a4 100644 +index c33992f7428957aa1e3cc0e919bba2ed577d9e5a..670baa641b14866d03db4cec0c718c724b0b7583 100644 --- a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc +++ b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc @@ -46,7 +46,8 @@ RootCompositorFrameSinkImpl::Create( @@ -544,7 +544,7 @@ index 0c9686f3c8070000bf5b180d9c06a8817d430c4a..4538b95f6e71708144eb7752438b1b31 // Notifies that a swap has occurred and provides information about the pixel diff --git a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom -index a0b87925e0c9d02f586cc4e9446cbfcf12b7aa1c..71659834eec5237016f95f93defa9dcb30f0af52 100644 +index 427017cc9c38cbcaae4009e5dd62946a11f40d57..4cbbf3416cfd8f2f53c590e00b89d1fdf09c8811 100644 --- a/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom +++ b/services/viz/privileged/mojom/compositing/frame_sink_manager.mojom @@ -30,6 +30,7 @@ struct RootCompositorFrameSinkParams { @@ -567,10 +567,10 @@ index 6b7fbb6cf13dc8ee6ade0878a9a2c1efc5d4d3f1..e2af75168cb914a7b3b4a6c9b6a28549 + Draw(gfx.mojom.Rect damage_rect) => (); }; diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h -index e1db8f745c077b2f57b39a48aeab434fe0e98541..ddafd1f2aa38ef30776fa89ffcf5d108be963ac9 100644 +index e4ff4cb0a2ec2ba5e469edc10e03abadb5bd660d..a4c55d9ca78168e23cad5ff6c0456f257acd8b8f 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h -@@ -77,6 +77,7 @@ class ExternalBeginFrameController; +@@ -78,6 +78,7 @@ class ExternalBeginFrameController; class DelegatedInkPointRenderer; } // namespace mojom class ContextProvider; @@ -578,7 +578,7 @@ index e1db8f745c077b2f57b39a48aeab434fe0e98541..ddafd1f2aa38ef30776fa89ffcf5d108 class HostFrameSinkManager; class LocalSurfaceId; class RasterContextProvider; -@@ -133,6 +134,16 @@ class COMPOSITOR_EXPORT ContextFactory { +@@ -134,6 +135,16 @@ class COMPOSITOR_EXPORT ContextFactory { virtual viz::HostFrameSinkManager* GetHostFrameSinkManager() = 0; }; @@ -595,7 +595,7 @@ index e1db8f745c077b2f57b39a48aeab434fe0e98541..ddafd1f2aa38ef30776fa89ffcf5d108 // Compositor object to take care of GPU painting. // A Browser compositor object is responsible for generating the final // displayable form of pixels comprising a single widget's contents. It draws an -@@ -167,6 +178,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -169,6 +180,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -605,7 +605,7 @@ index e1db8f745c077b2f57b39a48aeab434fe0e98541..ddafd1f2aa38ef30776fa89ffcf5d108 // Sets the root of the layer tree drawn by this Compositor. The root layer // must have no parent. The compositor's root layer is reset if the root layer // is destroyed. NULL can be passed to reset the root layer, in which case the -@@ -435,6 +449,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -440,6 +454,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, std::unique_ptr pending_begin_frame_args_; diff --git a/patches/chromium/fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch b/patches/chromium/fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch index 3260a967c23d..73ca81b3536c 100644 --- a/patches/chromium/fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch +++ b/patches/chromium/fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch @@ -7,10 +7,10 @@ Subject: Disable usage of pthread_fchdir_np and pthread_chdir_np in MAS builds. diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc -index d3396d984086717e69d99cff3107ab09506b2b02..237e310b12eb9814f7da9103cf61d69e423b2920 100644 +index a0dfda42bd4bc3249e35c40fbe335fa22d007ded..d8d1ee58130fd9d75404aecc00196cc141b20d52 100644 --- a/base/process/launch_mac.cc +++ b/base/process/launch_mac.cc -@@ -27,8 +27,10 @@ extern "C" { +@@ -28,8 +28,10 @@ extern "C" { // descriptor. libpthread only exposes a syscall wrapper starting in // macOS 10.12, but the system call dates back to macOS 10.5. On older OSes, // the syscall is issued directly. @@ -21,7 +21,7 @@ index d3396d984086717e69d99cff3107ab09506b2b02..237e310b12eb9814f7da9103cf61d69e int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim) API_AVAILABLE(macosx(10.14)); -@@ -96,21 +98,29 @@ class PosixSpawnFileActions { +@@ -97,21 +99,29 @@ class PosixSpawnFileActions { }; int ChangeCurrentThreadDirectory(const char* path) { @@ -51,7 +51,7 @@ index d3396d984086717e69d99cff3107ab09506b2b02..237e310b12eb9814f7da9103cf61d69e } struct GetAppOutputOptions { -@@ -230,11 +240,13 @@ Process LaunchProcess(const std::vector& argv, +@@ -231,11 +241,13 @@ Process LaunchProcess(const std::vector& argv, file_actions.Inherit(STDERR_FILENO); } diff --git a/patches/chromium/fix_patch_out_profile_refs_in_accessibility_ui.patch b/patches/chromium/fix_patch_out_profile_refs_in_accessibility_ui.patch index 67d94b94526f..aa08ad6f3a1e 100644 --- a/patches/chromium/fix_patch_out_profile_refs_in_accessibility_ui.patch +++ b/patches/chromium/fix_patch_out_profile_refs_in_accessibility_ui.patch @@ -7,7 +7,7 @@ This tweaks Chrome's Accessibility support at chrome://accessibility to make it usable from Electron by removing Profile references. diff --git a/chrome/browser/accessibility/accessibility_ui.cc b/chrome/browser/accessibility/accessibility_ui.cc -index 4453990236f07a58932f50701f31fab961d0fb9e..6193689e879f5e147ca1e6514fb2061423d31400 100644 +index eed11ee2d85b655073f3e5c704a5d5349a935cb6..c36379a17d564ea96de8172fbdf057f0d85b66fc 100644 --- a/chrome/browser/accessibility/accessibility_ui.cc +++ b/chrome/browser/accessibility/accessibility_ui.cc @@ -20,7 +20,10 @@ @@ -97,7 +97,7 @@ index 4453990236f07a58932f50701f31fab961d0fb9e..6193689e879f5e147ca1e6514fb20614 return; } -@@ -615,10 +622,12 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree( +@@ -614,10 +621,12 @@ void AccessibilityUIMessageHandler::RequestWebContentsTree( AXPropertyFilter::ALLOW_EMPTY); AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY); @@ -111,7 +111,7 @@ index 4453990236f07a58932f50701f31fab961d0fb9e..6193689e879f5e147ca1e6514fb20614 result->SetString(kTreeField, accessibility_contents); FireWebUIListener(request_type, *(result.get())); } -@@ -642,6 +651,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( +@@ -641,6 +650,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( AXPropertyFilter::ALLOW_EMPTY); AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY); @@ -119,7 +119,7 @@ index 4453990236f07a58932f50701f31fab961d0fb9e..6193689e879f5e147ca1e6514fb20614 for (Browser* browser : *BrowserList::GetInstance()) { if (browser->session_id().id() == session_id) { std::unique_ptr result( -@@ -656,6 +666,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( +@@ -655,6 +665,7 @@ void AccessibilityUIMessageHandler::RequestNativeUITree( return; } } @@ -127,7 +127,7 @@ index 4453990236f07a58932f50701f31fab961d0fb9e..6193689e879f5e147ca1e6514fb20614 #endif // !defined(OS_ANDROID) // No browser with the specified |session_id| was found. std::unique_ptr result(new base::DictionaryValue()); -@@ -771,5 +782,7 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents( +@@ -770,5 +781,7 @@ void AccessibilityUIMessageHandler::RequestAccessibilityEvents( // static void AccessibilityUIMessageHandler::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { diff --git a/patches/chromium/fix_properly_honor_printing_page_ranges.patch b/patches/chromium/fix_properly_honor_printing_page_ranges.patch index c61dfd566221..9c5b30c454d5 100644 --- a/patches/chromium/fix_properly_honor_printing_page_ranges.patch +++ b/patches/chromium/fix_properly_honor_printing_page_ranges.patch @@ -100,7 +100,7 @@ index fe7fc797504dcc7097a3d79a2dab2c18de737048..20c63b1f657f2969850b31eaafdff7e5 } else { // No need to bother, we don't know how many pages are available. diff --git a/ui/gtk/printing/print_dialog_gtk.cc b/ui/gtk/printing/print_dialog_gtk.cc -index f2ed36e1258f4f3ef1bfce972e215e3d5d7335b6..5b38bf1369a68546f0aeea8948abba995c65e7f7 100644 +index 01c9a6967203f0340f87390653476d4cd89fbd1f..deb9a72a9385cef416ed65eeb237e67239252d69 100644 --- a/ui/gtk/printing/print_dialog_gtk.cc +++ b/ui/gtk/printing/print_dialog_gtk.cc @@ -239,6 +239,24 @@ void PrintDialogGtk::UpdateSettings( diff --git a/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch b/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch index 6b4ddb323575..682b81e6fc5c 100644 --- a/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch +++ b/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch @@ -13,10 +13,10 @@ This patch can be removed once app.allowRendererProcessReuse is forced to true as then Chromiums assumptions around processes become correct. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 5c06f5d680357028cffa00f3dfdc17ff02a4a560..cefe0bab7ab42c8b0697cb64fc687545251f7410 100644 +index 0945a202580d6eba49e48d68921f2624fe481b43..a8482b0db04ccdcabad001f51d8d9c85091b856d 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3026,11 +3026,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { +@@ -3037,11 +3037,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { WebContentsImpl* outermost = GetOutermostWebContents(); if (event.button == blink::WebPointerProperties::Button::kBack && outermost->GetController().CanGoBack()) { diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 53e59e7c357f..07af633c8b00 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -8,7 +8,7 @@ and respond with custom instance. Also allows for us to at-runtime enable or disable this patch. diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc -index 2fdd2b3f3f8dcc14a2675b1c115d7b700a33c2e0..9f20f0f37890af424aba566f88653e6142d944eb 100644 +index b21dc7ca8847378ca87df6dd1a76ff79fbbf0a07..b118ec64382a725a7ef29de617d657f1bf436189 100644 --- a/content/browser/browsing_instance.cc +++ b/content/browser/browsing_instance.cc @@ -77,6 +77,13 @@ scoped_refptr BrowsingInstance::GetSiteInstanceForURL( @@ -42,10 +42,10 @@ index 65e627f2fa89352b0be27b5813d71a622bf1d326..113f4fd00f1cf994b39f64c9da387855 // another SiteInstance for the same site. void RegisterSiteInstance(SiteInstanceImpl* site_instance); diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 7bd420257285961e5cd6f7b2367e251dbec97749..13a291fb52a4b588257522fbcf6bafb330f94ed2 100644 +index c105cc7532d121c7bfb8c15d9be28288405ad81a..6614b1b70952ef6773d1f33e872f89c18827c00d 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -1538,6 +1538,21 @@ void NavigationRequest::BeginNavigation() { +@@ -1559,6 +1559,21 @@ void NavigationRequest::BeginNavigation() { if (IsSameDocument()) { render_frame_host_ = frame_tree_node_->current_frame_host(); } else { @@ -67,7 +67,7 @@ index 7bd420257285961e5cd6f7b2367e251dbec97749..13a291fb52a4b588257522fbcf6bafb3 // Select an appropriate RenderFrameHost. std::string frame_host_choice_reason; render_frame_host_ = -@@ -5574,6 +5589,7 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { +@@ -5663,6 +5678,7 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { {WILL_START_REQUEST, { WILL_REDIRECT_REQUEST, WILL_PROCESS_RESPONSE, @@ -75,7 +75,7 @@ index 7bd420257285961e5cd6f7b2367e251dbec97749..13a291fb52a4b588257522fbcf6bafb3 READY_TO_COMMIT, DID_COMMIT, CANCELING, -@@ -5587,10 +5603,14 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { +@@ -5676,10 +5692,14 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { WILL_FAIL_REQUEST, }}, {WILL_PROCESS_RESPONSE, { @@ -91,10 +91,10 @@ index 7bd420257285961e5cd6f7b2367e251dbec97749..13a291fb52a4b588257522fbcf6bafb3 NOT_STARTED, DID_COMMIT, diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h -index 5dbfedddef3b345844863db6444e9d23ea2c5fe8..d7307760c29af9f902c7385b5c77c061860542ba 100644 +index e40cd2050e330accefa14eb5153999e41f5e0186..3504430c9efda71e95f3e76e9d5de35c8f66c149 100644 --- a/content/browser/renderer_host/navigation_request.h +++ b/content/browser/renderer_host/navigation_request.h -@@ -133,6 +133,10 @@ class CONTENT_EXPORT NavigationRequest +@@ -136,6 +136,10 @@ class CONTENT_EXPORT NavigationRequest // asynchronous. WILL_PROCESS_RESPONSE, @@ -106,10 +106,10 @@ index 5dbfedddef3b345844863db6444e9d23ea2c5fe8..d7307760c29af9f902c7385b5c77c061 READY_TO_COMMIT, diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index 8c15970fce8516a96aab3c4c23c62cd56ad2516a..31665aeb08b5b7c68e3cc8168d209ba12f7869ee 100644 +index b0027728189403cf76371f9f7d6a4f614374f64a..0d2bdb0f06c26c093e1030590cfcbfca903deafe 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -2758,6 +2758,16 @@ scoped_refptr +@@ -2738,6 +2738,16 @@ scoped_refptr RenderFrameHostManager::GetSiteInstanceForNavigationRequest( NavigationRequest* request, std::string* reason) { @@ -126,7 +126,7 @@ index 8c15970fce8516a96aab3c4c23c62cd56ad2516a..31665aeb08b5b7c68e3cc8168d209ba1 SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); // All children of MHTML documents must be MHTML documents. They all live in -@@ -2785,10 +2795,59 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -2765,10 +2775,59 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( // // TODO(clamy): We should also consider as a candidate SiteInstance the // speculative SiteInstance that was computed on redirects. @@ -190,7 +190,7 @@ index 8c15970fce8516a96aab3c4c23c62cd56ad2516a..31665aeb08b5b7c68e3cc8168d209ba1 // Account for renderer-initiated reload as well. // Needed as a workaround for https://crbug.com/1045524, remove it when it is -@@ -2828,6 +2887,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -2801,6 +2860,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } @@ -201,10 +201,10 @@ index 8c15970fce8516a96aab3c4c23c62cd56ad2516a..31665aeb08b5b7c68e3cc8168d209ba1 } diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc -index 5dc7e7e2a1a9809f71fd115c240d736e09553314..55bdf011d7af564096e2f453faaf580172887878 100644 +index c4e4bfa4546c4dcc4c9d2ccd36bbfb4a5ca9c615..9c0e3cd87dfdd7bfe11d8d0afb1995e76a0bc187 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc -@@ -792,6 +792,10 @@ bool SiteInstanceImpl::HasRelatedSiteInstance(const SiteInfo& site_info) { +@@ -1003,6 +1003,10 @@ bool SiteInstanceImpl::HasRelatedSiteInstance(const SiteInfo& site_info) { return browsing_instance_->HasSiteInstance(site_info); } @@ -216,10 +216,10 @@ index 5dc7e7e2a1a9809f71fd115c240d736e09553314..55bdf011d7af564096e2f453faaf5801 const GURL& url) { return GetRelatedSiteInstanceImpl( diff --git a/content/browser/site_instance_impl.h b/content/browser/site_instance_impl.h -index 6aae4093ee732480f711a210fea0873a5e7ac77a..cb11fa9e3a425377ebc39067be69563047003d21 100644 +index 7a09d84c4b94a2d66d7efcb02cd9ad88b10bec29..9b12afc7d031c6763b17d970d9edec265e5b2431 100644 --- a/content/browser/site_instance_impl.h +++ b/content/browser/site_instance_impl.h -@@ -335,6 +335,7 @@ class CONTENT_EXPORT SiteInstanceImpl final : public SiteInstance, +@@ -401,6 +401,7 @@ class CONTENT_EXPORT SiteInstanceImpl final : public SiteInstance, BrowserContext* GetBrowserContext() override; const GURL& GetSiteURL() override; scoped_refptr GetRelatedSiteInstance(const GURL& url) override; @@ -228,10 +228,10 @@ index 6aae4093ee732480f711a210fea0873a5e7ac77a..cb11fa9e3a425377ebc39067be695630 size_t GetRelatedActiveContentsCount() override; bool RequiresDedicatedProcess() override; diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 343fc9aa93967500f313809f825ac01122852dfe..f7fa2a7fcf14a049f1cfa29bd86d335a3cb044c9 100644 +index 523084f820e841bbf8b8fa3974f94a4e938db81b..89344011112bde895c206e2c650d14c4567cff64 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -66,6 +66,21 @@ +@@ -69,6 +69,21 @@ namespace content { @@ -254,12 +254,12 @@ index 343fc9aa93967500f313809f825ac01122852dfe..f7fa2a7fcf14a049f1cfa29bd86d335a const MainFunctionParams& parameters) { return nullptr; diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index b1f955f30528077ab0aea5a343781b3221113249..2f828109553a26b91270d84d320e988a3793a822 100644 +index b1c4ad7a48f760d2ba7908c9611b5f894af575d6..373093da3974d774dad68b4172bca7d9cb22b71d 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -254,8 +254,45 @@ class CONTENT_EXPORT ContentBrowserClient { - using IsClipboardPasteAllowedCallback = - base::OnceCallback; +@@ -257,8 +257,45 @@ class CONTENT_EXPORT ContentBrowserClient { + using IsClipboardPasteContentAllowedCallback = + base::OnceCallback; + // Identifies the type of site instance to use for a navigation. + enum SiteInstanceForNavigationType { @@ -304,7 +304,7 @@ index b1f955f30528077ab0aea5a343781b3221113249..2f828109553a26b91270d84d320e988a // implementations for the browser startup code. See comments in // browser_main_parts.h. diff --git a/content/public/browser/site_instance.h b/content/public/browser/site_instance.h -index a721f2fbab6e621085a8c7806abd92b8077340a8..e9b936e05e1d6ac8ea6eb5eb4d412b37ae4acc86 100644 +index 25502c2f733b63618ca4960501228a62dd181a64..c7234855bfd176cb334a296a8b19fd10a4052a3d 100644 --- a/content/public/browser/site_instance.h +++ b/content/public/browser/site_instance.h @@ -135,6 +135,11 @@ class CONTENT_EXPORT SiteInstance : public base::RefCounted { diff --git a/patches/chromium/gpu_notify_when_dxdiag_request_fails.patch b/patches/chromium/gpu_notify_when_dxdiag_request_fails.patch index ef16444b356a..059b64d4852b 100644 --- a/patches/chromium/gpu_notify_when_dxdiag_request_fails.patch +++ b/patches/chromium/gpu_notify_when_dxdiag_request_fails.patch @@ -40,10 +40,10 @@ index 23bd3c93795488055a4db2d81c22d7fdb18b0092..5c23468ec6289f331fd4aabdb844fcb8 // Update the GPU feature info. This updates the blocklist and enabled status // of GPU rasterization. In the future this will be used for more features. diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc -index bb38974278df53fab6f91bfce1a94b3a686beced..957a464f86940441d70b012351d6f6d82bae284f 100644 +index 8546a5b6accf1e848a6ef31bbd1e9049a165e2a2..eca11c451cb7e23412ae0942a558cd188d173951 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc -@@ -1073,6 +1073,11 @@ void GpuDataManagerImplPrivate::TerminateInfoCollectionGpuProcess() { +@@ -1075,6 +1075,11 @@ void GpuDataManagerImplPrivate::TerminateInfoCollectionGpuProcess() { host->ForceShutdown(); } diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index 5ed849b53d51..5f2a5fac1bd8 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index 6d19ae8a5a125b28d2228408383ccbed9496f10f..407f779d5ca671a065e60c166486cfc6fd912713 100644 +index 915758d60d73ad915fbac47e2057882c7827fbd3..247ac45694d77460d7d17b213f1c6419ece8a460 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -723,6 +723,11 @@ +@@ -733,6 +733,11 @@ "includes": [3880], }, diff --git a/patches/chromium/gtk_visibility.patch b/patches/chromium/gtk_visibility.patch index 6ee108df05d8..d36a23c120fd 100644 --- a/patches/chromium/gtk_visibility.patch +++ b/patches/chromium/gtk_visibility.patch @@ -6,10 +6,10 @@ Subject: gtk_visibility.patch Allow electron to depend on GTK in the GN build. diff --git a/build/config/linux/gtk/BUILD.gn b/build/config/linux/gtk/BUILD.gn -index 5491aef735fc277521acbff97c1484fa81ef9ba4..8ff2728d1843e6d436aa2c59a6b991f2f257e864 100644 +index 150276479687782e9902af2c5435c3cea9df5295..42a4f685d75f7b20082e506331507bfe0b3044bd 100644 --- a/build/config/linux/gtk/BUILD.gn +++ b/build/config/linux/gtk/BUILD.gn -@@ -29,6 +29,8 @@ group("gtk") { +@@ -35,6 +35,8 @@ group("gtk") { # This should probably be moved into //ui/gtk. "//ui/ozone/platform/wayland", diff --git a/patches/chromium/mas_disable_remote_accessibility.patch b/patches/chromium/mas_disable_remote_accessibility.patch index a55009516f1d..9a8605bd3f47 100644 --- a/patches/chromium/mas_disable_remote_accessibility.patch +++ b/patches/chromium/mas_disable_remote_accessibility.patch @@ -47,7 +47,7 @@ index 9ddda9116e7284cbccde8a51e23ad7560dd06367..e846091ad99b0154636489e53491209f } // namespace diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm -index d2b88549b3005cf5fe43fc57c35403696c94ba80..f14d779670711f5aa4a46ac310bc94082cef7d7f 100644 +index 93db386ed8e7fa0d0f21c25d861b44bb1ba9f0c5..0969062960b4435970617a75ed2219e9028c507a 100644 --- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm @@ -550,10 +550,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { @@ -90,7 +90,7 @@ index c3a9fbf0f9d2b80c1de42a22ad094a286f0b559b..02493d4b62c98a3aebd3e460c459218a DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostNSViewBridgeOwner); }; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h -index 055d28d8c6f6cc6826db1f888b1ea0f535c3c716..1eedb217a700ffdc73d30c5daadf003d1cec7bed 100644 +index 9997e703d7c2b7c9a35a598b0c5b9d42cfa6769c..f78e3493abcae70f1ebf6ed4fa54b0feea358f30 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -46,7 +46,9 @@ class ScopedPasswordInputEnabler; @@ -103,7 +103,7 @@ index 055d28d8c6f6cc6826db1f888b1ea0f535c3c716..1eedb217a700ffdc73d30c5daadf003d @class RenderWidgetHostViewCocoa; namespace content { -@@ -640,10 +642,12 @@ class CONTENT_EXPORT RenderWidgetHostViewMac +@@ -643,10 +645,12 @@ class CONTENT_EXPORT RenderWidgetHostViewMac // EnsureSurfaceSynchronizedForWebTest(). uint32_t latest_capture_sequence_number_ = 0u; @@ -117,10 +117,10 @@ index 055d28d8c6f6cc6826db1f888b1ea0f535c3c716..1eedb217a700ffdc73d30c5daadf003d // Used to force the NSApplication's focused accessibility element to be the // content::BrowserAccessibilityCocoa accessibility tree when the NSView for diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 2b1574aa1669b0b5c9e7a38aba3f0345602bc440..bfa99980776b9aa216644ea146fbb1d1a085a85d 100644 +index 44a682e8b37d452fe39a6d1830ce33da693c4031..7d2426379b8c7b72b735ab936c529596e46dd9d1 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm -@@ -234,8 +234,10 @@ +@@ -236,8 +236,10 @@ void RenderWidgetHostViewMac::MigrateNSViewBridge( remote_cocoa::mojom::Application* remote_cocoa_application, uint64_t parent_ns_view_id) { @@ -131,7 +131,7 @@ index 2b1574aa1669b0b5c9e7a38aba3f0345602bc440..bfa99980776b9aa216644ea146fbb1d1 // Disconnect from the previous bridge (this will have the effect of // destroying the associated bridge), and close the receiver (to allow it -@@ -1383,8 +1385,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1395,8 +1397,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, gfx::NativeViewAccessible RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() { @@ -142,7 +142,7 @@ index 2b1574aa1669b0b5c9e7a38aba3f0345602bc440..bfa99980776b9aa216644ea146fbb1d1 return [GetInProcessNSView() window]; } -@@ -1416,9 +1420,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1428,9 +1432,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, } void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) { @@ -154,7 +154,7 @@ index 2b1574aa1669b0b5c9e7a38aba3f0345602bc440..bfa99980776b9aa216644ea146fbb1d1 } bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame( -@@ -1906,12 +1912,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, +@@ -1918,12 +1924,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback, void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken( const std::vector& window_token) { @@ -170,10 +170,10 @@ index 2b1574aa1669b0b5c9e7a38aba3f0345602bc440..bfa99980776b9aa216644ea146fbb1d1 /////////////////////////////////////////////////////////////////////////////// diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 8987ed3c59a3b482cae14f2cce71a6febfd41a73..dc646e919475198d332004d59cde25d2a3044988 100644 +index 6868f3ce6c48bce32c58a386640b0fe6ede91688..91518596912208fb086215f62570608869f48bc0 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn -@@ -314,6 +314,13 @@ component("base") { +@@ -317,6 +317,13 @@ component("base") { ] } @@ -208,10 +208,10 @@ index e7adfee3210ec723c687adfcc4bee8827ef643e7..25a924a47eeb30d783ef83dbb4896c4b + #endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_ diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h -index 492386c61ac6701fc38c5e90976b4e5f638189de..6050916081ebeb426ee6cf5dd67962f0961a1a94 100644 +index 6d218f9e38f4ea6c109aa1a7256bdb37a76056b3..0bbe5a8e6c217405cf45717c0777bed65f28b182 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.h +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h -@@ -29,7 +29,9 @@ +@@ -30,7 +30,9 @@ #include "ui/views/window/dialog_observer.h" @class NativeWidgetMacNSWindow; @@ -221,7 +221,7 @@ index 492386c61ac6701fc38c5e90976b4e5f638189de..6050916081ebeb426ee6cf5dd67962f0 @class NSView; namespace remote_cocoa { -@@ -408,11 +410,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost +@@ -409,11 +411,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost mojo::AssociatedRemote remote_ns_window_remote_; @@ -236,7 +236,7 @@ index 492386c61ac6701fc38c5e90976b4e5f638189de..6050916081ebeb426ee6cf5dd67962f0 // Used to force the NSApplication's focused accessibility element to be the // views::Views accessibility tree when the NSView for this is focused. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index d0be0e2ff2d9477376514ed2e6fd648a9dad94ec..e9d7b4b0a1aa036b4f000cc979c45d7a5a557617 100644 +index c2a1dc7a9ff9887a1eb72b6a0905c41bd9def353..e3a7bdb35324d91f9e9d05ad1835480cdf8463a2 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -284,14 +284,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator, @@ -262,7 +262,7 @@ index d0be0e2ff2d9477376514ed2e6fd648a9dad94ec..e9d7b4b0a1aa036b4f000cc979c45d7a } remote_cocoa::mojom::NativeWidgetNSWindow* -@@ -1133,6 +1141,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1145,6 +1153,7 @@ void HandleAccelerator(const ui::Accelerator& accelerator, void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens( const std::vector& window_token, const std::vector& view_token) { @@ -270,7 +270,7 @@ index d0be0e2ff2d9477376514ed2e6fd648a9dad94ec..e9d7b4b0a1aa036b4f000cc979c45d7a remote_window_accessible_ = ui::RemoteAccessibility::GetRemoteElementFromToken(window_token); remote_view_accessible_ = -@@ -1140,14 +1149,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator, +@@ -1152,14 +1161,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator, [remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()]; [remote_view_accessible_ setTopLevelUIElement:remote_window_accessible_.get()]; diff --git a/patches/chromium/mas_no_private_api.patch b/patches/chromium/mas_no_private_api.patch index 5c8ed2f47af3..0855a8c715d8 100644 --- a/patches/chromium/mas_no_private_api.patch +++ b/patches/chromium/mas_no_private_api.patch @@ -7,7 +7,7 @@ Guard usages in blink of private Mac APIs by MAS_BUILD, so they can be excluded for people who want to submit their apps to the Mac App store. diff --git a/content/browser/accessibility/accessibility_tree_formatter_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_mac.mm -index fa612b156034ca30446ccec5ec82098eafdf13a3..c6c06d1d62aee91a15827f30bf07b256e4d76c4e 100644 +index f0824ada891710245f5ff8278f27613165a5f6bf..b4a70a2cfc41957846d26bdeb586bf086cd315ca 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_mac.mm +++ b/content/browser/accessibility/accessibility_tree_formatter_mac.mm @@ -238,7 +238,7 @@ @@ -18,7 +18,7 @@ index fa612b156034ca30446ccec5ec82098eafdf13a3..c6c06d1d62aee91a15827f30bf07b256 +#ifndef MAS_BUILD // AXTextMarker if (content::IsAXTextMarker(value)) { - return PopulateTextPosition(content::AXTextMarkerToPosition(value).get(), + return PopulateTextPosition(content::AXTextMarkerToAXPosition(value), @@ -249,6 +249,7 @@ if (content::IsAXTextMarkerRange(value)) { return PopulateTextMarkerRange(value, line_indexer); @@ -27,17 +27,17 @@ index fa612b156034ca30446ccec5ec82098eafdf13a3..c6c06d1d62aee91a15827f30bf07b256 // AXValue if (CFGetTypeID(value) == AXValueGetTypeID()) { -@@ -359,7 +360,7 @@ +@@ -361,7 +362,7 @@ kConstValuePrefix + affinity); return set; } - +#ifndef MAS_BUILD base::Value AccessibilityTreeFormatterMac::PopulateTextMarkerRange( - id object, + id marker_range, const LineIndexer* line_indexer) const { -@@ -373,7 +374,7 @@ - dict.SetPath("focus", PopulateTextPosition(range.focus(), line_indexer)); +@@ -377,7 +378,7 @@ + PopulateTextPosition(ax_range.focus()->Clone(), line_indexer)); return dict; } - @@ -46,7 +46,7 @@ index fa612b156034ca30446ccec5ec82098eafdf13a3..c6c06d1d62aee91a15827f30bf07b256 NSArray* node_array, const LineIndexer* line_indexer) const { diff --git a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm -index 955a1c85425016cf13b2447cbf1aec9607a135c6..18a2de387cb09e24ff599dd556cef0fcf6777a0a 100644 +index 88f339d1669436db9c1e4d048a46fc28038c83fe..2e194c5174c24552eb684faa339ad92b640d9dd7 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm +++ b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm @@ -234,6 +234,7 @@ @@ -73,19 +73,19 @@ index 955a1c85425016cf13b2447cbf1aec9607a135c6..18a2de387cb09e24ff599dd556cef0fc id AttributeInvoker::DictNodeToTextMarker( const AXPropertyNode& dictnode) const { if (!dictnode.IsDict()) { -@@ -410,6 +413,7 @@ OptionalNSObject TextMarkerRangeGetEndMarker(const OptionalNSObject& obj) { +@@ -413,6 +416,7 @@ OptionalNSObject TextMarkerRangeGetEndMarker(const OptionalNSObject& obj) { return OptionalNSObject::NotNilOrError(content::AXTextMarkerFrom( - cocoa_node, position->text_offset(), position->affinity())); + cocoa_node, range.focus()->text_offset(), range.focus()->affinity())); } +#endif OptionalNSObject MakePairArray(const OptionalNSObject& obj1, const OptionalNSObject& obj2) { diff --git a/content/browser/accessibility/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h -index 33a689c23c72b1d18d0fceb595a4a45cf2790454..808eaf45096fbeb5d4bd62448c64078cccd13701 100644 +index a6493f1c466fcfbc9253e68fecac7c86ec69f075..d7bfd4847e99da466e9e2b5fae46f0b89220ad55 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.h +++ b/content/browser/accessibility/browser_accessibility_cocoa.h -@@ -147,7 +147,9 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker); +@@ -151,7 +151,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); @property(nonatomic, readonly) NSNumber* enabled; // Returns a text marker that points to the last character in the document that // can be selected with Voiceover. @@ -95,7 +95,7 @@ index 33a689c23c72b1d18d0fceb595a4a45cf2790454..808eaf45096fbeb5d4bd62448c64078c @property(nonatomic, readonly) NSNumber* expanded; @property(nonatomic, readonly) NSNumber* focused; @property(nonatomic, readonly) NSNumber* grabbed; -@@ -159,7 +161,9 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker); +@@ -163,7 +165,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); // Index of a row, column, or tree item. @property(nonatomic, readonly) NSNumber* index; @property(nonatomic, readonly) NSNumber* treeItemRowIndex; @@ -105,7 +105,7 @@ index 33a689c23c72b1d18d0fceb595a4a45cf2790454..808eaf45096fbeb5d4bd62448c64078c @property(nonatomic, readonly) NSString* invalid; @property(nonatomic, readonly) NSNumber* isMultiSelectable; @property(nonatomic, readonly) NSString* placeholderValue; -@@ -182,14 +186,18 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker); +@@ -186,14 +190,18 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); // The object is selected as a whole. @property(nonatomic, readonly) NSNumber* selected; @property(nonatomic, readonly) NSArray* selectedChildren; @@ -125,10 +125,10 @@ index 33a689c23c72b1d18d0fceb595a4a45cf2790454..808eaf45096fbeb5d4bd62448c64078c // is concerned. @property(nonatomic, readonly) NSString* subrole; diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm -index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21ca82a926 100644 +index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3c339e31f 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.mm +++ b/content/browser/accessibility/browser_accessibility_cocoa.mm -@@ -209,6 +209,7 @@ +@@ -202,6 +202,7 @@ NSString* const NSAccessibilityLengthForTextMarkerRangeParameterizedAttribute = @"AXLengthForTextMarkerRange"; @@ -136,7 +136,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 // Private attributes that can be used for testing text markers, e.g. in dump // tree tests. NSString* const -@@ -220,6 +221,7 @@ +@@ -213,6 +214,7 @@ NSString* const NSAccessibilityTextMarkerNodeDebugDescriptionParameterizedAttribute = @"AXTextMarkerNodeDebugDescription"; @@ -144,7 +144,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 // Other private attributes. NSString* const NSAccessibilityIdentifierChromeAttribute = @"ChromeAXNodeId"; -@@ -244,6 +246,7 @@ +@@ -237,6 +239,7 @@ // VoiceOver uses -1 to mean "no limit" for AXResultsLimit. const int kAXResultsLimitNoLimit = -1; @@ -152,7 +152,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 extern "C" { // The following are private accessibility APIs required for cursor navigation -@@ -467,6 +470,7 @@ void AddMisspelledTextAttributes(const AXPlatformRange& ax_range, +@@ -472,6 +475,7 @@ void AddMisspelledTextAttributes(const BrowserAccessibility::AXRange& ax_range, AddMisspelledTextAttributes(ax_range, attributed_text); return attributed_text; } @@ -160,7 +160,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 // Returns an autoreleased copy of the AXNodeData's attribute. NSString* NSStringForStringAttribute(BrowserAccessibility* browserAccessibility, -@@ -738,6 +742,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) { +@@ -743,6 +747,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) { #define NSAccessibilityLanguageAttribute @"AXLanguage" #endif @@ -168,7 +168,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 bool content::IsAXTextMarker(id object) { if (object == nil) return false; -@@ -781,6 +786,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) { +@@ -786,6 +791,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) { kCFAllocatorDefault, anchor_textmarker, focus_textmarker); return [static_cast(cf_marker_range) autorelease]; } @@ -176,7 +176,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 @implementation BrowserAccessibilityCocoa -@@ -820,7 +826,9 @@ + (void)initialize { +@@ -825,7 +831,9 @@ + (void)initialize { {NSAccessibilityEditableAncestorAttribute, @"editableAncestor"}, {NSAccessibilityElementBusyAttribute, @"elementBusy"}, {NSAccessibilityEnabledAttribute, @"enabled"}, @@ -186,7 +186,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 {NSAccessibilityExpandedAttribute, @"expanded"}, {NSAccessibilityFocusableAncestorAttribute, @"focusableAncestor"}, {NSAccessibilityFocusedAttribute, @"focused"}, -@@ -832,8 +840,10 @@ + (void)initialize { +@@ -837,8 +845,10 @@ + (void)initialize { {NSAccessibilityHighestEditableAncestorAttribute, @"highestEditableAncestor"}, {NSAccessibilityIndexAttribute, @"index"}, @@ -197,7 +197,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 {NSAccessibilityInvalidAttribute, @"invalid"}, {NSAccessibilityIsMultiSelectableAttribute, @"isMultiSelectable"}, {NSAccessibilityLanguageAttribute, @"language"}, -@@ -855,13 +865,17 @@ + (void)initialize { +@@ -860,13 +870,17 @@ + (void)initialize { {NSAccessibilityRowsAttribute, @"rows"}, // TODO(aboxhall): expose // NSAccessibilityServesAsTitleForUIElementsAttribute @@ -215,7 +215,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 {NSAccessibilitySizeAttribute, @"size"}, {NSAccessibilitySortDirectionAttribute, @"sortDirection"}, {NSAccessibilitySubroleAttribute, @"subrole"}, -@@ -1357,6 +1371,7 @@ - (NSNumber*)enabled { +@@ -1362,6 +1376,7 @@ - (NSNumber*)enabled { ax::mojom::Restriction::kDisabled); } @@ -223,15 +223,15 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 // Returns a text marker that points to the last character in the document that // can be selected with VoiceOver. - (id)endTextMarker { -@@ -1365,6 +1380,7 @@ - (id)endTextMarker { - BrowserAccessibilityPositionInstance position = _owner->CreatePositionAt(0); +@@ -1370,6 +1385,7 @@ - (id)endTextMarker { + BrowserAccessibility::AXPosition position = _owner->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtEndOfContent()); } +#endif - (NSNumber*)expanded { if (![self instanceActive]) -@@ -1565,6 +1581,7 @@ - (bool)findRowIndex:(BrowserAccessibilityCocoa*)toFind +@@ -1570,6 +1586,7 @@ - (bool)findRowIndex:(BrowserAccessibilityCocoa*)toFind return false; } @@ -239,7 +239,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 - (NSNumber*)insertionPointLineNumber { if (![self instanceActive]) return nil; -@@ -1590,6 +1607,7 @@ - (NSNumber*)insertionPointLineNumber { +@@ -1595,6 +1612,7 @@ - (NSNumber*)insertionPointLineNumber { caretPosition->AsTextPosition()->text_offset()); return @(std::distance(lineBreaks.begin(), iterator)); } @@ -247,7 +247,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 // Returns whether or not this node should be ignored in the // accessibility tree. -@@ -1941,8 +1959,12 @@ - (BOOL)shouldExposeTitleUIElement { +@@ -1946,8 +1964,12 @@ - (BOOL)shouldExposeTitleUIElement { return content::AXTextEdit(newValue, base::string16(), nil); } } @@ -260,7 +260,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 } - (BOOL)instanceActive { -@@ -2267,6 +2289,7 @@ - (NSArray*)selectedChildren { +@@ -2272,6 +2294,7 @@ - (NSArray*)selectedChildren { return ret; } @@ -268,7 +268,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 - (NSString*)selectedText { if (![self instanceActive]) return nil; -@@ -2278,11 +2301,13 @@ - (NSString*)selectedText { +@@ -2283,11 +2306,13 @@ - (NSString*)selectedText { return nil; return base::SysUTF16ToNSString(range.GetText()); } @@ -282,7 +282,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 - (NSValue*)selectedTextRange { if (![self instanceActive]) return nil; -@@ -2306,7 +2331,9 @@ - (NSValue*)selectedTextRange { +@@ -2312,7 +2337,9 @@ - (NSValue*)selectedTextRange { int selLength = range.GetText().length(); return [NSValue valueWithRange:NSMakeRange(selStart, selLength)]; } @@ -292,7 +292,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 - (id)selectedTextMarkerRange { if (![self instanceActive]) return nil; -@@ -2318,6 +2345,7 @@ - (id)selectedTextMarkerRange { +@@ -2324,6 +2351,7 @@ - (id)selectedTextMarkerRange { // words correctly. return CreateTextMarkerRange(ax_range.AsBackwardRange()); } @@ -300,7 +300,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 - (NSValue*)size { if (![self instanceActive]) -@@ -2350,6 +2378,7 @@ - (NSString*)sortDirection { +@@ -2356,6 +2384,7 @@ - (NSString*)sortDirection { return nil; } @@ -308,41 +308,38 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 // Returns a text marker that points to the first character in the document that // can be selected with VoiceOver. - (id)startTextMarker { -@@ -2358,6 +2387,7 @@ - (id)startTextMarker { - BrowserAccessibilityPositionInstance position = _owner->CreatePositionAt(0); +@@ -2364,6 +2393,7 @@ - (id)startTextMarker { + BrowserAccessibility::AXPosition position = _owner->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtStartOfContent()); } +#endif // Returns a subrole based upon the role. - (NSString*)subrole { -@@ -2687,11 +2717,13 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range { +@@ -2693,12 +2723,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range { NSMutableAttributedString* attributedInnerText = [[[NSMutableAttributedString alloc] initWithString:base::SysUTF16ToNSString(innerText)] autorelease]; +#ifndef MAS_BUILD if (!_owner->IsText()) { - AXPlatformRange ax_range(_owner->CreatePositionAt(0), - _owner->CreatePositionAt(int{innerText.length()})); + BrowserAccessibility::AXRange ax_range( + _owner->CreatePositionAt(0), + _owner->CreatePositionAt(int{innerText.length()})); AddMisspelledTextAttributes(ax_range, attributedInnerText); } +#endif return [attributedInnerText attributedSubstringFromRange:range]; } -@@ -2804,9 +2836,8 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -2811,6 +2843,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return ToBrowserAccessibilityCocoa(cell); } -- if ([attribute -- isEqualToString: -- NSAccessibilityUIElementForTextMarkerParameterizedAttribute]) { +#ifndef MAS_BUILD -+ if ([attribute isEqualToString:NSAccessibilityUIElementForTextMarkerParameterizedAttribute]) { - BrowserAccessibilityPositionInstance position = - CreatePositionFromTextMarker(parameter); - if (!position->IsNullPosition()) -@@ -3119,6 +3150,7 @@ AXPlatformRange range(std::move(lineStartPosition), + if ([attribute + isEqualToString: + NSAccessibilityUIElementForTextMarkerParameterizedAttribute]) { +@@ -3134,6 +3167,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return CreateTextMarker(root->CreatePositionAt(index)); } @@ -350,7 +347,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 if ([attribute isEqualToString: NSAccessibilityBoundsForRangeParameterizedAttribute]) { -@@ -3149,6 +3181,7 @@ AXPlatformRange range(std::move(lineStartPosition), +@@ -3164,6 +3198,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return nil; } @@ -358,7 +355,7 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 if ([attribute isEqualToString: NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) { -@@ -3263,6 +3296,7 @@ AXPlatformRange range(std::move(lineStartPosition), +@@ -3281,6 +3316,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return @(child->GetIndexInParent()); } @@ -366,27 +363,27 @@ index b5940319ae17bfaf43daf18feb42722bf3705bdd..d997cfaa6275a570686d0c1703c30f21 return nil; } -@@ -3792,6 +3826,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { - AXPlatformRange(_owner->CreatePositionAt(range.location), - _owner->CreatePositionAt(NSMaxRange(range)))); +@@ -3810,6 +3846,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { + _owner->CreatePositionAt(range.location), + _owner->CreatePositionAt(NSMaxRange(range)))); } +#ifndef MAS_BUILD if ([attribute isEqualToString:NSAccessibilitySelectedTextMarkerRangeAttribute]) { - AXPlatformRange range = CreateRangeFromTextMarkerRange(value); -@@ -3801,6 +3836,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { - manager->SetSelection(AXPlatformRange(range.anchor()->AsLeafTextPosition(), - range.focus()->AsLeafTextPosition())); + BrowserAccessibility::AXRange range = CreateRangeFromTextMarkerRange(value); +@@ -3820,6 +3857,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { + BrowserAccessibility::AXRange(range.anchor()->AsLeafTextPosition(), + range.focus()->AsLeafTextPosition())); } +#endif } - (id)accessibilityFocusedUIElement { diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm -index 03eb8ace47bc9262a05ac82747e1e67ffb1d5c97..ef39544bbf418099621784362660f5004934835d 100644 +index bf9b2cf399c88c3b08a727b492cd82106e53264b..3196760eb16e1f3642a612a6efd82b174f074f36 100644 --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm -@@ -483,7 +483,7 @@ void PostAnnouncementNotification(NSString* announcement) { +@@ -484,7 +484,7 @@ void PostAnnouncementNotification(NSString* announcement) { if (native_focus_object && [native_focus_object instanceActive]) { [user_info setObject:native_focus_object forKey:ui::NSAccessibilityTextChangeElement]; @@ -395,7 +392,7 @@ index 03eb8ace47bc9262a05ac82747e1e67ffb1d5c97..ef39544bbf418099621784362660f500 id selected_text = [native_focus_object selectedTextMarkerRange]; if (selected_text) { NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute = -@@ -491,6 +491,7 @@ void PostAnnouncementNotification(NSString* announcement) { +@@ -492,6 +492,7 @@ void PostAnnouncementNotification(NSString* announcement) { [user_info setObject:selected_text forKey:NSAccessibilitySelectedTextMarkerRangeAttribute]; } @@ -518,10 +515,10 @@ index b56737af6f4da7cc01f78430c53dfa5afd1bc6df..60cdaa18e55acfd5817d2689bdb5a0ec void BluetoothAdapterMac::RemovePairingDelegateInternal( diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn -index 426d34399bdcb5494bc451fabd5c05fd901dce54..22d20a43f9717443a17056e4c3b561d63b469a0d 100644 +index c68099d5baa0fec203313e8734d2d659578d687d..4a724e0f744722a4ba30ff6e22b56997364e4c49 100644 --- a/media/audio/BUILD.gn +++ b/media/audio/BUILD.gn -@@ -177,6 +177,12 @@ source_set("audio") { +@@ -175,6 +175,12 @@ source_set("audio") { "mac/scoped_audio_unit.cc", "mac/scoped_audio_unit.h", ] diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 6e02b00ee312..b5b1c1958bcc 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,7 +7,7 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index dc1d135df68e8f11619faffb57dfd38b41bc06d1..67986e284434115debf6a638b62c9585ac207c1d 100644 +index 2829dc39cd506a196c48ae0397f8dce1f33ce251..d39671bacc738e9185632bdebac31191d1a0c159 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc @@ -117,6 +117,11 @@ @@ -116,7 +116,7 @@ index dc1d135df68e8f11619faffb57dfd38b41bc06d1..67986e284434115debf6a638b62c9585 void NetworkContext::CreateURLLoaderFactory( mojo::PendingReceiver receiver, mojom::URLLoaderFactoryParamsPtr params) { -@@ -1917,6 +2002,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( +@@ -1947,6 +2032,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( std::move(cert_verifier)); cert_verifier = base::WrapUnique(cert_verifier_with_trust_anchors_); #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -127,7 +127,7 @@ index dc1d135df68e8f11619faffb57dfd38b41bc06d1..67986e284434115debf6a638b62c9585 builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( diff --git a/services/network/network_context.h b/services/network/network_context.h -index 102548a7f132cd1f7d46421fc2ae941dbff7c29d..34281acc5a2dece3b84666b25f4af423a04bf8df 100644 +index 9b38859a97361c640ef132cfc42606e7dc9b34d2..23bbc41ddfee63dacd622a1aa3cf750682501c76 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -90,6 +90,7 @@ class DomainReliabilityMonitor; @@ -147,7 +147,7 @@ index 102548a7f132cd1f7d46421fc2ae941dbff7c29d..34281acc5a2dece3b84666b25f4af423 void ResetURLLoaderFactories() override; void GetCookieManager( mojo::PendingReceiver receiver) override; -@@ -693,6 +696,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext +@@ -696,6 +699,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext CertVerifierWithTrustAnchors* cert_verifier_with_trust_anchors_ = nullptr; #endif @@ -157,10 +157,10 @@ index 102548a7f132cd1f7d46421fc2ae941dbff7c29d..34281acc5a2dece3b84666b25f4af423 // CertNetFetcher is not used by the current platform, or if the actual // net::CertVerifier is instantiated outside of the network service. diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 6f5abd0fa955f15584cb15a4a0dee6d47c657a1e..efe52249cbbcfed616d3190714ef037bdbde1621 100644 +index 7d708f26098739fc60e3f698c5ca9fd3843c242a..b1e73dc3250bb8402d4becfd673fd9aa54ecd7fb 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -222,6 +222,17 @@ struct CTPolicy { +@@ -192,6 +192,17 @@ struct CTPolicy { array excluded_legacy_spkis; }; @@ -178,7 +178,7 @@ index 6f5abd0fa955f15584cb15a4a0dee6d47c657a1e..efe52249cbbcfed616d3190714ef037b // Parameters for constructing a network context. struct NetworkContextParams { // Name used by memory tools to identify the context. -@@ -870,6 +881,9 @@ interface NetworkContext { +@@ -744,6 +755,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote client); diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index 0cec9be43590..f8c9ff65e180 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -108,7 +108,7 @@ index 60558d5f40b765ed3ca2f7d1abc1b95f7518fee9..ab44370dc89f64fe2b86089fd9781b71 mojo::PendingReceiver receiver); diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 0f62a9f4e236e8e91e06dfb5751cde17dddb7233..df3ff59008839c786217661e8862ba54580590ed 100644 +index 5b0ced0bfe7635495bd7e418367126335373633c..5e67fd252d6ce17d8093b81d89dec32756a8ba3b 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -2179,7 +2179,7 @@ void RenderProcessHostImpl::CreateNotificationService( diff --git a/patches/chromium/picture-in-picture.patch b/patches/chromium/picture-in-picture.patch index b34857a79fec..83b781e2d6d0 100644 --- a/patches/chromium/picture-in-picture.patch +++ b/patches/chromium/picture-in-picture.patch @@ -9,7 +9,7 @@ don't get errors for Chrome's generated resources, which are non-existent because we don't generate them in our build. diff --git a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc -index 664500224b99779388b5fabfface02a9ff599fdc..2be06a3e1934a73b9825953a3b897f5bc0f12540 100644 +index 7c81d93e92400874b88b639fde5aaa937efdcace..7f7ca0c53dbc41e06b1c566ae605c76d05e9abcb 100644 --- a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc +++ b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc @@ -4,7 +4,7 @@ @@ -22,7 +22,7 @@ index 664500224b99779388b5fabfface02a9ff599fdc..2be06a3e1934a73b9825953a3b897f5b #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/color_palette.h" diff --git a/chrome/browser/ui/views/overlay/close_image_button.cc b/chrome/browser/ui/views/overlay/close_image_button.cc -index 79b969d83f5b2dcee7ece6c18ac9a1dcf47ac5a1..a4d38d5d0e248cf92195f649b96c77cd1a22583f 100644 +index 6ea71449bf68081bd358c280c3c0b65af23fc97c..8e1c9e5e2cdd464ca1b5e6407b5dddccd31cdb2c 100644 --- a/chrome/browser/ui/views/overlay/close_image_button.cc +++ b/chrome/browser/ui/views/overlay/close_image_button.cc @@ -5,7 +5,7 @@ @@ -35,7 +35,7 @@ index 79b969d83f5b2dcee7ece6c18ac9a1dcf47ac5a1..a4d38d5d0e248cf92195f649b96c77cd #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/color_palette.h" diff --git a/chrome/browser/ui/views/overlay/overlay_window_views.cc b/chrome/browser/ui/views/overlay/overlay_window_views.cc -index 33c56c2c7b50561d03ba93346caa12b9da0fa6ab..f0daf2e4125f1aa34750b636449d0af2b70397bc 100644 +index b148e526ebb4de0111a07a971f038141889bda31..a163cdf5841186235513d9bd9d4ad7279e946d3f 100644 --- a/chrome/browser/ui/views/overlay/overlay_window_views.cc +++ b/chrome/browser/ui/views/overlay/overlay_window_views.cc @@ -15,16 +15,18 @@ @@ -73,11 +73,11 @@ index 33c56c2c7b50561d03ba93346caa12b9da0fa6ab..f0daf2e4125f1aa34750b636449d0af2 -#if defined(OS_WIN) +#if 0 - base::string16 app_user_model_id; + std::wstring app_user_model_id; Browser* browser = chrome::FindBrowserWithWebContents(controller->GetWebContents()); diff --git a/chrome/browser/ui/views/overlay/playback_image_button.cc b/chrome/browser/ui/views/overlay/playback_image_button.cc -index 36261d8e71b00aadbecc4d5e7c5d0568742481f4..13f4f6b451cd73e67792a5d8750a89af483b2d12 100644 +index c0fe1f138f441b691ac2cec2242bfc4d3bdf79ca..473eb45178549385c52fcce2e9ff0b2c77dd328d 100644 --- a/chrome/browser/ui/views/overlay/playback_image_button.cc +++ b/chrome/browser/ui/views/overlay/playback_image_button.cc @@ -5,7 +5,7 @@ @@ -90,7 +90,7 @@ index 36261d8e71b00aadbecc4d5e7c5d0568742481f4..13f4f6b451cd73e67792a5d8750a89af #include "third_party/skia/include/core/SkColor.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/views/overlay/resize_handle_button.cc b/chrome/browser/ui/views/overlay/resize_handle_button.cc -index b1272d8664afdd5c05afcb38a2f533741f210554..20f7ffa8be09b046122430c4497edce807f5d69f 100644 +index 51ce84d8e294a35e4c9d59387bdc7df0d7828070..03dd9142eb8cb899d856f1410694b152189102ab 100644 --- a/chrome/browser/ui/views/overlay/resize_handle_button.cc +++ b/chrome/browser/ui/views/overlay/resize_handle_button.cc @@ -5,7 +5,7 @@ @@ -103,7 +103,7 @@ index b1272d8664afdd5c05afcb38a2f533741f210554..20f7ffa8be09b046122430c4497edce8 #include "ui/base/hit_test.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/views/overlay/skip_ad_label_button.cc b/chrome/browser/ui/views/overlay/skip_ad_label_button.cc -index 61b52275ad685ffc4970dd5e58714310e9af0835..72c0199189bf0efbb7530f12a5c8dc3e72cc783c 100644 +index e5a05b7b04c9679f0b61f0b997f5326ccf881dbf..7ddd4d5f9b55a403b207445f86d78ec62cfc9cc9 100644 --- a/chrome/browser/ui/views/overlay/skip_ad_label_button.cc +++ b/chrome/browser/ui/views/overlay/skip_ad_label_button.cc @@ -4,7 +4,7 @@ @@ -116,7 +116,7 @@ index 61b52275ad685ffc4970dd5e58714310e9af0835..72c0199189bf0efbb7530f12a5c8dc3e #include "ui/gfx/color_palette.h" #include "ui/views/background.h" diff --git a/chrome/browser/ui/views/overlay/track_image_button.cc b/chrome/browser/ui/views/overlay/track_image_button.cc -index c0d070733148d2c9e0271b125ab6e09c55a4f686..f93ca7115cc7c7ed85007d3a392e5bd85426cae3 100644 +index dbcbbabe7df945f797559b46eaa04f02162299e0..1852ff15198970a92275d65582ec19c55a125314 100644 --- a/chrome/browser/ui/views/overlay/track_image_button.cc +++ b/chrome/browser/ui/views/overlay/track_image_button.cc @@ -5,7 +5,7 @@ diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index 33e5aa7aea88..f7cbfc2c29ec 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -387,10 +387,10 @@ index 4fde003f2a12794bfcd479ef2797cc6281c5720b..bc3bc4aee26f9373de35366ddb07f7ba // Tells the RenderFrame to switch the CSS to print media type, render every // requested page using the print preview document's frame/node, and then diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cffbe3671a1 100644 +index 74ae09e7fb99a029b81e5a62f935d6483e6fdd62..3c4ad1139658b46d78f47b3e0445b52bfac943dd 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc -@@ -41,6 +41,7 @@ +@@ -38,6 +38,7 @@ #include "printing/metafile_skia.h" #include "printing/mojom/print.mojom.h" #include "printing/print_job_constants.h" @@ -398,7 +398,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff #include "printing/units.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" -@@ -1169,7 +1170,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1166,7 +1167,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { if (!weak_this) return; @@ -408,7 +408,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff if (weak_this) web_frame->DispatchAfterPrintEvent(); -@@ -1196,7 +1198,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( +@@ -1194,7 +1196,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( receivers_.Add(this, std::move(receiver)); } @@ -417,7 +417,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr()); if (ipc_nesting_level_ > 1) return; -@@ -1211,7 +1213,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() { +@@ -1209,7 +1211,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() { // that instead. auto plugin = delegate_->GetPdfElement(frame); @@ -426,7 +426,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff if (!render_frame_gone_) frame->DispatchAfterPrintEvent(); -@@ -1230,7 +1232,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { +@@ -1228,7 +1230,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { } Print(frame, print_preview_context_.source_node(), @@ -436,7 +436,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff if (!render_frame_gone_) print_preview_context_.DispatchAfterPrintEvent(); // WARNING: |this| may be gone at this point. Do not do any more work here and -@@ -1278,6 +1281,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) { +@@ -1276,6 +1279,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) { if (ipc_nesting_level_ > 1) return; @@ -445,7 +445,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff print_preview_context_.OnPrintPreview(); if (print_preview_context_.IsForArc()) { -@@ -1852,7 +1857,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -1810,7 +1815,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { return; Print(duplicate_node.GetDocument().GetFrame(), duplicate_node, @@ -455,7 +455,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff // Check if |this| is still valid. if (!weak_this) return; -@@ -1867,7 +1873,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -1825,7 +1831,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, const blink::WebNode& node, @@ -466,7 +466,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff // If still not finished with earlier print request simply ignore. if (prep_frame_view_) return; -@@ -1875,7 +1883,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, +@@ -1833,7 +1841,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, FrameReference frame_ref(frame); uint32_t expected_page_count = 0; @@ -475,7 +475,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff DidFinishPrinting(FAIL_PRINT_INIT); return; // Failed to init print page settings. } -@@ -1894,8 +1902,41 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, +@@ -1852,8 +1860,41 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame, print_pages_params_->params->print_scaling_option; auto self = weak_ptr_factory_.GetWeakPtr(); @@ -518,7 +518,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff // Check if |this| is still valid. if (!self) return; -@@ -2144,7 +2185,9 @@ void PrintRenderFrameHelper::IPCProcessed() { +@@ -2102,7 +2143,9 @@ void PrintRenderFrameHelper::IPCProcessed() { } } @@ -529,7 +529,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff mojom::PrintPagesParams settings; settings.params = mojom::PrintParams::New(); GetPrintManagerHost()->GetDefaultPrintSettings(&settings.params); -@@ -2168,12 +2211,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) { +@@ -2126,12 +2169,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) { return result; } @@ -548,7 +548,7 @@ index cd1237696ff28e92aae5dd569b436a16deaf8777..c925bee8086b3b7918bcea9523244cff notify_browser_of_print_failure_ = false; GetPrintManagerHost()->ShowInvalidPrinterSettingsError(); return false; -@@ -2517,18 +2562,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type) { +@@ -2475,18 +2520,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type) { } bool PrintRenderFrameHelper::CheckForCancel() { diff --git a/patches/chromium/put_back_deleted_colors_for_autofill.patch b/patches/chromium/put_back_deleted_colors_for_autofill.patch index 4d9e0fb05ecb..a8a554a9a543 100644 --- a/patches/chromium/put_back_deleted_colors_for_autofill.patch +++ b/patches/chromium/put_back_deleted_colors_for_autofill.patch @@ -8,10 +8,10 @@ needed in chromium but our autofill implementation uses them. This patch can be our autofill implementation to work like Chromium's. diff --git a/ui/gtk/native_theme_gtk.cc b/ui/gtk/native_theme_gtk.cc -index 29ad448b1572856216b42d4f4737d844850b2ebb..5902d81f29984eb05a7c5324ab709e97e3b87557 100644 +index cc8966c3cb5d81f337932d45d89ca51047224116..e1fea89d33f7362b50aa8da04a622becf60660ff 100644 --- a/ui/gtk/native_theme_gtk.cc +++ b/ui/gtk/native_theme_gtk.cc -@@ -357,6 +357,29 @@ base::Optional SkColorFromColorId( +@@ -362,6 +362,29 @@ base::Optional SkColorFromColorId( case ui::NativeTheme::kColorId_TableHeaderSeparator: return GetBorderColor("GtkTreeView#treeview.view GtkButton#button"); @@ -42,10 +42,10 @@ index 29ad448b1572856216b42d4f4737d844850b2ebb..5902d81f29984eb05a7c5324ab709e97 // TODO(thomasanderson): Render GtkSpinner directly. case ui::NativeTheme::kColorId_ThrobberSpinningColor: diff --git a/ui/native_theme/common_theme.cc b/ui/native_theme/common_theme.cc -index 2969de7777e4104618149bacb99603b3f3fb416d..c7605301808133f9a995c0ceb95c84576d2cebd1 100644 +index a585d34fdb68c39f8f663de6c497359d7f0abfd0..34bc98d26cbfec2cd62d3bf89417c077ce828f06 100644 --- a/ui/native_theme/common_theme.cc +++ b/ui/native_theme/common_theme.cc -@@ -64,7 +64,8 @@ base::Optional GetHighContrastColor( +@@ -52,7 +52,8 @@ base::Optional GetHighContrastColor( } } @@ -53,11 +53,11 @@ index 2969de7777e4104618149bacb99603b3f3fb416d..c7605301808133f9a995c0ceb95c8457 +base::Optional GetDarkSchemeColor(const NativeTheme* base_theme, + NativeTheme::ColorId color_id) { switch (color_id) { - // Dialogs - case NativeTheme::kColorId_WindowBackground: -@@ -83,6 +84,14 @@ base::Optional GetDarkSchemeColor(NativeTheme::ColorId color_id) { - case NativeTheme::kColorId_AvatarIconIncognito: - return gfx::kGoogleGrey200; + // Alert + case NativeTheme::kColorId_AlertSeverityLow: +@@ -64,6 +65,14 @@ base::Optional GetDarkSchemeColor(NativeTheme::ColorId color_id) { + case NativeTheme::kColorId_FootnoteContainerBorder: + return gfx::kGoogleGrey900; + // Results Tables + case NativeTheme::kColorId_ResultsTableNormalBackground: @@ -67,12 +67,12 @@ index 2969de7777e4104618149bacb99603b3f3fb416d..c7605301808133f9a995c0ceb95c8457 + case NativeTheme::kColorId_ResultsTableDimmedText: + return SkColorSetA(base_theme->GetSystemColor(NativeTheme::kColorId_ResultsTableNormalText), 0x80); + - // FocusableBorder - case NativeTheme::kColorId_FocusedBorderColor: - return SkColorSetA(gfx::kGoogleBlue300, 0x4D); -@@ -579,6 +588,18 @@ SkColor GetDefaultColor(NativeTheme::ColorId color_id, - case NativeTheme::kColorId_UnfocusedBorderColor: - return gfx::kGoogleGrey300; + // Button + case NativeTheme::kColorId_ProminentButtonColor: + return gfx::kGoogleBlue300; +@@ -511,6 +520,18 @@ SkColor GetDefaultColor(NativeTheme::ColorId color_id, + case NativeTheme::kColorId_WindowBackground: + return SK_ColorWHITE; + // Results Tables + case NativeTheme::kColorId_ResultsTableNormalBackground: @@ -86,23 +86,23 @@ index 2969de7777e4104618149bacb99603b3f3fb416d..c7605301808133f9a995c0ceb95c8457 + case NativeTheme::kColorId_ResultsTableDimmedText: + return SkColorSetRGB(0x64, 0x64, 0x64); + - // Material spinner/throbber - case NativeTheme::kColorId_ThrobberSpinningColor: - return gfx::kGoogleBlue600; -@@ -682,7 +703,7 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id, + case NativeTheme::kColorId_NumColors: + // Keeping the kColorId_NumColors case instead of using the default case + // allows ColorId additions to trigger compile error for an incomplete +@@ -555,7 +576,7 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id, } if (color_scheme == NativeTheme::ColorScheme::kDark) { - base::Optional color = GetDarkSchemeColor(color_id); + base::Optional color = GetDarkSchemeColor(base_theme, color_id); - if (color.has_value()) - return color.value(); - } + if (color.has_value()) { + DVLOG(2) << "GetDarkSchemeColor: " + << "NativeTheme::ColorId: " << NativeThemeColorIdName(color_id) diff --git a/ui/native_theme/native_theme_color_id.h b/ui/native_theme/native_theme_color_id.h -index d08b6a27c0377140562b8feee14b3ae595eb336e..b3d47ac70bc91f3e1cb9931560e6fb36cc6dfef5 100644 +index 8f89aa16c66d4447a8e91bb95eb76f4bde024224..495b345d06de2e10ae14cff7c4af2d85563e80f8 100644 --- a/ui/native_theme/native_theme_color_id.h +++ b/ui/native_theme/native_theme_color_id.h -@@ -151,6 +151,11 @@ +@@ -147,6 +147,11 @@ OP(kColorId_TableHeaderText), \ OP(kColorId_TableHeaderBackground), \ OP(kColorId_TableHeaderSeparator), \ @@ -115,10 +115,10 @@ index d08b6a27c0377140562b8feee14b3ae595eb336e..b3d47ac70bc91f3e1cb9931560e6fb36 OP(kColorId_ThrobberSpinningColor), \ OP(kColorId_ThrobberWaitingColor), \ diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc -index 4d0ed521015660da2376ebc9c50b0f4235ff112c..f4dff8de98066ea0ee4fb30ce832b27707791743 100644 +index 0726b178dc73dcb0728510486d07b46df464ace9..e3962d04553dcdf27bbb878f39a47e279dc4959f 100644 --- a/ui/native_theme/native_theme_win.cc +++ b/ui/native_theme/native_theme_win.cc -@@ -652,6 +652,18 @@ base::Optional NativeThemeWin::GetPlatformHighContrastColor( +@@ -651,6 +651,18 @@ base::Optional NativeThemeWin::GetPlatformHighContrastColor( case kColorId_ThrobberWaitingColor: return system_colors_[SystemThemeColor::kGrayText]; diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index d14d8d0869d9..ddacb18cbc14 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -30,10 +30,10 @@ index e3fe7f35ddad36765bda4e38042ce77b58f37b3f..e5e45826022f65d57eccb2a004934439 // RenderWidgetHost on the main frame, and false otherwise. virtual bool IsWidgetForMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index c50126455356bbe34b3f126b652aa098d2e0758c..34f9c18f8a35903e9ab97574a0e08a3b46696889 100644 +index c4db072350e60db8323e9d275a28222ac9d18b3e..ff38837491c6668ea87ea3dc4dee89f3e4de6cb5 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc -@@ -1928,6 +1928,8 @@ void RenderWidgetHostImpl::FilterDropData(DropData* drop_data) { +@@ -1902,6 +1902,8 @@ void RenderWidgetHostImpl::FilterDropData(DropData* drop_data) { void RenderWidgetHostImpl::SetCursor(const ui::Cursor& cursor) { if (view_) view_->UpdateCursor(WebCursor(cursor)); @@ -43,10 +43,10 @@ index c50126455356bbe34b3f126b652aa098d2e0758c..34f9c18f8a35903e9ab97574a0e08a3b void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index a21877e24ddfdefbccbf3bdafb2132cf244655e8..13bd9fc314ff85ac8ce7876f9f5f8a1507d4c7d3 100644 +index c36d614a237077e5dedb4450ec51316b0fd2a990..6a044db477fc5b20e3ab6e14fda3c21162d112cb 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4159,6 +4159,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -4170,6 +4170,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -59,10 +59,10 @@ index a21877e24ddfdefbccbf3bdafb2132cf244655e8..13bd9fc314ff85ac8ce7876f9f5f8a15 RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index a861fc353dc845f294b0001544738dfa4d3ca1d1..f9fd8ebc471af32ad7158a0054f1b2dc6098026d 100644 +index 90feb1f15ba6f1a6367fe50113d44b435f56bd13..eed7f31c0f4212f33598334948dd997ac1142a67 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -951,6 +951,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, +@@ -961,6 +961,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, blink::mojom::FrameVisibility visibility) override; void SendScreenRects() override; TextInputManager* GetTextInputManager() override; @@ -71,7 +71,7 @@ index a861fc353dc845f294b0001544738dfa4d3ca1d1..f9fd8ebc471af32ad7158a0054f1b2dc bool IsShowingContextMenuOnPage() const override; void DidChangeScreenOrientation() override; diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h -index adbfea805ecc09f9612b4ec9de31a408c8ca0019..3445d590b01918324dc4e5913ee1fc5dda27ab5d 100644 +index 69654654f5e59631b15a8c45fb76977f217356d6..d70af96206f89a9939a2d06efccca625ad0cb9ef 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -14,6 +14,7 @@ diff --git a/patches/chromium/remove_some_deps_that_do_not_work_on_arm64.patch b/patches/chromium/remove_some_deps_that_do_not_work_on_arm64.patch index c9822a68537c..6a2cc299150b 100644 --- a/patches/chromium/remove_some_deps_that_do_not_work_on_arm64.patch +++ b/patches/chromium/remove_some_deps_that_do_not_work_on_arm64.patch @@ -6,7 +6,7 @@ Subject: remove some deps that do not work on arm64 Once these deps have been fixed upstream we can remove this patch. diff --git a/.vpython b/.vpython -index e76e966921da472fdf713eabe25235fb5951d0fc..031725b7b0417e456df5dab514382beb3e720226 100644 +index 827327374782363bd8db87681e864943d3bb97e7..c0588809b730997929ed1d78b3481612b6ba42f5 100644 --- a/.vpython +++ b/.vpython @@ -53,10 +53,10 @@ wheel: < @@ -24,7 +24,7 @@ index e76e966921da472fdf713eabe25235fb5951d0fc..031725b7b0417e456df5dab514382beb # Used by: # build/lacros/test_runner.py -@@ -74,37 +74,37 @@ wheel: < +@@ -74,27 +74,27 @@ wheel: < # This version must also be compatible with the "numpy" version, as "cv2" # depends on "numpy". In this case, OpenCV@2.4.13.2 has been built against # numpy@1.11.3. @@ -69,20 +69,6 @@ index e76e966921da472fdf713eabe25235fb5951d0fc..031725b7b0417e456df5dab514382beb +# match_tag: < +# platform: "macosx_10_6_intel" +# > -+#> - - # Used by: - # third_party/catapult - # - # This version must be compatible with the version range specified by - # //third_party/catapult/telemetry/telemetry/internal/util/external_modules.py --wheel: < -- name: "infra/python/wheels/numpy/${vpython_platform}" -- version: "version:1.11.3" --> -+#wheel: < -+# name: "infra/python/wheels/numpy/${vpython_platform}" -+# version: "version:1.11.3" +#> # Used by: diff --git a/patches/chromium/render_widget_host_view_base.patch b/patches/chromium/render_widget_host_view_base.patch index 97ca21ba86fb..febe437be331 100644 --- a/patches/chromium/render_widget_host_view_base.patch +++ b/patches/chromium/render_widget_host_view_base.patch @@ -6,10 +6,10 @@ Subject: render_widget_host_view_base.patch ... something to do with OSR? and maybe as well? terrifying. diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc -index fc77bac7d93213272a46cfd4cb1111f41e16ece2..067ffb6a7f235e421644b51fbafff361cbd0129d 100644 +index da0698caa0767c5b232821cebe9d6a9df05450e3..335d432e5cb38e5e3eddbccb8fd048d65b02d499 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc -@@ -567,6 +567,13 @@ bool RenderWidgetHostViewBase::ScreenRectIsUnstableFor( +@@ -577,6 +577,13 @@ bool RenderWidgetHostViewBase::ScreenRectIsUnstableFor( return false; } @@ -24,7 +24,7 @@ index fc77bac7d93213272a46cfd4cb1111f41e16ece2..067ffb6a7f235e421644b51fbafff361 const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) { diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h -index 2607251a60c9fee6cd1ab08ac967af7a1b64024c..df311890f06447939f4befdc7306c3d6bc7f5d73 100644 +index 7fd61deee01936024a541f4894d24d5c99fed340..d274fcb2f96a4589c7e641cd0acf8c82209c19a3 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h @@ -25,8 +25,10 @@ @@ -60,7 +60,7 @@ index 2607251a60c9fee6cd1ab08ac967af7a1b64024c..df311890f06447939f4befdc7306c3d6 // This only needs to be overridden by RenderWidgetHostViewBase subclasses // that handle content embedded within other RenderWidgetHostViews. gfx::PointF TransformPointToRootCoordSpaceF( -@@ -283,6 +290,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { +@@ -282,6 +289,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { virtual void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency); diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index 187b1109ab0f..8c2accbf5d89 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -10,7 +10,7 @@ kinds of utility windows. Similarly for `disableAutoHideCursor`. Additionally, disables usage of some private APIs in MAS builds. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index fe292660023d2944a83eb672fd50f57212e5df3d..f33a7cf57b5b734a1f195935a5477d5ca8ba9611 100644 +index 867eebe26002856bcdc1fcb33ef2619603adbb62..7255671200d83ae4438bed28dbb8eae558b94b47 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -153,6 +153,15 @@ void ExtractUnderlines(NSAttributedString* string, @@ -50,7 +50,7 @@ index fe292660023d2944a83eb672fd50f57212e5df3d..f33a7cf57b5b734a1f195935a5477d5c if (view == self) hitSelf = YES; if ([view isKindOfClass:[self class]] && ![view isEqual:self] && -@@ -994,6 +1010,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { +@@ -999,6 +1015,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { eventType == NSKeyDown && !(modifierFlags & NSCommandKeyMask); @@ -61,7 +61,7 @@ index fe292660023d2944a83eb672fd50f57212e5df3d..f33a7cf57b5b734a1f195935a5477d5c // We only handle key down events and just simply forward other events. if (eventType != NSKeyDown) { _hostHelper->ForwardKeyboardEvent(event, latency_info); -@@ -1722,9 +1742,11 @@ - (NSAccessibilityRole)accessibilityRole { +@@ -1727,9 +1747,11 @@ - (NSAccessibilityRole)accessibilityRole { // Since this implementation doesn't have to wait any IPC calls, this doesn't // make any key-typing jank. --hbono 7/23/09 // @@ -73,7 +73,7 @@ index fe292660023d2944a83eb672fd50f57212e5df3d..f33a7cf57b5b734a1f195935a5477d5c - (NSArray*)validAttributesForMarkedText { // This code is just copied from WebKit except renaming variables. -@@ -1733,7 +1755,10 @@ - (NSArray*)validAttributesForMarkedText { +@@ -1738,7 +1760,10 @@ - (NSArray*)validAttributesForMarkedText { initWithObjects:NSUnderlineStyleAttributeName, NSUnderlineColorAttributeName, NSMarkedClauseSegmentAttributeName, diff --git a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch b/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch index 84c7c0ede732..9927e88b0a61 100644 --- a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch +++ b/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch @@ -9,10 +9,10 @@ for every navigation to keep Node.js working properly. Once Native Modules in th are required to be NAPI or context aware (Electron v11), this patch can be removed. diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc -index 092cb7aa6b5d1e2b516569eae8b9dabed6661dfc..963196951c0dce346220c11287ceeab32fec2e32 100644 +index ab0472c9eda27bcccdceab2486f878b2e48c86cf..420e7452f4f3c8a9c266e0a767c75fd866506bc4 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc -@@ -1266,6 +1266,25 @@ ChromeContentRendererClient::GetProtocolHandlerSecurityLevel() { +@@ -1267,6 +1267,25 @@ ChromeContentRendererClient::GetProtocolHandlerSecurityLevel() { #endif } @@ -39,7 +39,7 @@ index 092cb7aa6b5d1e2b516569eae8b9dabed6661dfc..963196951c0dce346220c11287ceeab3 WebLocalFrame* frame, ui::PageTransition transition_type, diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h -index 30718f6b057fcca8eef7516cb48720c4137c3cb4..7a1f4ad8e73cf141ac7c60a9aced2b81cbc61812 100644 +index 0c5a146410ef9519f587714d52fedea951e91d14..59909a250f0062b5b937625a5ba96079bacb3e74 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h @@ -122,6 +122,11 @@ class ChromeContentRendererClient @@ -55,7 +55,7 @@ index 30718f6b057fcca8eef7516cb48720c4137c3cb4..7a1f4ad8e73cf141ac7c60a9aced2b81 override; void WillSendRequest(blink::WebLocalFrame* frame, diff --git a/content/public/renderer/content_renderer_client.cc b/content/public/renderer/content_renderer_client.cc -index 18e13633bc5f2be2830f6c10f4a46783c57720d4..e9123e07996f511e66ce23e28bcfc2f8ecedd6c5 100644 +index 2023cec6ef2d9d90dfe2b68caec2c350d0212490..53587c613aa1c4d6401f056b393dda3c84fe9559 100644 --- a/content/public/renderer/content_renderer_client.cc +++ b/content/public/renderer/content_renderer_client.cc @@ -117,6 +117,14 @@ bool ContentRendererClient::HandleNavigation( @@ -74,10 +74,10 @@ index 18e13633bc5f2be2830f6c10f4a46783c57720d4..e9123e07996f511e66ce23e28bcfc2f8 blink::WebLocalFrame* frame, ui::PageTransition transition_type, diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index 357df68c64071ef7dca98ce4aab885dd936b1c49..f501a2ab0bd6d4664dad13913671c4d7d5a96c1e 100644 +index ff1d4178b3c1e477730c5103b8907bc5d01dd9fe..9888848f113b54cde1d0a004f8f5ea6984721b83 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -210,6 +210,13 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -208,6 +208,13 @@ class CONTENT_EXPORT ContentRendererClient { bool is_redirect); #endif @@ -92,10 +92,10 @@ index 357df68c64071ef7dca98ce4aab885dd936b1c49..f501a2ab0bd6d4664dad13913671c4d7 // |url|. If the function returns a valid |new_url|, the request must be // updated to use it. diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 49b0d9012c43661a4fb4b9b8b8a68c156c7a76b6..db038990188455fc645c3c769a71e01af1ad3f0b 100644 +index adac4b9b2b73be64495dbbb858af5402523bb59b..d497f3aac9bee9d5738bc50b5650dc2142870e2a 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -5313,6 +5313,23 @@ void RenderFrameImpl::BeginNavigation( +@@ -5307,6 +5307,23 @@ void RenderFrameImpl::BeginNavigation( // we can do a per-frame check here rather than a process-wide check. bool should_fork = HasWebUIScheme(url) || HasWebUIScheme(old_url) || (enabled_bindings_ & kWebUIBindingsPolicyMask); diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index f42ba112fa2c..4585958cf99a 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 0059045f81b205157e7e4bf772500a49808edb31..5b7a11d3c2b18f403fc0123d0c6d58757daeeec2 100644 +index b2d116b6b12862fa0e4003e9bbd121f39ac63042..e2906b7be45bbda0875b360112621ffcf6d66c60 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1274,7 +1274,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1245,7 +1245,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/ssl_security_state_tab_helper.patch b/patches/chromium/ssl_security_state_tab_helper.patch index bbdb91cdcb3a..f78d0ead4dd9 100644 --- a/patches/chromium/ssl_security_state_tab_helper.patch +++ b/patches/chromium/ssl_security_state_tab_helper.patch @@ -6,7 +6,7 @@ Subject: ssl_security_state_tab_helper.patch Allows populating security tab info for devtools in Electron. diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc -index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb7538e1a7cf7 100644 +index e85187fe0e087e8e6f5552bd63be1720d27ed59f..ac7009506c4a173f0a7c4717b6eb3fadbfeeb797 100644 --- a/chrome/browser/ssl/security_state_tab_helper.cc +++ b/chrome/browser/ssl/security_state_tab_helper.cc @@ -7,6 +7,7 @@ @@ -17,7 +17,7 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 #include "base/feature_list.h" #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" -@@ -14,25 +15,29 @@ +@@ -14,24 +15,28 @@ #include "base/strings/string_util.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" @@ -29,7 +29,6 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 #include "chrome/browser/safe_browsing/ui_manager.h" #include "chrome/browser/ssl/known_interception_disclosure_infobar_delegate.h" +#endif - #include "chrome/browser/ssl/tls_deprecation_config.h" #include "chrome/common/chrome_features.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" @@ -48,7 +47,7 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 #include "components/security_state/content/content_utils.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/navigation_entry.h" -@@ -55,7 +60,7 @@ +@@ -54,7 +59,7 @@ #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -57,7 +56,7 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 #include "chrome/browser/safe_browsing/chrome_password_protection_service.h" #endif -@@ -99,9 +104,12 @@ bool IsLegacyTLS(GURL url, int connection_status) { +@@ -98,9 +103,12 @@ bool IsLegacyTLS(GURL url, int connection_status) { // default we treat TLS < 1.2 as Legacy, unless the "SSLVersionMin" policy is // set. std::string ssl_version_min_str = switches::kSSLVersionTLSv12; @@ -73,7 +72,7 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 } // Convert the pref string to an SSLVersion, if it is valid. Otherwise use the -@@ -121,8 +129,9 @@ bool IsLegacyTLS(GURL url, int connection_status) { +@@ -120,8 +128,9 @@ bool IsLegacyTLS(GURL url, int connection_status) { } // namespace @@ -84,7 +83,7 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 SecurityStateTabHelper::SecurityStateTabHelper( content::WebContents* web_contents) -@@ -168,6 +177,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { +@@ -150,6 +159,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { // information is still being initialized, thus no need to check for that. state->malicious_content_status = GetMaliciousContentStatus(); @@ -92,7 +91,7 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 ReputationWebContentsObserver* reputation_web_contents_observer = ReputationWebContentsObserver::FromWebContents(web_contents()); state->safety_tip_info = -@@ -192,6 +202,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { +@@ -174,6 +184,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { } } @@ -100,7 +99,7 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 return state; } -@@ -254,8 +265,10 @@ void SecurityStateTabHelper::DidFinishNavigation( +@@ -236,8 +247,10 @@ void SecurityStateTabHelper::DidFinishNavigation( UMA_HISTOGRAM_BOOLEAN("interstitial.ssl.visited_site_after_warning", true); } @@ -111,7 +110,7 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 } void SecurityStateTabHelper::DidChangeVisibleSecurityState() { -@@ -279,6 +292,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { +@@ -261,6 +274,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { web_contents()->GetController().GetVisibleEntry(); if (!entry) return security_state::MALICIOUS_CONTENT_STATUS_NONE; @@ -119,7 +118,7 @@ index 70491781c7c97a86a3469b3a6954b579156f164d..813ebf8fc088822e7d17d0fbe4aeb753 safe_browsing::SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); if (!sb_service) -@@ -361,6 +375,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { +@@ -343,6 +357,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { break; } } diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index d1a296b3de86..265d72820358 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,10 +22,10 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index df3ff59008839c786217661e8862ba54580590ed..cddd153328e3e1e4154aa61e9786b3eaef3f4a05 100644 +index 5e67fd252d6ce17d8093b81d89dec32756a8ba3b..1b93f610a23c1e1c1ec5a90bfcc9958ec06aad65 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -405,6 +405,11 @@ class RendererSandboxedProcessLauncherDelegate +@@ -400,6 +400,11 @@ class RendererSandboxedProcessLauncherDelegate { } @@ -37,7 +37,7 @@ index df3ff59008839c786217661e8862ba54580590ed..cddd153328e3e1e4154aa61e9786b3ea ~RendererSandboxedProcessLauncherDelegate() override = default; #if defined(OS_WIN) -@@ -433,6 +438,9 @@ class RendererSandboxedProcessLauncherDelegate +@@ -428,6 +433,9 @@ class RendererSandboxedProcessLauncherDelegate #if BUILDFLAG(USE_ZYGOTE_HANDLE) ZygoteHandle GetZygote() override { @@ -47,7 +47,7 @@ index df3ff59008839c786217661e8862ba54580590ed..cddd153328e3e1e4154aa61e9786b3ea const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); base::CommandLine::StringType renderer_prefix = -@@ -447,10 +455,13 @@ class RendererSandboxedProcessLauncherDelegate +@@ -446,10 +454,13 @@ class RendererSandboxedProcessLauncherDelegate return sandbox::policy::SandboxType::kRenderer; } @@ -62,7 +62,7 @@ index df3ff59008839c786217661e8862ba54580590ed..cddd153328e3e1e4154aa61e9786b3ea }; const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; -@@ -1909,11 +1920,18 @@ bool RenderProcessHostImpl::Init() { +@@ -1908,11 +1919,18 @@ bool RenderProcessHostImpl::Init() { cmd_line->PrependWrapper(renderer_prefix); AppendRendererCommandLine(cmd_line.get()); diff --git a/patches/chromium/ui_gtk_public_header.patch b/patches/chromium/ui_gtk_public_header.patch index 26683e7caa9b..233539886f79 100644 --- a/patches/chromium/ui_gtk_public_header.patch +++ b/patches/chromium/ui_gtk_public_header.patch @@ -6,10 +6,10 @@ Subject: ui_gtk_public_header.patch Allow electron to depend on //ui/gtk/gtk_util.h diff --git a/ui/gtk/BUILD.gn b/ui/gtk/BUILD.gn -index 3ca7f064f627e5076c12cd79c56991e351cea6b1..7530f279b9d81ce3196a49d10e34c317a8a030fd 100644 +index 73d65668a65802b0ca6112d05c76aefddd157502..b4f29ffa2e029cbcee413aaa7bf54cc03e790864 100644 --- a/ui/gtk/BUILD.gn +++ b/ui/gtk/BUILD.gn -@@ -31,13 +31,15 @@ component("gtk_ui_delegate") { +@@ -39,11 +39,13 @@ component("gtk_ui_delegate") { } component("gtk") { @@ -19,8 +19,6 @@ index 3ca7f064f627e5076c12cd79c56991e351cea6b1..7530f279b9d81ce3196a49d10e34c317 + "gtk_util.h", + ] sources = [ - "gtk_key_bindings_handler.cc", - "gtk_key_bindings_handler.h", "gtk_ui.cc", "gtk_util.cc", - "gtk_util.h", diff --git a/patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch b/patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch index e003f93d5b27..4cade1a6ca32 100644 --- a/patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch +++ b/patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch @@ -6,7 +6,7 @@ Subject: unsandboxed_ppapi_processes_skip_zygote.patch Unsandboxed ppapi processes should skip zygote. diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc -index 4ee1f46e8b8ee1685f1c9eb8bafe48fa299b69e2..ce5a23d935e09a4f4c41ed108f18ccc0fbeab3b6 100644 +index 839bb1285a41e7d881c7ebd5e5e9d4817aeb26d9..f75ce4caac66284cb0aab8ed93f842d200e75ba7 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc @@ -111,6 +111,9 @@ class PpapiPluginSandboxedProcessLauncherDelegate diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index 54b01b275b2b..ec2cdf29e29b 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,12 +9,12 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index e137e4e16941a539346cd248a51c872159765d32..5c06f5d680357028cffa00f3dfdc17ff02a4a560 100644 +index f3884caf2320fb17bed8d84f342b5f8cc3b0b4c1..0945a202580d6eba49e48d68921f2624fe481b43 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -2734,6 +2734,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -2745,6 +2745,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { frame_tree_.Init(site_instance.get(), params.renderer_initiated_creation, - params.main_frame_name); + params.main_frame_name, params.is_prerendering); + if (params.view && params.delegate_view) { + view_.reset(params.view); @@ -25,7 +25,7 @@ index e137e4e16941a539346cd248a51c872159765d32..5c06f5d680357028cffa00f3dfdc17ff WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -2744,6 +2750,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -2755,6 +2761,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { view_.reset(CreateWebContentsView(this, delegate, &render_view_host_delegate_view_)); } @@ -34,7 +34,7 @@ index e137e4e16941a539346cd248a51c872159765d32..5c06f5d680357028cffa00f3dfdc17ff CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 8a913c6aa050fce21b71a0b493abb6c90d2f2931..79af85209da3ca2d6eb7bc27f97e5becad7312e4 100644 +index f7c4564d7ab04ade8e85b4e4ebbf73cfe40bee66..dbbe18b2375112759d65bee0c53da0b58bad609c 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h @@ -87,8 +87,11 @@ class BrowserContext; @@ -49,7 +49,7 @@ index 8a913c6aa050fce21b71a0b493abb6c90d2f2931..79af85209da3ca2d6eb7bc27f97e5bec class WebUI; struct DropData; struct MHTMLGenerationParams; -@@ -221,6 +224,10 @@ class WebContents : public PageNavigator, +@@ -228,6 +231,10 @@ class WebContents : public PageNavigator, // Sandboxing flags set on the new WebContents. network::mojom::WebSandboxFlags starting_sandbox_flags; diff --git a/patches/chromium/webview_cross_drag.patch b/patches/chromium/webview_cross_drag.patch index 8ae9fcd9d6c2..439c1bd4feff 100644 --- a/patches/chromium/webview_cross_drag.patch +++ b/patches/chromium/webview_cross_drag.patch @@ -8,10 +8,10 @@ This allows dragging and dropping between s. Originally landed in https://github.com/electron/libchromiumcontent/pull/267 diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc -index 4bdcc50a40e498f83eef230780d538c77e038c80..5b6f371b80675a8681accf28eeeb1ce5fc981d36 100644 +index 81dab5885e269b9e69aa33fc9f7733dcea2fcfd7..8fa9e7d5223596b0178e8caf2c0bb55036c6f4b6 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc -@@ -794,9 +794,7 @@ gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const { +@@ -791,9 +791,7 @@ gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const { bool WebContentsViewAura::IsValidDragTarget( RenderWidgetHostImpl* target_rwh) const { diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index 3c50bec68e57..791edc2ed3f9 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -10,10 +10,10 @@ An attempt to upstream this was made, but rejected: https://chromium-review.googlesource.com/c/chromium/src/+/1954347 diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index a4695ba832fc5ae6f458baf38bbf7efa95dc610e..357df68c64071ef7dca98ce4aab885dd936b1c49 100644 +index 204c63d3ad36eae56afbdd311cbd8549872d357c..ff1d4178b3c1e477730c5103b8907bc5d01dd9fe 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -374,6 +374,11 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -372,6 +372,11 @@ class CONTENT_EXPORT ContentRendererClient { virtual void DidInitializeWorkerContextOnWorkerThread( v8::Local context) {} @@ -26,10 +26,10 @@ index a4695ba832fc5ae6f458baf38bbf7efa95dc610e..357df68c64071ef7dca98ce4aab885dd // An empty URL is returned if the URL is not overriden. virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 9362fb2b7cb2fa0054c3b8578f1e56c7bfd82627..e7ee8f52f4cf276d301522e00fed6ab9f34e1f56 100644 +index fcc6479c78f2415d1cdb7326b583c6546bed55d4..78f4629da1ad9447cb0cffc6548e25fd32b7220b 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -910,6 +910,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { +@@ -928,6 +928,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); } @@ -43,10 +43,10 @@ index 9362fb2b7cb2fa0054c3b8578f1e56c7bfd82627..e7ee8f52f4cf276d301522e00fed6ab9 const v8::Local& worker) { GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index aea8d1c53436dbb90352f2de1eebb287815e7e78..534c8f6032124d6b94e35f036158bbe8122f85bb 100644 +index 9c18bcc27ec8a85d7ffe7aff5242d9eef75a3290..0235ca804e67a587d62b93ced9f026bc41efdf22 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -196,6 +196,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -195,6 +195,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; @@ -55,10 +55,10 @@ index aea8d1c53436dbb90352f2de1eebb287815e7e78..534c8f6032124d6b94e35f036158bbe8 const blink::WebSecurityOrigin& script_origin) override; blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel() diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index 563c13288c6664469c0c5ae121b0c7add38a1ddd..96c5370e38f9960aa14d7dcfcc841a427b129aca 100644 +index e6a0363371256789eb90b4cf675681d140e264bf..5c13b5d5eb584148b6ebaf5843660d314e2d503c 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -697,6 +697,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -689,6 +689,7 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} @@ -67,7 +67,7 @@ index 563c13288c6664469c0c5ae121b0c7add38a1ddd..96c5370e38f9960aa14d7dcfcc841a42 const WebSecurityOrigin& script_origin) { return false; diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc -index cf8326757d4f1ad8acb27ad61c65ab0db61874c3..10292488d8700123edaa6f9834a6f37ae4c169f0 100644 +index d06931f255e68af0ff583b83ada2ecfd23b799a7..8533e1dbe847ee348c7f1b1e1fdf4270dfd4b2c1 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc @@ -737,6 +737,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index e92c4ccde381..b4b9adb44a15 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -19,10 +19,10 @@ that clearly establishes the worker script is ready for evaluation with the scop initialized. diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index f501a2ab0bd6d4664dad13913671c4d7d5a96c1e..e633d1755405feeae8c45c0bcbf90f672aacadc5 100644 +index 9888848f113b54cde1d0a004f8f5ea6984721b83..5f799d4c51842d425965f52f4c581d6eb241dab5 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -381,6 +381,11 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -379,6 +379,11 @@ class CONTENT_EXPORT ContentRendererClient { virtual void DidInitializeWorkerContextOnWorkerThread( v8::Local context) {} @@ -35,10 +35,10 @@ index f501a2ab0bd6d4664dad13913671c4d7d5a96c1e..e633d1755405feeae8c45c0bcbf90f67 // from the worker thread. virtual void WillDestroyWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index e7ee8f52f4cf276d301522e00fed6ab9f34e1f56..99906d5d855f2331332065d609c44b919dfe5edf 100644 +index 78f4629da1ad9447cb0cffc6548e25fd32b7220b..10e45daae49431adda74e1141433e03e21caa6cf 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -922,6 +922,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( +@@ -940,6 +940,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( worker); } @@ -52,10 +52,10 @@ index e7ee8f52f4cf276d301522e00fed6ab9f34e1f56..99906d5d855f2331332065d609c44b91 const blink::WebSecurityOrigin& script_origin) { return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 534c8f6032124d6b94e35f036158bbe8122f85bb..ac95f5daea0919464f87aeeab99a0c5e5581318b 100644 +index 0235ca804e67a587d62b93ced9f026bc41efdf22..a7dc38fe54f8b9e5333089cbe52adc6a24d26018 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -196,6 +196,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -195,6 +195,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; @@ -65,10 +65,10 @@ index 534c8f6032124d6b94e35f036158bbe8122f85bb..ac95f5daea0919464f87aeeab99a0c5e bool AllowScriptExtensionForServiceWorker( const blink::WebSecurityOrigin& script_origin) override; diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index 96c5370e38f9960aa14d7dcfcc841a427b129aca..92fda0b5d32f75fff1508e146333082a3eb9ef1c 100644 +index 5c13b5d5eb584148b6ebaf5843660d314e2d503c..5f3d159b85fcefb6542e755556f4cfd15fa85b24 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -697,6 +697,8 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -689,6 +689,8 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} @@ -78,10 +78,10 @@ index 96c5370e38f9960aa14d7dcfcc841a427b129aca..92fda0b5d32f75fff1508e146333082a virtual bool AllowScriptExtensionForServiceWorker( const WebSecurityOrigin& script_origin) { diff --git a/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc b/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc -index a14ccefd7d315bc9757dd995723ec9705ccc2416..c735b617969235ced5a41fc7a1915de0177c71ce 100644 +index 59430d092bec9e633c35d02d267884a66268ae81..10a567b0b0331f7ed119f62b8a842f27bfa31ee0 100644 --- a/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc +++ b/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc -@@ -273,6 +273,7 @@ void WorkerOrWorkletScriptController::PrepareForEvaluation() { +@@ -257,6 +257,7 @@ void WorkerOrWorkletScriptController::PrepareForEvaluation() { V8PerContextData* per_context_data = script_state_->PerContextData(); ignore_result(per_context_data->ConstructorForType( global_scope_->GetWrapperTypeInfo())); @@ -89,7 +89,7 @@ index a14ccefd7d315bc9757dd995723ec9705ccc2416..c735b617969235ced5a41fc7a1915de0 #else // USE_BLINK_V8_BINDING_NEW_IDL_INTERFACE ScriptState::Scope scope(script_state_); v8::Local context = script_state_->GetContext(); -@@ -298,6 +299,8 @@ void WorkerOrWorkletScriptController::PrepareForEvaluation() { +@@ -282,6 +283,8 @@ void WorkerOrWorkletScriptController::PrepareForEvaluation() { wrapper_type_info->InstallConditionalFeatures( context, *world_, global_object, v8::Local(), v8::Local(), global_interface_template); diff --git a/patches/depot_tools/remove_some_deps_that_do_not_work_on_arm64.patch b/patches/depot_tools/remove_some_deps_that_do_not_work_on_arm64.patch index 1a8decbfe46a..a887fa2262da 100644 --- a/patches/depot_tools/remove_some_deps_that_do_not_work_on_arm64.patch +++ b/patches/depot_tools/remove_some_deps_that_do_not_work_on_arm64.patch @@ -6,7 +6,7 @@ Subject: remove some deps that do not work on arm64 Once these deps have newly built arm64 versions we can remove this patch. diff --git a/gsutil.vpython b/gsutil.vpython -index b0a646271eae7426988bbef47a4162f47872c1d1..d9465adeb29f1c696d8ef442a753e6737627bd6f 100644 +index a9b6ec9ef6794dd980f3fa90780dcf20cb20ac15..7dd97f2e41789e640d508c584e4d510e62fe3616 100644 --- a/gsutil.vpython +++ b/gsutil.vpython @@ -25,19 +25,19 @@ wheel < @@ -27,26 +27,26 @@ index b0a646271eae7426988bbef47a4162f47872c1d1..d9465adeb29f1c696d8ef442a753e673 ## -wheel: < -- name: "infra/python/wheels/cryptography/${platform}_${py_python}_${py_abi}" -- version: "version:2.0.3" +- name: "infra/python/wheels/cryptography/${vpython_platform}" +- version: "version:2.9.2" -> +#wheel: < -+# name: "infra/python/wheels/cryptography/${platform}_${py_python}_${py_abi}" -+# version: "version:2.0.3" ++# name: "infra/python/wheels/cryptography/${vpython_platform}" ++# version: "version:2.9.2" +#> wheel: < name: "infra/python/wheels/appdirs-py2_py3" -@@ -54,10 +54,10 @@ wheel: < +@@ -49,10 +49,10 @@ wheel: < version: "version:1.1.6" > -wheel: < -- name: "infra/python/wheels/cffi/${platform}_${py_python}_${py_abi}" +- name: "infra/python/wheels/cffi/${vpython_platform}" - version: "version:1.10.0" -> +#wheel: < -+# name: "infra/python/wheels/cffi/${platform}_${py_python}_${py_abi}" ++# name: "infra/python/wheels/cffi/${vpython_platform}" +# version: "version:1.10.0" +#> diff --git a/patches/v8/add_realloc.patch b/patches/v8/add_realloc.patch index 66e69651237a..e7fa850e79de 100644 --- a/patches/v8/add_realloc.patch +++ b/patches/v8/add_realloc.patch @@ -12,10 +12,10 @@ when we override ReallocateBufferMemory, so we therefore need to implement Realloc on the v8 side. diff --git a/include/v8.h b/include/v8.h -index 63bd969ed6f83f8728a2cbb4479e269d1e3ffbc0..0d79c72077d05c69312d527b0e23b68f85a7cfd7 100644 +index 7cb19bbede03db217b2283ad0ff0df84aafdd168..b869480cddda91242738786d9ffdc24c3d7ac7dd 100644 --- a/include/v8.h +++ b/include/v8.h -@@ -5295,6 +5295,13 @@ class V8_EXPORT ArrayBuffer : public Object { +@@ -5355,6 +5355,13 @@ class V8_EXPORT ArrayBuffer : public Object { */ virtual void* AllocateUninitialized(size_t length) = 0; @@ -30,10 +30,10 @@ index 63bd969ed6f83f8728a2cbb4479e269d1e3ffbc0..0d79c72077d05c69312d527b0e23b68f * Free the memory block of size |length|, pointed to by |data|. * That memory is guaranteed to be previously allocated by |Allocate|. diff --git a/src/api/api.cc b/src/api/api.cc -index 1107b70b672d783b479a28f7a66afb10959e41d8..3e00ce21aeba97372b0b849ecc47e1e9a5b3c804 100644 +index 6c6813995f74f1b0c3527d55848bfeb1bbb31a26..3575e9e1a594abdc2a443667f8889bcb27b605ac 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -313,6 +313,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { +@@ -315,6 +315,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { i::V8::SetSnapshotBlob(snapshot_blob); } diff --git a/patches/v8/build_gn.patch b/patches/v8/build_gn.patch index 92f2156e3682..95cabfb6a672 100644 --- a/patches/v8/build_gn.patch +++ b/patches/v8/build_gn.patch @@ -9,7 +9,7 @@ necessary for native modules to load. Also, some fixes relating to mksnapshot on ARM. diff --git a/BUILD.gn b/BUILD.gn -index 2b6029fd109844fc140c6576a19c621f812bea93..54a421d6541a3811b7a6e24cd4ac55fa1c1d7a1a 100644 +index 4e9ef83a08dc641fcf4d4df23cd4b815a1a5ee2b..82f3723cb326a148eade470085f960ed261d1831 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -441,7 +441,7 @@ config("internal_config") { @@ -21,7 +21,7 @@ index 2b6029fd109844fc140c6576a19c621f812bea93..54a421d6541a3811b7a6e24cd4ac55fa defines += [ "BUILDING_V8_SHARED" ] } } -@@ -4877,7 +4877,7 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -4993,7 +4993,7 @@ if (current_toolchain == v8_generator_toolchain) { "src/interpreter/bytecodes.h", ] @@ -30,7 +30,7 @@ index 2b6029fd109844fc140c6576a19c621f812bea93..54a421d6541a3811b7a6e24cd4ac55fa deps = [ ":v8_libbase", -@@ -4914,6 +4914,8 @@ if (current_toolchain == v8_snapshot_toolchain) { +@@ -5031,6 +5031,8 @@ if (current_toolchain == v8_snapshot_toolchain) { configs = [ ":internal_config" ] diff --git a/patches/v8/chore_disallow_copying_cppheapcreateparams.patch b/patches/v8/chore_disallow_copying_cppheapcreateparams.patch index 50c7c8a0f187..4692253a6add 100644 --- a/patches/v8/chore_disallow_copying_cppheapcreateparams.patch +++ b/patches/v8/chore_disallow_copying_cppheapcreateparams.patch @@ -11,17 +11,21 @@ implicitly deletes its copy ctor, so this commit makes it explicit. Xref: https://chromium-review.googlesource.com/c/v8/v8/+/2536642 diff --git a/include/v8-cppgc.h b/include/v8-cppgc.h -index 8860ea8a78de67ab9e9ac453ec1774c8c6b17b8a..1ae9c485bbf083449d7e812696975ffef5e37573 100644 +index fba35f71c9ae079fde28f5f26de1fbedcf8f671d..8b6e5fdb843ee5b70a68118cc384f23f405d64d2 100644 --- a/include/v8-cppgc.h +++ b/include/v8-cppgc.h -@@ -26,8 +26,13 @@ namespace internal { - class CppHeap; - } // namespace internal +@@ -72,12 +72,17 @@ struct WrapperDescriptor final { + uint16_t embedder_id_for_garbage_collected; + }; -struct V8_EXPORT CppHeapCreateParams { +class V8_EXPORT CppHeapCreateParams { + public: + CppHeapCreateParams(const CppHeapCreateParams&) = delete; + CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete; + std::vector> custom_spaces; + WrapperDescriptor wrapper_descriptor; + + private: + CppHeapCreateParams (const CppHeapCreateParams&) =delete; @@ -30,7 +34,7 @@ index 8860ea8a78de67ab9e9ac453ec1774c8c6b17b8a..1ae9c485bbf083449d7e812696975ffe /** diff --git a/include/v8.h b/include/v8.h -index 0d79c72077d05c69312d527b0e23b68f85a7cfd7..5e03f54a918191650d5dd6768a6e8c3a31de4300 100644 +index b869480cddda91242738786d9ffdc24c3d7ac7dd..a8b984658dc1309cb626f96c222ad9bffcb13754 100644 --- a/include/v8.h +++ b/include/v8.h @@ -93,6 +93,7 @@ class Utils; diff --git a/patches/v8/dcheck.patch b/patches/v8/dcheck.patch index e8f5db7b831e..e3c1449506e6 100644 --- a/patches/v8/dcheck.patch +++ b/patches/v8/dcheck.patch @@ -6,10 +6,10 @@ Subject: dcheck.patch https://github.com/auchenberg/volkswagen diff --git a/src/api/api.cc b/src/api/api.cc -index 3e00ce21aeba97372b0b849ecc47e1e9a5b3c804..5c5498a5c0732158bf4f4eb37c7d21231ccac45d 100644 +index 3575e9e1a594abdc2a443667f8889bcb27b605ac..e5bee991f774f13f2b3b89b980f3b84a9a540458 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -8798,7 +8798,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { +@@ -8887,7 +8887,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { } void Isolate::PerformMicrotaskCheckpoint() { diff --git a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch index e52411d9d208..cdc476cac0fe 100644 --- a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch +++ b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch @@ -12,7 +12,7 @@ This patch can be safely removed if, when it is removed, `node.lib` does not contain any standard C++ library exports (e.g. `std::ostringstream`). diff --git a/BUILD.gn b/BUILD.gn -index 77760d840e62acfd214633108da576f296d32ce8..6d3202f21931cccbd69765d27926b8c92dc9aad1 100644 +index 993d57f342e777b6376823d7e68b0fae6a374868..d98a0465115b4a5d8a24385d4d3eacc45bd34c44 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -441,6 +441,10 @@ config("internal_config") { @@ -27,7 +27,7 @@ index 77760d840e62acfd214633108da576f296d32ce8..6d3202f21931cccbd69765d27926b8c9 defines += [ "BUILDING_V8_SHARED" ] } diff --git a/src/base/macros.h b/src/base/macros.h -index 9079d15662836848d0b3ba1c09a5207936c6a79b..370eb1a6344b998d028f90f5087a4b92f46cfddb 100644 +index b370d8818b1fa23fb916e8be343a0f98fada0aba..dda0ada417544059f041609655c3d50a433d59db 100644 --- a/src/base/macros.h +++ b/src/base/macros.h @@ -394,13 +394,17 @@ bool is_inbounds(float_t v) { diff --git a/patches/v8/export_symbols_needed_for_windows_build.patch b/patches/v8/export_symbols_needed_for_windows_build.patch index 5cffe9e6f8a9..99bea7b1be50 100644 --- a/patches/v8/export_symbols_needed_for_windows_build.patch +++ b/patches/v8/export_symbols_needed_for_windows_build.patch @@ -6,10 +6,10 @@ Subject: Export symbols needed for Windows build These symbols are required to build v8 with BUILD_V8_SHARED on Windows. diff --git a/src/objects/objects.h b/src/objects/objects.h -index 73b3369da085f8950d6f92589f93cd80273a57ab..da598f60382f54d30abae1ad30256f998b7b2628 100644 +index c68445597f562d043953bd38baf25d818646de68..60f519ad45da2680d24ea2012446f5d62fd8e981 100644 --- a/src/objects/objects.h +++ b/src/objects/objects.h -@@ -826,7 +826,7 @@ enum class KeyCollectionMode { +@@ -824,7 +824,7 @@ enum class KeyCollectionMode { // Utility superclass for stack-allocated objects that must be updated // on gc. It provides two ways for the gc to update instances, either // iterating or updating after gc. diff --git a/patches/v8/expose_mksnapshot.patch b/patches/v8/expose_mksnapshot.patch index c0539fe6b2ba..14b2ab58ceb3 100644 --- a/patches/v8/expose_mksnapshot.patch +++ b/patches/v8/expose_mksnapshot.patch @@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch Needed in order to target mksnapshot for mksnapshot zip. diff --git a/BUILD.gn b/BUILD.gn -index 54a421d6541a3811b7a6e24cd4ac55fa1c1d7a1a..77760d840e62acfd214633108da576f296d32ce8 100644 +index 82f3723cb326a148eade470085f960ed261d1831..993d57f342e777b6376823d7e68b0fae6a374868 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -4888,7 +4888,6 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -5005,7 +5005,6 @@ if (current_toolchain == v8_generator_toolchain) { if (current_toolchain == v8_snapshot_toolchain) { v8_executable("mksnapshot") { diff --git a/patches/v8/workaround_an_undefined_symbol_error.patch b/patches/v8/workaround_an_undefined_symbol_error.patch index 99a908147397..c746ff3c5735 100644 --- a/patches/v8/workaround_an_undefined_symbol_error.patch +++ b/patches/v8/workaround_an_undefined_symbol_error.patch @@ -12,10 +12,10 @@ By moving some functions out of the the arm64-assembler header file, this error no longer seems to happen. diff --git a/src/codegen/arm64/assembler-arm64.cc b/src/codegen/arm64/assembler-arm64.cc -index 441f299a17a6f870f545dbcd2c28a5e49b952ac3..79249d463c8fe7d73caca6b36ed6033b3c363c67 100644 +index 72cac5bd603bb84d721e4f5cbadaecd7c0d2e89e..8b31f57f4897a70906a92654a4d41f4c5787f271 100644 --- a/src/codegen/arm64/assembler-arm64.cc +++ b/src/codegen/arm64/assembler-arm64.cc -@@ -3658,6 +3658,22 @@ void Assembler::MoveWide(const Register& rd, uint64_t imm, int shift, +@@ -3659,6 +3659,22 @@ void Assembler::MoveWide(const Register& rd, uint64_t imm, int shift, ImmMoveWide(static_cast(imm)) | ShiftMoveWide(shift)); } From e715b9c92185f126d5232326432758bf7a6dc848 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 4 Mar 2021 15:53:46 -0800 Subject: [PATCH 04/85] chore: media_internal_resources becomes resources Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2699022 --- electron_paks.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron_paks.gni b/electron_paks.gni index f6eb9aff89c8..0257db3fa9b1 100644 --- a/electron_paks.gni +++ b/electron_paks.gni @@ -73,7 +73,7 @@ template("electron_extra_paks") { "//components/resources", "//content:content_resources", "//content:dev_ui_content_resources", - "//content/browser/resources/media:media_internals_resources", + "//content/browser/resources/media:resources", "//content/browser/tracing:resources", "//content/browser/webrtc/resources", "//electron:resources", From c8148febfa826e82b16de91493631c471313d17b Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 4 Mar 2021 16:20:36 -0800 Subject: [PATCH 05/85] chore: update patches --- ...rustedauthclient_to_urlloaderfactory.patch | 7 +-- patches/v8/.patches | 1 - ...disallow_copying_cppheapcreateparams.patch | 47 ------------------- 3 files changed, 4 insertions(+), 51 deletions(-) delete mode 100644 patches/v8/chore_disallow_copying_cppheapcreateparams.patch diff --git a/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch b/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch index c62965bd034d..d7c75bb39cb9 100644 --- a/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch +++ b/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch @@ -82,7 +82,7 @@ index ce483753dff0130c5ac20258c0cf7e399c0d1c51..dea741c526f10616c3779f76a6d9cf8a OnAuthCredentials(base::nullopt); return; } -@@ -1201,10 +1207,21 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, +@@ -1201,10 +1207,22 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, DCHECK(!auth_challenge_responder_receiver_.is_bound()); @@ -96,8 +96,9 @@ index ce483753dff0130c5ac20258c0cf7e399c0d1c51..dea741c526f10616c3779f76a6d9cf8a + head->auth_challenge_info = auth_info; + if (auth_client_) { + auth_client_->OnAuthRequired( -+ fetch_window_id_, request_id_, url_request_->url(), first_auth_attempt_, -+ auth_info, url_request->response_headers(), ++ fetch_window_id_, factory_params_->process_id, render_frame_id_, ++ request_id_, url_request_->url(), first_auth_attempt_, auth_info, ++ std::move(head), + auth_challenge_responder_receiver_.BindNewPipeAndPassRemote()); + } else { + auth_cert_observer_->OnAuthRequired( diff --git a/patches/v8/.patches b/patches/v8/.patches index c28181e02f98..61e50e1801db 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -6,4 +6,3 @@ export_symbols_needed_for_windows_build.patch workaround_an_undefined_symbol_error.patch do_not_export_private_v8_symbols_on_windows.patch fix_build_deprecated_attirbute_for_older_msvc_versions.patch -chore_disallow_copying_cppheapcreateparams.patch diff --git a/patches/v8/chore_disallow_copying_cppheapcreateparams.patch b/patches/v8/chore_disallow_copying_cppheapcreateparams.patch deleted file mode 100644 index 4692253a6add..000000000000 --- a/patches/v8/chore_disallow_copying_cppheapcreateparams.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Charles Kerr -Date: Thu, 19 Nov 2020 13:12:56 -0600 -Subject: chore: disallow copying CppHeapCreateParams - -Experimental commit to resolve FTBS https://ci.appveyor.com/project/electron-bot/electron-ljo26/builds/36405680#L25345 -which introduces a new struct CppHeapCreateParams that aggregates a -vector of unique_ptrs. Our Windows CI is unhappy that this struct -implicitly deletes its copy ctor, so this commit makes it explicit. - -Xref: https://chromium-review.googlesource.com/c/v8/v8/+/2536642 - -diff --git a/include/v8-cppgc.h b/include/v8-cppgc.h -index fba35f71c9ae079fde28f5f26de1fbedcf8f671d..8b6e5fdb843ee5b70a68118cc384f23f405d64d2 100644 ---- a/include/v8-cppgc.h -+++ b/include/v8-cppgc.h -@@ -72,12 +72,17 @@ struct WrapperDescriptor final { - uint16_t embedder_id_for_garbage_collected; - }; - --struct V8_EXPORT CppHeapCreateParams { -+class V8_EXPORT CppHeapCreateParams { -+ public: - CppHeapCreateParams(const CppHeapCreateParams&) = delete; - CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete; - - std::vector> custom_spaces; - WrapperDescriptor wrapper_descriptor; -+ -+ private: -+ CppHeapCreateParams (const CppHeapCreateParams&) =delete; -+ CppHeapCreateParams& operator=(const CppHeapCreateParams&) =delete; - }; - - /** -diff --git a/include/v8.h b/include/v8.h -index b869480cddda91242738786d9ffdc24c3d7ac7dd..a8b984658dc1309cb626f96c222ad9bffcb13754 100644 ---- a/include/v8.h -+++ b/include/v8.h -@@ -93,6 +93,7 @@ class Utils; - class Value; - class WasmMemoryObject; - class WasmModuleObject; -+class CppHeapCreateParams; - template - class GlobalValueMap; - template From 87df2766ba1bdf68b1d2e1a16f8bf244d9d68889 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 4 Mar 2021 16:23:10 -0800 Subject: [PATCH 06/85] refactor: extensions::ViewType moved to mojom Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710351 --- shell/browser/api/electron_api_web_contents.cc | 6 +++--- shell/browser/api/electron_api_web_contents.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index bf5908568a50..96725e4b6019 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -591,7 +591,7 @@ bool IsDevToolsFileSystemAdded(content::WebContents* web_contents, #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) -WebContents::Type GetTypeFromViewType(extensions::ViewType view_type) { +WebContents::Type GetTypeFromViewType(extensions::mojom::ViewType view_type) { switch (view_type) { case extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: return WebContents::Type::kBackgroundPage; @@ -625,7 +625,7 @@ WebContents::WebContents(v8::Isolate* isolate, { #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) // WebContents created by extension host will have valid ViewType set. - extensions::ViewType view_type = extensions::GetViewType(web_contents); + extensions::mojom::ViewType view_type = extensions::GetViewType(web_contents); if (view_type != extensions::VIEW_TYPE_INVALID) { InitWithExtensionView(isolate, web_contents, view_type); } @@ -865,7 +865,7 @@ void WebContents::InitWithSessionAndOptions( #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) void WebContents::InitWithExtensionView(v8::Isolate* isolate, content::WebContents* web_contents, - extensions::ViewType view_type) { + extensions::mojom::ViewType view_type) { // Must reassign type prior to calling `Init`. type_ = GetTypeFromViewType(view_type); if (GetType() == Type::kRemote) diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index a490ba6f94ec..639de8f3b086 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -48,7 +48,7 @@ #endif #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) -#include "extensions/common/view_type.h" +#include "extensions/common/mojom/view_type.mojom.h" namespace extensions { class ScriptExecutor; @@ -453,7 +453,7 @@ class WebContents : public gin::Wrappable, #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) void InitWithExtensionView(v8::Isolate* isolate, content::WebContents* web_contents, - extensions::ViewType view_type); + extensions::mojom::ViewType view_type); #endif // content::WebContentsDelegate: From e900271beaafbece021aec1b8458b86ebec9d3fb Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 4 Mar 2021 16:25:30 -0800 Subject: [PATCH 07/85] chore: might_have_observers has been removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2667839 --- shell/browser/api/electron_api_web_contents.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 639de8f3b086..acf560fb78ff 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -338,7 +338,7 @@ class WebContents : public gin::Wrappable, } void RemoveObserver(ExtendedWebContentsObserver* obs) { // Trying to remove from an empty collection leads to an access violation - if (observers_.might_have_observers()) + if (!observers_.empty()) observers_.RemoveObserver(obs); } From eccfa516c59780deba7fbf70fdd4e313b0000666 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 15:08:38 -0800 Subject: [PATCH 08/85] refactor: CertVerifier is not in the network namespace anymore Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2689805 --- shell/browser/electron_browser_client.cc | 2 +- shell/browser/electron_browser_client.h | 2 +- shell/browser/net/network_context_service.cc | 2 +- shell/browser/net/network_context_service.h | 3 ++- shell/browser/net/system_network_context_manager.cc | 5 +++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 7ae833bb084a..fd1f23405d47 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -1068,7 +1068,7 @@ void ElectronBrowserClient::ConfigureNetworkContextParams( bool in_memory, const base::FilePath& relative_partition_path, network::mojom::NetworkContextParams* network_context_params, - network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) { + cert_verifier::mojom::CertVerifierCreationParams* cert_verifier_creation_params) { DCHECK(browser_context); return NetworkContextServiceFactory::GetForContext(browser_context) ->ConfigureNetworkContextParams(network_context_params, diff --git a/shell/browser/electron_browser_client.h b/shell/browser/electron_browser_client.h index abda113521ee..f962e4cfd599 100644 --- a/shell/browser/electron_browser_client.h +++ b/shell/browser/electron_browser_client.h @@ -163,7 +163,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient, bool in_memory, const base::FilePath& relative_partition_path, network::mojom::NetworkContextParams* network_context_params, - network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) + cert_verifier::mojom::CertVerifierCreationParams* cert_verifier_creation_params) override; network::mojom::NetworkContext* GetSystemNetworkContext() override; content::MediaObserver* GetMediaObserver() override; diff --git a/shell/browser/net/network_context_service.cc b/shell/browser/net/network_context_service.cc index e7c8ea19500a..99649c6b41b8 100644 --- a/shell/browser/net/network_context_service.cc +++ b/shell/browser/net/network_context_service.cc @@ -26,7 +26,7 @@ NetworkContextService::~NetworkContextService() = default; void NetworkContextService::ConfigureNetworkContextParams( network::mojom::NetworkContextParams* network_context_params, - network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) { + cert_verifier::mojom::CertVerifierCreationParams* cert_verifier_creation_params) { bool in_memory = browser_context_->IsOffTheRecord(); const base::FilePath& path = browser_context_->GetPath(); diff --git a/shell/browser/net/network_context_service.h b/shell/browser/net/network_context_service.h index be5e92b905c6..ef0c3fdebb74 100644 --- a/shell/browser/net/network_context_service.h +++ b/shell/browser/net/network_context_service.h @@ -9,6 +9,7 @@ #include "chrome/browser/net/proxy_config_monitor.h" #include "components/keyed_service/core/keyed_service.h" #include "mojo/public/cpp/bindings/remote.h" +#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom.h" #include "services/network/public/mojom/network_context.mojom.h" #include "shell/browser/electron_browser_context.h" @@ -26,7 +27,7 @@ class NetworkContextService : public KeyedService { void ConfigureNetworkContextParams( network::mojom::NetworkContextParams* network_context_params, - network::mojom::CertVerifierCreationParams* + cert_verifier::mojom::CertVerifierCreationParams* cert_verifier_creation_params); private: diff --git a/shell/browser/net/system_network_context_manager.cc b/shell/browser/net/system_network_context_manager.cc index f2454e27fa3a..7ca2308a8361 100644 --- a/shell/browser/net/system_network_context_manager.cc +++ b/shell/browser/net/system_network_context_manager.cc @@ -15,6 +15,7 @@ #include "content/public/common/content_features.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "net/net_buildflags.h" +#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom.h" #include "services/network/network_service.h" #include "services/network/public/cpp/cross_thread_pending_shared_url_loader_factory.h" #include "services/network/public/cpp/features.h" @@ -157,8 +158,8 @@ SystemNetworkContextManager::CreateDefaultNetworkContextParams() { ConfigureDefaultNetworkContextParams(network_context_params.get()); - network::mojom::CertVerifierCreationParamsPtr cert_verifier_creation_params = - network::mojom::CertVerifierCreationParams::New(); + cert_verifier::mojom::CertVerifierCreationParamsPtr cert_verifier_creation_params = + cert_verifier::mojom::CertVerifierCreationParams::New(); network_context_params->cert_verifier_params = content::GetCertVerifierParams(std::move(cert_verifier_creation_params)); return network_context_params; From 2fed02556deac66e6ee5d1606c55fa073d6219e0 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 15:15:58 -0800 Subject: [PATCH 09/85] refactor: ExtensionUserScriptManager is now UserScriptManager Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2657617 --- .../browser/extensions/electron_extension_system.cc | 12 ++++++------ shell/browser/extensions/electron_extension_system.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/shell/browser/extensions/electron_extension_system.cc b/shell/browser/extensions/electron_extension_system.cc index 20ffcc552ee6..30beafcf4d94 100644 --- a/shell/browser/extensions/electron_extension_system.cc +++ b/shell/browser/extensions/electron_extension_system.cc @@ -24,7 +24,6 @@ #include "electron/buildflags/buildflags.h" #include "extensions/browser/api/app_runtime/app_runtime_api.h" #include "extensions/browser/extension_registry.h" -#include "extensions/browser/extension_user_script_manager.h" #include "extensions/browser/info_map.h" #include "extensions/browser/management_policy.h" #include "extensions/browser/notification_types.h" @@ -32,6 +31,7 @@ #include "extensions/browser/quota_service.h" #include "extensions/browser/runtime_data.h" #include "extensions/browser/service_worker_manager.h" +#include "extensions/browser/user_script_manager.h" #include "extensions/browser/value_store/value_store_factory_impl.h" #include "extensions/common/constants.h" #include "extensions/common/file_util.h" @@ -84,8 +84,8 @@ void ElectronExtensionSystem::InitForRegularProfile(bool extensions_enabled) { runtime_data_ = std::make_unique(ExtensionRegistry::Get(browser_context_)); quota_service_ = std::make_unique(); - extension_user_script_manager_ = - std::make_unique(browser_context_); + user_script_manager_ = + std::make_unique(browser_context_); app_sorting_ = std::make_unique(); extension_loader_ = std::make_unique(browser_context_); @@ -140,9 +140,9 @@ ServiceWorkerManager* ElectronExtensionSystem::service_worker_manager() { return service_worker_manager_.get(); } -ExtensionUserScriptManager* -ElectronExtensionSystem::extension_user_script_manager() { - return new ExtensionUserScriptManager(browser_context_); +UserScriptManager* +ElectronExtensionSystem::user_script_manager() { + return new UserScriptManager(browser_context_); } StateStore* ElectronExtensionSystem::state_store() { diff --git a/shell/browser/extensions/electron_extension_system.h b/shell/browser/extensions/electron_extension_system.h index 53dc8cccf6ad..09b06f9bc7f8 100644 --- a/shell/browser/extensions/electron_extension_system.h +++ b/shell/browser/extensions/electron_extension_system.h @@ -61,7 +61,7 @@ class ElectronExtensionSystem : public ExtensionSystem { RuntimeData* runtime_data() override; ManagementPolicy* management_policy() override; ServiceWorkerManager* service_worker_manager() override; - ExtensionUserScriptManager* extension_user_script_manager() override; + UserScriptManager* user_script_manager() override; StateStore* state_store() override; StateStore* rules_store() override; scoped_refptr store_factory() override; @@ -103,7 +103,7 @@ class ElectronExtensionSystem : public ExtensionSystem { std::unique_ptr service_worker_manager_; std::unique_ptr runtime_data_; std::unique_ptr quota_service_; - std::unique_ptr extension_user_script_manager_; + std::unique_ptr user_script_manager_; std::unique_ptr app_sorting_; std::unique_ptr management_policy_; From 0d94e0d1d9ed21b801026a113f038f5da3c4a887 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 15:30:36 -0800 Subject: [PATCH 10/85] refactor: content::SiteInstance::GetSiteForURL was removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2680274 --- shell/browser/electron_browser_client.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index fd1f23405d47..5d071fe5b185 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -46,6 +46,7 @@ #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" +#include "content/browser/site_instance_impl.h" #include "electron/buildflags/buildflags.h" #include "electron/grit/electron_resources.h" #include "electron/shell/common/api/api.mojom.h" @@ -195,6 +196,11 @@ namespace { // Next navigation should not restart renderer process. bool g_suppress_renderer_process_restart = false; +// c.f. https://chromium-review.googlesource.com/c/chromium/src/+/2680274 +content::SiteInfo GetSiteForURL(content::BrowserContext* browser_context, const GURL& url) { + return content::SiteInfo::Create(content::IsolationContext(browser_context), content::UrlInfo(url, false), content::CoopCoepCrossOriginIsolatedInfo::CreateNonIsolated()); +} + bool IsSameWebSite(content::BrowserContext* browser_context, content::SiteInstance* site_instance, const GURL& dest_url) { @@ -202,7 +208,7 @@ bool IsSameWebSite(content::BrowserContext* browser_context, // `IsSameSiteWithURL` doesn't seem to work for some URIs such as // `file:`, handle these scenarios by comparing only the site as // defined by `GetSiteForURL`. - (content::SiteInstance::GetSiteForURL(browser_context, dest_url) == + (GetSiteForURL(browser_context, dest_url).site_url() == site_instance->GetSiteURL()); } @@ -499,7 +505,7 @@ content::SiteInstance* ElectronBrowserClient::GetSiteInstanceFromAffinity( std::string affinity = GetAffinityPreference(rfh); if (!affinity.empty()) { auto iter = site_per_affinities_.find(affinity); - GURL dest_site = content::SiteInstance::GetSiteForURL(browser_context, url); + GURL dest_site = GetSiteForURL(browser_context, url).site_url(); if (iter != site_per_affinities_.end() && IsSameWebSite(browser_context, iter->second, dest_site)) { return iter->second; From 1a296e59c2d413978739ddbea4022abaf4f1b8bb Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 15:36:52 -0800 Subject: [PATCH 11/85] refactor: MenuItemType was moved to mojom Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2071443 --- shell/common/gin_converters/content_converter.cc | 14 +++++++------- shell/common/gin_converters/content_converter.h | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/shell/common/gin_converters/content_converter.cc b/shell/common/gin_converters/content_converter.cc index 953f0cd48d9e..4b308f4fb3d9 100644 --- a/shell/common/gin_converters/content_converter.cc +++ b/shell/common/gin_converters/content_converter.cc @@ -110,19 +110,19 @@ struct Converter { }; // static -v8::Local Converter::ToV8( +v8::Local Converter::ToV8( v8::Isolate* isolate, - const blink::MenuItem::Type& val) { + const blink::mojom::MenuItem::Type& val) { switch (val) { - case blink::MenuItem::CHECKABLE_OPTION: + case blink::mojom::MenuItem::Type::kCheckableOption: return StringToV8(isolate, "checkbox"); - case blink::MenuItem::GROUP: + case blink::mojom::MenuItem::Type::kGroup: return StringToV8(isolate, "radio"); - case blink::MenuItem::SEPARATOR: + case blink::mojom::MenuItem::Type::kSeparator: return StringToV8(isolate, "separator"); - case blink::MenuItem::SUBMENU: + case blink::mojom::MenuItem::Type::kSubMenu: return StringToV8(isolate, "submenu"); - case blink::MenuItem::OPTION: + case blink::mojom::MenuItem::Type::kOption: default: return StringToV8(isolate, "normal"); } diff --git a/shell/common/gin_converters/content_converter.h b/shell/common/gin_converters/content_converter.h index 8b0e5adb3ab5..9ec846004d98 100644 --- a/shell/common/gin_converters/content_converter.h +++ b/shell/common/gin_converters/content_converter.h @@ -11,7 +11,6 @@ #include "content/public/common/referrer.h" #include "content/public/common/stop_find_action.h" #include "gin/converter.h" -#include "third_party/blink/public/common/context_menu_data/menu_item.h" #include "third_party/blink/public/mojom/permissions/permission_status.mojom.h" namespace content { @@ -26,9 +25,9 @@ using ContextMenuParamsWithWebContents = namespace gin { template <> -struct Converter { +struct Converter { static v8::Local ToV8(v8::Isolate* isolate, - const blink::MenuItem::Type& val); + const blink::mojom::MenuItem::Type& val); }; template <> From dc36e8e6fc9afceb69f2a554c5670bddaead380b Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 15:41:32 -0800 Subject: [PATCH 12/85] refactor: extensions::ViewType was moved to mojom Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2710351 --- .../browser/api/electron_api_web_contents.cc | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 96725e4b6019..cf97c5b2c4fd 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -157,6 +157,7 @@ #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) #include "extensions/browser/script_executor.h" #include "extensions/browser/view_type_utils.h" +#include "extensions/common/mojom/view_type.mojom.h" #include "shell/browser/extensions/electron_extension_web_contents_observer.h" #endif @@ -593,17 +594,17 @@ bool IsDevToolsFileSystemAdded(content::WebContents* web_contents, WebContents::Type GetTypeFromViewType(extensions::mojom::ViewType view_type) { switch (view_type) { - case extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: + case extensions::mojom::ViewType::kExtensionBackgroundPage: return WebContents::Type::kBackgroundPage; - case extensions::VIEW_TYPE_APP_WINDOW: - case extensions::VIEW_TYPE_COMPONENT: - case extensions::VIEW_TYPE_EXTENSION_DIALOG: - case extensions::VIEW_TYPE_EXTENSION_POPUP: - case extensions::VIEW_TYPE_BACKGROUND_CONTENTS: - case extensions::VIEW_TYPE_EXTENSION_GUEST: - case extensions::VIEW_TYPE_TAB_CONTENTS: - case extensions::VIEW_TYPE_INVALID: + case extensions::mojom::ViewType::kAppWindow: + case extensions::mojom::ViewType::kComponent: + case extensions::mojom::ViewType::kExtensionDialog: + case extensions::mojom::ViewType::kExtensionPopup: + case extensions::mojom::ViewType::kBackgroundContents: + case extensions::mojom::ViewType::kExtensionGuest: + case extensions::mojom::ViewType::kTabContents: + case extensions::mojom::ViewType::kInvalid: return WebContents::Type::kRemote; } } @@ -626,7 +627,7 @@ WebContents::WebContents(v8::Isolate* isolate, #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) // WebContents created by extension host will have valid ViewType set. extensions::mojom::ViewType view_type = extensions::GetViewType(web_contents); - if (view_type != extensions::VIEW_TYPE_INVALID) { + if (view_type != extensions::mojom::ViewType::kInvalid) { InitWithExtensionView(isolate, web_contents, view_type); } From 59669e99cbfe98458dc314a5ebd55dccd5a7c6e8 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 16:00:59 -0800 Subject: [PATCH 13/85] refacotr: grit::ResourceMap replaced with webui::ResourcePath Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2685601 --- .../electron_component_extension_resource_manager.cc | 8 ++++---- .../electron_component_extension_resource_manager.h | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/shell/browser/extensions/electron_component_extension_resource_manager.cc b/shell/browser/extensions/electron_component_extension_resource_manager.cc index 58309f93bdb5..2ef745f083ba 100644 --- a/shell/browser/extensions/electron_component_extension_resource_manager.cc +++ b/shell/browser/extensions/electron_component_extension_resource_manager.cc @@ -82,7 +82,7 @@ ElectronComponentExtensionResourceManager::GetTemplateReplacementsForExtension( } void ElectronComponentExtensionResourceManager::AddComponentResourceEntries( - const GritResourceMap* entries, + const webui::ResourcePath* entries, size_t size) { base::FilePath gen_folder_path = base::FilePath().AppendASCII( "@out_folder@/gen/chrome/browser/resources/"); @@ -90,12 +90,12 @@ void ElectronComponentExtensionResourceManager::AddComponentResourceEntries( for (size_t i = 0; i < size; ++i) { base::FilePath resource_path = - base::FilePath().AppendASCII(entries[i].name); + base::FilePath().AppendASCII(entries[i].path); resource_path = resource_path.NormalizePathSeparators(); if (!gen_folder_path.IsParent(resource_path)) { DCHECK(!base::Contains(path_to_resource_id_, resource_path)); - path_to_resource_id_[resource_path] = entries[i].value; + path_to_resource_id_[resource_path] = entries[i].id; } else { // If the resource is a generated file, strip the generated folder's path, // so that it can be served from a normal URL (as if it were not @@ -104,7 +104,7 @@ void ElectronComponentExtensionResourceManager::AddComponentResourceEntries( base::FilePath().AppendASCII(resource_path.AsUTF8Unsafe().substr( gen_folder_path.value().length())); DCHECK(!base::Contains(path_to_resource_id_, effective_path)); - path_to_resource_id_[effective_path] = entries[i].value; + path_to_resource_id_[effective_path] = entries[i].id; } } } diff --git a/shell/browser/extensions/electron_component_extension_resource_manager.h b/shell/browser/extensions/electron_component_extension_resource_manager.h index 5823ea5b2bd3..6af44b0a95c1 100644 --- a/shell/browser/extensions/electron_component_extension_resource_manager.h +++ b/shell/browser/extensions/electron_component_extension_resource_manager.h @@ -13,6 +13,7 @@ #include "base/files/file_path.h" #include "base/macros.h" #include "extensions/browser/component_extension_resource_manager.h" +#include "ui/base/webui/resource_path.h" struct GritResourceMap; @@ -32,7 +33,7 @@ class ElectronComponentExtensionResourceManager const std::string& extension_id) const override; private: - void AddComponentResourceEntries(const GritResourceMap* entries, size_t size); + void AddComponentResourceEntries(const webui::ResourcePath* entries, size_t size); // A map from a resource path to the resource ID. Used by // IsComponentExtensionResource. From be627568b23f6178184669b67b9399dbd354c50d Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 16:39:01 -0800 Subject: [PATCH 14/85] refactor: blink::MenuItem::Type was moved to mojom Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2071443 --- .../gin_converters/content_converter.cc | 55 ------------------- .../common/gin_converters/content_converter.h | 1 + 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/shell/common/gin_converters/content_converter.cc b/shell/common/gin_converters/content_converter.cc index 4b308f4fb3d9..ac68e60250f5 100644 --- a/shell/common/gin_converters/content_converter.cc +++ b/shell/common/gin_converters/content_converter.cc @@ -21,61 +21,6 @@ #include "ui/events/keycodes/dom/keycode_converter.h" #include "ui/events/keycodes/keyboard_code_conversion.h" -namespace { - -void ExecuteCommand(content::WebContents* web_contents, - int action, - const GURL& link_followed) { - web_contents->ExecuteCustomContextMenuCommand(action, link_followed); -} - -// Forward declaration for nested recursive call. -v8::Local MenuToV8(v8::Isolate* isolate, - content::WebContents* web_contents, - const GURL& link_followed, - const std::vector& menu); - -v8::Local MenuItemToV8(v8::Isolate* isolate, - content::WebContents* web_contents, - const GURL& link_followed, - const blink::MenuItem& item) { - gin_helper::Dictionary v8_item = gin::Dictionary::CreateEmpty(isolate); - switch (item.type) { - case blink::MenuItem::CHECKABLE_OPTION: - case blink::MenuItem::GROUP: - v8_item.Set("checked", item.checked); - FALLTHROUGH; - case blink::MenuItem::OPTION: - case blink::MenuItem::SUBMENU: - v8_item.Set("label", item.label); - v8_item.Set("enabled", item.enabled); - FALLTHROUGH; - default: - v8_item.Set("type", item.type); - } - if (item.type == blink::MenuItem::SUBMENU) - v8_item.Set("submenu", - MenuToV8(isolate, web_contents, link_followed, item.submenu)); - else if (item.action > 0) - v8_item.Set("click", base::BindRepeating(ExecuteCommand, web_contents, - item.action, link_followed)); - return v8_item.GetHandle(); -} - -v8::Local MenuToV8(v8::Isolate* isolate, - content::WebContents* web_contents, - const GURL& link_followed, - const std::vector& menu) { - std::vector> v8_menu; - v8_menu.reserve(menu.size()); - for (const auto& menu_item : menu) - v8_menu.push_back( - MenuItemToV8(isolate, web_contents, link_followed, menu_item)); - return gin::ConvertToV8(isolate, v8_menu); -} - -} // namespace - namespace gin { template <> diff --git a/shell/common/gin_converters/content_converter.h b/shell/common/gin_converters/content_converter.h index 9ec846004d98..61f846c987f8 100644 --- a/shell/common/gin_converters/content_converter.h +++ b/shell/common/gin_converters/content_converter.h @@ -11,6 +11,7 @@ #include "content/public/common/referrer.h" #include "content/public/common/stop_find_action.h" #include "gin/converter.h" +#include "third_party/blink/public/mojom/choosers/popup_menu.mojom.h" #include "third_party/blink/public/mojom/permissions/permission_status.mojom.h" namespace content { From 77ad17b38357e240b1eade74b13703b41030f978 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 16:42:15 -0800 Subject: [PATCH 15/85] refactor: CreateDataPipe deprecated form was removed Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2698090 --- shell/browser/net/electron_url_loader_factory.cc | 4 ++-- shell/browser/net/node_stream_loader.cc | 2 +- shell/browser/net/url_pipe_loader.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/browser/net/electron_url_loader_factory.cc b/shell/browser/net/electron_url_loader_factory.cc index 6944e0da67a1..2f670eeb598b 100644 --- a/shell/browser/net/electron_url_loader_factory.cc +++ b/shell/browser/net/electron_url_loader_factory.cc @@ -501,7 +501,7 @@ void ElectronURLLoaderFactory::StartLoadingStream( client_remote->OnReceiveResponse(std::move(head)); mojo::ScopedDataPipeProducerHandle producer; mojo::ScopedDataPipeConsumerHandle consumer; - if (mojo::CreateDataPipe(nullptr, &producer, &consumer) != MOJO_RESULT_OK) { + if (mojo::CreateDataPipe(nullptr, producer, consumer) != MOJO_RESULT_OK) { client_remote->OnComplete( network::URLLoaderCompletionStatus(net::ERR_INSUFFICIENT_RESOURCES)); return; @@ -548,7 +548,7 @@ void ElectronURLLoaderFactory::SendContents( // Code bellow follows the pattern of data_url_loader_factory.cc. mojo::ScopedDataPipeProducerHandle producer; mojo::ScopedDataPipeConsumerHandle consumer; - if (mojo::CreateDataPipe(nullptr, &producer, &consumer) != MOJO_RESULT_OK) { + if (mojo::CreateDataPipe(nullptr, producer, consumer) != MOJO_RESULT_OK) { client_remote->OnComplete( network::URLLoaderCompletionStatus(net::ERR_INSUFFICIENT_RESOURCES)); return; diff --git a/shell/browser/net/node_stream_loader.cc b/shell/browser/net/node_stream_loader.cc index a6925494639f..423216a4db6e 100644 --- a/shell/browser/net/node_stream_loader.cc +++ b/shell/browser/net/node_stream_loader.cc @@ -52,7 +52,7 @@ NodeStreamLoader::~NodeStreamLoader() { void NodeStreamLoader::Start(network::mojom::URLResponseHeadPtr head) { mojo::ScopedDataPipeProducerHandle producer; mojo::ScopedDataPipeConsumerHandle consumer; - MojoResult rv = mojo::CreateDataPipe(nullptr, &producer, &consumer); + MojoResult rv = mojo::CreateDataPipe(nullptr, producer, consumer); if (rv != MOJO_RESULT_OK) { NotifyComplete(net::ERR_INSUFFICIENT_RESOURCES); return; diff --git a/shell/browser/net/url_pipe_loader.cc b/shell/browser/net/url_pipe_loader.cc index a290478f4af4..39a4152e6477 100644 --- a/shell/browser/net/url_pipe_loader.cc +++ b/shell/browser/net/url_pipe_loader.cc @@ -61,7 +61,7 @@ void URLPipeLoader::OnResponseStarted( const network::mojom::URLResponseHead& response_head) { mojo::ScopedDataPipeProducerHandle producer; mojo::ScopedDataPipeConsumerHandle consumer; - MojoResult rv = mojo::CreateDataPipe(nullptr, &producer, &consumer); + MojoResult rv = mojo::CreateDataPipe(nullptr, producer, consumer); if (rv != MOJO_RESULT_OK) { NotifyComplete(net::ERR_INSUFFICIENT_RESOURCES); return; From 4e02d9407a7fab96f9bf3fae313eaed8a9c9a46e Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 16:46:44 -0800 Subject: [PATCH 16/85] refactor: DesktopMediaList::Type replaces content::DesktopMediaType_* Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2700637 --- shell/browser/api/electron_api_desktop_capturer.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/browser/api/electron_api_desktop_capturer.cc b/shell/browser/api/electron_api_desktop_capturer.cc index a6b406afe05f..4f2331c5afae 100644 --- a/shell/browser/api/electron_api_desktop_capturer.cc +++ b/shell/browser/api/electron_api_desktop_capturer.cc @@ -96,7 +96,7 @@ void DesktopCapturer::StartHandling(bool capture_window, // Apply the new thumbnail size and restart capture. if (capture_window) { window_capturer_ = std::make_unique( - content::DesktopMediaID::TYPE_WINDOW, + DesktopMediaList::Type::kWindow, content::desktop_capture::CreateWindowCapturer()); window_capturer_->SetThumbnailSize(thumbnail_size); window_capturer_->AddObserver(this); @@ -107,7 +107,7 @@ void DesktopCapturer::StartHandling(bool capture_window, if (capture_screen) { screen_capturer_ = std::make_unique( - content::DesktopMediaID::TYPE_SCREEN, + DesktopMediaList::Type::kScreen, content::desktop_capture::CreateScreenCapturer()); screen_capturer_->SetThumbnailSize(thumbnail_size); screen_capturer_->AddObserver(this); @@ -124,7 +124,7 @@ void DesktopCapturer::OnSourceUnchanged(DesktopMediaList* list) { void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) { if (capture_window_ && - list->GetMediaListType() == content::DesktopMediaID::TYPE_WINDOW) { + list->GetMediaListType() == DesktopMediaList::Type::kWindow) { capture_window_ = false; const auto& media_list_sources = list->GetSources(); std::vector window_sources; @@ -138,7 +138,7 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) { } if (capture_screen_ && - list->GetMediaListType() == content::DesktopMediaID::TYPE_SCREEN) { + list->GetMediaListType() == DesktopMediaList::Type::kScreen) { capture_screen_ = false; const auto& media_list_sources = list->GetSources(); std::vector screen_sources; From f51f427646bf2d8a29614a34eb0aee0f495548a4 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 16:50:32 -0800 Subject: [PATCH 17/85] chore: wire up activation_time in OSR Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2638372 --- shell/browser/osr/osr_render_widget_host_view.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index 449e296929db..38b32b81455a 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -144,8 +144,8 @@ class ElectronDelegatedFrameHostClient return *view_->GetBackgroundColor(); } - void OnFrameTokenChanged(uint32_t frame_token) override { - view_->render_widget_host()->DidProcessFrame(frame_token); + void OnFrameTokenChanged(uint32_t frame_token, base::TimeTicks activation_time) override { + view_->render_widget_host()->DidProcessFrame(frame_token, activation_time); } float GetDeviceScaleFactor() const override { From 59432fe30ac4173ff0a9f13248b5f80468545f24 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 16:51:11 -0800 Subject: [PATCH 18/85] chore: remove deleted file from chromium_src list --- chromium_src/BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/chromium_src/BUILD.gn b/chromium_src/BUILD.gn index 4fdd2a0ead9b..940ecee0381f 100644 --- a/chromium_src/BUILD.gn +++ b/chromium_src/BUILD.gn @@ -44,7 +44,6 @@ static_library("chrome") { "//chrome/browser/predictors/resolve_host_client_impl.h", "//chrome/browser/ssl/security_state_tab_helper.cc", "//chrome/browser/ssl/security_state_tab_helper.h", - "//chrome/browser/ssl/tls_deprecation_config.cc", "//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc", "//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h", "//extensions/browser/app_window/size_constraints.cc", From 54cc68dd7a818a89dcea522282a819f7b49753fc Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Fri, 5 Mar 2021 16:54:18 -0800 Subject: [PATCH 19/85] chore: fix lint --- shell/browser/electron_browser_client.cc | 12 ++++++++---- shell/browser/electron_browser_client.h | 4 ++-- .../electron_component_extension_resource_manager.h | 3 ++- .../browser/extensions/electron_extension_system.cc | 6 ++---- shell/browser/net/network_context_service.cc | 3 ++- shell/browser/net/system_network_context_manager.cc | 5 +++-- shell/browser/osr/osr_render_widget_host_view.cc | 3 ++- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 5d071fe5b185..fafb02ebdff1 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -30,6 +30,7 @@ #include "chrome/common/chrome_version.h" #include "components/net_log/chrome_net_log.h" #include "components/network_hints/common/network_hints.mojom.h" +#include "content/browser/site_instance_impl.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/browser_task_traits.h" @@ -46,7 +47,6 @@ #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" #include "content/public/common/url_constants.h" -#include "content/browser/site_instance_impl.h" #include "electron/buildflags/buildflags.h" #include "electron/grit/electron_resources.h" #include "electron/shell/common/api/api.mojom.h" @@ -197,8 +197,11 @@ namespace { bool g_suppress_renderer_process_restart = false; // c.f. https://chromium-review.googlesource.com/c/chromium/src/+/2680274 -content::SiteInfo GetSiteForURL(content::BrowserContext* browser_context, const GURL& url) { - return content::SiteInfo::Create(content::IsolationContext(browser_context), content::UrlInfo(url, false), content::CoopCoepCrossOriginIsolatedInfo::CreateNonIsolated()); +content::SiteInfo GetSiteForURL(content::BrowserContext* browser_context, + const GURL& url) { + return content::SiteInfo::Create( + content::IsolationContext(browser_context), content::UrlInfo(url, false), + content::CoopCoepCrossOriginIsolatedInfo::CreateNonIsolated()); } bool IsSameWebSite(content::BrowserContext* browser_context, @@ -1074,7 +1077,8 @@ void ElectronBrowserClient::ConfigureNetworkContextParams( bool in_memory, const base::FilePath& relative_partition_path, network::mojom::NetworkContextParams* network_context_params, - cert_verifier::mojom::CertVerifierCreationParams* cert_verifier_creation_params) { + cert_verifier::mojom::CertVerifierCreationParams* + cert_verifier_creation_params) { DCHECK(browser_context); return NetworkContextServiceFactory::GetForContext(browser_context) ->ConfigureNetworkContextParams(network_context_params, diff --git a/shell/browser/electron_browser_client.h b/shell/browser/electron_browser_client.h index f962e4cfd599..3a73958b01db 100644 --- a/shell/browser/electron_browser_client.h +++ b/shell/browser/electron_browser_client.h @@ -163,8 +163,8 @@ class ElectronBrowserClient : public content::ContentBrowserClient, bool in_memory, const base::FilePath& relative_partition_path, network::mojom::NetworkContextParams* network_context_params, - cert_verifier::mojom::CertVerifierCreationParams* cert_verifier_creation_params) - override; + cert_verifier::mojom::CertVerifierCreationParams* + cert_verifier_creation_params) override; network::mojom::NetworkContext* GetSystemNetworkContext() override; content::MediaObserver* GetMediaObserver() override; content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override; diff --git a/shell/browser/extensions/electron_component_extension_resource_manager.h b/shell/browser/extensions/electron_component_extension_resource_manager.h index 6af44b0a95c1..499928f2da9b 100644 --- a/shell/browser/extensions/electron_component_extension_resource_manager.h +++ b/shell/browser/extensions/electron_component_extension_resource_manager.h @@ -33,7 +33,8 @@ class ElectronComponentExtensionResourceManager const std::string& extension_id) const override; private: - void AddComponentResourceEntries(const webui::ResourcePath* entries, size_t size); + void AddComponentResourceEntries(const webui::ResourcePath* entries, + size_t size); // A map from a resource path to the resource ID. Used by // IsComponentExtensionResource. diff --git a/shell/browser/extensions/electron_extension_system.cc b/shell/browser/extensions/electron_extension_system.cc index 30beafcf4d94..81de1bf9732e 100644 --- a/shell/browser/extensions/electron_extension_system.cc +++ b/shell/browser/extensions/electron_extension_system.cc @@ -84,8 +84,7 @@ void ElectronExtensionSystem::InitForRegularProfile(bool extensions_enabled) { runtime_data_ = std::make_unique(ExtensionRegistry::Get(browser_context_)); quota_service_ = std::make_unique(); - user_script_manager_ = - std::make_unique(browser_context_); + user_script_manager_ = std::make_unique(browser_context_); app_sorting_ = std::make_unique(); extension_loader_ = std::make_unique(browser_context_); @@ -140,8 +139,7 @@ ServiceWorkerManager* ElectronExtensionSystem::service_worker_manager() { return service_worker_manager_.get(); } -UserScriptManager* -ElectronExtensionSystem::user_script_manager() { +UserScriptManager* ElectronExtensionSystem::user_script_manager() { return new UserScriptManager(browser_context_); } diff --git a/shell/browser/net/network_context_service.cc b/shell/browser/net/network_context_service.cc index 99649c6b41b8..a99cdb99eb2a 100644 --- a/shell/browser/net/network_context_service.cc +++ b/shell/browser/net/network_context_service.cc @@ -26,7 +26,8 @@ NetworkContextService::~NetworkContextService() = default; void NetworkContextService::ConfigureNetworkContextParams( network::mojom::NetworkContextParams* network_context_params, - cert_verifier::mojom::CertVerifierCreationParams* cert_verifier_creation_params) { + cert_verifier::mojom::CertVerifierCreationParams* + cert_verifier_creation_params) { bool in_memory = browser_context_->IsOffTheRecord(); const base::FilePath& path = browser_context_->GetPath(); diff --git a/shell/browser/net/system_network_context_manager.cc b/shell/browser/net/system_network_context_manager.cc index 7ca2308a8361..03385e1a749f 100644 --- a/shell/browser/net/system_network_context_manager.cc +++ b/shell/browser/net/system_network_context_manager.cc @@ -158,8 +158,9 @@ SystemNetworkContextManager::CreateDefaultNetworkContextParams() { ConfigureDefaultNetworkContextParams(network_context_params.get()); - cert_verifier::mojom::CertVerifierCreationParamsPtr cert_verifier_creation_params = - cert_verifier::mojom::CertVerifierCreationParams::New(); + cert_verifier::mojom::CertVerifierCreationParamsPtr + cert_verifier_creation_params = + cert_verifier::mojom::CertVerifierCreationParams::New(); network_context_params->cert_verifier_params = content::GetCertVerifierParams(std::move(cert_verifier_creation_params)); return network_context_params; diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index 38b32b81455a..59f0568a5aaa 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -144,7 +144,8 @@ class ElectronDelegatedFrameHostClient return *view_->GetBackgroundColor(); } - void OnFrameTokenChanged(uint32_t frame_token, base::TimeTicks activation_time) override { + void OnFrameTokenChanged(uint32_t frame_token, + base::TimeTicks activation_time) override { view_->render_widget_host()->DidProcessFrame(frame_token, activation_time); } From e99e6a5a8a47729daa367089804fd5e91feb4a24 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Sat, 6 Mar 2021 01:03:38 +0000 Subject: [PATCH 20/85] update patches --- .../chromium/add_trustedauthclient_to_urlloaderfactory.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch b/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch index d7c75bb39cb9..065e264737eb 100644 --- a/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch +++ b/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch @@ -50,7 +50,7 @@ index cfa9d0c197ca9851f13b088ecae4aba614c7ac55..d93a6ce481630535b75d858e5b7b04e5 // cookies) and to shard network resources, like the cache. If set, takes // precedence over ResourceRequest::TrustedParams::IsolationInfo field diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index ce483753dff0130c5ac20258c0cf7e399c0d1c51..dea741c526f10616c3779f76a6d9cf8aece4210a 100644 +index ce483753dff0130c5ac20258c0cf7e399c0d1c51..0e31b92419e124136447efc6a1642ade5eaa0a5e 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc @@ -463,6 +463,7 @@ URLLoader::URLLoader( From b36292780fe2aeaaddbe0c1550fe17b41ebb4db8 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Sat, 6 Mar 2021 05:00:21 -0800 Subject: [PATCH 21/85] chore: bump chromium in DEPS to 91.0.4438.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index bc21aefe21a0..522eca0ffc57 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4435.3', + '91.0.4438.0', 'node_version': 'v14.16.0', 'nan_version': From ee0ab6f3920938c40dba30471351689c44af8f73 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Sun, 7 Mar 2021 05:00:15 -0800 Subject: [PATCH 22/85] chore: bump chromium in DEPS to 91.0.4439.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 522eca0ffc57..740416cc25d3 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4438.0', + '91.0.4439.0', 'node_version': 'v14.16.0', 'nan_version': From 8949b8a462758d35f1c3080d35de6e9a6b112b2c Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Mon, 8 Mar 2021 05:00:14 -0800 Subject: [PATCH 23/85] chore: bump chromium in DEPS to 91.0.4440.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 740416cc25d3..e715dcf6deb5 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4439.0', + '91.0.4440.0', 'node_version': 'v14.16.0', 'nan_version': From ab943d78b2e9b2c0e9fc063df64e7a2242cee5f1 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 9 Mar 2021 05:00:42 -0800 Subject: [PATCH 24/85] chore: bump chromium in DEPS to 91.0.4441.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index e715dcf6deb5..a16dbc22932a 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4440.0', + '91.0.4441.0', 'node_version': 'v14.16.0', 'nan_version': From 8c6027c519298889f54a5c412b590c920096653c Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 10 Mar 2021 05:01:20 -0800 Subject: [PATCH 25/85] chore: bump chromium in DEPS to 91.0.4442.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index a16dbc22932a..d103beeaa389 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4441.0', + '91.0.4442.0', 'node_version': 'v14.16.0', 'nan_version': From 35cafdd1d84bc21e32bb1e6f3779492b9828a82e Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Thu, 11 Mar 2021 05:00:25 -0800 Subject: [PATCH 26/85] chore: bump chromium in DEPS to 91.0.4443.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index d103beeaa389..4bfc381825bd 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4442.0', + '91.0.4443.0', 'node_version': 'v14.16.0', 'nan_version': From 5e7ae59d299a7a0783f672901d85c66b87ba5947 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Sat, 13 Mar 2021 05:00:21 -0800 Subject: [PATCH 27/85] chore: bump chromium in DEPS to 91.0.4445.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 4bfc381825bd..020d51b29bde 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4443.0', + '91.0.4445.0', 'node_version': 'v14.16.0', 'nan_version': From f933c249fe0eb7c41a2296eac97c003997259190 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Sun, 14 Mar 2021 06:00:46 -0700 Subject: [PATCH 28/85] chore: bump chromium in DEPS to 91.0.4446.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 020d51b29bde..260d2e6c279a 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4445.0', + '91.0.4446.0', 'node_version': 'v14.16.0', 'nan_version': From 1e16606524ae8da57e01dd8707177d6969e33d95 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 15 Mar 2021 14:32:18 -0400 Subject: [PATCH 29/85] chore: update patches --- patches/boringssl/expose_aes-cfb.patch | 2 +- patches/chromium/.patches | 1 - patches/chromium/accelerator.patch | 10 +-- ...client_precreatemessageloop_callback.patch | 6 +- .../add_didinstallconditionalfeatures.patch | 30 ++++----- ...rustedauthclient_to_urlloaderfactory.patch | 48 +++++++------- ..._windows_to_have_different_web_prefs.patch | 4 +- ..._secondary_label_via_simplemenumodel.patch | 46 +++++++------- patches/chromium/blink_local_frame.patch | 12 ++-- patches/chromium/blink_world_context.patch | 8 +-- patches/chromium/build_gn.patch | 4 +- patches/chromium/can_create_window.patch | 36 +++++------ ...screationoverridden_with_full_params.patch | 42 ++++++------- ...esources_not_chrome_for_spellchecker.patch | 6 +- .../chromium/content_browser_main_loop.patch | 4 +- patches/chromium/dcheck.patch | 8 +-- ...ay_lock_the_protocol_scheme_registry.patch | 4 +- patches/chromium/desktop_media_list.patch | 17 ++--- patches/chromium/disable-redraw-lock.patch | 4 +- .../disable_color_correct_rendering.patch | 10 +-- .../disable_compositor_recycling.patch | 2 +- patches/chromium/disable_hidden.patch | 6 +- patches/chromium/disable_unload_metrics.patch | 6 +- ...ll_getwebframe_-_view_when_get_blink.patch | 4 +- .../chromium/enable_reset_aspect_ratio.patch | 4 +- ...xpose_setuseragent_on_networkcontext.patch | 12 ++-- ...dd_set_theme_source_to_allow_apps_to.patch | 18 +++--- ..._scheduler_throttling_per_renderview.patch | 22 +++---- ...screen_rendering_with_viz_compositor.patch | 10 +-- ...chdir_np_and_pthread_chdir_np_in_mas.patch | 8 +-- ..._properly_honor_printing_page_ranges.patch | 6 +- ...ns_through_the_web_contents_delegate.patch | 4 +- ...fix_use_electron_generated_resources.patch | 2 +- patches/chromium/frame_host_manager.patch | 32 +++++----- .../gin_enable_disable_v8_platform.patch | 2 +- .../chromium/gritsettings_resource_ids.patch | 4 +- .../mas_disable_remote_accessibility.patch | 12 ++-- patches/chromium/mas_no_private_api.patch | 54 ++++++++-------- ...emote_certificate_verification_logic.patch | 16 ++--- .../chromium/notification_provenance.patch | 14 ++--- ..._version_py_script_to_work_on_mac_ci.patch | 26 -------- patches/chromium/picture-in-picture.patch | 10 +-- patches/chromium/printing.patch | 62 +++++++++---------- ...put_back_deleted_colors_for_autofill.patch | 18 +++--- ...r_changes_to_the_webcontentsobserver.patch | 16 ++--- .../render_widget_host_view_base.patch | 12 ++-- .../render_widget_host_view_mac.patch | 2 +- patches/chromium/resource_file_conflict.patch | 6 +- ...ove_contentrendererclient_shouldfork.patch | 14 ++--- patches/chromium/scroll_bounce_flag.patch | 4 +- .../ssl_security_state_tab_helper.patch | 30 +++------ .../support_mixed_sandbox_with_zygote.patch | 60 +++++++++--------- ...andboxed_ppapi_processes_skip_zygote.patch | 2 +- .../upload_list_add_loadsync_method.patch | 6 +- patches/chromium/web_contents.patch | 12 ++-- patches/chromium/webview_cross_drag.patch | 2 +- .../worker_context_will_destroy.patch | 18 +++--- ...feat_add_hook_to_notify_script_ready.patch | 14 ++--- patches/v8/add_realloc.patch | 8 +-- patches/v8/build_gn.patch | 8 +-- patches/v8/dcheck.patch | 8 +-- ...export_private_v8_symbols_on_windows.patch | 4 +- ...ort_symbols_needed_for_windows_build.patch | 2 +- patches/v8/expose_mksnapshot.patch | 4 +- 64 files changed, 423 insertions(+), 465 deletions(-) delete mode 100644 patches/chromium/patch_the_ensure_gn_version_py_script_to_work_on_mac_ci.patch diff --git a/patches/boringssl/expose_aes-cfb.patch b/patches/boringssl/expose_aes-cfb.patch index 9db69edbe398..e517d269c225 100644 --- a/patches/boringssl/expose_aes-cfb.patch +++ b/patches/boringssl/expose_aes-cfb.patch @@ -57,7 +57,7 @@ index 53cb9d2dc8f1962a70dc12b648d27c32be8aca4b..84af06fc56e4aa72d4d48801d7c037ad callback(EVP_aes_192_ctr(), "aes-192-ctr", NULL, arg); callback(EVP_aes_256_ctr(), "aes-256-ctr", NULL, arg); diff --git a/include/openssl/cipher.h b/include/openssl/cipher.h -index 3feadea85aa2f60b3c4e2956040cf015a72aa5b1..988f98fb7cdc564cafc4d0d3fe1dd777e278b26e 100644 +index badd496293fb9748adacff10478ea702d1155c5f..8565934bac9a810281b04946cb9f38d7623320f7 100644 --- a/include/openssl/cipher.h +++ b/include/openssl/cipher.h @@ -430,6 +430,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des_ede3_ecb(void); diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 350412698dd1..ad688acde96e 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -50,7 +50,6 @@ fix_disable_usage_of_abort_report_np_in_mas_builds.patch fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch fix_disable_usage_of_setapplicationisdaemon_and.patch unsandboxed_ppapi_processes_skip_zygote.patch -patch_the_ensure_gn_version_py_script_to_work_on_mac_ci.patch build_add_electron_tracing_category.patch worker_context_will_destroy.patch frame_host_manager.patch diff --git a/patches/chromium/accelerator.patch b/patches/chromium/accelerator.patch index 781b8b780855..b8917189c22f 100644 --- a/patches/chromium/accelerator.patch +++ b/patches/chromium/accelerator.patch @@ -10,7 +10,7 @@ This patch makes three changes to Accelerator::GetShortcutText to improve shortc 3. Ctrl-Shift-= should show as Ctrl-+ diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc -index 17e1739c12ee38864e735130792321adadb43f08..7b0bfec6f18e883eb7ad7e3bfe564163592f584e 100644 +index 1a2a154b743cd4ecccf1be9971f36896e982dc6e..cbd5ce0929b956456424c4e6a159418f7eb91638 100644 --- a/ui/base/accelerators/accelerator.cc +++ b/ui/base/accelerators/accelerator.cc @@ -12,6 +12,7 @@ @@ -31,7 +31,7 @@ index 17e1739c12ee38864e735130792321adadb43f08..7b0bfec6f18e883eb7ad7e3bfe564163 #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ui/base/ui_base_features.h" -@@ -205,7 +204,15 @@ base::string16 Accelerator::GetShortcutText() const { +@@ -205,7 +204,15 @@ std::u16string Accelerator::GetShortcutText() const { shortcut = KeyCodeToName(); #endif @@ -47,7 +47,7 @@ index 17e1739c12ee38864e735130792321adadb43f08..7b0bfec6f18e883eb7ad7e3bfe564163 #if defined(OS_WIN) // Our fallback is to try translate the key code to a regular character // unless it is one of digits (VK_0 to VK_9). Some keyboard -@@ -214,21 +221,14 @@ base::string16 Accelerator::GetShortcutText() const { +@@ -214,21 +221,14 @@ std::u16string Accelerator::GetShortcutText() const { // accent' for '0'). For display in the menu (e.g. Ctrl-0 for the // default zoom level), we leave VK_[0-9] alone without translation. wchar_t key; @@ -65,7 +65,7 @@ index 17e1739c12ee38864e735130792321adadb43f08..7b0bfec6f18e883eb7ad7e3bfe564163 - UsLayoutKeyboardCodeToDomCode(key_code_), false); - if (c != 0) - shortcut += -- static_cast(base::ToUpperASCII(c)); +- static_cast(base::ToUpperASCII(c)); + shortcut = key; + } #endif @@ -75,7 +75,7 @@ index 17e1739c12ee38864e735130792321adadb43f08..7b0bfec6f18e883eb7ad7e3bfe564163 } #if defined(OS_APPLE) -@@ -411,7 +411,7 @@ base::string16 Accelerator::ApplyLongFormModifiers( +@@ -411,7 +411,7 @@ std::u16string Accelerator::ApplyLongFormModifiers( // more information. if (IsCtrlDown()) shortcut = ApplyModifierToAcceleratorString(shortcut, IDS_APP_CTRL_KEY); diff --git a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch index 80b0cf0f4ba2..ab582702b19c 100644 --- a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch +++ b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch @@ -10,10 +10,10 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set. This should be upstreamed. diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc -index c6fada5cefbf9ca359be880c5ab747884c7ba4ce..fc4f434c8cb7e231edbf257410f7cc1dab75b0d0 100644 +index 5b4034b583163068c29b9aee3e2b8cd4687c67ed..ee0e1404fc06c591e6f26471d049d0a29d87e7ef 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc -@@ -260,6 +260,10 @@ int GpuMain(const MainFunctionParams& parameters) { +@@ -259,6 +259,10 @@ int GpuMain(const MainFunctionParams& parameters) { // to the GpuProcessHost once the GpuServiceImpl has started. viz::GpuServiceImpl::InstallPreInitializeLogHandler(); @@ -24,7 +24,7 @@ index c6fada5cefbf9ca359be880c5ab747884c7ba4ce..fc4f434c8cb7e231edbf257410f7cc1d // We are experiencing what appear to be memory-stomp issues in the GPU // process. These issues seem to be impacting the task executor and listeners // registered to it. Create the task executor on the heap to guard against -@@ -397,7 +401,6 @@ int GpuMain(const MainFunctionParams& parameters) { +@@ -396,7 +400,6 @@ int GpuMain(const MainFunctionParams& parameters) { } #endif diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index e0bb10ab6a23..6151cb80d74b 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -10,10 +10,10 @@ DidCreateScriptContext is called, not all JS APIs are available in the context, which can cause some preload scripts to trip. diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index 68b45e8311053222bda00a43de469d707f566539..aea37e280b490ba29e263403e019454d1bb0bf18 100644 +index 7255ccd1ab7128616ae45c7810a90821496becc0..9ed4547d784ee6e552cc31d7f6091c722218f565 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h -@@ -127,6 +127,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, +@@ -129,6 +129,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, virtual void DidHandleOnloadEvents() {} virtual void DidCreateScriptContext(v8::Local context, int32_t world_id) {} @@ -23,10 +23,10 @@ index 68b45e8311053222bda00a43de469d707f566539..aea37e280b490ba29e263403e019454d int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index cddf3397e3149cb6192871dbac94b4914a216220..adac4b9b2b73be64495dbbb858af5402523bb59b 100644 +index 0970915229d119d5d45041a9b21846b054f6d1ae..2d6f936ade9cb1baceeea038df48e92f4ab3783a 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4542,6 +4542,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, +@@ -4578,6 +4578,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, observer.DidCreateScriptContext(context, world_id); } @@ -40,10 +40,10 @@ index cddf3397e3149cb6192871dbac94b4914a216220..adac4b9b2b73be64495dbbb858af5402 int world_id) { for (auto& observer : observers_) diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h -index bc6ba9e052143dae239248cfbe585249a5e541a0..5dbd5e061009dd4360b54e9f24ec76c6592c5b6f 100644 +index 9ab20deefcc7339a783e9d922c55f42840cbbf8f..52e763e8cf62ea9c5e6025d2fedd66eb8c9c8470 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h -@@ -593,6 +593,8 @@ class CONTENT_EXPORT RenderFrameImpl +@@ -597,6 +597,8 @@ class CONTENT_EXPORT RenderFrameImpl blink::WebLocalFrameClient::LazyLoadBehavior lazy_load_behavior) override; void DidCreateScriptContext(v8::Local context, int world_id) override; @@ -53,10 +53,10 @@ index bc6ba9e052143dae239248cfbe585249a5e541a0..5dbd5e061009dd4360b54e9f24ec76c6 int world_id) override; void DidChangeScrollOffset() override; diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h -index ea4b3ed3bacf4b65776f654de49f30825ba38e16..fdb2973d1123a94b0322b3fee874536f7851c05f 100644 +index fd8b154d7a38a6444dd6ceea93b422918561d0f4..8deaf19c88fdeab5ccf7bf24a086094d255e5a1a 100644 --- a/third_party/blink/public/web/web_local_frame_client.h +++ b/third_party/blink/public/web/web_local_frame_client.h -@@ -566,6 +566,9 @@ class BLINK_EXPORT WebLocalFrameClient { +@@ -571,6 +571,9 @@ class BLINK_EXPORT WebLocalFrameClient { virtual void DidCreateScriptContext(v8::Local, int32_t world_id) {} @@ -79,10 +79,10 @@ index be5cf4457cd379d5abc119d209d2df6520ad1022..8a0baac5bb8cb403324fb8156be62b92 if (World().IsMainWorld()) { GetFrame()->Loader().DispatchDidClearWindowObjectInMainWorld(); diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h -index 59bae1425ae816c727ea8da5b15ef171b8947520..d748d8cae61c7523568d7855bd7677abff9638e8 100644 +index 20a509a57d8916f8fb522575e7a5dd9c2f8a9092..60193a0e5e369b09d59379415d06a74d268d0590 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client.h +++ b/third_party/blink/renderer/core/frame/local_frame_client.h -@@ -295,6 +295,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient { +@@ -294,6 +294,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient { virtual void DidCreateScriptContext(v8::Local, int32_t world_id) = 0; @@ -92,10 +92,10 @@ index 59bae1425ae816c727ea8da5b15ef171b8947520..d748d8cae61c7523568d7855bd7677ab int32_t world_id) = 0; virtual bool AllowScriptExtensions() = 0; diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -index ef047d63ce4d1b72f85f1ddceeef44e80719c102..74a9c38e4cbe900f1c2da21d7357da3bafec7175 100644 +index 76a5edbafc727c8760c4cc12d9279fb96fde3740..205cbc9f1f629e10a92d2b86a65460fd115a2149 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc -@@ -274,6 +274,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( +@@ -272,6 +272,13 @@ void LocalFrameClientImpl::DidCreateScriptContext( web_frame_->Client()->DidCreateScriptContext(context, world_id); } @@ -110,7 +110,7 @@ index ef047d63ce4d1b72f85f1ddceeef44e80719c102..74a9c38e4cbe900f1c2da21d7357da3b v8::Local context, int32_t world_id) { diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h -index ef43b90303b7546d1163209cbade473b8cf17091..246ec76f84219390753b72778a18c8e2dec8bfdc 100644 +index 244a0028b7a6d14e3eb30041b36c9ef49b61018a..ea98189f0f03a9099d6963fe0fb3ae8fb0548c64 100644 --- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h +++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h @@ -76,6 +76,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient { @@ -123,10 +123,10 @@ index ef43b90303b7546d1163209cbade473b8cf17091..246ec76f84219390753b72778a18c8e2 int32_t world_id) override; diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h -index 26520031e93bb4de9b0e12faed1cd67da5660a26..e90550d6f60b8d91701aa1a16524ed28849dda3d 100644 +index 10a75b729c365f04545888c92c811e2da6c59919..43ad2a74d904d74fd6c39a61aa73093e5296510e 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h -@@ -348,6 +348,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { +@@ -344,6 +344,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { void DidCreateScriptContext(v8::Local, int32_t world_id) override {} diff --git a/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch b/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch index 065e264737eb..ba3316796d42 100644 --- a/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch +++ b/patches/chromium/add_trustedauthclient_to_urlloaderfactory.patch @@ -10,7 +10,7 @@ WebContents, and cancels the authentication if there's no WebContents available, which there isn't in the case of the 'net' module. diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index cfa9d0c197ca9851f13b088ecae4aba614c7ac55..d93a6ce481630535b75d858e5b7b04e50f81e2f8 100644 +index b35746e2850d7d724fcf3dc09ddbfea1ca56a746..491172c51c2d196573f2e835f7b81df30a33cf2f 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom @@ -192,6 +192,26 @@ struct CTPolicy { @@ -40,7 +40,7 @@ index cfa9d0c197ca9851f13b088ecae4aba614c7ac55..d93a6ce481630535b75d858e5b7b04e5 interface CertVerifierClient { Verify( int32 default_error, -@@ -623,6 +643,8 @@ struct URLLoaderFactoryParams { +@@ -606,6 +626,8 @@ struct URLLoaderFactoryParams { // impact because of the extra process hops, so use should be minimized. pending_remote? header_client; @@ -50,12 +50,12 @@ index cfa9d0c197ca9851f13b088ecae4aba614c7ac55..d93a6ce481630535b75d858e5b7b04e5 // cookies) and to shard network resources, like the cache. If set, takes // precedence over ResourceRequest::TrustedParams::IsolationInfo field diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc -index ce483753dff0130c5ac20258c0cf7e399c0d1c51..0e31b92419e124136447efc6a1642ade5eaa0a5e 100644 +index 136c4ec48412354cbc3d77880dd34ec836694004..f484bb54c59866d13e532cd81ed28ad9f982549a 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc -@@ -463,6 +463,7 @@ URLLoader::URLLoader( +@@ -465,6 +465,7 @@ URLLoader::URLLoader( + scoped_refptr resource_scheduler_client, base::WeakPtr keepalive_statistics_recorder, - base::WeakPtr network_usage_accumulator, mojom::TrustedURLLoaderHeaderClient* url_loader_header_client, + mojom::TrustedURLLoaderAuthClient* url_loader_auth_client, mojom::OriginPolicyManager* origin_policy_manager, @@ -73,20 +73,20 @@ index ce483753dff0130c5ac20258c0cf7e399c0d1c51..0e31b92419e124136447efc6a1642ade if (want_raw_headers_) { options_ |= mojom::kURLLoadOptionSendSSLInfoWithResponse | mojom::kURLLoadOptionSendSSLInfoForCertificateError; -@@ -1189,7 +1195,7 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, - // |this| may have been deleted. +@@ -1198,7 +1204,7 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, return; } -- if (!auth_cert_observer_) { -+ if (!auth_cert_observer_ && !auth_client_) { + auto* url_loader_network_observer = GetURLLoaderNetworkServiceObserver(); +- if (!url_loader_network_observer) { ++ if (!url_loader_network_observer && !auth_client_) { OnAuthCredentials(base::nullopt); return; } -@@ -1201,10 +1207,22 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, +@@ -1210,10 +1216,22 @@ void URLLoader::OnAuthRequired(net::URLRequest* url_request, DCHECK(!auth_challenge_responder_receiver_.is_bound()); -- auth_cert_observer_->OnAuthRequired( +- url_loader_network_observer->OnAuthRequired( - fetch_window_id_, request_id_, url_request_->url(), first_auth_attempt_, - auth_info, url_request->response_headers(), - auth_challenge_responder_receiver_.BindNewPipeAndPassRemote()); @@ -101,7 +101,7 @@ index ce483753dff0130c5ac20258c0cf7e399c0d1c51..0e31b92419e124136447efc6a1642ade + std::move(head), + auth_challenge_responder_receiver_.BindNewPipeAndPassRemote()); + } else { -+ auth_cert_observer_->OnAuthRequired( ++ url_loader_network_observer->OnAuthRequired( + fetch_window_id_, request_id_, url_request_->url(), first_auth_attempt_, + auth_info, url_request->response_headers(), + auth_challenge_responder_receiver_.BindNewPipeAndPassRemote()); @@ -110,18 +110,18 @@ index ce483753dff0130c5ac20258c0cf7e399c0d1c51..0e31b92419e124136447efc6a1642ade auth_challenge_responder_receiver_.set_disconnect_handler( base::BindOnce(&URLLoader::DeleteSelf, base::Unretained(this))); diff --git a/services/network/url_loader.h b/services/network/url_loader.h -index 21ec3b43cd58c738b281b3d51dde6879bb7619df..7c607c68ec27af31238537fd1943015d72c30a18 100644 +index f8c6112335ea43912485e76ec48d28b8609fab83..25c17fc78a03ba6a0b1a399e22bbba827e2275fb 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h -@@ -130,6 +130,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader +@@ -128,6 +128,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader + scoped_refptr resource_scheduler_client, base::WeakPtr keepalive_statistics_recorder, - base::WeakPtr network_usage_accumulator, mojom::TrustedURLLoaderHeaderClient* url_loader_header_client, + mojom::TrustedURLLoaderAuthClient* url_loader_auth_client, mojom::OriginPolicyManager* origin_policy_manager, std::unique_ptr trust_token_helper_factory, -@@ -500,6 +501,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader +@@ -517,6 +518,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) URLLoader base::Optional fetch_window_id_; mojo::Remote header_client_; @@ -130,30 +130,30 @@ index 21ec3b43cd58c738b281b3d51dde6879bb7619df..7c607c68ec27af31238537fd1943015d std::unique_ptr file_opener_for_upload_; diff --git a/services/network/url_loader_factory.cc b/services/network/url_loader_factory.cc -index af9e13bb4f1fefbda57182069d5d677e23eaed56..5651380c7296eea4a520a0ef4d97ebe1f89ef0e5 100644 +index 766d343375c24c5746fb442370b544a8cf76d58f..627efb08ed0974f0c7672085e46996048af8c244 100644 --- a/services/network/url_loader_factory.cc +++ b/services/network/url_loader_factory.cc -@@ -77,6 +77,7 @@ URLLoaderFactory::URLLoaderFactory( +@@ -76,6 +76,7 @@ URLLoaderFactory::URLLoaderFactory( resource_scheduler_client_(std::move(resource_scheduler_client)), header_client_(std::move(params_->header_client)), coep_reporter_(std::move(params_->coep_reporter)), + auth_client_(std::move(params_->auth_client)), cors_url_loader_factory_(cors_url_loader_factory), cookie_observer_(std::move(params_->cookie_observer)), - auth_cert_observer_(std::move(params_->auth_cert_observer)), -@@ -305,6 +306,7 @@ void URLLoaderFactory::CreateLoaderAndStart( + url_loader_network_service_observer_( +@@ -279,6 +280,7 @@ void URLLoaderFactory::CreateLoaderAndStart( + context_->require_network_isolation_key(), resource_scheduler_client_, std::move(keepalive_statistics_recorder), - std::move(network_usage_accumulator), header_client_.is_bound() ? header_client_.get() : nullptr, + auth_client_.is_bound() ? auth_client_.get() : nullptr, context_->origin_policy_manager(), std::move(trust_token_factory), context_->cors_origin_access_list(), std::move(cookie_observer), - std::move(auth_cert_observer), std::move(devtools_observer)); + std::move(url_loader_network_observer), std::move(devtools_observer)); diff --git a/services/network/url_loader_factory.h b/services/network/url_loader_factory.h -index 36978ccde84b7575c11035e9efb352b057e3cd1a..f68889501d243cc21b0e58567b63fbc02dd747e8 100644 +index f0e423b245026a06161ab922c1aed44c9152e40a..ebce1dae5a0bceeff8e77595d4cb57166c1d236f 100644 --- a/services/network/url_loader_factory.h +++ b/services/network/url_loader_factory.h -@@ -76,6 +76,7 @@ class URLLoaderFactory : public mojom::URLLoaderFactory { +@@ -79,6 +79,7 @@ class URLLoaderFactory : public mojom::URLLoaderFactory { scoped_refptr resource_scheduler_client_; mojo::Remote header_client_; mojo::Remote coep_reporter_; diff --git a/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch index b4e113cee94d..2aaa6a59c2a5 100644 --- a/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch @@ -86,7 +86,7 @@ index ba1ba323ec45296c33b5931652a001d6bd24dbe0..663d47894592499531ff924c78b51832 out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index ab727750abcb0253463e83c984bf1afd9e296021..cd4598e022b144c728990b47957baa031097dfc9 100644 +index e1fb30cfba2656989141f0a53ec3e6202c9b0409..ff9da0f6e66ed6565a64c33cc60f39510075c1f4 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -128,7 +128,7 @@ index ab727750abcb0253463e83c984bf1afd9e296021..cd4598e022b144c728990b47957baa03 // only controls whether or not the "document.cookie" field is properly // connected to the backing store, for instance if you wanted to be able to diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h -index 68d33ca3be294fc79f6d5d1a6ae6a8dfd427f4b1..9663462132151638ad480f8431a0ea428c6f0563 100644 +index ae180b30284c17c7319925531440161f66b873c7..2857c7fdcb18b6f9d858c038ee2a9784c141766b 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -6,6 +6,7 @@ diff --git a/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch b/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch index ca0e3a8edc6c..97491c73a90d 100644 --- a/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch +++ b/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch @@ -6,81 +6,81 @@ Subject: Allow setting secondary label via SimpleMenuModel Builds on https://chromium-review.googlesource.com/c/chromium/src/+/2208976 diff --git a/ui/base/models/simple_menu_model.cc b/ui/base/models/simple_menu_model.cc -index 7db4ef95402087b875be983f230f3e73e1e8af59..129c5b06f7a40a49ff566759b6da0911aac3d044 100644 +index 016dab7776139c8ea7eab60569f3e5c5aeff8014..022225c4c02300667c58dc61165cc19d68eb4ca7 100644 --- a/ui/base/models/simple_menu_model.cc +++ b/ui/base/models/simple_menu_model.cc -@@ -53,6 +53,11 @@ base::string16 SimpleMenuModel::Delegate::GetLabelForCommandId( - return base::string16(); +@@ -53,6 +53,11 @@ std::u16string SimpleMenuModel::Delegate::GetLabelForCommandId( + return std::u16string(); } -+base::string16 SimpleMenuModel::Delegate::GetSecondaryLabelForCommandId( ++std::u16string SimpleMenuModel::Delegate::GetSecondaryLabelForCommandId( + int command_id) const { -+ return base::string16(); ++ return std::u16string(); +} + ImageModel SimpleMenuModel::Delegate::GetIconForCommandId( int command_id) const { return ImageModel(); -@@ -295,6 +300,11 @@ void SimpleMenuModel::SetLabel(int index, const base::string16& label) { +@@ -295,6 +300,11 @@ void SimpleMenuModel::SetLabel(int index, const std::u16string& label) { MenuItemsChanged(); } -+void SimpleMenuModel::SetSecondaryLabel(int index, const base::string16& secondary_label) { ++void SimpleMenuModel::SetSecondaryLabel(int index, const std::u16string& secondary_label) { + items_[ValidateItemIndex(index)].secondary_label = secondary_label; + MenuItemsChanged(); +} + void SimpleMenuModel::SetMinorText(int index, - const base::string16& minor_text) { + const std::u16string& minor_text) { items_[ValidateItemIndex(index)].minor_text = minor_text; -@@ -377,6 +387,12 @@ base::string16 SimpleMenuModel::GetLabelAt(int index) const { +@@ -377,6 +387,12 @@ std::u16string SimpleMenuModel::GetLabelAt(int index) const { return items_[ValidateItemIndex(index)].label; } -+base::string16 SimpleMenuModel::GetSecondaryLabelAt(int index) const { ++std::u16string SimpleMenuModel::GetSecondaryLabelAt(int index) const { + if (IsItemDynamicAt(index)) + return delegate_->GetSecondaryLabelForCommandId(GetCommandIdAt(index)); + return items_[ValidateItemIndex(index)].secondary_label; +} + - base::string16 SimpleMenuModel::GetMinorTextAt(int index) const { + std::u16string SimpleMenuModel::GetMinorTextAt(int index) const { return items_[ValidateItemIndex(index)].minor_text; } diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h -index 7cefe1d152ef6df95bc431cb1d35147210b614b9..db13baf0000f917dc63aadd42d5168cdac9fb020 100644 +index 7dc52c90a032ae21db1e453f1f901c49131a11ca..f5df563276d97f4e0b4b20100e7b2474acaea461 100644 --- a/ui/base/models/simple_menu_model.h +++ b/ui/base/models/simple_menu_model.h @@ -51,6 +51,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { // Some command ids have labels and icons that change over time. virtual bool IsItemForCommandIdDynamic(int command_id) const; - virtual base::string16 GetLabelForCommandId(int command_id) const; -+ virtual base::string16 GetSecondaryLabelForCommandId(int command_id) const; + virtual std::u16string GetLabelForCommandId(int command_id) const; ++ virtual std::u16string GetSecondaryLabelForCommandId(int command_id) const; // Gets the icon for the item with the specified id. virtual ImageModel GetIconForCommandId(int command_id) const; @@ -154,6 +155,9 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { // Sets the label for the item at |index|. - void SetLabel(int index, const base::string16& label); + void SetLabel(int index, const std::u16string& label); + // Sets the secondary_label for the item at |index|. -+ void SetSecondaryLabel(int index, const base::string16& secondary_label); ++ void SetSecondaryLabel(int index, const std::u16string& secondary_label); + // Sets the minor text for the item at |index|. - void SetMinorText(int index, const base::string16& minor_text); + void SetMinorText(int index, const std::u16string& minor_text); @@ -186,6 +190,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override; int GetCommandIdAt(int index) const override; - base::string16 GetLabelAt(int index) const override; -+ base::string16 GetSecondaryLabelAt(int index) const override; - base::string16 GetMinorTextAt(int index) const override; + std::u16string GetLabelAt(int index) const override; ++ std::u16string GetSecondaryLabelAt(int index) const override; + std::u16string GetMinorTextAt(int index) const override; ImageModel GetMinorIconAt(int index) const override; bool IsItemDynamicAt(int index) const override; @@ -223,6 +228,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { int command_id = 0; ItemType type = TYPE_COMMAND; - base::string16 label; -+ base::string16 secondary_label; - base::string16 minor_text; + std::u16string label; ++ std::u16string secondary_label; + std::u16string minor_text; ImageModel minor_icon; ImageModel icon; diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index 6d0519157063..92a272c95e6e 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -15,10 +15,10 @@ Refs changes in: This patch reverts the changes to fix associated crashes in Electron. diff --git a/third_party/blink/renderer/core/frame/frame.cc b/third_party/blink/renderer/core/frame/frame.cc -index cc24d583ac920c5d7f0d667b0890fd323c58280a..ae12f5f18eccacf0377511aa8f1f99123168a6a5 100644 +index f06a116b6a5b963308c1fd099bcbad5a72c2bce0..f2a2bfbdedfac3ba0c2100a447c22c56e5d88fbb 100644 --- a/third_party/blink/renderer/core/frame/frame.cc +++ b/third_party/blink/renderer/core/frame/frame.cc -@@ -117,14 +117,6 @@ bool Frame::Detach(FrameDetachType type) { +@@ -118,14 +118,6 @@ bool Frame::Detach(FrameDetachType type) { DCHECK(!IsDetached()); @@ -33,7 +33,7 @@ index cc24d583ac920c5d7f0d667b0890fd323c58280a..ae12f5f18eccacf0377511aa8f1f9912 if (type == FrameDetachType::kRemove) { if (provisional_frame_) { provisional_frame_->Detach(FrameDetachType::kRemove); -@@ -147,6 +139,14 @@ bool Frame::Detach(FrameDetachType type) { +@@ -148,6 +140,14 @@ bool Frame::Detach(FrameDetachType type) { GetWindowProxyManager()->ClearForSwap(); } @@ -49,10 +49,10 @@ index cc24d583ac920c5d7f0d667b0890fd323c58280a..ae12f5f18eccacf0377511aa8f1f9912 // its owning reference back to our owning LocalFrame. client_->Detached(type); diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index e1353cf55aa63b6ec6bd5470b92269193313a6a7..867e66291ce43cd744269c68f4f7ee90c054c8a3 100644 +index 0d0e15a70e33fe2579a9c15bc52f28c918e8c4de..1a02ba1623cbdcf9853985512302a211589da198 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc -@@ -671,10 +671,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -672,10 +672,6 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { } DCHECK(!view_ || !view_->IsAttached()); @@ -63,7 +63,7 @@ index e1353cf55aa63b6ec6bd5470b92269193313a6a7..867e66291ce43cd744269c68f4f7ee90 if (!Client()) return false; -@@ -716,6 +712,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { +@@ -717,6 +713,11 @@ bool LocalFrame::DetachImpl(FrameDetachType type) { DCHECK(!view_->IsAttached()); Client()->WillBeDetached(); diff --git a/patches/chromium/blink_world_context.patch b/patches/chromium/blink_world_context.patch index f7a59b180862..2bc1cd6a41e1 100644 --- a/patches/chromium/blink_world_context.patch +++ b/patches/chromium/blink_world_context.patch @@ -7,7 +7,7 @@ This exposes a method for obtaining a reference to an isolated world, which is otherwise not available in the Blink API. diff --git a/third_party/blink/public/web/web_local_frame.h b/third_party/blink/public/web/web_local_frame.h -index 9484e7c7944b0f0602d4f230854e45ed716fb884..96325d07de4690ab5ee03c538fd6dccc0cf3de96 100644 +index 315c95a0ba24ea675d82f1d1b1840683c012de82..01709c0c3ed79dad8cacb1c7075d4dfba8dc6d84 100644 --- a/third_party/blink/public/web/web_local_frame.h +++ b/third_party/blink/public/web/web_local_frame.h @@ -368,6 +368,8 @@ class WebLocalFrame : public WebFrame { @@ -20,10 +20,10 @@ index 9484e7c7944b0f0602d4f230854e45ed716fb884..96325d07de4690ab5ee03c538fd6dccc // Executes script in the context of the current page and returns the value // that the script evaluated to with callback. Script execution can be diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index 0a880c510a1901d2c59226df0fa807f55ed2edc0..2fbbe5d1bb7d515dad97b8805448729fe00d4ed1 100644 +index 1b180b94b247d7f39f61596a5a86ce38f595362a..99258a29d82ea0e37b226c8d6e2f3a810e615883 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -@@ -1036,6 +1036,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { +@@ -1037,6 +1037,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { return MainWorldScriptContext()->Global(); } @@ -38,7 +38,7 @@ index 0a880c510a1901d2c59226df0fa807f55ed2edc0..2fbbe5d1bb7d515dad97b8805448729f return BindingSecurity::ShouldAllowAccessToFrame( CurrentDOMWindow(V8PerIsolateData::MainThreadIsolate()), diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h -index c0119afcd891087844f6d4d42b0c7d071278d52b..f39db84eea9ae29c039f578cfde7cea201433e23 100644 +index 44d642f4cf94000e42241ff5dafdabf4ed8fbafb..1000a606f1e5a7dea2705e0d35c9cfef8e48abfb 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h @@ -166,6 +166,8 @@ class CORE_EXPORT WebLocalFrameImpl final diff --git a/patches/chromium/build_gn.patch b/patches/chromium/build_gn.patch index 1664fe1daf6b..beb3a02f520c 100644 --- a/patches/chromium/build_gn.patch +++ b/patches/chromium/build_gn.patch @@ -14,7 +14,7 @@ tradeoff is that switching from MAS_BUILD to !MAS_BUILD or vice-versa will rebuild the entire tree. diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn -index fa375deef6c851867efdd8e9d6a79261b1256774..e170c988f01fb62c0193456c8e65378fad87e7b0 100644 +index 4bedf1ef1b3c642ff2839d0ad62caaedd1e1254f..ef5c81761df66c41fb8db575434280c4866d4f4a 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -123,6 +123,9 @@ if (current_os == "") { @@ -27,7 +27,7 @@ index fa375deef6c851867efdd8e9d6a79261b1256774..e170c988f01fb62c0193456c8e65378f # Set to enable the official build level of optimization. This has nothing # to do with branding, but enables an additional level of optimization above # release (!is_debug). This might be better expressed as a tri-state -@@ -334,6 +337,7 @@ default_compiler_configs = [ +@@ -336,6 +339,7 @@ default_compiler_configs = [ "//build/config/compiler/pgo:default_pgo_flags", "//build/config/coverage:default_coverage", "//build/config/sanitizers:default_sanitizer_flags", diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 7a0ce3221065..023054e9f73b 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -9,10 +9,10 @@ potentially prevent a window from being created. TODO(loc): this patch is currently broken. diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 7d498c0568cddd3a91ab5b6ee84676e50bf0ef1a..2f8111fda3400b01b29c09d6f3d256aac1e69020 100644 +index f2d027d32e3cff2d1f0f03ed6c47ee689524ca1d..82dac3411b63e541d92b486f5e2108cce881b48e 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -5287,6 +5287,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -5312,6 +5312,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To(), params->frame_name, params->disposition, *params->features, @@ -21,10 +21,10 @@ index 7d498c0568cddd3a91ab5b6ee84676e50bf0ef1a..2f8111fda3400b01b29c09d6f3d256aa &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index fe4a5571e3ffd587dd8b566f07be41953e220a0a..c36d614a237077e5dedb4450ec51316b0fd2a990 100644 +index dfb04614aa0244934798870317f500751869b7ea..703f847c844fda3b9efbbd7ce28743c5a9d991a4 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3619,6 +3619,14 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( +@@ -3637,6 +3637,14 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( } auto* new_contents_impl = new_contents.get(); @@ -39,7 +39,7 @@ index fe4a5571e3ffd587dd8b566f07be41953e220a0a..c36d614a237077e5dedb4450ec51316b new_contents_impl->GetController().SetSessionStorageNamespace( partition_id, session_storage_namespace); -@@ -3661,12 +3669,6 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( +@@ -3679,12 +3687,6 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( AddWebContentsDestructionObserver(new_contents_impl); } @@ -53,10 +53,10 @@ index fe4a5571e3ffd587dd8b566f07be41953e220a0a..c36d614a237077e5dedb4450ec51316b new_contents_impl, opener, params.target_url, params.referrer.To(), params.disposition, diff --git a/content/common/frame.mojom b/content/common/frame.mojom -index 92e4ff63cb65e06a3d6dc8af521691aed7119bfd..23b5a2266433182c494bdd1cf3c0aed01a1d6fa2 100644 +index 7f26f6ed0861bc5a351123feddddd10b479409f3..bfd5c4aca4b3c23ee092788eb97bf5dfe00ad944 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom -@@ -529,6 +529,10 @@ struct CreateNewWindowParams { +@@ -528,6 +528,10 @@ struct CreateNewWindowParams { // The impression associated with the navigation in the new window, if // one is specified. Impression? impression; @@ -68,10 +68,10 @@ index 92e4ff63cb65e06a3d6dc8af521691aed7119bfd..23b5a2266433182c494bdd1cf3c0aed0 // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index c8926e0e832d2edabbfda9416ec95bc701776387..523084f820e841bbf8b8fa3974f94a4e938db81b 100644 +index 4516cea37427a933e961e1e646dfa1b685b6acc1..8d899d675d0eca0856269e9887371a6f633ef767 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -562,6 +562,8 @@ bool ContentBrowserClient::CanCreateWindow( +@@ -552,6 +552,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -81,7 +81,7 @@ index c8926e0e832d2edabbfda9416ec95bc701776387..523084f820e841bbf8b8fa3974f94a4e bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 3aed911c525b7e100fae096994212c3e7d4ee308..b1c4ad7a48f760d2ba7908c9611b5f894af575d6 100644 +index fedf85bfac89c9372b0fd48e908b1c73da92c0ee..52a300a553742469ad7eea7ccb85e5e9988363b7 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -158,6 +158,7 @@ class NetworkService; @@ -92,7 +92,7 @@ index 3aed911c525b7e100fae096994212c3e7d4ee308..b1c4ad7a48f760d2ba7908c9611b5f89 } // namespace network namespace sandbox { -@@ -916,6 +917,8 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -910,6 +911,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, @@ -102,7 +102,7 @@ index 3aed911c525b7e100fae096994212c3e7d4ee308..b1c4ad7a48f760d2ba7908c9611b5f89 bool opener_suppressed, bool* no_javascript_access); diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 22de0f5ed42f6fd641220e7bc5f20a1c60e107fc..15226ca43d1e1f0e5b89eaecd2029f7be8e802fa 100644 +index ba416aebd7936d5cf7f890d071acf503765b47f6..412fa31a6fb853eb757e19e64efb0829753faed9 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -27,6 +27,17 @@ namespace content { @@ -124,7 +124,7 @@ index 22de0f5ed42f6fd641220e7bc5f20a1c60e107fc..15226ca43d1e1f0e5b89eaecd2029f7b const OpenURLParams& params) { return nullptr; diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index e752b5bd6893bc991f9c5628d4b46a6f616ceb5e..d33903b54130cc9deffce09472e9ac2d8329d82d 100644 +index 164d5d1d4d401ba2ff9a6d233d11d43346526f2e..dd7968c1eacc79eadd9b068e0cfb10a03c6ac311 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -17,6 +17,7 @@ @@ -135,8 +135,8 @@ index e752b5bd6893bc991f9c5628d4b46a6f616ceb5e..d33903b54130cc9deffce09472e9ac2d #include "content/public/browser/eye_dropper.h" #include "content/public/browser/invalidate_type.h" #include "content/public/browser/media_stream_request.h" -@@ -337,6 +338,13 @@ class CONTENT_EXPORT WebContentsDelegate { - const std::string& partition_id, +@@ -341,6 +342,13 @@ class CONTENT_EXPORT WebContentsDelegate { + const StoragePartitionId& partition_id, SessionStorageNamespace* session_storage_namespace); + virtual void WebContentsCreatedWithFullParams( @@ -150,7 +150,7 @@ index e752b5bd6893bc991f9c5628d4b46a6f616ceb5e..d33903b54130cc9deffce09472e9ac2d // typically happens when popups are created. virtual void WebContentsCreated(WebContents* source_contents, diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc -index bcc333b8d17ec931db3585407d4cf8b15bf7c236..605f15acc3b6221870e6bb9467d182127f82fe84 100644 +index 43924d90b41a349bc496d6ca940c1c9963d2773c..2840883471055f0b09ecbc18d301e1b5de8b3d5a 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -28,6 +28,7 @@ @@ -221,10 +221,10 @@ index 4f735ad0d97eaac9a57dad137e479f8a7ec33a36..0a3c5821962c85609b64b3625fa6b8d6 } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 664fd015bc9e7f36078e131c036b88074d4756a0..cfd8e88a8bb6311002f45ba2b1ce40fa56301e26 100644 +index e4f5968c7917f932a52f23efb08c3bfd7aec6d2f..7fb0c57f3e6a6668acb99e47cf46b22d2cbe0f3a 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2027,6 +2027,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, +@@ -2015,6 +2015,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, } WebWindowFeatures window_features = GetWindowFeaturesFromString(features); diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index b12ac9cf4292..17d8535569fc 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -35,7 +35,7 @@ index 5b4d70991e19edcdfee731c56251932bf43e535f..fe1977c5e6ce0f5b30e8be529b9efa51 #endif // CHROME_BROWSER_ANDROID_DOCUMENT_DOCUMENT_WEB_CONTENTS_DELEGATE_H_ diff --git a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc -index 362b3d7486198109626344e46d29e4446bd00d44..442281b1c7b7f45ffaaa245232975e07fc1edfd9 100644 +index 8642c20123ec62fd6c90c8945d78bc3e04116c5b..f33ad843cc4b602c0e3312be426b81a0332afe66 100644 --- a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc +++ b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc @@ -123,8 +123,7 @@ class DriveWebContentsManager : public content::WebContentsObserver, @@ -140,10 +140,10 @@ index 33f1168f834d138aefb190b7718271d6962b3532..aeb30a22349e0682586bd1bad20dc5e2 } diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc -index 2f2862c426124556e1109dd243475d8514c814d8..7456a84ea0cf7be69ac8f84140f11c68a429ed6f 100644 +index 19ca9ee265876d2d33ced262be84cda1d056372c..b41c489a683995c3aa582d7eccbabe679b5cbb46 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc -@@ -1762,12 +1762,11 @@ bool Browser::IsWebContentsCreationOverridden( +@@ -1769,12 +1769,11 @@ bool Browser::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -159,10 +159,10 @@ index 2f2862c426124556e1109dd243475d8514c814d8..7456a84ea0cf7be69ac8f84140f11c68 WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 3a0202c2139b3a6d62f10d9ce965e689dc96bf4a..0e45b455daee1e1ddb8ad3ab263d70db3a7b675d 100644 +index 32f9f251d2c3f8c5443f2284d6f70769848df532..a3729cf13b57607dabc6278634f6ff0c2a030097 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -797,8 +797,7 @@ class Browser : public TabStripModelObserver, +@@ -796,8 +796,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -201,7 +201,7 @@ index 058ec72442d59989c4d6df4a7c791ecfeff0ef99..f7c8c2139382cb2e290c561624291afe // The profile used for the presentation. Profile* otr_profile_; diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc -index e8cee3297c218cd86b1200003e574c3713ab7afe..48216c9fccf1452f869fcfb24ba5206798c4c4e6 100644 +index bf69ad20f61b6928b1a65edef324577dcc6af689..82050776a23fa7b6af4b27bd28325c10f75c5fb7 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc @@ -168,14 +168,13 @@ bool WebContentsDelegateAndroid::IsWebContentsCreationOverridden( @@ -222,7 +222,7 @@ index e8cee3297c218cd86b1200003e574c3713ab7afe..48216c9fccf1452f869fcfb24ba52067 java_gurl); } diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.h b/components/embedder_support/android/delegate/web_contents_delegate_android.h -index 348c65a323c6104030f50e1336ccbd9ada9e7628..c7d6a0041de46784bb28146d5ffd53ded3e5685d 100644 +index cf50204a6aeb099d25dc41d4180f8a1e32a63eda..642e88a4de3044173423fae5bfe2e30ef442f366 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.h +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.h @@ -78,8 +78,7 @@ class WebContentsDelegateAndroid : public content::WebContentsDelegate { @@ -264,10 +264,10 @@ index c5c5a7b63b5b3b62a9517cbef3ae23ce57a3c89c..4f1b7e88d6d2ae89a60311c8aeb1fcee void AddNewContents(content::WebContents* source, std::unique_ptr new_contents, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 6a044db477fc5b20e3ab6e14fda3c21162d112cb..f3884caf2320fb17bed8d84f342b5f8cc3b0b4c1 100644 +index cd90a347277d1375251e4e4b9025ca1726010324..53f48964e6dfd0fb9b91762760b59a006ac7cc0c 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3571,8 +3571,7 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( +@@ -3589,8 +3589,7 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( if (delegate_ && delegate_->IsWebContentsCreationOverridden( source_site_instance, params.window_container_type, @@ -278,7 +278,7 @@ index 6a044db477fc5b20e3ab6e14fda3c21162d112cb..f3884caf2320fb17bed8d84f342b5f8c opener, source_site_instance, is_new_browsing_instance, opener->GetLastCommittedURL(), params.frame_name, params.target_url, diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc -index 15226ca43d1e1f0e5b89eaecd2029f7be8e802fa..5565c3238ce555e3702b27697babed74394e4d0a 100644 +index 412fa31a6fb853eb757e19e64efb0829753faed9..1378593a48932b8272bafbe70c4797befdc32f02 100644 --- a/content/public/browser/web_contents_delegate.cc +++ b/content/public/browser/web_contents_delegate.cc @@ -135,8 +135,7 @@ bool WebContentsDelegate::IsWebContentsCreationOverridden( @@ -292,10 +292,10 @@ index 15226ca43d1e1f0e5b89eaecd2029f7be8e802fa..5565c3238ce555e3702b27697babed74 } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index d33903b54130cc9deffce09472e9ac2d8329d82d..dbbf35be27c5e14acca88bcb22598962966375f0 100644 +index dd7968c1eacc79eadd9b068e0cfb10a03c6ac311..6ce899d5eab1d643d71e33a85653f8802122614c 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -316,8 +316,7 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -320,8 +320,7 @@ class CONTENT_EXPORT WebContentsDelegate { SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -306,7 +306,7 @@ index d33903b54130cc9deffce09472e9ac2d8329d82d..dbbf35be27c5e14acca88bcb22598962 // Allow delegate to creates a custom WebContents when // WebContents::CreateNewWindow() is called. This function is only called diff --git a/extensions/browser/guest_view/extension_options/extension_options_guest.cc b/extensions/browser/guest_view/extension_options/extension_options_guest.cc -index bda659c7a464a58413e7eb33a897065268ab3fc6..29950878aca7f1518265561dea79b78d82230982 100644 +index 5f49edfabed15d691dc6cc7b17896165297735a7..d64baa43afcf5a0f87797995b84b60d84e1f05a2 100644 --- a/extensions/browser/guest_view/extension_options/extension_options_guest.cc +++ b/extensions/browser/guest_view/extension_options/extension_options_guest.cc @@ -212,8 +212,7 @@ bool ExtensionOptionsGuest::IsWebContentsCreationOverridden( @@ -320,7 +320,7 @@ index bda659c7a464a58413e7eb33a897065268ab3fc6..29950878aca7f1518265561dea79b78d // view is used for displaying embedded extension options, we want any // external links to be opened in a new tab, not in a new guest view so we diff --git a/extensions/browser/guest_view/extension_options/extension_options_guest.h b/extensions/browser/guest_view/extension_options/extension_options_guest.h -index 97273c32a05acf325fd0de22c4f79c1746aa23bc..4b357acd069387963347d35d82371b955147893f 100644 +index 9b293d0df6c634bf44a69d607c4eee839a74b4a1..7e5b9cbdcc232c5e20eae0130d800f508411b827 100644 --- a/extensions/browser/guest_view/extension_options/extension_options_guest.h +++ b/extensions/browser/guest_view/extension_options/extension_options_guest.h @@ -55,8 +55,7 @@ class ExtensionOptionsGuest @@ -334,10 +334,10 @@ index 97273c32a05acf325fd0de22c4f79c1746aa23bc..4b357acd069387963347d35d82371b95 content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc -index e910810ff0de768dba372cbe43c8ee851d5b430b..59813e3162e41db0a7e6e5519a7b42d2f50e4bec 100644 +index f3b8095088310c0811d33904bc400a4ff8c60323..c5398f93dedef93b71e64af3a2d9f2c011245b8d 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc -@@ -382,8 +382,7 @@ bool MimeHandlerViewGuest::IsWebContentsCreationOverridden( +@@ -379,8 +379,7 @@ bool MimeHandlerViewGuest::IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -348,7 +348,7 @@ index e910810ff0de768dba372cbe43c8ee851d5b430b..59813e3162e41db0a7e6e5519a7b42d2 } diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h -index bdba06b3d493a3ecf6d96ebabc336179b35feada..44e8c6e0e31831c29f8463ded1b640ec6c86b3da 100644 +index 17f911eef902bd5f30c852c1f517f4c1dd22c5b0..be333612ef35a8f43e66f3ca181bd573dd40791b 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h @@ -157,8 +157,7 @@ class MimeHandlerViewGuest @@ -362,7 +362,7 @@ index bdba06b3d493a3ecf6d96ebabc336179b35feada..44e8c6e0e31831c29f8463ded1b640ec content::RenderFrameHost* opener, content::SiteInstance* source_site_instance, diff --git a/fuchsia/engine/browser/frame_impl.cc b/fuchsia/engine/browser/frame_impl.cc -index 781cdcb53ae6bb60f807d3a80293739568ce8f71..a8305998edac476bec47b531be7aa20db1982df2 100644 +index f50f4343ed5a487538ef9ce819cd19300623a3dd..282bca34f82e5a3b27bc66f0cab494e388f35b9e 100644 --- a/fuchsia/engine/browser/frame_impl.cc +++ b/fuchsia/engine/browser/frame_impl.cc @@ -372,8 +372,7 @@ bool FrameImpl::IsWebContentsCreationOverridden( @@ -376,7 +376,7 @@ index 781cdcb53ae6bb60f807d3a80293739568ce8f71..a8305998edac476bec47b531be7aa20d // can catch bad client behavior while not interfering with normal operation. constexpr size_t kMaxPendingWebContentsCount = 10; diff --git a/fuchsia/engine/browser/frame_impl.h b/fuchsia/engine/browser/frame_impl.h -index 9bdcbcc9fedf490c93d4765f2ff0e9d664245038..be92c446edec096921e4c61053d8f9f9321c0e78 100644 +index 429c3b508ea698dc286676a84b6a3817eb14b553..03a610610cbb120e4a9c367bbb074050365cc04f 100644 --- a/fuchsia/engine/browser/frame_impl.h +++ b/fuchsia/engine/browser/frame_impl.h @@ -234,8 +234,7 @@ class FrameImpl : public fuchsia::web::Frame, @@ -404,7 +404,7 @@ index 4fdbf1c7030bb2b3765780d1e8c5a502679745de..5b59ce27eaa03897e5cbb3115b485a3e ->options() ->block_new_web_contents(); diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc -index d5730f111981ca06835aeec44389920d1d000786..904f4a215cc3e5f7ac0037e05b79a0f4501f951e 100644 +index 2315e34e4c9cb60fee248c71e44984f68f1462d3..49a165ac686f611d8a982bf0b5481504e824b5a6 100644 --- a/ui/views/controls/webview/web_dialog_view.cc +++ b/ui/views/controls/webview/web_dialog_view.cc @@ -431,8 +431,7 @@ bool WebDialogView::IsWebContentsCreationOverridden( @@ -418,7 +418,7 @@ index d5730f111981ca06835aeec44389920d1d000786..904f4a215cc3e5f7ac0037e05b79a0f4 return delegate_->HandleShouldOverrideWebContentsCreation(); return false; diff --git a/ui/views/controls/webview/web_dialog_view.h b/ui/views/controls/webview/web_dialog_view.h -index d4cb57f0f043d48906d75a46873de6bb0108266e..19bb92a54134d18c695c9fa6a090f1be4c9469dd 100644 +index dadead3378af8b756b37b4efc58bee0aa121751f..62ac39757774de85e3ab2ec62c929e70993ebcf2 100644 --- a/ui/views/controls/webview/web_dialog_view.h +++ b/ui/views/controls/webview/web_dialog_view.h @@ -160,8 +160,7 @@ class WEBVIEW_EXPORT WebDialogView : public ClientView, diff --git a/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch b/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch index 80389b5250e6..9daceb6af1bf 100644 --- a/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch +++ b/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch @@ -7,10 +7,10 @@ spellchecker uses a few IDS_ resources. We need to load these from Electrons grit header instead of Chromes diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index b46c00260b5e9431f6465c8ff8cdddff217ab517..a7f1c10650505e16d89d60a409372b98096544bb 100644 +index 8eebf372cfe6c17d5a7c807e557e085f8d569f19..bcab35896cfee95fa982e7f48a977addb62b02ec 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -6234,6 +6234,7 @@ static_library("browser") { +@@ -6233,6 +6233,7 @@ static_library("browser") { deps += [ "//components/spellcheck/browser", "//components/spellcheck/common", @@ -44,7 +44,7 @@ index 41761e18716a7d9221511978dc4582a1804920e2..faea3d936c678e31fa29b93ae1ccd976 ] } diff --git a/components/language/core/browser/language_prefs.cc b/components/language/core/browser/language_prefs.cc -index c14811efa87b223729d37695d86f858dd8f366ee..444c8273e4985f7e276ad0dd0fd001b027bc0d47 100644 +index fc220d8c9f297268e7e480bb518d2de0d3dd9e4f..18e27d61fab8919969756129de1f61f55790cc88 100644 --- a/components/language/core/browser/language_prefs.cc +++ b/components/language/core/browser/language_prefs.cc @@ -21,7 +21,7 @@ diff --git a/patches/chromium/content_browser_main_loop.patch b/patches/chromium/content_browser_main_loop.patch index 24db72ca020a..87cff27e3df7 100644 --- a/patches/chromium/content_browser_main_loop.patch +++ b/patches/chromium/content_browser_main_loop.patch @@ -8,10 +8,10 @@ run before shutdown. This is required to cleanup WebContents asynchronously in electron::api::WebContents::ResetManagedWebContents. diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc -index 37b9556adceca54bfe80328232c8add16381e9c8..ed60f417f3a0704ac9b42a92f3f8493f0d314149 100644 +index 72693b82f5c4bcd0b5151e97820ec2de9662670c..dba51b8cdd420f8fecc45dff2a92a3110435c737 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc -@@ -1405,7 +1405,7 @@ void BrowserMainLoop::MainMessageLoopRun() { +@@ -1413,7 +1413,7 @@ void BrowserMainLoop::MainMessageLoopRun() { NOTREACHED(); #else base::RunLoop run_loop; diff --git a/patches/chromium/dcheck.patch b/patches/chromium/dcheck.patch index da77ab582a55..1ac6eaa8c749 100644 --- a/patches/chromium/dcheck.patch +++ b/patches/chromium/dcheck.patch @@ -17,10 +17,10 @@ only one or two specific checks fail. Then it's better to simply comment out the failing checks and allow the rest of the target to have them enabled. diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc -index 7cd8a4d740413a9d1d4687a7a05e98d432ba58c0..335d5b6f9a296f793a8b5e6ca08b3585d28582fe 100644 +index 21601429c56fc374da8826cb68361ff0de56ac55..9b27a4ff1abac2b104f0ac16c9ed2e3518279d84 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc -@@ -1326,8 +1326,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( +@@ -1336,8 +1336,10 @@ NavigationType NavigationControllerImpl::ClassifyNavigation( return NAVIGATION_TYPE_NEW_SUBFRAME; } @@ -33,7 +33,7 @@ index 7cd8a4d740413a9d1d4687a7a05e98d432ba58c0..335d5b6f9a296f793a8b5e6ca08b3585 if (rfh->GetParent()) { // All manual subframes would be did_create_new_entry and handled above, so -@@ -1618,7 +1620,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewEntry( +@@ -1629,7 +1631,10 @@ void NavigationControllerImpl::RendererDidNavigateToNewEntry( new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon(); } @@ -46,7 +46,7 @@ index 7cd8a4d740413a9d1d4687a7a05e98d432ba58c0..335d5b6f9a296f793a8b5e6ca08b3585 // navigation. Now we know that the renderer has updated its state accordingly // and it is safe to also clear the browser side history. diff --git a/ui/base/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc -index 84071dbb29c4394d9199132c403a416745a9adfa..10e895128ba8f32768e3aa5a2386fc91a02a8771 100644 +index 0763e37f028a708c6e739458ec4c87c406e79b46..2d238fde0a1eb3f22fd52cbad3b12d704af2e8ae 100644 --- a/ui/base/clipboard/clipboard_win.cc +++ b/ui/base/clipboard/clipboard_win.cc @@ -924,10 +924,10 @@ SkBitmap ClipboardWin::ReadImageInternal(ClipboardBuffer buffer) const { diff --git a/patches/chromium/delay_lock_the_protocol_scheme_registry.patch b/patches/chromium/delay_lock_the_protocol_scheme_registry.patch index 722d5d453f87..82dc9fbb5751 100644 --- a/patches/chromium/delay_lock_the_protocol_scheme_registry.patch +++ b/patches/chromium/delay_lock_the_protocol_scheme_registry.patch @@ -19,10 +19,10 @@ https://chromium-review.googlesource.com/c/chromium/src/+/1901591, we should try re-submitting the patch. diff --git a/content/app/content_main_runner_impl.cc b/content/app/content_main_runner_impl.cc -index 7873fad0a61ba34a860c1dccd368f1920f5011ee..c4b97ae887f5923c006abdda88aaccd330cfe0ad 100644 +index e49304a95fdb71565f61d8d1eb27de365e450eb9..2cf621a173d9c10a20e802ee44fbaa1d364f67e9 100644 --- a/content/app/content_main_runner_impl.cc +++ b/content/app/content_main_runner_impl.cc -@@ -721,7 +721,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { +@@ -722,7 +722,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) { } #endif diff --git a/patches/chromium/desktop_media_list.patch b/patches/chromium/desktop_media_list.patch index 24edda676860..c335a7dc42c4 100644 --- a/patches/chromium/desktop_media_list.patch +++ b/patches/chromium/desktop_media_list.patch @@ -7,10 +7,10 @@ Subject: desktop_media_list.patch * Free the one-time use capturer after thumbnails are fetched diff --git a/chrome/browser/media/webrtc/desktop_media_list.h b/chrome/browser/media/webrtc/desktop_media_list.h -index cf7deb678217727e7fe0deed1663b5174164f040..d947051b1cdb36e20a3d9ed29b2172b83eaedf9d 100644 +index cb383b8d095f3fe82a88d811068d98f09d6c508c..dd05d1928ccfe10deb5f96bbcb35eb63b8a3672c 100644 --- a/chrome/browser/media/webrtc/desktop_media_list.h +++ b/chrome/browser/media/webrtc/desktop_media_list.h -@@ -52,6 +52,9 @@ class DesktopMediaList { +@@ -53,6 +53,9 @@ class DesktopMediaList { virtual ~DesktopMediaList() {} @@ -20,7 +20,7 @@ index cf7deb678217727e7fe0deed1663b5174164f040..d947051b1cdb36e20a3d9ed29b2172b8 // Sets time interval between updates. By default list of sources and their // thumbnail are updated once per second. If called after StartUpdating() then // it will take effect only after the next update. -@@ -83,6 +86,7 @@ class DesktopMediaList { +@@ -84,6 +87,7 @@ class DesktopMediaList { virtual int GetSourceCount() const = 0; virtual const Source& GetSource(int index) const = 0; @@ -29,7 +29,7 @@ index cf7deb678217727e7fe0deed1663b5174164f040..d947051b1cdb36e20a3d9ed29b2172b8 virtual Type GetMediaListType() const = 0; }; diff --git a/chrome/browser/media/webrtc/desktop_media_list_base.cc b/chrome/browser/media/webrtc/desktop_media_list_base.cc -index bce801e2538ec1391e067822f7fda1248cd7c516..4efcf50745b27e66c8f544072993c9bd4490782e 100644 +index a3e1de40e843b5450f417a0455e0e7d7dee1d1bd..2f7f96a5d56d503fc231ca3c96be243cf7cbb389 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_base.cc +++ b/chrome/browser/media/webrtc/desktop_media_list_base.cc @@ -24,6 +24,11 @@ DesktopMediaListBase::DesktopMediaListBase(base::TimeDelta update_period, @@ -79,7 +79,7 @@ index bce801e2538ec1391e067822f7fda1248cd7c516..4efcf50745b27e66c8f544072993c9bd SourceSet new_source_set; for (size_t i = 0; i < new_sources.size(); ++i) { diff --git a/chrome/browser/media/webrtc/desktop_media_list_base.h b/chrome/browser/media/webrtc/desktop_media_list_base.h -index 0c2b98182a8397d2fb0334ea9619f65222c59467..3340c0060ee7475a8c64de3a1cee9dba24d4a732 100644 +index a1038183d5b44ca760576bff55534b5841e2e9d2..d036a4e630e9ba8311cf7670a53b12ac33fdd2ef 100644 --- a/chrome/browser/media/webrtc/desktop_media_list_base.h +++ b/chrome/browser/media/webrtc/desktop_media_list_base.h @@ -27,6 +27,7 @@ class DesktopMediaListBase : public DesktopMediaList { @@ -111,10 +111,10 @@ index ad7f766a36b1b6b2a8bc0f96369f1aaadf6681f7..f6c6c14a0937430df62c9b9c1132c591 protected: virtual ~DesktopMediaListObserver() {} diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc -index 8958de11bc10fc50929a552e9a454b6c143d5713..c2d223f527014ecdcccee78194577a31514fc0c9 100644 +index f0efd4af8b7dde2c13d9e63d64249589f14ac24c..6c8c91f7d9574517da6faebe9c73fe3ed03310e3 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc -@@ -10,14 +10,15 @@ +@@ -10,15 +10,16 @@ #include "base/hash/hash.h" #include "base/message_loop/message_pump_type.h" #include "base/single_thread_task_runner.h" @@ -127,11 +127,12 @@ index 8958de11bc10fc50929a552e9a454b6c143d5713..c2d223f527014ecdcccee78194577a31 -#include "chrome/grit/generated_resources.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" + #include "content/public/common/content_features.h" +#include "electron/grit/electron_resources.h" #include "media/base/video_util.h" #include "third_party/libyuv/include/libyuv/scale_argb.h" #include "third_party/skia/include/core/SkBitmap.h" -@@ -259,6 +260,8 @@ void NativeDesktopMediaList::Worker::RefreshNextThumbnail() { +@@ -265,6 +266,8 @@ void NativeDesktopMediaList::Worker::RefreshNextThumbnail() { FROM_HERE, base::BindOnce(&NativeDesktopMediaList::UpdateNativeThumbnailsFinished, media_list_)); diff --git a/patches/chromium/disable-redraw-lock.patch b/patches/chromium/disable-redraw-lock.patch index 0c3455585f17..35e7fd1f416f 100644 --- a/patches/chromium/disable-redraw-lock.patch +++ b/patches/chromium/disable-redraw-lock.patch @@ -15,7 +15,7 @@ the redraw locking mechanism, which fixes these issues. The electron issue can be found at https://github.com/electron/electron/issues/1821 diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 0a3940b751709585b94e356e0beb02cd81f6e871..1013375edabb6e59338bcd9266f04ee09668098e 100644 +index 0cf04f6ee625d5d8b58c68f100a599e51ff65927..e92d9cd727d1347db2d455811cc9d4c731d44676 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -305,6 +305,10 @@ constexpr int kSynthesizedMouseMessagesTimeDifference = 500; @@ -49,7 +49,7 @@ index 0a3940b751709585b94e356e0beb02cd81f6e871..1013375edabb6e59338bcd9266f04ee0 // HWNDMessageHandler, gfx::WindowImpl overrides: diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h -index 042392a659fd6934e84d66cc985d25863e365e34..5e88e780c3da4805eae7870291188e636423042e 100644 +index 3c2cfa7fec2c37fa4a57261e694fb071ab237791..8f7c1b6d383740f3ae825c08c3f929e4fee80ac9 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h @@ -202,6 +202,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, diff --git a/patches/chromium/disable_color_correct_rendering.patch b/patches/chromium/disable_color_correct_rendering.patch index 207b222fab93..79650809347c 100644 --- a/patches/chromium/disable_color_correct_rendering.patch +++ b/patches/chromium/disable_color_correct_rendering.patch @@ -20,7 +20,7 @@ to deal with color spaces. That is being tracked at https://crbug.com/634542 and https://crbug.com/711107. diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc -index 711f6264fd94139897a074ff421bef73f61e3975..85d1c9a83c5d62f5ca943c1b5f1ec7426eb14763 100644 +index 973eeeb28dfe7260144cd2026aa936dc6a15750c..6d2b701848f0b53ec9701b2a14d67b24ba5763cf 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -1785,6 +1785,10 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw( @@ -229,7 +229,7 @@ index a0fc635ce92491cc3df706e3e52bd8b0cacb2f15..32c497ca0b40517d70639cb16829a628 + +#undef PATCH_CS diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc -index 80ab092b8480b90210c55a6f630485b7cce51d88..2435a17e914867db1583a24d410b45007043c2a1 100644 +index 25a5780a488191d970b780c1af6712187a5e9cde..2030f3857edfea997a7ff615b3882ec478b9512d 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -223,6 +223,7 @@ GpuTerminationStatus ConvertToGpuTerminationStatus( @@ -241,10 +241,10 @@ index 80ab092b8480b90210c55a6f630485b7cce51d88..2435a17e914867db1583a24d410b4500 sandbox::policy::switches::kGpuSandboxAllowSysVShm, sandbox::policy::switches::kGpuSandboxFailuresFatal, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 1b93f610a23c1e1c1ec5a90bfcc9958ec06aad65..8d5f60f36ff4cd92722458049d41836522e90262 100644 +index 24c3f7991246985947e567d90779ecb9416c8686..273b86362eb9eb801ef828f7073ee5c86ca97bd8 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -213,6 +213,7 @@ +@@ -214,6 +214,7 @@ #include "ui/accessibility/accessibility_switches.h" #include "ui/base/ui_base_switches.h" #include "ui/display/display_switches.h" @@ -252,7 +252,7 @@ index 1b93f610a23c1e1c1ec5a90bfcc9958ec06aad65..8d5f60f36ff4cd92722458049d418365 #include "ui/gl/gl_switches.h" #include "ui/native_theme/native_theme_features.h" #include "url/origin.h" -@@ -3220,6 +3221,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( +@@ -3152,6 +3153,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer( // Propagate the following switches to the renderer command line (along // with any associated values) if present in the browser command line. static const char* const kSwitchNames[] = { diff --git a/patches/chromium/disable_compositor_recycling.patch b/patches/chromium/disable_compositor_recycling.patch index e2df42239ec5..182ea6aa21c5 100644 --- a/patches/chromium/disable_compositor_recycling.patch +++ b/patches/chromium/disable_compositor_recycling.patch @@ -6,7 +6,7 @@ Subject: fix: disabling compositor recycling Compositor recycling is useful for Chrome because there can be many tabs and spinning up a compositor for each one would be costly. In practice, Chrome uses the parent compositor code path of browser_compositor_view_mac.mm; the NSView of each tab is detached when it's hidden and attached when it's shown. For Electron, there is no parent compositor, so we're forced into the "own compositor" code path, which seems to be non-optimal and pretty ruthless in terms of the release of resources. Electron has no real concept of multiple tabs per window, so it should be okay to disable this ruthless recycling altogether in Electron. diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 7d2426379b8c7b72b735ab936c529596e46dd9d1..c834d63e13136734bf6ad2ada60b3d75ceeb52a0 100644 +index 925b5ab3e666c14f01745f59859ce25f14f64899..8c55c85010940f3ad2135841d9d780779bc2b07d 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -487,7 +487,11 @@ diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index 960ba28f0d7d..fc6bd707c900 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -6,7 +6,7 @@ Subject: disable_hidden.patch Electron uses this to disable background throttling for hidden windows. diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index 75d7780ab829ec817d8f956fc1cef3d161849179..c4db072350e60db8323e9d275a28222ac9d18b3e 100644 +index 20c2816765f639ce6ecab16db124f885702064dd..d98336a4b552290aff88a0c14321a58807c7eb05 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -709,6 +709,9 @@ void RenderWidgetHostImpl::WasHidden() { @@ -20,7 +20,7 @@ index 75d7780ab829ec817d8f956fc1cef3d161849179..c4db072350e60db8323e9d275a28222a blink::mojom::PointerLockResult::kWrongDocument); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index 25b10d1d867a7d4052e0daba7b83f62e4e522638..1d7a6bf0994b6529a42b3db505cd28fd33fe579a 100644 +index 36994e352ee697fe445f9b7f20bbb0db0d728cd4..a21adfbc22ed2199520121b8fe36244a735f0653 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -834,6 +834,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl @@ -34,7 +34,7 @@ index 25b10d1d867a7d4052e0daba7b83f62e4e522638..1d7a6bf0994b6529a42b3db505cd28fd // |routing_id| must not be MSG_ROUTING_NONE. // If this object outlives |delegate|, DetachDelegate() must be called when diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc -index 351e15aeabf320951681646251a04802cda79bde..60263de834e57311ba1e506f6a3eed104a550792 100644 +index 624f7f5aa5314bd810074f354073ff98bb66b3d2..6417bef874d990535a610c78e547ecba57b78369 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -597,7 +597,7 @@ void RenderWidgetHostViewAura::HideImpl() { diff --git a/patches/chromium/disable_unload_metrics.patch b/patches/chromium/disable_unload_metrics.patch index 4da0e2dd54eb..6ec51721354f 100644 --- a/patches/chromium/disable_unload_metrics.patch +++ b/patches/chromium/disable_unload_metrics.patch @@ -24,10 +24,10 @@ This patch temporarily disables the metrics so we can have green CI, and we should continue seeking for a real fix. diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc -index 5894c68f14fd3b4a843055e418d8521f526a4c48..bffb4b73103e68632e56d4fd5cc106e2828f84c1 100644 +index c30c380d80c15d3795365be20525ad7a01f3ca4a..8e7aeb43a436ec6be46ffcd7d319a3e2d85462e0 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc -@@ -1025,6 +1025,7 @@ void Navigator::RecordNavigationMetrics( +@@ -1017,6 +1017,7 @@ void Navigator::RecordNavigationMetrics( .InMilliseconds()); } @@ -35,7 +35,7 @@ index 5894c68f14fd3b4a843055e418d8521f526a4c48..bffb4b73103e68632e56d4fd5cc106e2 // If this is a same-process navigation and we have timestamps for unload // durations, fill those metrics out as well. if (params.unload_start && params.unload_end && -@@ -1071,6 +1072,7 @@ void Navigator::RecordNavigationMetrics( +@@ -1063,6 +1064,7 @@ void Navigator::RecordNavigationMetrics( first_before_unload_start_time) .InMilliseconds()); } diff --git a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch index cfb3761803a5..bc082da171b2 100644 --- a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch +++ b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch @@ -11,10 +11,10 @@ This regressed in https://chromium-review.googlesource.com/c/chromium/src/+/2572 Upstream: https://chromium-review.googlesource.com/c/chromium/src/+/2598393 diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index d497f3aac9bee9d5738bc50b5650dc2142870e2a..44e234fb8d4332f0f4d5966a141561c283c6626b 100644 +index 43e20435b41c2d682a361ff4f0681081bcf4eab0..b562c8b1f5e588d4a1e471c41e208a18df4482f2 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -2643,7 +2643,7 @@ blink::WebLocalFrame* RenderFrameImpl::GetWebFrame() { +@@ -2668,7 +2668,7 @@ blink::WebLocalFrame* RenderFrameImpl::GetWebFrame() { } const blink::web_pref::WebPreferences& RenderFrameImpl::GetBlinkPreferences() { diff --git a/patches/chromium/enable_reset_aspect_ratio.patch b/patches/chromium/enable_reset_aspect_ratio.patch index e79e3a986a06..d92f2bc22cc4 100644 --- a/patches/chromium/enable_reset_aspect_ratio.patch +++ b/patches/chromium/enable_reset_aspect_ratio.patch @@ -6,7 +6,7 @@ Subject: feat: enable setting aspect ratio to 0 Make SetAspectRatio accept 0 as valid input, which would reset to null. diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 7476de34aa6ecf7759492e871db82a35bf1a2288..896de263c09b0c0b74f4be472d5d1ce9a3854429 100644 +index 9eb420b6499dcf97a687b833b04c67be28e4074d..081463f6199eb9d9b1205685379d08f60f8ea551 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -483,7 +483,7 @@ void DesktopWindowTreeHostWin::SetOpacity(float opacity) { @@ -19,7 +19,7 @@ index 7476de34aa6ecf7759492e871db82a35bf1a2288..896de263c09b0c0b74f4be472d5d1ce9 aspect_ratio.height()); } diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc -index 1013375edabb6e59338bcd9266f04ee09668098e..80b0e1cb9f52c8b25f00d538733c0c15c2df0196 100644 +index e92d9cd727d1347db2d455811cc9d4c731d44676..3dc8185c1fcb19ba20d90e3f5e999d1c4e6c1b1f 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -921,8 +921,11 @@ void HWNDMessageHandler::SetFullscreen(bool fullscreen) { diff --git a/patches/chromium/expose_setuseragent_on_networkcontext.patch b/patches/chromium/expose_setuseragent_on_networkcontext.patch index f9f69d0f10df..15075ece0aec 100644 --- a/patches/chromium/expose_setuseragent_on_networkcontext.patch +++ b/patches/chromium/expose_setuseragent_on_networkcontext.patch @@ -33,10 +33,10 @@ index 0ccfe130f00ec3b6c75cd8ee04d5a2777e1fd00c..653829457d58bf92057cc36aa8a28970 DISALLOW_COPY_AND_ASSIGN(StaticHttpUserAgentSettings); }; diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index d39671bacc738e9185632bdebac31191d1a0c159..2465a053da8f95c3f643a908bbfe06143fa7d78d 100644 +index 8a00bf59c728217069000b1f1ece72e1540baf85..fc98675c01f64e6c674a7cdb4d9195edff446949 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc -@@ -1158,6 +1158,13 @@ void NetworkContext::SetNetworkConditions( +@@ -1139,6 +1139,13 @@ void NetworkContext::SetNetworkConditions( std::move(network_conditions)); } @@ -51,7 +51,7 @@ index d39671bacc738e9185632bdebac31191d1a0c159..2465a053da8f95c3f643a908bbfe0614 // This may only be called on NetworkContexts created with the constructor // that calls MakeURLRequestContext(). diff --git a/services/network/network_context.h b/services/network/network_context.h -index 23bbc41ddfee63dacd622a1aa3cf750682501c76..68888f46623667f00ac6b6f1f7fb7d33965333a0 100644 +index 06b1a0d550de946aa41efca2be4efde694cc24c7..fe7c5c6501838e480c2bc95823e9f562839ad99c 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -254,6 +254,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext @@ -63,10 +63,10 @@ index 23bbc41ddfee63dacd622a1aa3cf750682501c76..68888f46623667f00ac6b6f1f7fb7d33 void SetEnableReferrers(bool enable_referrers) override; #if BUILDFLAG(IS_CHROMEOS_ASH) diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index b1e73dc3250bb8402d4becfd673fd9aa54ecd7fb..cfa9d0c197ca9851f13b088ecae4aba614c7ac55 100644 +index 7a62dfd110555d2bf6ed4be075967ce6396855ef..b35746e2850d7d724fcf3dc09ddbfea1ca56a746 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -964,6 +964,9 @@ interface NetworkContext { +@@ -948,6 +948,9 @@ interface NetworkContext { SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id, NetworkConditions? conditions); @@ -77,7 +77,7 @@ index b1e73dc3250bb8402d4becfd673fd9aa54ecd7fb..cfa9d0c197ca9851f13b088ecae4aba6 SetAcceptLanguage(string new_accept_language); diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h -index feecbe157692fe205d176e3782b24c17b85f4e18..2bd5713a46616231a5af19a5357bfbd851105582 100644 +index f233265ccc0be9b412bf2e3e702e12614fa435c4..51006ddb52a0c4c4ea9f1cdb631cf4d75967bb66 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h @@ -117,6 +117,7 @@ class TestNetworkContext : public mojom::NetworkContext { diff --git a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch index e6275ac018a3..204e9ffa63af 100644 --- a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch +++ b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch @@ -13,10 +13,10 @@ uses internally for things like menus and devtools. We can remove this patch once it has in some shape been upstreamed. diff --git a/ui/native_theme/native_theme.cc b/ui/native_theme/native_theme.cc -index 2855ee596225d70f2ef7027073406f2c9f60ea62..7cff1321dc8af524db12be4ca0777ed049c2f918 100644 +index 2f4d54a14f47d39bf028842a8db8db3066bb4894..427c70e793d87eb6d0f0072adceae3ce98198d09 100644 --- a/ui/native_theme/native_theme.cc +++ b/ui/native_theme/native_theme.cc -@@ -268,6 +268,8 @@ base::Optional NativeTheme::GetColorProviderColor( +@@ -274,6 +274,8 @@ base::Optional NativeTheme::GetColorProviderColor( } bool NativeTheme::ShouldUseDarkColors() const { @@ -26,12 +26,12 @@ index 2855ee596225d70f2ef7027073406f2c9f60ea62..7cff1321dc8af524db12be4ca0777ed0 } diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h -index c0f051e820b134b003f23d8d7bc93024cf76d3d1..6b4c5e82797f383230b60772ff4b2fb462252d59 100644 +index 0196aa21e880a517461001e7bbb1f3399bbc3b37..9375f55b6ab4a897d4e837e681eedf0145af9302 100644 --- a/ui/native_theme/native_theme.h +++ b/ui/native_theme/native_theme.h -@@ -397,6 +397,22 @@ class NATIVE_THEME_EXPORT NativeTheme { - ColorId color_id, - ColorScheme color_scheme = ColorScheme::kDefault) const; +@@ -402,6 +402,22 @@ class NATIVE_THEME_EXPORT NativeTheme { + SkColor GetUnprocessedSystemColor(ColorId color_id, + ColorScheme color_scheme) const; + enum ThemeSource { + kSystem, @@ -52,7 +52,7 @@ index c0f051e820b134b003f23d8d7bc93024cf76d3d1..6b4c5e82797f383230b60772ff4b2fb4 // Returns a shared instance of the native theme that should be used for web // rendering. Do not use it in a normal application context (i.e. browser). // The returned object should not be deleted by the caller. This function is -@@ -551,6 +567,7 @@ class NATIVE_THEME_EXPORT NativeTheme { +@@ -568,6 +584,7 @@ class NATIVE_THEME_EXPORT NativeTheme { bool forced_colors_ = false; PreferredColorScheme preferred_color_scheme_ = PreferredColorScheme::kLight; PreferredContrast preferred_contrast_ = PreferredContrast::kNoPreference; @@ -61,10 +61,10 @@ index c0f051e820b134b003f23d8d7bc93024cf76d3d1..6b4c5e82797f383230b60772ff4b2fb4 DISALLOW_COPY_AND_ASSIGN(NativeTheme); }; diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc -index e3962d04553dcdf27bbb878f39a47e279dc4959f..9c2b87278dc090da48082483aee331202a56ecc2 100644 +index 90e3b67bd5c78be3ea0d0f0e4ef94bc95ea375a2..510791b29b6b16f92eecb804912992fd843c4d9c 100644 --- a/ui/native_theme/native_theme_win.cc +++ b/ui/native_theme/native_theme_win.cc -@@ -740,6 +740,8 @@ bool NativeThemeWin::ShouldUseDarkColors() const { +@@ -748,6 +748,8 @@ bool NativeThemeWin::ShouldUseDarkColors() const { // ...unless --force-dark-mode was specified in which case caveat emptor. if (InForcedColorsMode() && !IsForcedDarkMode()) return false; diff --git a/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch index 9393f60338c7..ae04a6875a42 100644 --- a/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -6,7 +6,7 @@ Subject: feat: allow disabling blink scheduler throttling per RenderView This allows us to disable throttling for hidden windows. diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc -index 517ee0e43e83da558964ae00b9c80219e5978ea2..c8e05b7e97b15170a7f3d41a673ec16a630d8feb 100644 +index a0dc55dc6751550527437b653f8a3ce782c755de..6e42cb67cc912620e32caaa40174cbd9c34218f1 100644 --- a/content/browser/renderer_host/render_view_host_impl.cc +++ b/content/browser/renderer_host/render_view_host_impl.cc @@ -601,6 +601,11 @@ void RenderViewHostImpl::SetBackgroundOpaque(bool opaque) { @@ -48,7 +48,7 @@ index 0edd8ddc099b2e66869d2d4fff42f761d3be6079..bcc704efaf27f9b042b349fa0b097917 // This interface should only be implemented inside content. friend class RenderViewHostImpl; diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h -index 3f455e17e167bd01a219abf2f6fd2b8e235cf3c8..5dd40d3e2f28cf53729801c6960a6f64d057bf7f 100644 +index 166b3d3aa70dc2d6e8123ea1df3d3cb400be747c..f3bccc47ab2fe2d192f7d11628c7bdcf04638d02 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -224,6 +224,8 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient, @@ -61,10 +61,10 @@ index 3f455e17e167bd01a219abf2f6fd2b8e235cf3c8..5dd40d3e2f28cf53729801c6960a6f64 #if defined(OS_ANDROID) diff --git a/third_party/blink/public/mojom/page/page.mojom b/third_party/blink/public/mojom/page/page.mojom -index e122d4ffb857023841dabcb6fed352d7586d8344..3c7cd1cb8b204024a0835150302ee8896e01ee45 100644 +index 464faabf887dcdefa26a747393ccce851bf035d7..7048eec311563bd6f2b9eeba145c418a0f8f6c2d 100644 --- a/third_party/blink/public/mojom/page/page.mojom +++ b/third_party/blink/public/mojom/page/page.mojom -@@ -73,4 +73,7 @@ interface PageBroadcast { +@@ -76,4 +76,7 @@ interface PageBroadcast { // Set history offset and length. SetHistoryOffsetAndLength(int32 offset, int32 length); @@ -85,10 +85,10 @@ index e8212d4566666683d67590ef0fe11e452d71b6fc..b19500d4af881c795e84baff16e9973e // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 51dc16be3019edba22bfcd0c735f49337574dd59..87e81332dc8f81772facd93bae7ffd3f967b64cd 100644 +index 57d18d8d664bb06bc89aa83f27959f712684cca2..ba01fb7cbbff1535401cdc687570c9a86e2011dd 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -3524,6 +3524,13 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -3512,6 +3512,13 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -102,7 +102,7 @@ index 51dc16be3019edba22bfcd0c735f49337574dd59..87e81332dc8f81772facd93bae7ffd3f void WebViewImpl::SetVisibilityState( mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) { -@@ -3536,7 +3543,8 @@ void WebViewImpl::SetVisibilityState( +@@ -3524,7 +3531,8 @@ void WebViewImpl::SetVisibilityState( } GetPage()->SetVisibilityState(visibility_state, is_initial_state); GetPage()->GetPageScheduler()->SetPageVisible( @@ -113,10 +113,10 @@ index 51dc16be3019edba22bfcd0c735f49337574dd59..87e81332dc8f81772facd93bae7ffd3f mojom::blink::PageVisibilityState WebViewImpl::GetVisibilityState() { diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h -index 297d3e515abe14dec4909d94117ba64f91e43b44..8d7c16f677c63aea437d16ed1d5e35bfd82608fc 100644 +index 9afdc9a5f84380436c0435662ae5c633bc7482f6..25fc8941370cb9ab0dd93402f5118e0184e6aca1 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h -@@ -369,6 +369,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -384,6 +384,7 @@ class CORE_EXPORT WebViewImpl final : public WebView, LocalDOMWindow* PagePopupWindow() const; PageScheduler* Scheduler() const override; @@ -124,8 +124,8 @@ index 297d3e515abe14dec4909d94117ba64f91e43b44..8d7c16f677c63aea437d16ed1d5e35bf void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) override; mojom::blink::PageVisibilityState GetVisibilityState() override; -@@ -765,11 +766,18 @@ class CORE_EXPORT WebViewImpl final : public WebView, - SkColor background_color_override_ = Color::kTransparent; +@@ -780,11 +781,18 @@ class CORE_EXPORT WebViewImpl final : public WebView, + float zoom_factor_override_ = 0.f; + // TODO(bokan): Temporary debugging added to diagnose diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index b6c892c2ffd3..99b71c2696b0 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -81,7 +81,7 @@ index 1026b739d283f0fc252fa2af83a6d4cf51bc8553..fe562ab60ce98b8bb0c5080a6428deb3 private: const HWND hwnd_; diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn -index 8985715274291f6e847a5188bf30339e60f07aa3..00322d1fd7d94f2091aca5460644e122374e5c19 100644 +index 248021aeb18072215d77081158b73dc8107f8958..970171531b4a728becba5b0142471c2c976b7e35 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn @@ -129,6 +129,8 @@ viz_component("service") { @@ -484,10 +484,10 @@ index 0000000000000000000000000000000000000000..48fa86caaab3c15764f105eb7ad2aecf + +#endif // COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SOFTWARE_OUTPUT_DEVICE_PROXY_H_ diff --git a/components/viz/service/display_embedder/software_output_device_win.cc b/components/viz/service/display_embedder/software_output_device_win.cc -index 2bb30e5318b6b48c2e6d4b1f64a6a36c68f963d1..9e805f27a9d7d1c0aa68cdf9f48895c055ca7791 100644 +index 599b06c1765ef4ddbfeb2fd96e0875098f7c6ae1..2151fc8aa710162a3870639bd6e952df9d15a0be 100644 --- a/components/viz/service/display_embedder/software_output_device_win.cc +++ b/components/viz/service/display_embedder/software_output_device_win.cc -@@ -188,7 +188,7 @@ void SoftwareOutputDeviceWinProxy::EndPaintDelegated( +@@ -191,7 +191,7 @@ void SoftwareOutputDeviceWinProxy::EndPaintDelegated( if (!canvas_) return; @@ -497,10 +497,10 @@ index 2bb30e5318b6b48c2e6d4b1f64a6a36c68f963d1..9e805f27a9d7d1c0aa68cdf9f48895c0 waiting_on_draw_ack_ = true; diff --git a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc -index c33992f7428957aa1e3cc0e919bba2ed577d9e5a..670baa641b14866d03db4cec0c718c724b0b7583 100644 +index 378ff94440c9f33ed3569d9818ca92083781cc48..831afb1678c889ac162666298849617d53bdc827 100644 --- a/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc +++ b/components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc -@@ -46,7 +46,8 @@ RootCompositorFrameSinkImpl::Create( +@@ -47,7 +47,8 @@ RootCompositorFrameSinkImpl::Create( params->gpu_compositing, params->widget, params->renderer_settings); auto output_surface = output_surface_provider->CreateOutputSurface( params->widget, params->gpu_compositing, display_client.get(), diff --git a/patches/chromium/fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch b/patches/chromium/fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch index 73ca81b3536c..b1e99bd71ab2 100644 --- a/patches/chromium/fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch +++ b/patches/chromium/fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas.patch @@ -7,10 +7,10 @@ Subject: Disable usage of pthread_fchdir_np and pthread_chdir_np in MAS builds. diff --git a/base/process/launch_mac.cc b/base/process/launch_mac.cc -index a0dfda42bd4bc3249e35c40fbe335fa22d007ded..d8d1ee58130fd9d75404aecc00196cc141b20d52 100644 +index 05ad8648a42cdca97d12167246a305373cb5aba3..e3c31792dbc3d9cc94c1e01aa3cfda4e35b6008c 100644 --- a/base/process/launch_mac.cc +++ b/base/process/launch_mac.cc -@@ -28,8 +28,10 @@ extern "C" { +@@ -27,8 +27,10 @@ extern "C" { // descriptor. libpthread only exposes a syscall wrapper starting in // macOS 10.12, but the system call dates back to macOS 10.5. On older OSes, // the syscall is issued directly. @@ -21,7 +21,7 @@ index a0dfda42bd4bc3249e35c40fbe335fa22d007ded..d8d1ee58130fd9d75404aecc00196cc1 int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim) API_AVAILABLE(macosx(10.14)); -@@ -97,21 +99,29 @@ class PosixSpawnFileActions { +@@ -96,21 +98,29 @@ class PosixSpawnFileActions { }; int ChangeCurrentThreadDirectory(const char* path) { @@ -51,7 +51,7 @@ index a0dfda42bd4bc3249e35c40fbe335fa22d007ded..d8d1ee58130fd9d75404aecc00196cc1 } struct GetAppOutputOptions { -@@ -231,11 +241,13 @@ Process LaunchProcess(const std::vector& argv, +@@ -230,11 +240,13 @@ Process LaunchProcess(const std::vector& argv, file_actions.Inherit(STDERR_FILENO); } diff --git a/patches/chromium/fix_properly_honor_printing_page_ranges.patch b/patches/chromium/fix_properly_honor_printing_page_ranges.patch index 9c5b30c454d5..e8d63efe6eec 100644 --- a/patches/chromium/fix_properly_honor_printing_page_ranges.patch +++ b/patches/chromium/fix_properly_honor_printing_page_ranges.patch @@ -10,7 +10,7 @@ them should they exist. This will be upstreamed. diff --git a/printing/printing_context_mac.h b/printing/printing_context_mac.h -index f63f7f2674d9562f57dea4f9c9f473aa595a0c5f..78a46dbea7ff31209748ef47d541725397d80616 100644 +index 00c78a7446480a15a4dfa360ccdc438eaf1215c1..5b0db3e754ac6c9e335365173800d2e1a5ca629d 100644 --- a/printing/printing_context_mac.h +++ b/printing/printing_context_mac.h @@ -82,6 +82,10 @@ class PRINTING_EXPORT PrintingContextMac : public PrintingContext { @@ -25,7 +25,7 @@ index f63f7f2674d9562f57dea4f9c9f473aa595a0c5f..78a46dbea7ff31209748ef47d5417253 // Returns true if duplex mode is set. bool SetDuplexModeInPrintSettings(mojom::DuplexMode mode); diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm -index aa950b59390fdae9a5152affb7a7438cb78eb6f4..9b5307bda7b73cb502fe185be2a7c02e23a7722c 100644 +index ff9b3e08d49cb0daec83df36257729ff2636fe66..20031e220903f0882bef091ed048f47c4c5dc61c 100644 --- a/printing/printing_context_mac.mm +++ b/printing/printing_context_mac.mm @@ -189,7 +189,8 @@ PMPaper MatchPaper(CFArrayRef paper_list, @@ -100,7 +100,7 @@ index fe7fc797504dcc7097a3d79a2dab2c18de737048..20c63b1f657f2969850b31eaafdff7e5 } else { // No need to bother, we don't know how many pages are available. diff --git a/ui/gtk/printing/print_dialog_gtk.cc b/ui/gtk/printing/print_dialog_gtk.cc -index 01c9a6967203f0340f87390653476d4cd89fbd1f..deb9a72a9385cef416ed65eeb237e67239252d69 100644 +index d2ed5cbe4a48abe0026dda24a016da654e7e201a..d1bdf05c89e2c2aef71e8a8a2bf293725b2559d3 100644 --- a/ui/gtk/printing/print_dialog_gtk.cc +++ b/ui/gtk/printing/print_dialog_gtk.cc @@ -239,6 +239,24 @@ void PrintDialogGtk::UpdateSettings( diff --git a/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch b/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch index 682b81e6fc5c..f2dd2f9da50d 100644 --- a/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch +++ b/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch @@ -13,10 +13,10 @@ This patch can be removed once app.allowRendererProcessReuse is forced to true as then Chromiums assumptions around processes become correct. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 0945a202580d6eba49e48d68921f2624fe481b43..a8482b0db04ccdcabad001f51d8d9c85091b856d 100644 +index ce9d64d9770e53e501d561af25094dd8f79bf331..86e5356ec057fddd49e93c49e49156f95f4ed646 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -3037,11 +3037,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { +@@ -3056,11 +3056,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { WebContentsImpl* outermost = GetOutermostWebContents(); if (event.button == blink::WebPointerProperties::Button::kBack && outermost->GetController().CanGoBack()) { diff --git a/patches/chromium/fix_use_electron_generated_resources.patch b/patches/chromium/fix_use_electron_generated_resources.patch index 8311e7f2208c..2b9745d5ea20 100644 --- a/patches/chromium/fix_use_electron_generated_resources.patch +++ b/patches/chromium/fix_use_electron_generated_resources.patch @@ -12,7 +12,7 @@ as they will loaded as empty strings. * IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME on Windows diff --git a/chrome/browser/pdf/pdf_extension_util.cc b/chrome/browser/pdf/pdf_extension_util.cc -index 33fd198d1c92ad20c5f6243bc64956a7d9488e1f..40e5444e48ad8a2b15bace12cf4a28165902ccc8 100644 +index 0944d8c843985ee2f72e28bca37105a681cb82bb..6b1a3a1b7f8b776323d321d0b425e040654646a9 100644 --- a/chrome/browser/pdf/pdf_extension_util.cc +++ b/chrome/browser/pdf/pdf_extension_util.cc @@ -9,8 +9,7 @@ diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 07af633c8b00..e65fb2328402 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -42,10 +42,10 @@ index 65e627f2fa89352b0be27b5813d71a622bf1d326..113f4fd00f1cf994b39f64c9da387855 // another SiteInstance for the same site. void RegisterSiteInstance(SiteInstanceImpl* site_instance); diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index c105cc7532d121c7bfb8c15d9be28288405ad81a..6614b1b70952ef6773d1f33e872f89c18827c00d 100644 +index 615b50b53728a37e7a60247cd66213dd4d5811b0..500668cd676911ee3bc871eb3ff6b33a66d01c6a 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc -@@ -1559,6 +1559,21 @@ void NavigationRequest::BeginNavigation() { +@@ -1570,6 +1570,21 @@ void NavigationRequest::BeginNavigation() { if (IsSameDocument()) { render_frame_host_ = frame_tree_node_->current_frame_host(); } else { @@ -67,7 +67,7 @@ index c105cc7532d121c7bfb8c15d9be28288405ad81a..6614b1b70952ef6773d1f33e872f89c1 // Select an appropriate RenderFrameHost. std::string frame_host_choice_reason; render_frame_host_ = -@@ -5663,6 +5678,7 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { +@@ -5750,6 +5765,7 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { {WILL_START_REQUEST, { WILL_REDIRECT_REQUEST, WILL_PROCESS_RESPONSE, @@ -75,7 +75,7 @@ index c105cc7532d121c7bfb8c15d9be28288405ad81a..6614b1b70952ef6773d1f33e872f89c1 READY_TO_COMMIT, DID_COMMIT, CANCELING, -@@ -5676,10 +5692,14 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { +@@ -5763,10 +5779,14 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { WILL_FAIL_REQUEST, }}, {WILL_PROCESS_RESPONSE, { @@ -91,10 +91,10 @@ index c105cc7532d121c7bfb8c15d9be28288405ad81a..6614b1b70952ef6773d1f33e872f89c1 NOT_STARTED, DID_COMMIT, diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h -index e40cd2050e330accefa14eb5153999e41f5e0186..3504430c9efda71e95f3e76e9d5de35c8f66c149 100644 +index fb6af6129bee6cb74dc8f41de6ebe1931b13494f..ac0aa6c2a808b9b696e408701bd114f402099ffa 100644 --- a/content/browser/renderer_host/navigation_request.h +++ b/content/browser/renderer_host/navigation_request.h -@@ -136,6 +136,10 @@ class CONTENT_EXPORT NavigationRequest +@@ -139,6 +139,10 @@ class CONTENT_EXPORT NavigationRequest // asynchronous. WILL_PROCESS_RESPONSE, @@ -106,10 +106,10 @@ index e40cd2050e330accefa14eb5153999e41f5e0186..3504430c9efda71e95f3e76e9d5de35c READY_TO_COMMIT, diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc -index b0027728189403cf76371f9f7d6a4f614374f64a..0d2bdb0f06c26c093e1030590cfcbfca903deafe 100644 +index d3cc62fa063918b50ceb8f854bcc737f9e53193f..e09db90709c7b7b1c652d6e1b12e513d5bd6a10e 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc -@@ -2738,6 +2738,16 @@ scoped_refptr +@@ -2804,6 +2804,16 @@ scoped_refptr RenderFrameHostManager::GetSiteInstanceForNavigationRequest( NavigationRequest* request, std::string* reason) { @@ -126,7 +126,7 @@ index b0027728189403cf76371f9f7d6a4f614374f64a..0d2bdb0f06c26c093e1030590cfcbfca SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance(); // All children of MHTML documents must be MHTML documents. They all live in -@@ -2765,10 +2775,59 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -2831,10 +2841,59 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( // // TODO(clamy): We should also consider as a candidate SiteInstance the // speculative SiteInstance that was computed on redirects. @@ -190,7 +190,7 @@ index b0027728189403cf76371f9f7d6a4f614374f64a..0d2bdb0f06c26c093e1030590cfcbfca // Account for renderer-initiated reload as well. // Needed as a workaround for https://crbug.com/1045524, remove it when it is -@@ -2801,6 +2860,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( +@@ -2867,6 +2926,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest( request->ResetStateForSiteInstanceChange(); } @@ -201,10 +201,10 @@ index b0027728189403cf76371f9f7d6a4f614374f64a..0d2bdb0f06c26c093e1030590cfcbfca } diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc -index c4e4bfa4546c4dcc4c9d2ccd36bbfb4a5ca9c615..9c0e3cd87dfdd7bfe11d8d0afb1995e76a0bc187 100644 +index 216d9a065146a10fd6187cde30ce725ac1acf2a8..807125e8b47793efe998b76e95e94aae62259107 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc -@@ -1003,6 +1003,10 @@ bool SiteInstanceImpl::HasRelatedSiteInstance(const SiteInfo& site_info) { +@@ -1015,6 +1015,10 @@ bool SiteInstanceImpl::HasRelatedSiteInstance(const SiteInfo& site_info) { return browsing_instance_->HasSiteInstance(site_info); } @@ -216,10 +216,10 @@ index c4e4bfa4546c4dcc4c9d2ccd36bbfb4a5ca9c615..9c0e3cd87dfdd7bfe11d8d0afb1995e7 const GURL& url) { return GetRelatedSiteInstanceImpl( diff --git a/content/browser/site_instance_impl.h b/content/browser/site_instance_impl.h -index 7a09d84c4b94a2d66d7efcb02cd9ad88b10bec29..9b12afc7d031c6763b17d970d9edec265e5b2431 100644 +index 95da3d92e7732c233148ebdc8df0e8e440109bee..b32f71aaedad4e291cd18009c23845f754eea7ca 100644 --- a/content/browser/site_instance_impl.h +++ b/content/browser/site_instance_impl.h -@@ -401,6 +401,7 @@ class CONTENT_EXPORT SiteInstanceImpl final : public SiteInstance, +@@ -409,6 +409,7 @@ class CONTENT_EXPORT SiteInstanceImpl final : public SiteInstance, BrowserContext* GetBrowserContext() override; const GURL& GetSiteURL() override; scoped_refptr GetRelatedSiteInstance(const GURL& url) override; @@ -228,7 +228,7 @@ index 7a09d84c4b94a2d66d7efcb02cd9ad88b10bec29..9b12afc7d031c6763b17d970d9edec26 size_t GetRelatedActiveContentsCount() override; bool RequiresDedicatedProcess() override; diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 523084f820e841bbf8b8fa3974f94a4e938db81b..89344011112bde895c206e2c650d14c4567cff64 100644 +index 8d899d675d0eca0856269e9887371a6f633ef767..060d1fd273f4cd8da5898c0eb5b3b21bd38d766a 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -69,6 +69,21 @@ @@ -254,7 +254,7 @@ index 523084f820e841bbf8b8fa3974f94a4e938db81b..89344011112bde895c206e2c650d14c4 const MainFunctionParams& parameters) { return nullptr; diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index b1c4ad7a48f760d2ba7908c9611b5f894af575d6..373093da3974d774dad68b4172bca7d9cb22b71d 100644 +index 52a300a553742469ad7eea7ccb85e5e9988363b7..656706320502312bd81a3af4e4185692cc841adb 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -257,8 +257,45 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/chromium/gin_enable_disable_v8_platform.patch b/patches/chromium/gin_enable_disable_v8_platform.patch index 94ae28fb7ca8..2c9c346b6943 100644 --- a/patches/chromium/gin_enable_disable_v8_platform.patch +++ b/patches/chromium/gin_enable_disable_v8_platform.patch @@ -38,7 +38,7 @@ index f23af2d9738f3aa76e3a49301e1c3216ee4a64b4..ede178acabc63c3c33d6ce93efd5632b v8::Isolate* isolate() { return isolate_; } diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc -index ac74939f36630673c4ee9db02bef320f17c86154..3dd0f2be0be9ac5194523333aa0d822eaa9eb814 100644 +index e9cc71b968428b8806db8ad5089cc84f28f8cdbb..e5eff4f655bbaa1379499c2e480a930648e8d84b 100644 --- a/gin/v8_initializer.cc +++ b/gin/v8_initializer.cc @@ -198,12 +198,14 @@ enum LoadV8FileResult { diff --git a/patches/chromium/gritsettings_resource_ids.patch b/patches/chromium/gritsettings_resource_ids.patch index 5f2a5fac1bd8..2c4c51c3b9d1 100644 --- a/patches/chromium/gritsettings_resource_ids.patch +++ b/patches/chromium/gritsettings_resource_ids.patch @@ -6,10 +6,10 @@ Subject: gritsettings_resource_ids.patch Add electron resources file to the list of resource ids generation. diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec -index 915758d60d73ad915fbac47e2057882c7827fbd3..247ac45694d77460d7d17b213f1c6419ece8a460 100644 +index cecbbaf47ca01d6a27b1fae6e973658a92a524ad..e90cd439ed661f8364394f5a1097129bc8fb5097 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec -@@ -733,6 +733,11 @@ +@@ -753,6 +753,11 @@ "includes": [3880], }, diff --git a/patches/chromium/mas_disable_remote_accessibility.patch b/patches/chromium/mas_disable_remote_accessibility.patch index 9a8605bd3f47..94581082ad5a 100644 --- a/patches/chromium/mas_disable_remote_accessibility.patch +++ b/patches/chromium/mas_disable_remote_accessibility.patch @@ -47,7 +47,7 @@ index 9ddda9116e7284cbccde8a51e23ad7560dd06367..e846091ad99b0154636489e53491209f } // namespace diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm -index 93db386ed8e7fa0d0f21c25d861b44bb1ba9f0c5..0969062960b4435970617a75ed2219e9028c507a 100644 +index 276ef2a830848af488f12746d25f12413101342e..82d2d75adc0b659be392fc8d6068fa09880e1993 100644 --- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm +++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm @@ -550,10 +550,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) { @@ -90,7 +90,7 @@ index c3a9fbf0f9d2b80c1de42a22ad094a286f0b559b..02493d4b62c98a3aebd3e460c459218a DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostNSViewBridgeOwner); }; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h -index 9997e703d7c2b7c9a35a598b0c5b9d42cfa6769c..f78e3493abcae70f1ebf6ed4fa54b0feea358f30 100644 +index dee1fd0bbbb3239ed435f9adbfc50fa6f898a7de..69d9fc9da5638e1e0c908210959cb0e8440babaa 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -46,7 +46,9 @@ class ScopedPasswordInputEnabler; @@ -117,7 +117,7 @@ index 9997e703d7c2b7c9a35a598b0c5b9d42cfa6769c..f78e3493abcae70f1ebf6ed4fa54b0fe // Used to force the NSApplication's focused accessibility element to be the // content::BrowserAccessibilityCocoa accessibility tree when the NSView for diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm -index 44a682e8b37d452fe39a6d1830ce33da693c4031..7d2426379b8c7b72b735ab936c529596e46dd9d1 100644 +index dcde566593996b62833f20a65a24c658d3fcd629..925b5ab3e666c14f01745f59859ce25f14f64899 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -236,8 +236,10 @@ @@ -170,7 +170,7 @@ index 44a682e8b37d452fe39a6d1830ce33da693c4031..7d2426379b8c7b72b735ab936c529596 /////////////////////////////////////////////////////////////////////////////// diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn -index 6868f3ce6c48bce32c58a386640b0fe6ede91688..91518596912208fb086215f62570608869f48bc0 100644 +index eee1067a534be43aa47bb0d803011ddb8edd3f83..b9c9c32e3e3d71e10fa8f341a000696b54822e6a 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn @@ -317,6 +317,13 @@ component("base") { @@ -208,7 +208,7 @@ index e7adfee3210ec723c687adfcc4bee8827ef643e7..25a924a47eeb30d783ef83dbb4896c4b + #endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_ diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h -index 6d218f9e38f4ea6c109aa1a7256bdb37a76056b3..0bbe5a8e6c217405cf45717c0777bed65f28b182 100644 +index 69d612b69a91228c55bd71ed15244dc7d19ea4b7..a3078e7372bf1e928dcd8c0f023ae8e5d6f051a0 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.h +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h @@ -30,7 +30,9 @@ @@ -236,7 +236,7 @@ index 6d218f9e38f4ea6c109aa1a7256bdb37a76056b3..0bbe5a8e6c217405cf45717c0777bed6 // Used to force the NSApplication's focused accessibility element to be the // views::Views accessibility tree when the NSView for this is focused. diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm -index c2a1dc7a9ff9887a1eb72b6a0905c41bd9def353..e3a7bdb35324d91f9e9d05ad1835480cdf8463a2 100644 +index eecf660ac81c6dbd85ee6cbcf490fb434cb5cf0e..19e145d22eeabb871799f6a7abb113c8c62a25a1 100644 --- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm +++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm @@ -284,14 +284,22 @@ void HandleAccelerator(const ui::Accelerator& accelerator, diff --git a/patches/chromium/mas_no_private_api.patch b/patches/chromium/mas_no_private_api.patch index 0855a8c715d8..941d23bd9b52 100644 --- a/patches/chromium/mas_no_private_api.patch +++ b/patches/chromium/mas_no_private_api.patch @@ -82,10 +82,10 @@ index 88f339d1669436db9c1e4d048a46fc28038c83fe..2e194c5174c24552eb684faa339ad92b OptionalNSObject MakePairArray(const OptionalNSObject& obj1, const OptionalNSObject& obj2) { diff --git a/content/browser/accessibility/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h -index a6493f1c466fcfbc9253e68fecac7c86ec69f075..d7bfd4847e99da466e9e2b5fae46f0b89220ad55 100644 +index eff8d3fe2d47c519952e74ca2d6238ad39429d74..ef74a8983171bb720e4be7b1efa0b1350550727d 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.h +++ b/content/browser/accessibility/browser_accessibility_cocoa.h -@@ -151,7 +151,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); +@@ -157,7 +157,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); @property(nonatomic, readonly) NSNumber* enabled; // Returns a text marker that points to the last character in the document that // can be selected with Voiceover. @@ -95,7 +95,7 @@ index a6493f1c466fcfbc9253e68fecac7c86ec69f075..d7bfd4847e99da466e9e2b5fae46f0b8 @property(nonatomic, readonly) NSNumber* expanded; @property(nonatomic, readonly) NSNumber* focused; @property(nonatomic, readonly) NSNumber* grabbed; -@@ -163,7 +165,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); +@@ -169,7 +171,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); // Index of a row, column, or tree item. @property(nonatomic, readonly) NSNumber* index; @property(nonatomic, readonly) NSNumber* treeItemRowIndex; @@ -105,7 +105,7 @@ index a6493f1c466fcfbc9253e68fecac7c86ec69f075..d7bfd4847e99da466e9e2b5fae46f0b8 @property(nonatomic, readonly) NSString* invalid; @property(nonatomic, readonly) NSNumber* isMultiSelectable; @property(nonatomic, readonly) NSString* placeholderValue; -@@ -186,14 +190,18 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); +@@ -192,14 +196,18 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); // The object is selected as a whole. @property(nonatomic, readonly) NSNumber* selected; @property(nonatomic, readonly) NSArray* selectedChildren; @@ -125,7 +125,7 @@ index a6493f1c466fcfbc9253e68fecac7c86ec69f075..d7bfd4847e99da466e9e2b5fae46f0b8 // is concerned. @property(nonatomic, readonly) NSString* subrole; diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm -index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3c339e31f 100644 +index 86e56961584a26746cc254e8d0f53fe29f62fdb9..2d8265b3d41ce834d29f2764daf4be4aad15a1d1 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.mm +++ b/content/browser/accessibility/browser_accessibility_cocoa.mm @@ -202,6 +202,7 @@ @@ -215,7 +215,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 {NSAccessibilitySizeAttribute, @"size"}, {NSAccessibilitySortDirectionAttribute, @"sortDirection"}, {NSAccessibilitySubroleAttribute, @"subrole"}, -@@ -1362,6 +1376,7 @@ - (NSNumber*)enabled { +@@ -1370,6 +1384,7 @@ - (NSNumber*)enabled { ax::mojom::Restriction::kDisabled); } @@ -223,7 +223,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 // Returns a text marker that points to the last character in the document that // can be selected with VoiceOver. - (id)endTextMarker { -@@ -1370,6 +1385,7 @@ - (id)endTextMarker { +@@ -1378,6 +1393,7 @@ - (id)endTextMarker { BrowserAccessibility::AXPosition position = _owner->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtEndOfContent()); } @@ -231,7 +231,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 - (NSNumber*)expanded { if (![self instanceActive]) -@@ -1570,6 +1586,7 @@ - (bool)findRowIndex:(BrowserAccessibilityCocoa*)toFind +@@ -1578,6 +1594,7 @@ - (bool)findRowIndex:(BrowserAccessibilityCocoa*)toFind return false; } @@ -239,7 +239,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 - (NSNumber*)insertionPointLineNumber { if (![self instanceActive]) return nil; -@@ -1595,6 +1612,7 @@ - (NSNumber*)insertionPointLineNumber { +@@ -1603,6 +1620,7 @@ - (NSNumber*)insertionPointLineNumber { caretPosition->AsTextPosition()->text_offset()); return @(std::distance(lineBreaks.begin(), iterator)); } @@ -247,8 +247,8 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 // Returns whether or not this node should be ignored in the // accessibility tree. -@@ -1946,8 +1964,12 @@ - (BOOL)shouldExposeTitleUIElement { - return content::AXTextEdit(newValue, base::string16(), nil); +@@ -1954,8 +1972,12 @@ - (BOOL)shouldExposeTitleUIElement { + return content::AXTextEdit(newValue, std::u16string(), nil); } } +#ifndef MAS_BUILD @@ -260,7 +260,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 } - (BOOL)instanceActive { -@@ -2272,6 +2294,7 @@ - (NSArray*)selectedChildren { +@@ -2283,6 +2305,7 @@ - (NSArray*)selectedChildren { return ret; } @@ -268,7 +268,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 - (NSString*)selectedText { if (![self instanceActive]) return nil; -@@ -2283,11 +2306,13 @@ - (NSString*)selectedText { +@@ -2294,11 +2317,13 @@ - (NSString*)selectedText { return nil; return base::SysUTF16ToNSString(range.GetText()); } @@ -282,7 +282,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 - (NSValue*)selectedTextRange { if (![self instanceActive]) return nil; -@@ -2312,7 +2337,9 @@ - (NSValue*)selectedTextRange { +@@ -2323,7 +2348,9 @@ - (NSValue*)selectedTextRange { int selLength = range.GetText().length(); return [NSValue valueWithRange:NSMakeRange(selStart, selLength)]; } @@ -292,7 +292,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 - (id)selectedTextMarkerRange { if (![self instanceActive]) return nil; -@@ -2324,6 +2351,7 @@ - (id)selectedTextMarkerRange { +@@ -2335,6 +2362,7 @@ - (id)selectedTextMarkerRange { // words correctly. return CreateTextMarkerRange(ax_range.AsBackwardRange()); } @@ -300,7 +300,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 - (NSValue*)size { if (![self instanceActive]) -@@ -2356,6 +2384,7 @@ - (NSString*)sortDirection { +@@ -2367,6 +2395,7 @@ - (NSString*)sortDirection { return nil; } @@ -308,7 +308,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 // Returns a text marker that points to the first character in the document that // can be selected with VoiceOver. - (id)startTextMarker { -@@ -2364,6 +2393,7 @@ - (id)startTextMarker { +@@ -2375,6 +2404,7 @@ - (id)startTextMarker { BrowserAccessibility::AXPosition position = _owner->CreatePositionAt(0); return CreateTextMarker(position->CreatePositionAtStartOfContent()); } @@ -316,7 +316,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 // Returns a subrole based upon the role. - (NSString*)subrole { -@@ -2693,12 +2723,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range { +@@ -2704,12 +2734,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range { NSMutableAttributedString* attributedInnerText = [[[NSMutableAttributedString alloc] initWithString:base::SysUTF16ToNSString(innerText)] autorelease]; @@ -331,7 +331,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 return [attributedInnerText attributedSubstringFromRange:range]; } -@@ -2811,6 +2843,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -2822,6 +2854,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return ToBrowserAccessibilityCocoa(cell); } @@ -339,7 +339,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 if ([attribute isEqualToString: NSAccessibilityUIElementForTextMarkerParameterizedAttribute]) { -@@ -3134,6 +3167,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -3145,6 +3178,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return CreateTextMarker(root->CreatePositionAt(index)); } @@ -347,7 +347,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 if ([attribute isEqualToString: NSAccessibilityBoundsForRangeParameterizedAttribute]) { -@@ -3164,6 +3198,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -3175,6 +3209,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return nil; } @@ -355,7 +355,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 if ([attribute isEqualToString: NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) { -@@ -3281,6 +3316,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute +@@ -3292,6 +3327,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute return @(child->GetIndexInParent()); } @@ -363,7 +363,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 return nil; } -@@ -3810,6 +3846,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { +@@ -3821,6 +3857,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { _owner->CreatePositionAt(range.location), _owner->CreatePositionAt(NSMaxRange(range)))); } @@ -371,7 +371,7 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 if ([attribute isEqualToString:NSAccessibilitySelectedTextMarkerRangeAttribute]) { BrowserAccessibility::AXRange range = CreateRangeFromTextMarkerRange(value); -@@ -3820,6 +3857,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { +@@ -3831,6 +3868,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { BrowserAccessibility::AXRange(range.anchor()->AsLeafTextPosition(), range.focus()->AsLeafTextPosition())); } @@ -380,10 +380,10 @@ index b0e3b8d22bfb3eda00612985454718ecaca91e83..6e487fa6382119d82f4fb8eeefd6c3a3 - (id)accessibilityFocusedUIElement { diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm -index bf9b2cf399c88c3b08a727b492cd82106e53264b..3196760eb16e1f3642a612a6efd82b174f074f36 100644 +index 2a5163acf68b8a26b562dd0ab54e78fb408e89fe..98a5b1efc461d8f46becd78a4e19c410300e40e0 100644 --- a/content/browser/accessibility/browser_accessibility_manager_mac.mm +++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm -@@ -484,7 +484,7 @@ void PostAnnouncementNotification(NSString* announcement) { +@@ -482,7 +482,7 @@ void PostAnnouncementNotification(NSString* announcement) { if (native_focus_object && [native_focus_object instanceActive]) { [user_info setObject:native_focus_object forKey:ui::NSAccessibilityTextChangeElement]; @@ -392,7 +392,7 @@ index bf9b2cf399c88c3b08a727b492cd82106e53264b..3196760eb16e1f3642a612a6efd82b17 id selected_text = [native_focus_object selectedTextMarkerRange]; if (selected_text) { NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute = -@@ -492,6 +492,7 @@ void PostAnnouncementNotification(NSString* announcement) { +@@ -490,6 +490,7 @@ void PostAnnouncementNotification(NSString* announcement) { [user_info setObject:selected_text forKey:NSAccessibilitySelectedTextMarkerRangeAttribute]; } diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index b5b1c1958bcc..172d3f0cc427 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -7,10 +7,10 @@ This adds a callback from the network service that's used to implement session.setCertificateVerifyCallback. diff --git a/services/network/network_context.cc b/services/network/network_context.cc -index 2829dc39cd506a196c48ae0397f8dce1f33ce251..d39671bacc738e9185632bdebac31191d1a0c159 100644 +index 8e53d65ddca7b54a6effd1767257a4d8239251d8..8a00bf59c728217069000b1f1ece72e1540baf85 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc -@@ -117,6 +117,11 @@ +@@ -116,6 +116,11 @@ #include "services/network/url_loader.h" #include "services/network/url_request_context_builder_mojo.h" @@ -22,7 +22,7 @@ index 2829dc39cd506a196c48ae0397f8dce1f33ce251..d39671bacc738e9185632bdebac31191 #if BUILDFLAG(IS_CT_SUPPORTED) #include "components/certificate_transparency/chrome_ct_policy_enforcer.h" #include "components/certificate_transparency/chrome_require_ct_delegate.h" -@@ -375,6 +380,79 @@ bool SCTAuditingDelegate::IsSCTAuditingEnabled() { +@@ -374,6 +379,79 @@ bool SCTAuditingDelegate::IsSCTAuditingEnabled() { } // namespace @@ -102,7 +102,7 @@ index 2829dc39cd506a196c48ae0397f8dce1f33ce251..d39671bacc738e9185632bdebac31191 constexpr uint32_t NetworkContext::kMaxOutstandingRequestsPerProcess; NetworkContext::PendingCertVerify::PendingCertVerify() = default; -@@ -574,6 +652,13 @@ void NetworkContext::SetClient( +@@ -573,6 +651,13 @@ void NetworkContext::SetClient( client_.Bind(std::move(client)); } @@ -116,7 +116,7 @@ index 2829dc39cd506a196c48ae0397f8dce1f33ce251..d39671bacc738e9185632bdebac31191 void NetworkContext::CreateURLLoaderFactory( mojo::PendingReceiver receiver, mojom::URLLoaderFactoryParamsPtr params) { -@@ -1947,6 +2032,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( +@@ -1930,6 +2015,9 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext( std::move(cert_verifier)); cert_verifier = base::WrapUnique(cert_verifier_with_trust_anchors_); #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -127,7 +127,7 @@ index 2829dc39cd506a196c48ae0397f8dce1f33ce251..d39671bacc738e9185632bdebac31191 builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( diff --git a/services/network/network_context.h b/services/network/network_context.h -index 9b38859a97361c640ef132cfc42606e7dc9b34d2..23bbc41ddfee63dacd622a1aa3cf750682501c76 100644 +index 72885bc1d20a4da5ad4df3fb8185f05bcf6fbfba..06b1a0d550de946aa41efca2be4efde694cc24c7 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -90,6 +90,7 @@ class DomainReliabilityMonitor; @@ -157,7 +157,7 @@ index 9b38859a97361c640ef132cfc42606e7dc9b34d2..23bbc41ddfee63dacd622a1aa3cf7506 // CertNetFetcher is not used by the current platform, or if the actual // net::CertVerifier is instantiated outside of the network service. diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index 7d708f26098739fc60e3f698c5ca9fd3843c242a..b1e73dc3250bb8402d4becfd673fd9aa54ecd7fb 100644 +index 49aefdb660cf522e44ce22bb7d183481d0948e85..7a62dfd110555d2bf6ed4be075967ce6396855ef 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom @@ -192,6 +192,17 @@ struct CTPolicy { @@ -178,7 +178,7 @@ index 7d708f26098739fc60e3f698c5ca9fd3843c242a..b1e73dc3250bb8402d4becfd673fd9aa // Parameters for constructing a network context. struct NetworkContextParams { // Name used by memory tools to identify the context. -@@ -744,6 +755,9 @@ interface NetworkContext { +@@ -728,6 +739,9 @@ interface NetworkContext { // Sets a client for this network context. SetClient(pending_remote client); diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index f8c9ff65e180..f0a91855caf7 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -7,10 +7,10 @@ Pass RenderProcessHost through to PlatformNotificationService so Electron can identify which renderer a notification came from. diff --git a/content/browser/notifications/blink_notification_service_impl.cc b/content/browser/notifications/blink_notification_service_impl.cc -index d756a1b8cfeba5900c95863ca29cb15d9e1b15e4..3159df3456483453b9b362bb8942b45160d67b4d 100644 +index deacfeefaa2fde66378fed29bb29d4bfbcaecf85..d13758a82dc0a809d0812f07caf79316b4b321b4 100644 --- a/content/browser/notifications/blink_notification_service_impl.cc +++ b/content/browser/notifications/blink_notification_service_impl.cc -@@ -87,9 +87,11 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl( +@@ -88,9 +88,11 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl( PlatformNotificationContextImpl* notification_context, BrowserContext* browser_context, scoped_refptr service_worker_context, @@ -22,7 +22,7 @@ index d756a1b8cfeba5900c95863ca29cb15d9e1b15e4..3159df3456483453b9b362bb8942b451 browser_context_(browser_context), service_worker_context_(std::move(service_worker_context)), origin_(origin), -@@ -150,8 +152,9 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( +@@ -151,8 +153,9 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( notification_id, std::move(event_listener_remote)); GetNotificationService(browser_context_) @@ -108,10 +108,10 @@ index 60558d5f40b765ed3ca2f7d1abc1b95f7518fee9..ab44370dc89f64fe2b86089fd9781b71 mojo::PendingReceiver receiver); diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 5b0ced0bfe7635495bd7e418367126335373633c..5e67fd252d6ce17d8093b81d89dec32756a8ba3b 100644 +index 1b7c03f529ec864c9fb30887137b92317dcd1f11..bb60223620f6aab8d48db90ddc9f8b511834f692 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -2179,7 +2179,7 @@ void RenderProcessHostImpl::CreateNotificationService( +@@ -2107,7 +2107,7 @@ void RenderProcessHostImpl::CreateNotificationService( mojo::PendingReceiver receiver) { DCHECK_CURRENTLY_ON(BrowserThread::UI); storage_partition_impl_->GetPlatformNotificationContext()->CreateService( @@ -142,7 +142,7 @@ index ca61088079c4150fcf389504ddcf26bcf6bf69cd..d9c034c39890eef1fe3d95c6d7c0ae68 const GURL& origin, const blink::PlatformNotificationData& notification_data, diff --git a/content/test/mock_platform_notification_service.cc b/content/test/mock_platform_notification_service.cc -index 2f5b8be21c8b37bb6a0c7fe52c87cb7f9debbca0..7934f6e625584466ff0aabc69583343c728759ea 100644 +index 1d8a0687f9ec7e7894c74ac94f1648ad3c1621c8..05450dbe825552e00136837ee4ec4e5373201a45 100644 --- a/content/test/mock_platform_notification_service.cc +++ b/content/test/mock_platform_notification_service.cc @@ -30,6 +30,7 @@ MockPlatformNotificationService::MockPlatformNotificationService( @@ -154,7 +154,7 @@ index 2f5b8be21c8b37bb6a0c7fe52c87cb7f9debbca0..7934f6e625584466ff0aabc69583343c const GURL& origin, const blink::PlatformNotificationData& notification_data, diff --git a/content/test/mock_platform_notification_service.h b/content/test/mock_platform_notification_service.h -index 6d108f9884f7e8f608b70ec33d286a06346e7456..4650a01c2d090c5957eb7a7e21f124489513142a 100644 +index caf6118cc1f0d99b054d2361648751be31368387..ea906b97850c676951a554af288845bb95d6e2a8 100644 --- a/content/test/mock_platform_notification_service.h +++ b/content/test/mock_platform_notification_service.h @@ -47,6 +47,7 @@ class MockPlatformNotificationService : public PlatformNotificationService { diff --git a/patches/chromium/patch_the_ensure_gn_version_py_script_to_work_on_mac_ci.patch b/patches/chromium/patch_the_ensure_gn_version_py_script_to_work_on_mac_ci.patch deleted file mode 100644 index f4050cd0035c..000000000000 --- a/patches/chromium/patch_the_ensure_gn_version_py_script_to_work_on_mac_ci.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jeremy Apthorp -Date: Fri, 12 Apr 2019 12:47:57 -0700 -Subject: patch_the_ensure_gn_version_py_script_to_work_on_mac_ci.patch - -This patches the ensure_gn_version_py script to work on macOS CI. -This script is temporary until https://crbug.com/944667 is resolved. We need to -patch it because on mac CI, we check out the source code on Linux, which -confuses the script. - -diff --git a/buildtools/ensure_gn_version.py b/buildtools/ensure_gn_version.py -index cfc75a37792a93f209a0e7543d577a18d004a615..dd8c3468a914f44050b19002cb2c2df312038398 100755 ---- a/buildtools/ensure_gn_version.py -+++ b/buildtools/ensure_gn_version.py -@@ -45,6 +45,11 @@ def ChmodGnFile(path_to_exe): - stat.S_IROTH | stat.S_IXOTH) - - def main(): -+ # NB. on Electron's CI we check out the macOS source on Linux. Bypass this -+ # check as it's not relevant on Electron CI and it gets confused. -+ if os.environ.get('CI') is not None: -+ return 0 -+ - parser = argparse.ArgumentParser() - parser.add_argument('version', - help='CIPD "git_revision:XYZ" label for GN to sync to') diff --git a/patches/chromium/picture-in-picture.patch b/patches/chromium/picture-in-picture.patch index 83b781e2d6d0..03b273d242af 100644 --- a/patches/chromium/picture-in-picture.patch +++ b/patches/chromium/picture-in-picture.patch @@ -9,7 +9,7 @@ don't get errors for Chrome's generated resources, which are non-existent because we don't generate them in our build. diff --git a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc -index 7c81d93e92400874b88b639fde5aaa937efdcace..7f7ca0c53dbc41e06b1c566ae605c76d05e9abcb 100644 +index 84b64238fdf3a4cb13226af338a1cb3257f3a869..3fb23fab89abdb1eca15b549c9495edd0af03472 100644 --- a/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc +++ b/chrome/browser/ui/views/overlay/back_to_tab_image_button.cc @@ -4,7 +4,7 @@ @@ -22,7 +22,7 @@ index 7c81d93e92400874b88b639fde5aaa937efdcace..7f7ca0c53dbc41e06b1c566ae605c76d #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/color_palette.h" diff --git a/chrome/browser/ui/views/overlay/close_image_button.cc b/chrome/browser/ui/views/overlay/close_image_button.cc -index 6ea71449bf68081bd358c280c3c0b65af23fc97c..8e1c9e5e2cdd464ca1b5e6407b5dddccd31cdb2c 100644 +index a4f6f5dbbf08fc2c7e5f158d0ad170f98c80b4e4..916898ce712ce3327788882fa60048b7390731ee 100644 --- a/chrome/browser/ui/views/overlay/close_image_button.cc +++ b/chrome/browser/ui/views/overlay/close_image_button.cc @@ -5,7 +5,7 @@ @@ -77,7 +77,7 @@ index b148e526ebb4de0111a07a971f038141889bda31..a163cdf5841186235513d9bd9d4ad727 Browser* browser = chrome::FindBrowserWithWebContents(controller->GetWebContents()); diff --git a/chrome/browser/ui/views/overlay/playback_image_button.cc b/chrome/browser/ui/views/overlay/playback_image_button.cc -index c0fe1f138f441b691ac2cec2242bfc4d3bdf79ca..473eb45178549385c52fcce2e9ff0b2c77dd328d 100644 +index 578d17812c1eedcd262b13c1a38338876a7b455e..774b1376750694e5082b88a0f1a15328e0766985 100644 --- a/chrome/browser/ui/views/overlay/playback_image_button.cc +++ b/chrome/browser/ui/views/overlay/playback_image_button.cc @@ -5,7 +5,7 @@ @@ -90,7 +90,7 @@ index c0fe1f138f441b691ac2cec2242bfc4d3bdf79ca..473eb45178549385c52fcce2e9ff0b2c #include "third_party/skia/include/core/SkColor.h" #include "ui/base/l10n/l10n_util.h" diff --git a/chrome/browser/ui/views/overlay/resize_handle_button.cc b/chrome/browser/ui/views/overlay/resize_handle_button.cc -index 51ce84d8e294a35e4c9d59387bdc7df0d7828070..03dd9142eb8cb899d856f1410694b152189102ab 100644 +index 5598da600a3172bde389d34537230e1502c05df1..a63d65a715de32e9ccad653bdbdf12b154265f32 100644 --- a/chrome/browser/ui/views/overlay/resize_handle_button.cc +++ b/chrome/browser/ui/views/overlay/resize_handle_button.cc @@ -5,7 +5,7 @@ @@ -116,7 +116,7 @@ index e5a05b7b04c9679f0b61f0b997f5326ccf881dbf..7ddd4d5f9b55a403b207445f86d78ec6 #include "ui/gfx/color_palette.h" #include "ui/views/background.h" diff --git a/chrome/browser/ui/views/overlay/track_image_button.cc b/chrome/browser/ui/views/overlay/track_image_button.cc -index dbcbbabe7df945f797559b46eaa04f02162299e0..1852ff15198970a92275d65582ec19c55a125314 100644 +index 82b18daa41184fa97da3cfca2fd80d766dfa40ba..bf00f25c64b3e126b61b2e2dc2a29fb9d46ebe7d 100644 --- a/chrome/browser/ui/views/overlay/track_image_button.cc +++ b/chrome/browser/ui/views/overlay/track_image_button.cc @@ -5,7 +5,7 @@ diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index f7cbfc2c29ec..15b877eeb340 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -11,7 +11,7 @@ majority of changes originally come from these PRs: This patch also fixes callback for manual user cancellation and success. diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc -index 1f33cee63624693729b27caabb9f25891cf169f8..3d20b4e11497d91bf24b433846440a26df3effa4 100644 +index 3cff6d2a77cdd5e9303873c5e70d27f08a1b95c2..a0eeb96a74e0e40d0656c9670594f15a0dd906a0 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc @@ -350,18 +350,25 @@ void PrintJob::StartPdfToEmfConversion( @@ -43,7 +43,7 @@ index 1f33cee63624693729b27caabb9f25891cf169f8..3d20b4e11497d91bf24b433846440a26 using RenderMode = PdfRenderSettings::Mode; RenderMode mode; diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc -index 47a5b3c2a11ec595ff926df10f856ed3c5375c55..38769ab454b143a1f50d1291a363092cd3dad407 100644 +index 91edb6e296fd94491a7b379f289e3f7a0b91a53b..ec4fd72f889188869a8ee05ffee2132207b98d48 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -22,7 +22,6 @@ @@ -102,7 +102,7 @@ index 47a5b3c2a11ec595ff926df10f856ed3c5375c55..38769ab454b143a1f50d1291a363092c } diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc -index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d5f953a78 100644 +index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518cafdb352 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc @@ -28,10 +28,10 @@ @@ -129,16 +129,16 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d @@ -75,6 +76,8 @@ using PrintSettingsCallback = base::OnceCallback)>; - void ShowWarningMessageBox(const base::string16& message) { + void ShowWarningMessageBox(const std::u16string& message) { + LOG(ERROR) << "Invalid printer settings " << message; +#if 0 // Runs always on the UI thread. static bool is_dialog_shown = false; if (is_dialog_shown) -@@ -83,6 +86,7 @@ void ShowWarningMessageBox(const base::string16& message) { +@@ -83,6 +86,7 @@ void ShowWarningMessageBox(const std::u16string& message) { base::AutoReset auto_reset(&is_dialog_shown, true); - chrome::ShowWarningMessageBox(nullptr, base::string16(), message); + chrome::ShowWarningMessageBox(nullptr, std::u16string(), message); +#endif } @@ -154,7 +154,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d RenderParamsFromPrintSettings(printer_query->settings(), params->params.get()); params->params->document_cookie = printer_query->cookie(); -@@ -348,12 +354,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) +@@ -345,12 +351,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) : PrintManager(web_contents), queue_(g_browser_process->print_job_manager()->queue()) { DCHECK(queue_); @@ -169,7 +169,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d } PrintViewManagerBase::~PrintViewManagerBase() { -@@ -361,7 +369,10 @@ PrintViewManagerBase::~PrintViewManagerBase() { +@@ -358,7 +366,10 @@ PrintViewManagerBase::~PrintViewManagerBase() { DisconnectFromCurrentPrintJob(); } @@ -181,7 +181,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d DisconnectFromCurrentPrintJob(); // Don't print / print preview crashed tabs. -@@ -369,7 +380,14 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { +@@ -366,7 +377,14 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { return false; SetPrintingRFH(rfh); @@ -197,7 +197,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d return true; } -@@ -490,9 +508,9 @@ void PrintViewManagerBase::StartLocalPrintJob( +@@ -487,9 +505,9 @@ void PrintViewManagerBase::StartLocalPrintJob( void PrintViewManagerBase::UpdatePrintingEnabled() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // The Unretained() is safe because ForEachFrame() is synchronous. @@ -210,7 +210,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d } void PrintViewManagerBase::NavigationStopped() { -@@ -609,12 +627,13 @@ void PrintViewManagerBase::DidPrintDocument( +@@ -606,12 +624,13 @@ void PrintViewManagerBase::DidPrintDocument( void PrintViewManagerBase::GetDefaultPrintSettings( GetDefaultPrintSettingsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -225,7 +225,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d content::RenderFrameHost* render_frame_host = print_manager_host_receivers_.GetCurrentTargetFrame(); -@@ -630,11 +649,12 @@ void PrintViewManagerBase::UpdatePrintSettings( +@@ -627,11 +646,12 @@ void PrintViewManagerBase::UpdatePrintSettings( base::Value job_settings, UpdatePrintSettingsCallback callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -239,7 +239,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d if (!job_settings.FindIntKey(kSettingPrinterType)) { UpdatePrintSettingsReply(std::move(callback), nullptr, false); return; -@@ -673,7 +693,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) { +@@ -665,7 +685,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) { PrintManager::PrintingFailed(cookie); #if BUILDFLAG(ENABLE_PRINT_PREVIEW) @@ -248,7 +248,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d #endif ReleasePrinterQuery(); -@@ -685,6 +705,11 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) { +@@ -677,6 +697,11 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) { } void PrintViewManagerBase::ShowInvalidPrinterSettingsError() { @@ -260,7 +260,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&ShowWarningMessageBox, l10n_util::GetStringUTF16( -@@ -754,9 +779,13 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent( +@@ -746,9 +771,13 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent( content::NotificationService::NoDetails()); break; } @@ -276,7 +276,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d NOTREACHED(); break; } -@@ -854,8 +883,10 @@ bool PrintViewManagerBase::CreateNewPrintJob( +@@ -846,8 +875,10 @@ bool PrintViewManagerBase::CreateNewPrintJob( DCHECK(!quit_inner_loop_); DCHECK(query); @@ -289,7 +289,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d // We can't print if there is no renderer. if (!web_contents()->GetMainFrame()->GetRenderViewHost() || -@@ -876,8 +907,6 @@ bool PrintViewManagerBase::CreateNewPrintJob( +@@ -868,8 +899,6 @@ bool PrintViewManagerBase::CreateNewPrintJob( /*source_id=*/""); #endif @@ -298,7 +298,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d printing_succeeded_ = false; return true; } -@@ -926,14 +955,22 @@ void PrintViewManagerBase::ReleasePrintJob() { +@@ -918,14 +947,22 @@ void PrintViewManagerBase::ReleasePrintJob() { content::RenderFrameHost* rfh = printing_rfh_; printing_rfh_ = nullptr; @@ -323,7 +323,7 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d // Don't close the worker thread. print_job_ = nullptr; } -@@ -969,7 +1006,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { +@@ -961,7 +998,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() { } bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) { @@ -333,10 +333,10 @@ index 81df8a2cb0c374c6a93520fdd3c1951752b3c1f3..cad3c7ab1f7182f596484fe29ad8a60d if (!cookie) { diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h -index 93103940036ece118c511703c20c659d73724202..fcbf4c69d1b6cd30124444158e3f2c6da3371977 100644 +index 17d25f0008699ce41158424a9d266d22952ab631..d22f7f8c16ffbc90db57004f7fb09aab7034e2bf 100644 --- a/chrome/browser/printing/print_view_manager_base.h +++ b/chrome/browser/printing/print_view_manager_base.h -@@ -38,6 +38,8 @@ class PrintJob; +@@ -39,6 +39,8 @@ class PrintJob; class PrintQueriesQueue; class PrinterQuery; @@ -345,7 +345,7 @@ index 93103940036ece118c511703c20c659d73724202..fcbf4c69d1b6cd30124444158e3f2c6d // Base class for managing the print commands for a WebContents. class PrintViewManagerBase : public content::NotificationObserver, public PrintManager { -@@ -47,7 +49,10 @@ class PrintViewManagerBase : public content::NotificationObserver, +@@ -48,7 +50,10 @@ class PrintViewManagerBase : public content::NotificationObserver, // Prints the current document immediately. Since the rendering is // asynchronous, the actual printing will not be completed on the return of // this function. Returns false if printing is impossible at the moment. @@ -357,7 +357,7 @@ index 93103940036ece118c511703c20c659d73724202..fcbf4c69d1b6cd30124444158e3f2c6d #if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Prints the document in |print_data| with settings specified in -@@ -214,9 +219,15 @@ class PrintViewManagerBase : public content::NotificationObserver, +@@ -215,9 +220,15 @@ class PrintViewManagerBase : public content::NotificationObserver, // The current RFH that is printing with a system printing dialog. content::RenderFrameHost* printing_rfh_ = nullptr; @@ -387,7 +387,7 @@ index 4fde003f2a12794bfcd479ef2797cc6281c5720b..bc3bc4aee26f9373de35366ddb07f7ba // Tells the RenderFrame to switch the CSS to print media type, render every // requested page using the print preview document's frame/node, and then diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index 74ae09e7fb99a029b81e5a62f935d6483e6fdd62..3c4ad1139658b46d78f47b3e0445b52bfac943dd 100644 +index 54e6f97423fc08772cc3505e82fb8640178d41b0..c66aa6faaefad9b7d3b5371b5280356989da5e97 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc @@ -38,6 +38,7 @@ @@ -398,7 +398,7 @@ index 74ae09e7fb99a029b81e5a62f935d6483e6fdd62..3c4ad1139658b46d78f47b3e0445b52b #include "printing/units.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" -@@ -1166,7 +1167,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1165,7 +1166,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { if (!weak_this) return; @@ -408,7 +408,7 @@ index 74ae09e7fb99a029b81e5a62f935d6483e6fdd62..3c4ad1139658b46d78f47b3e0445b52b if (weak_this) web_frame->DispatchAfterPrintEvent(); -@@ -1194,7 +1196,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( +@@ -1193,7 +1195,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver( receivers_.Add(this, std::move(receiver)); } @@ -417,7 +417,7 @@ index 74ae09e7fb99a029b81e5a62f935d6483e6fdd62..3c4ad1139658b46d78f47b3e0445b52b ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr()); if (ipc_nesting_level_ > 1) return; -@@ -1209,7 +1211,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() { +@@ -1208,7 +1210,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() { // that instead. auto plugin = delegate_->GetPdfElement(frame); @@ -426,7 +426,7 @@ index 74ae09e7fb99a029b81e5a62f935d6483e6fdd62..3c4ad1139658b46d78f47b3e0445b52b if (!render_frame_gone_) frame->DispatchAfterPrintEvent(); -@@ -1228,7 +1230,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { +@@ -1227,7 +1229,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() { } Print(frame, print_preview_context_.source_node(), @@ -436,7 +436,7 @@ index 74ae09e7fb99a029b81e5a62f935d6483e6fdd62..3c4ad1139658b46d78f47b3e0445b52b if (!render_frame_gone_) print_preview_context_.DispatchAfterPrintEvent(); // WARNING: |this| may be gone at this point. Do not do any more work here and -@@ -1276,6 +1279,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) { +@@ -1275,6 +1278,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) { if (ipc_nesting_level_ > 1) return; @@ -548,7 +548,7 @@ index 74ae09e7fb99a029b81e5a62f935d6483e6fdd62..3c4ad1139658b46d78f47b3e0445b52b notify_browser_of_print_failure_ = false; GetPrintManagerHost()->ShowInvalidPrinterSettingsError(); return false; -@@ -2475,18 +2520,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type) { +@@ -2486,18 +2531,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type) { } bool PrintRenderFrameHelper::CheckForCancel() { @@ -622,7 +622,7 @@ index 92561ff7c6bce6febd8cd2f39f59e3df707f8bdb..241686fa8bdc346f073b5fb92f57c72c std::unique_ptr settings = PrintSettingsFromJobSettings(job_settings); diff --git a/printing/printing_context.h b/printing/printing_context.h -index 268e03d2b8d4f1c81f6ebe81b44ffa6252f88c4b..1baef8c1d58becf760b1576a2d541810a2f98555 100644 +index de7861c6c620f573c72f4bd5fd877b4e919dd97d..337dcddcf611fcf0238de26c4981c8e34d3f6eeb 100644 --- a/printing/printing_context.h +++ b/printing/printing_context.h @@ -134,12 +134,12 @@ class PRINTING_EXPORT PrintingContext { diff --git a/patches/chromium/put_back_deleted_colors_for_autofill.patch b/patches/chromium/put_back_deleted_colors_for_autofill.patch index a8a554a9a543..de85a16c0efc 100644 --- a/patches/chromium/put_back_deleted_colors_for_autofill.patch +++ b/patches/chromium/put_back_deleted_colors_for_autofill.patch @@ -8,10 +8,10 @@ needed in chromium but our autofill implementation uses them. This patch can be our autofill implementation to work like Chromium's. diff --git a/ui/gtk/native_theme_gtk.cc b/ui/gtk/native_theme_gtk.cc -index cc8966c3cb5d81f337932d45d89ca51047224116..e1fea89d33f7362b50aa8da04a622becf60660ff 100644 +index 5882e183ffd353890c367e3ff44937bb6226ff84..3f1b45f5b2e54ffaf1e47e93389b4a945867523f 100644 --- a/ui/gtk/native_theme_gtk.cc +++ b/ui/gtk/native_theme_gtk.cc -@@ -362,6 +362,29 @@ base::Optional SkColorFromColorId( +@@ -364,6 +364,29 @@ base::Optional SkColorFromColorId( case ui::NativeTheme::kColorId_TableHeaderSeparator: return GetBorderColor("GtkTreeView#treeview.view GtkButton#button"); @@ -42,7 +42,7 @@ index cc8966c3cb5d81f337932d45d89ca51047224116..e1fea89d33f7362b50aa8da04a622bec // TODO(thomasanderson): Render GtkSpinner directly. case ui::NativeTheme::kColorId_ThrobberSpinningColor: diff --git a/ui/native_theme/common_theme.cc b/ui/native_theme/common_theme.cc -index a585d34fdb68c39f8f663de6c497359d7f0abfd0..34bc98d26cbfec2cd62d3bf89417c077ce828f06 100644 +index 082e12fcabd16d3db77ee9c5e47f7e383245aa45..fc1d7a814c52fa09bea550039763b1c83fffc530 100644 --- a/ui/native_theme/common_theme.cc +++ b/ui/native_theme/common_theme.cc @@ -52,7 +52,8 @@ base::Optional GetHighContrastColor( @@ -70,7 +70,7 @@ index a585d34fdb68c39f8f663de6c497359d7f0abfd0..34bc98d26cbfec2cd62d3bf89417c077 // Button case NativeTheme::kColorId_ProminentButtonColor: return gfx::kGoogleBlue300; -@@ -511,6 +520,18 @@ SkColor GetDefaultColor(NativeTheme::ColorId color_id, +@@ -512,6 +521,18 @@ SkColor GetDefaultColor(NativeTheme::ColorId color_id, case NativeTheme::kColorId_WindowBackground: return SK_ColorWHITE; @@ -89,7 +89,7 @@ index a585d34fdb68c39f8f663de6c497359d7f0abfd0..34bc98d26cbfec2cd62d3bf89417c077 case NativeTheme::kColorId_NumColors: // Keeping the kColorId_NumColors case instead of using the default case // allows ColorId additions to trigger compile error for an incomplete -@@ -555,7 +576,7 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id, +@@ -556,7 +577,7 @@ SkColor GetAuraColor(NativeTheme::ColorId color_id, } if (color_scheme == NativeTheme::ColorScheme::kDark) { @@ -99,10 +99,10 @@ index a585d34fdb68c39f8f663de6c497359d7f0abfd0..34bc98d26cbfec2cd62d3bf89417c077 DVLOG(2) << "GetDarkSchemeColor: " << "NativeTheme::ColorId: " << NativeThemeColorIdName(color_id) diff --git a/ui/native_theme/native_theme_color_id.h b/ui/native_theme/native_theme_color_id.h -index 8f89aa16c66d4447a8e91bb95eb76f4bde024224..495b345d06de2e10ae14cff7c4af2d85563e80f8 100644 +index efb0f8658db38b99aadb92334b4c0948d289d224..a424ceaef8979084ca7dd514849a38dfe9e5b252 100644 --- a/ui/native_theme/native_theme_color_id.h +++ b/ui/native_theme/native_theme_color_id.h -@@ -147,6 +147,11 @@ +@@ -146,6 +146,11 @@ OP(kColorId_TableHeaderText), \ OP(kColorId_TableHeaderBackground), \ OP(kColorId_TableHeaderSeparator), \ @@ -115,10 +115,10 @@ index 8f89aa16c66d4447a8e91bb95eb76f4bde024224..495b345d06de2e10ae14cff7c4af2d85 OP(kColorId_ThrobberSpinningColor), \ OP(kColorId_ThrobberWaitingColor), \ diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc -index 0726b178dc73dcb0728510486d07b46df464ace9..e3962d04553dcdf27bbb878f39a47e279dc4959f 100644 +index 46eab8ff45a3bb874cd8b16076dd9fa918ffbd45..90e3b67bd5c78be3ea0d0f0e4ef94bc95ea375a2 100644 --- a/ui/native_theme/native_theme_win.cc +++ b/ui/native_theme/native_theme_win.cc -@@ -651,6 +651,18 @@ base::Optional NativeThemeWin::GetPlatformHighContrastColor( +@@ -659,6 +659,18 @@ base::Optional NativeThemeWin::GetPlatformHighContrastColor( case kColorId_ThrobberWaitingColor: return system_colors_[SystemThemeColor::kGrayText]; diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index ddacb18cbc14..11ce44b05718 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -8,7 +8,7 @@ Chrome moved the SetCursor IPC message to mojo, which we use to tell OSR about ` Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2172779 diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h -index e3fe7f35ddad36765bda4e38042ce77b58f37b3f..e5e45826022f65d57eccb2a0049344395303a019 100644 +index 4a60eef424879cf96003bc2522887dc8c7630254..51bcc78ecd8f5f40e90a5e9077ac59b37c5c3e13 100644 --- a/content/browser/renderer_host/render_widget_host_delegate.h +++ b/content/browser/renderer_host/render_widget_host_delegate.h @@ -14,6 +14,7 @@ @@ -30,7 +30,7 @@ index e3fe7f35ddad36765bda4e38042ce77b58f37b3f..e5e45826022f65d57eccb2a004934439 // RenderWidgetHost on the main frame, and false otherwise. virtual bool IsWidgetForMainFrame(RenderWidgetHostImpl*); diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc -index c4db072350e60db8323e9d275a28222ac9d18b3e..ff38837491c6668ea87ea3dc4dee89f3e4de6cb5 100644 +index d98336a4b552290aff88a0c14321a58807c7eb05..fd3eac0706be719433257c218abe5402863726fc 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -1902,6 +1902,8 @@ void RenderWidgetHostImpl::FilterDropData(DropData* drop_data) { @@ -43,10 +43,10 @@ index c4db072350e60db8323e9d275a28222ac9d18b3e..ff38837491c6668ea87ea3dc4dee89f3 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index c36d614a237077e5dedb4450ec51316b0fd2a990..6a044db477fc5b20e3ab6e14fda3c21162d112cb 100644 +index 703f847c844fda3b9efbbd7ce28743c5a9d991a4..cd90a347277d1375251e4e4b9025ca1726010324 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -4170,6 +4170,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { +@@ -4188,6 +4188,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { return text_input_manager_.get(); } @@ -59,10 +59,10 @@ index c36d614a237077e5dedb4450ec51316b0fd2a990..6a044db477fc5b20e3ab6e14fda3c211 RenderWidgetHostImpl* render_widget_host) { return render_widget_host == GetMainFrame()->GetRenderWidgetHost(); diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h -index 90feb1f15ba6f1a6367fe50113d44b435f56bd13..eed7f31c0f4212f33598334948dd997ac1142a67 100644 +index 1f383dfb0302fcbf0220c6a4cd8890660b1131a9..cf4bfa28fbd48a655bfe3233155dd7bfd20c898b 100644 --- a/content/browser/web_contents/web_contents_impl.h +++ b/content/browser/web_contents/web_contents_impl.h -@@ -961,6 +961,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, +@@ -960,6 +960,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, blink::mojom::FrameVisibility visibility) override; void SendScreenRects() override; TextInputManager* GetTextInputManager() override; @@ -71,7 +71,7 @@ index 90feb1f15ba6f1a6367fe50113d44b435f56bd13..eed7f31c0f4212f33598334948dd997a bool IsShowingContextMenuOnPage() const override; void DidChangeScreenOrientation() override; diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h -index 69654654f5e59631b15a8c45fb76977f217356d6..d70af96206f89a9939a2d06efccca625ad0cb9ef 100644 +index ada26a7d33b79596cc161aa3a73e3698bd76de81..a65f15f0f5788faf44213d484989a2cb112b1e30 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -14,6 +14,7 @@ @@ -82,7 +82,7 @@ index 69654654f5e59631b15a8c45fb76977f217356d6..d70af96206f89a9939a2d06efccca625 #include "content/public/browser/allow_service_worker_result.h" #include "content/public/browser/cookie_access_details.h" #include "content/public/browser/navigation_controller.h" -@@ -363,6 +364,9 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener { +@@ -369,6 +370,9 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener { // Invoked every time the WebContents changes visibility. virtual void OnVisibilityChanged(Visibility visibility) {} diff --git a/patches/chromium/render_widget_host_view_base.patch b/patches/chromium/render_widget_host_view_base.patch index febe437be331..b0a02e3ad92d 100644 --- a/patches/chromium/render_widget_host_view_base.patch +++ b/patches/chromium/render_widget_host_view_base.patch @@ -6,7 +6,7 @@ Subject: render_widget_host_view_base.patch ... something to do with OSR? and maybe as well? terrifying. diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc -index da0698caa0767c5b232821cebe9d6a9df05450e3..335d432e5cb38e5e3eddbccb8fd048d65b02d499 100644 +index fd202aae99a908a6dc7be45ed620b6a77cba6af8..97d28c588a4779141215f768c0b36960c7f19c8e 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc @@ -577,6 +577,13 @@ bool RenderWidgetHostViewBase::ScreenRectIsUnstableFor( @@ -24,10 +24,10 @@ index da0698caa0767c5b232821cebe9d6a9df05450e3..335d432e5cb38e5e3eddbccb8fd048d6 const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) { diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h -index 7fd61deee01936024a541f4894d24d5c99fed340..d274fcb2f96a4589c7e641cd0acf8c82209c19a3 100644 +index 868c503052ce7f144da067f98b5b06ea98aa541a..9c57e660cfed6922479ea647ea43c7745bd6bec8 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h -@@ -25,8 +25,10 @@ +@@ -26,8 +26,10 @@ #include "components/viz/host/hit_test/hit_test_query.h" #include "content/browser/renderer_host/display_feature.h" #include "content/browser/renderer_host/event_with_latency_info.h" @@ -38,7 +38,7 @@ index 7fd61deee01936024a541f4894d24d5c99fed340..d274fcb2f96a4589c7e641cd0acf8c82 #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/visibility.h" #include "content/public/common/widget_type.h" -@@ -65,9 +67,11 @@ class CursorManager; +@@ -66,9 +68,11 @@ class CursorManager; class MouseWheelPhaseHandler; class RenderWidgetHostImpl; class RenderWidgetHostViewBaseObserver; @@ -50,7 +50,7 @@ index 7fd61deee01936024a541f4894d24d5c99fed340..d274fcb2f96a4589c7e641cd0acf8c82 class WebCursor; class WebContentsAccessibility; class DelegatedFrameHost; -@@ -123,6 +127,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { +@@ -124,6 +128,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { bool show_reason_unoccluded, bool show_reason_bfcache_restore) final; @@ -60,7 +60,7 @@ index 7fd61deee01936024a541f4894d24d5c99fed340..d274fcb2f96a4589c7e641cd0acf8c82 // This only needs to be overridden by RenderWidgetHostViewBase subclasses // that handle content embedded within other RenderWidgetHostViews. gfx::PointF TransformPointToRootCoordSpaceF( -@@ -282,6 +289,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { +@@ -283,6 +290,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { virtual void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency); diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index 8c2accbf5d89..ff694cb8b3b5 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -10,7 +10,7 @@ kinds of utility windows. Similarly for `disableAutoHideCursor`. Additionally, disables usage of some private APIs in MAS builds. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index 867eebe26002856bcdc1fcb33ef2619603adbb62..7255671200d83ae4438bed28dbb8eae558b94b47 100644 +index cb8d2b79fd15c0178feedc6e4be1c5150d8e5d47..62f536126e6fd4335072172fa58dcf71837b4b98 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -153,6 +153,15 @@ void ExtractUnderlines(NSAttributedString* string, diff --git a/patches/chromium/resource_file_conflict.patch b/patches/chromium/resource_file_conflict.patch index c607a80a3d09..3ebe221e2e95 100644 --- a/patches/chromium/resource_file_conflict.patch +++ b/patches/chromium/resource_file_conflict.patch @@ -52,10 +52,10 @@ Some alternatives to this patch: None of these options seems like a substantial maintainability win over this patch to me (@nornagon). diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn -index 6f386508b11746fb9d313b51642e3450bfdf2ef5..247c6bc34f6405c4b186c93387c2731b149d243c 100644 +index f80853980d0d72fa843f3109593e3c4fadbfb65f..a76a56e19ce8450e1965aebe505d8f537a493b56 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn -@@ -1423,7 +1423,7 @@ if (is_chrome_branded && !is_android) { +@@ -1499,7 +1499,7 @@ if (is_chrome_branded && !is_android) { } } @@ -64,7 +64,7 @@ index 6f386508b11746fb9d313b51642e3450bfdf2ef5..247c6bc34f6405c4b186c93387c2731b chrome_paks("packed_resources") { if (is_mac) { output_dir = "$root_gen_dir/repack" -@@ -1443,6 +1443,12 @@ if (!is_android) { +@@ -1519,6 +1519,12 @@ if (!is_android) { } } diff --git a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch b/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch index 9927e88b0a61..687bf4e45b95 100644 --- a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch +++ b/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch @@ -9,10 +9,10 @@ for every navigation to keep Node.js working properly. Once Native Modules in th are required to be NAPI or context aware (Electron v11), this patch can be removed. diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc -index ab0472c9eda27bcccdceab2486f878b2e48c86cf..420e7452f4f3c8a9c266e0a767c75fd866506bc4 100644 +index 08dda0d5779cefcc0aa2d7d691d8f84137975b5e..d3439ac00ea7e58c2eee210831d38bb8745468cc 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc -@@ -1267,6 +1267,25 @@ ChromeContentRendererClient::GetProtocolHandlerSecurityLevel() { +@@ -1282,6 +1282,25 @@ ChromeContentRendererClient::GetProtocolHandlerSecurityLevel() { #endif } @@ -39,7 +39,7 @@ index ab0472c9eda27bcccdceab2486f878b2e48c86cf..420e7452f4f3c8a9c266e0a767c75fd8 WebLocalFrame* frame, ui::PageTransition transition_type, diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h -index 0c5a146410ef9519f587714d52fedea951e91d14..59909a250f0062b5b937625a5ba96079bacb3e74 100644 +index 0340221d15b589505065c287012a9aa8367d7301..e68ca8f3978a339e4deef2d91794b139e20c6907 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h @@ -122,6 +122,11 @@ class ChromeContentRendererClient @@ -55,7 +55,7 @@ index 0c5a146410ef9519f587714d52fedea951e91d14..59909a250f0062b5b937625a5ba96079 override; void WillSendRequest(blink::WebLocalFrame* frame, diff --git a/content/public/renderer/content_renderer_client.cc b/content/public/renderer/content_renderer_client.cc -index 2023cec6ef2d9d90dfe2b68caec2c350d0212490..53587c613aa1c4d6401f056b393dda3c84fe9559 100644 +index 9745f3208baaf1654c8386c11067958c0e47fd28..8ebebd91eb1216d5ccb4dd31dad0b9772053f2f1 100644 --- a/content/public/renderer/content_renderer_client.cc +++ b/content/public/renderer/content_renderer_client.cc @@ -117,6 +117,14 @@ bool ContentRendererClient::HandleNavigation( @@ -74,7 +74,7 @@ index 2023cec6ef2d9d90dfe2b68caec2c350d0212490..53587c613aa1c4d6401f056b393dda3c blink::WebLocalFrame* frame, ui::PageTransition transition_type, diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index ff1d4178b3c1e477730c5103b8907bc5d01dd9fe..9888848f113b54cde1d0a004f8f5ea6984721b83 100644 +index 04ef16a04e8597d49e1730b9ea11191e350d63d1..5735c09a753c5aaffe4bb75efe2a5bb7b0672ed6 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -208,6 +208,13 @@ class CONTENT_EXPORT ContentRendererClient { @@ -92,10 +92,10 @@ index ff1d4178b3c1e477730c5103b8907bc5d01dd9fe..9888848f113b54cde1d0a004f8f5ea69 // |url|. If the function returns a valid |new_url|, the request must be // updated to use it. diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index adac4b9b2b73be64495dbbb858af5402523bb59b..d497f3aac9bee9d5738bc50b5650dc2142870e2a 100644 +index 2d6f936ade9cb1baceeea038df48e92f4ab3783a..43e20435b41c2d682a361ff4f0681081bcf4eab0 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -5307,6 +5307,23 @@ void RenderFrameImpl::BeginNavigation( +@@ -5347,6 +5347,23 @@ void RenderFrameImpl::BeginNavigation( // we can do a per-frame check here rather than a process-wide check. bool should_fork = HasWebUIScheme(url) || HasWebUIScheme(old_url) || (enabled_bindings_ & kWebUIBindingsPolicyMask); diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index 4585958cf99a..cc47c65dac82 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index b2d116b6b12862fa0e4003e9bbd121f39ac63042..e2906b7be45bbda0875b360112621ffcf6d66c60 100644 +index 33e17936aa5410cf4074d19593949798db90d40e..47b32784f4299595891c35234045cb3d4939039f 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1245,7 +1245,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1268,7 +1268,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/ssl_security_state_tab_helper.patch b/patches/chromium/ssl_security_state_tab_helper.patch index f78d0ead4dd9..24470069fb76 100644 --- a/patches/chromium/ssl_security_state_tab_helper.patch +++ b/patches/chromium/ssl_security_state_tab_helper.patch @@ -6,7 +6,7 @@ Subject: ssl_security_state_tab_helper.patch Allows populating security tab info for devtools in Electron. diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc -index e85187fe0e087e8e6f5552bd63be1720d27ed59f..ac7009506c4a173f0a7c4717b6eb3fadbfeeb797 100644 +index 810fdd18c25a3d3abf13b163e8e63b201d3736e9..0c678efd12694b2f5bd3969f9ad7d1adf4ef4a72 100644 --- a/chrome/browser/ssl/security_state_tab_helper.cc +++ b/chrome/browser/ssl/security_state_tab_helper.cc @@ -7,6 +7,7 @@ @@ -56,23 +56,7 @@ index e85187fe0e087e8e6f5552bd63be1720d27ed59f..ac7009506c4a173f0a7c4717b6eb3fad #include "chrome/browser/safe_browsing/chrome_password_protection_service.h" #endif -@@ -98,9 +103,12 @@ bool IsLegacyTLS(GURL url, int connection_status) { - // default we treat TLS < 1.2 as Legacy, unless the "SSLVersionMin" policy is - // set. - std::string ssl_version_min_str = switches::kSSLVersionTLSv12; -- PrefService* local_state = g_browser_process->local_state(); -- if (local_state && local_state->HasPrefPath(prefs::kSSLVersionMin)) { -- ssl_version_min_str = local_state->GetString(prefs::kSSLVersionMin); -+ -+ // Read directly from the command line, since our pref store is not the same -+ // as Chrome's. -+ auto* cmd_line = base::CommandLine::ForCurrentProcess(); -+ if (cmd_line->HasSwitch(::switches::kSSLVersionMin)) { -+ ssl_version_min_str = cmd_line->GetSwitchValueASCII(::switches::kSSLVersionMin); - } - - // Convert the pref string to an SSLVersion, if it is valid. Otherwise use the -@@ -120,8 +128,9 @@ bool IsLegacyTLS(GURL url, int connection_status) { +@@ -76,8 +81,9 @@ void RecordSecurityLevel( } // namespace @@ -83,7 +67,7 @@ index e85187fe0e087e8e6f5552bd63be1720d27ed59f..ac7009506c4a173f0a7c4717b6eb3fad SecurityStateTabHelper::SecurityStateTabHelper( content::WebContents* web_contents) -@@ -150,6 +159,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { +@@ -101,6 +107,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { // information is still being initialized, thus no need to check for that. state->malicious_content_status = GetMaliciousContentStatus(); @@ -91,7 +75,7 @@ index e85187fe0e087e8e6f5552bd63be1720d27ed59f..ac7009506c4a173f0a7c4717b6eb3fad ReputationWebContentsObserver* reputation_web_contents_observer = ReputationWebContentsObserver::FromWebContents(web_contents()); state->safety_tip_info = -@@ -174,6 +184,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { +@@ -125,6 +132,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() { } } @@ -99,7 +83,7 @@ index e85187fe0e087e8e6f5552bd63be1720d27ed59f..ac7009506c4a173f0a7c4717b6eb3fad return state; } -@@ -236,8 +247,10 @@ void SecurityStateTabHelper::DidFinishNavigation( +@@ -184,8 +192,10 @@ void SecurityStateTabHelper::DidFinishNavigation( UMA_HISTOGRAM_BOOLEAN("interstitial.ssl.visited_site_after_warning", true); } @@ -110,7 +94,7 @@ index e85187fe0e087e8e6f5552bd63be1720d27ed59f..ac7009506c4a173f0a7c4717b6eb3fad } void SecurityStateTabHelper::DidChangeVisibleSecurityState() { -@@ -261,6 +274,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { +@@ -209,6 +219,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { web_contents()->GetController().GetVisibleEntry(); if (!entry) return security_state::MALICIOUS_CONTENT_STATUS_NONE; @@ -118,7 +102,7 @@ index e85187fe0e087e8e6f5552bd63be1720d27ed59f..ac7009506c4a173f0a7c4717b6eb3fad safe_browsing::SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); if (!sb_service) -@@ -343,6 +357,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { +@@ -291,6 +302,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const { break; } } diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index 265d72820358..31a1c014d93e 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,12 +22,12 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 5e67fd252d6ce17d8093b81d89dec32756a8ba3b..1b93f610a23c1e1c1ec5a90bfcc9958ec06aad65 100644 +index bb60223620f6aab8d48db90ddc9f8b511834f692..24c3f7991246985947e567d90779ecb9416c8686 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc -@@ -400,6 +400,11 @@ class RendererSandboxedProcessLauncherDelegate - { - } +@@ -392,10 +392,18 @@ class RendererSandboxedProcessLauncherDelegate + public: + RendererSandboxedProcessLauncherDelegate() = default; +#if BUILDFLAG(USE_ZYGOTE_HANDLE) + RendererSandboxedProcessLauncherDelegate(bool use_zygote): @@ -36,9 +36,6 @@ index 5e67fd252d6ce17d8093b81d89dec32756a8ba3b..1b93f610a23c1e1c1ec5a90bfcc9958e + ~RendererSandboxedProcessLauncherDelegate() override = default; - #if defined(OS_WIN) -@@ -428,6 +433,9 @@ class RendererSandboxedProcessLauncherDelegate - #if BUILDFLAG(USE_ZYGOTE_HANDLE) ZygoteHandle GetZygote() override { + if (!use_zygote_) { @@ -47,38 +44,41 @@ index 5e67fd252d6ce17d8093b81d89dec32756a8ba3b..1b93f610a23c1e1c1ec5a90bfcc9958e const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); base::CommandLine::StringType renderer_prefix = -@@ -446,10 +454,13 @@ class RendererSandboxedProcessLauncherDelegate +@@ -413,6 +421,11 @@ class RendererSandboxedProcessLauncherDelegate + sandbox::policy::SandboxType GetSandboxType() override { return sandbox::policy::SandboxType::kRenderer; } - --#if defined(OS_WIN) - private: -+#if defined(OS_WIN) - const bool renderer_code_integrity_enabled_; - #endif ++ ++ private: +#if BUILDFLAG(USE_ZYGOTE_HANDLE) + bool use_zygote_ = true; +#endif }; - const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; -@@ -1908,11 +1919,18 @@ bool RenderProcessHostImpl::Init() { - cmd_line->PrependWrapper(renderer_prefix); - AppendRendererCommandLine(cmd_line.get()); - + #if defined(OS_WIN) +@@ -423,6 +436,9 @@ class RendererSandboxedProcessLauncherDelegateWin + RendererSandboxedProcessLauncherDelegateWin(base::CommandLine* cmd_line) + : renderer_code_integrity_enabled_( + GetContentClient()->browser()->IsRendererCodeIntegrityEnabled()) { ++#if BUILDFLAG(USE_ZYGOTE_HANDLE) ++ use_zygote_ = !cmd_line->HasSwitch(switches::kNoZygote); ++#endif + if (cmd_line->HasSwitch(switches::kJavaScriptFlags)) { + std::string js_flags = + cmd_line->GetSwitchValueASCII(switches::kJavaScriptFlags); +@@ -1832,9 +1848,15 @@ bool RenderProcessHostImpl::Init() { + std::unique_ptr sandbox_delegate = + std::make_unique( + cmd_line.get()); ++#else +#if BUILDFLAG(USE_ZYGOTE_HANDLE) + bool use_zygote = !cmd_line->HasSwitch(switches::kNoZygote); -+ auto delegate = std::make_unique(use_zygote); -+#else -+ auto delegate = std::make_unique(); ++ std::unique_ptr sandbox_delegate = ++ std::make_unique(use_zygote); + #else + std::unique_ptr sandbox_delegate = + std::make_unique(); +#endif -+ + #endif // Spawn the child process asynchronously to avoid blocking the UI thread. // As long as there's no renderer prefix, we can use the zygote process - // at this stage. - child_process_launcher_ = std::make_unique( -- std::make_unique(), -+ std::move(delegate), - std::move(cmd_line), GetID(), this, std::move(mojo_invitation_), - base::BindRepeating(&RenderProcessHostImpl::OnMojoError, id_), - GetV8SnapshotFilesToPreload()); diff --git a/patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch b/patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch index 4cade1a6ca32..b35a510900d0 100644 --- a/patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch +++ b/patches/chromium/unsandboxed_ppapi_processes_skip_zygote.patch @@ -6,7 +6,7 @@ Subject: unsandboxed_ppapi_processes_skip_zygote.patch Unsandboxed ppapi processes should skip zygote. diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc -index 839bb1285a41e7d881c7ebd5e5e9d4817aeb26d9..f75ce4caac66284cb0aab8ed93f842d200e75ba7 100644 +index 7e40de399a031edf1320358c3e6b94afdec53d4d..2c08b54de2e457754900100950845730c9493366 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc @@ -111,6 +111,9 @@ class PpapiPluginSandboxedProcessLauncherDelegate diff --git a/patches/chromium/upload_list_add_loadsync_method.patch b/patches/chromium/upload_list_add_loadsync_method.patch index ad68278328c1..d4c501324778 100644 --- a/patches/chromium/upload_list_add_loadsync_method.patch +++ b/patches/chromium/upload_list_add_loadsync_method.patch @@ -9,7 +9,7 @@ deprecated, and this API should be removed once the deprecated behavior is no longer supported. diff --git a/components/upload_list/upload_list.cc b/components/upload_list/upload_list.cc -index 4a6b57e81398727977a9ad21ec601ee2f81e910b..03163affcc649ae53c2b7110d27dbd39ae00ae26 100644 +index c5c8119703c245132433f95fbd3764cfff41f8c3..9aa707d8b13b9c91a21ff5f38e680a7f6446503c 100644 --- a/components/upload_list/upload_list.cc +++ b/components/upload_list/upload_list.cc @@ -72,6 +72,10 @@ void UploadList::Load(base::OnceClosure callback) { @@ -24,10 +24,10 @@ index 4a6b57e81398727977a9ad21ec601ee2f81e910b..03163affcc649ae53c2b7110d27dbd39 const base::Time& end, base::OnceClosure callback) { diff --git a/components/upload_list/upload_list.h b/components/upload_list/upload_list.h -index 20358339df63ae2bb8b955870c5daf51b65f19f7..7cf89626bea8ee9436f15366446f053a479ac438 100644 +index c9dee47c8bb0917cd662d0565702890e953cdeea..b914d133df43fc2458af111a4dc83285bfc1aa02 100644 --- a/components/upload_list/upload_list.h +++ b/components/upload_list/upload_list.h -@@ -73,6 +73,8 @@ class UploadList : public base::RefCountedThreadSafe { +@@ -75,6 +75,8 @@ class UploadList : public base::RefCountedThreadSafe { // overwrite the previously supplied one, and the first will not be called. void Load(base::OnceClosure callback); diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index ec2cdf29e29b..a395d40cab54 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,10 +9,10 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index f3884caf2320fb17bed8d84f342b5f8cc3b0b4c1..0945a202580d6eba49e48d68921f2624fe481b43 100644 +index 53f48964e6dfd0fb9b91762760b59a006ac7cc0c..ce9d64d9770e53e501d561af25094dd8f79bf331 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc -@@ -2745,6 +2745,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -2764,6 +2764,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { frame_tree_.Init(site_instance.get(), params.renderer_initiated_creation, params.main_frame_name, params.is_prerendering); @@ -25,7 +25,7 @@ index f3884caf2320fb17bed8d84f342b5f8cc3b0b4c1..0945a202580d6eba49e48d68921f2624 WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -2755,6 +2761,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -2774,6 +2780,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { view_.reset(CreateWebContentsView(this, delegate, &render_view_host_delegate_view_)); } @@ -34,10 +34,10 @@ index f3884caf2320fb17bed8d84f342b5f8cc3b0b4c1..0945a202580d6eba49e48d68921f2624 CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index f7c4564d7ab04ade8e85b4e4ebbf73cfe40bee66..dbbe18b2375112759d65bee0c53da0b58bad609c 100644 +index 7c81ae0070db8d4ed8712efc56a6af7d3f6261cf..b46afaac2bfbf349e759522498a1cfd6f53091c5 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h -@@ -87,8 +87,11 @@ class BrowserContext; +@@ -88,8 +88,11 @@ class BrowserContext; class BrowserPluginGuestDelegate; class RenderFrameHost; class RenderViewHost; @@ -49,7 +49,7 @@ index f7c4564d7ab04ade8e85b4e4ebbf73cfe40bee66..dbbe18b2375112759d65bee0c53da0b5 class WebUI; struct DropData; struct MHTMLGenerationParams; -@@ -228,6 +231,10 @@ class WebContents : public PageNavigator, +@@ -229,6 +232,10 @@ class WebContents : public PageNavigator, // Sandboxing flags set on the new WebContents. network::mojom::WebSandboxFlags starting_sandbox_flags; diff --git a/patches/chromium/webview_cross_drag.patch b/patches/chromium/webview_cross_drag.patch index 439c1bd4feff..c9be206723d8 100644 --- a/patches/chromium/webview_cross_drag.patch +++ b/patches/chromium/webview_cross_drag.patch @@ -8,7 +8,7 @@ This allows dragging and dropping between s. Originally landed in https://github.com/electron/libchromiumcontent/pull/267 diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc -index 81dab5885e269b9e69aa33fc9f7733dcea2fcfd7..8fa9e7d5223596b0178e8caf2c0bb55036c6f4b6 100644 +index d8d434d386b40388d804b6b887c10c4ada206d72..1f261fc8ae77b38d58b13eee2dcb6d53fb26a6f7 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -791,9 +791,7 @@ gfx::NativeView WebContentsViewAura::GetRenderWidgetHostViewParent() const { diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index 791edc2ed3f9..a0e2ad1b25f1 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -10,7 +10,7 @@ An attempt to upstream this was made, but rejected: https://chromium-review.googlesource.com/c/chromium/src/+/1954347 diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index 204c63d3ad36eae56afbdd311cbd8549872d357c..ff1d4178b3c1e477730c5103b8907bc5d01dd9fe 100644 +index bf03da5697646830ded4210544700faafb4f686f..04ef16a04e8597d49e1730b9ea11191e350d63d1 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -372,6 +372,11 @@ class CONTENT_EXPORT ContentRendererClient { @@ -26,10 +26,10 @@ index 204c63d3ad36eae56afbdd311cbd8549872d357c..ff1d4178b3c1e477730c5103b8907bc5 // An empty URL is returned if the URL is not overriden. virtual GURL OverrideFlashEmbedWithHTML(const GURL& url); diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index fcc6479c78f2415d1cdb7326b583c6546bed55d4..78f4629da1ad9447cb0cffc6548e25fd32b7220b 100644 +index 7aec578843ce514da499fc40ddb8a9ceb8e7a78f..8b2287e020172e17c5dc5fa28a19ac7a251d4732 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -928,6 +928,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { +@@ -910,6 +910,12 @@ void RendererBlinkPlatformImpl::WillStopWorkerThread() { WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread(); } @@ -43,10 +43,10 @@ index fcc6479c78f2415d1cdb7326b583c6546bed55d4..78f4629da1ad9447cb0cffc6548e25fd const v8::Local& worker) { GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 9c18bcc27ec8a85d7ffe7aff5242d9eef75a3290..0235ca804e67a587d62b93ced9f026bc41efdf22 100644 +index 7a836b82ee155148ea8711b0f933331074d24524..4e3805bbef80957ff7d2c42282eaf9f8fedac46c 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -195,6 +195,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -194,6 +194,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; @@ -55,10 +55,10 @@ index 9c18bcc27ec8a85d7ffe7aff5242d9eef75a3290..0235ca804e67a587d62b93ced9f026bc const blink::WebSecurityOrigin& script_origin) override; blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel() diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index e6a0363371256789eb90b4cf675681d140e264bf..5c13b5d5eb584148b6ebaf5843660d314e2d503c 100644 +index b5904a748f70b86df3ffda9ed8f0cab1132ad35d..911708b508fb38c0f22b3ceaa92fc6a66308ac17 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -689,6 +689,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -684,6 +684,7 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} @@ -67,10 +67,10 @@ index e6a0363371256789eb90b4cf675681d140e264bf..5c13b5d5eb584148b6ebaf5843660d31 const WebSecurityOrigin& script_origin) { return false; diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc -index d06931f255e68af0ff583b83ada2ecfd23b799a7..8533e1dbe847ee348c7f1b1e1fdf4270dfd4b2c1 100644 +index f3112e1618c7040e6781a19519a19cded9b1335d..aeeeae4b4b9429a6c3cb3c91ae0c642e74fdcc36 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc -@@ -737,6 +737,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { +@@ -738,6 +738,12 @@ void WorkerThread::PrepareForShutdownOnWorkerThread() { nested_runner_->QuitNow(); } diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index b4b9adb44a15..769a7e8eb7b5 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -19,7 +19,7 @@ that clearly establishes the worker script is ready for evaluation with the scop initialized. diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index 9888848f113b54cde1d0a004f8f5ea6984721b83..5f799d4c51842d425965f52f4c581d6eb241dab5 100644 +index 5735c09a753c5aaffe4bb75efe2a5bb7b0672ed6..a4a014778522a685c62c73e751f74d5f647d3aff 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h @@ -379,6 +379,11 @@ class CONTENT_EXPORT ContentRendererClient { @@ -35,10 +35,10 @@ index 9888848f113b54cde1d0a004f8f5ea6984721b83..5f799d4c51842d425965f52f4c581d6e // from the worker thread. virtual void WillDestroyWorkerContextOnWorkerThread( diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc -index 78f4629da1ad9447cb0cffc6548e25fd32b7220b..10e45daae49431adda74e1141433e03e21caa6cf 100644 +index 8b2287e020172e17c5dc5fa28a19ac7a251d4732..f0ebbb0fc851f85811bef5aeb22f4d7414e3c84b 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc -@@ -940,6 +940,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( +@@ -922,6 +922,12 @@ void RendererBlinkPlatformImpl::WorkerContextCreated( worker); } @@ -52,10 +52,10 @@ index 78f4629da1ad9447cb0cffc6548e25fd32b7220b..10e45daae49431adda74e1141433e03e const blink::WebSecurityOrigin& script_origin) { return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker( diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h -index 0235ca804e67a587d62b93ced9f026bc41efdf22..a7dc38fe54f8b9e5333089cbe52adc6a24d26018 100644 +index 4e3805bbef80957ff7d2c42282eaf9f8fedac46c..ad1551231a3411c86969b4108d66b3dc22c73e21 100644 --- a/content/renderer/renderer_blink_platform_impl.h +++ b/content/renderer/renderer_blink_platform_impl.h -@@ -195,6 +195,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -194,6 +194,8 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { void DidStartWorkerThread() override; void WillStopWorkerThread() override; void WorkerContextCreated(const v8::Local& worker) override; @@ -65,10 +65,10 @@ index 0235ca804e67a587d62b93ced9f026bc41efdf22..a7dc38fe54f8b9e5333089cbe52adc6a bool AllowScriptExtensionForServiceWorker( const blink::WebSecurityOrigin& script_origin) override; diff --git a/third_party/blink/public/platform/platform.h b/third_party/blink/public/platform/platform.h -index 5c13b5d5eb584148b6ebaf5843660d314e2d503c..5f3d159b85fcefb6542e755556f4cfd15fa85b24 100644 +index 911708b508fb38c0f22b3ceaa92fc6a66308ac17..792ea5e1159f17354a5e6fd838f3e789469d37cd 100644 --- a/third_party/blink/public/platform/platform.h +++ b/third_party/blink/public/platform/platform.h -@@ -689,6 +689,8 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -684,6 +684,8 @@ class BLINK_PLATFORM_EXPORT Platform { virtual void DidStartWorkerThread() {} virtual void WillStopWorkerThread() {} virtual void WorkerContextCreated(const v8::Local& worker) {} diff --git a/patches/v8/add_realloc.patch b/patches/v8/add_realloc.patch index e7fa850e79de..0bc27acc1a63 100644 --- a/patches/v8/add_realloc.patch +++ b/patches/v8/add_realloc.patch @@ -12,10 +12,10 @@ when we override ReallocateBufferMemory, so we therefore need to implement Realloc on the v8 side. diff --git a/include/v8.h b/include/v8.h -index 7cb19bbede03db217b2283ad0ff0df84aafdd168..b869480cddda91242738786d9ffdc24c3d7ac7dd 100644 +index fb53ca0b8a14f0f7c6e48e149c84fcfe3709fa12..289e2e7f2e4767aa8476126739dfcb7b8d71b401 100644 --- a/include/v8.h +++ b/include/v8.h -@@ -5355,6 +5355,13 @@ class V8_EXPORT ArrayBuffer : public Object { +@@ -5373,6 +5373,13 @@ class V8_EXPORT ArrayBuffer : public Object { */ virtual void* AllocateUninitialized(size_t length) = 0; @@ -30,10 +30,10 @@ index 7cb19bbede03db217b2283ad0ff0df84aafdd168..b869480cddda91242738786d9ffdc24c * Free the memory block of size |length|, pointed to by |data|. * That memory is guaranteed to be previously allocated by |Allocate|. diff --git a/src/api/api.cc b/src/api/api.cc -index 6c6813995f74f1b0c3527d55848bfeb1bbb31a26..3575e9e1a594abdc2a443667f8889bcb27b605ac 100644 +index 335c161672e4d596dc87a80376330a03f295788f..2ee0731218f8565e48af4e37745ad95e914dfdf0 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -315,6 +315,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { +@@ -320,6 +320,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { i::V8::SetSnapshotBlob(snapshot_blob); } diff --git a/patches/v8/build_gn.patch b/patches/v8/build_gn.patch index 95cabfb6a672..5618848f69b5 100644 --- a/patches/v8/build_gn.patch +++ b/patches/v8/build_gn.patch @@ -9,10 +9,10 @@ necessary for native modules to load. Also, some fixes relating to mksnapshot on ARM. diff --git a/BUILD.gn b/BUILD.gn -index 4e9ef83a08dc641fcf4d4df23cd4b815a1a5ee2b..82f3723cb326a148eade470085f960ed261d1831 100644 +index b713df86b88286ce146e195d303483595bf22537..6e4ca3ff5f01adc9821d13650715b292b9a204b8 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -441,7 +441,7 @@ config("internal_config") { +@@ -450,7 +450,7 @@ config("internal_config") { ":cppgc_header_features", ] @@ -21,7 +21,7 @@ index 4e9ef83a08dc641fcf4d4df23cd4b815a1a5ee2b..82f3723cb326a148eade470085f960ed defines += [ "BUILDING_V8_SHARED" ] } } -@@ -4993,7 +4993,7 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -5049,7 +5049,7 @@ if (current_toolchain == v8_generator_toolchain) { "src/interpreter/bytecodes.h", ] @@ -30,7 +30,7 @@ index 4e9ef83a08dc641fcf4d4df23cd4b815a1a5ee2b..82f3723cb326a148eade470085f960ed deps = [ ":v8_libbase", -@@ -5031,6 +5031,8 @@ if (current_toolchain == v8_snapshot_toolchain) { +@@ -5087,6 +5087,8 @@ if (current_toolchain == v8_snapshot_toolchain) { configs = [ ":internal_config" ] diff --git a/patches/v8/dcheck.patch b/patches/v8/dcheck.patch index e3c1449506e6..6b88bd650109 100644 --- a/patches/v8/dcheck.patch +++ b/patches/v8/dcheck.patch @@ -6,10 +6,10 @@ Subject: dcheck.patch https://github.com/auchenberg/volkswagen diff --git a/src/api/api.cc b/src/api/api.cc -index 3575e9e1a594abdc2a443667f8889bcb27b605ac..e5bee991f774f13f2b3b89b980f3b84a9a540458 100644 +index 2ee0731218f8565e48af4e37745ad95e914dfdf0..26b4aa9b364524664d78d6ceaa0d342887bcfa27 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -8887,7 +8887,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { +@@ -8917,7 +8917,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { } void Isolate::PerformMicrotaskCheckpoint() { @@ -19,10 +19,10 @@ index 3575e9e1a594abdc2a443667f8889bcb27b605ac..e5bee991f774f13f2b3b89b980f3b84a isolate->default_microtask_queue()->PerformCheckpoint(this); } diff --git a/src/heap/heap.cc b/src/heap/heap.cc -index 23b84296be18f17371ae1aaa3d4389e23963e313..5b53bc8ee05824bab22302e8a731839f3b3f2318 100644 +index 2c1b6788f3b1648855aa1496eebfb679461de64f..b8a77816772593211cc015589c6ee17d06374c6f 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc -@@ -5551,9 +5551,9 @@ void Heap::TearDown() { +@@ -5553,9 +5553,9 @@ void Heap::TearDown() { void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback, GCType gc_type, void* data) { DCHECK_NOT_NULL(callback); diff --git a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch index cdc476cac0fe..1530861a6542 100644 --- a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch +++ b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch @@ -12,10 +12,10 @@ This patch can be safely removed if, when it is removed, `node.lib` does not contain any standard C++ library exports (e.g. `std::ostringstream`). diff --git a/BUILD.gn b/BUILD.gn -index 993d57f342e777b6376823d7e68b0fae6a374868..d98a0465115b4a5d8a24385d4d3eacc45bd34c44 100644 +index 27125e6525139c6aa39278ab1a52b7befd4ea108..e948fc4bbb99e204bf2a91592f588a3fc41d7761 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -441,6 +441,10 @@ config("internal_config") { +@@ -450,6 +450,10 @@ config("internal_config") { ":cppgc_header_features", ] diff --git a/patches/v8/export_symbols_needed_for_windows_build.patch b/patches/v8/export_symbols_needed_for_windows_build.patch index 99bea7b1be50..94e4fec916b1 100644 --- a/patches/v8/export_symbols_needed_for_windows_build.patch +++ b/patches/v8/export_symbols_needed_for_windows_build.patch @@ -19,7 +19,7 @@ index c68445597f562d043953bd38baf25d818646de68..60f519ad45da2680d24ea2012446f5d6 explicit inline Relocatable(Isolate* isolate); inline virtual ~Relocatable(); diff --git a/src/objects/ordered-hash-table.h b/src/objects/ordered-hash-table.h -index ca1d29d2fd686453747efa2e1d18fedba3883929..db5ab3f57ae2e75e8b90966161359926f70bf7cd 100644 +index 1746e2dc89625a00c6cae0b249142a11de7072c3..cd076405a17f99f77d51b6c146223becf4fb4587 100644 --- a/src/objects/ordered-hash-table.h +++ b/src/objects/ordered-hash-table.h @@ -63,7 +63,7 @@ namespace internal { diff --git a/patches/v8/expose_mksnapshot.patch b/patches/v8/expose_mksnapshot.patch index 14b2ab58ceb3..87581a8fc876 100644 --- a/patches/v8/expose_mksnapshot.patch +++ b/patches/v8/expose_mksnapshot.patch @@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch Needed in order to target mksnapshot for mksnapshot zip. diff --git a/BUILD.gn b/BUILD.gn -index 82f3723cb326a148eade470085f960ed261d1831..993d57f342e777b6376823d7e68b0fae6a374868 100644 +index 6e4ca3ff5f01adc9821d13650715b292b9a204b8..27125e6525139c6aa39278ab1a52b7befd4ea108 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -5005,7 +5005,6 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -5061,7 +5061,6 @@ if (current_toolchain == v8_generator_toolchain) { if (current_toolchain == v8_snapshot_toolchain) { v8_executable("mksnapshot") { From 8f4e362d8fa6032e71eecb0679df0ee9eec26fac Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 15 Mar 2021 18:21:51 -0400 Subject: [PATCH 30/85] fixup gn check --- shell/browser/electron_browser_client.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index fafb02ebdff1..2aa0087658ec 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -30,7 +30,6 @@ #include "chrome/common/chrome_version.h" #include "components/net_log/chrome_net_log.h" #include "components/network_hints/common/network_hints.mojom.h" -#include "content/browser/site_instance_impl.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/browser_task_traits.h" From 57a8781c01c8c32b9fda4d7e7b4637eb39a7d4a7 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 15 Mar 2021 18:43:25 -0400 Subject: [PATCH 31/85] Merge branch 'master' into roller/chromium/master --- .circleci/config.yml | 2 +- .github/CODEOWNERS | 6 - .github/ISSUE_TEMPLATE/Bug_report.md | 58 - .github/ISSUE_TEMPLATE/bug_report.yml | 73 ++ .github/ISSUE_TEMPLATE/feature_request.yml | 21 +- .../mac_app_store_private_api_rejection.md | 25 - .../mac_app_store_private_api_rejection.yml | 30 + ELECTRON_VERSION | 2 +- build/webpack/webpack.config.base.js | 7 - buildflags/BUILD.gn | 1 - buildflags/buildflags.gni | 2 - default_app/default_app.ts | 3 +- docs/README.md | 1 - docs/api/app.md | 58 - docs/api/auto-updater.md | 3 + docs/api/browser-window.md | 9 +- docs/api/command-line-switches.md | 5 - docs/api/cookies.md | 2 + docs/api/power-monitor.md | 4 +- docs/api/remote.md | 217 ---- docs/api/session.md | 9 +- docs/api/web-contents.md | 53 - docs/api/webview-tag.md | 9 - docs/api/window-open.md | 6 +- docs/breaking-changes.md | 3 + docs/tutorial/quick-start.md | 3 +- docs/tutorial/security.md | 135 +-- filenames.auto.gni | 22 - lib/asar/fs-wrapper.ts | 49 +- lib/browser/api/crash-reporter.ts | 2 +- lib/browser/api/module-names.ts | 50 - lib/browser/api/web-contents.ts | 5 +- lib/browser/guest-view-manager.ts | 2 - lib/browser/guest-window-manager.ts | 1 - lib/browser/init.ts | 4 - lib/browser/remote/objects-registry.ts | 128 -- lib/browser/remote/server.ts | 519 -------- lib/common/parse-features-string.ts | 2 +- lib/common/remote/types.ts | 85 -- lib/renderer/api/module-list.ts | 11 - lib/renderer/api/remote.ts | 395 ------- lib/renderer/remote/callbacks-registry.ts | 59 - lib/renderer/security-warnings.ts | 22 - lib/renderer/web-view/web-view-attributes.ts | 15 - lib/renderer/web-view/web-view-constants.ts | 1 - lib/renderer/web-view/web-view-element.ts | 1 - lib/sandboxed_renderer/api/module-list.ts | 11 - package.json | 2 +- patches/chromium/.patches | 1 + ..._windows_to_have_different_web_prefs.patch | 28 +- ..._of_webview_to_blinks_webprefs_logic.patch | 40 + patches/node/.patches | 2 +- ...ng_back_node_with_ltcg_configuration.patch | 51 - ...is_on_64bit_arch_and_ptr_compression.patch | 2 +- ...everse_jsargs_defines_in_common_gypi.patch | 4 +- ...ne_asynccleanuphookhandle_in_headers.patch | 73 ++ shell/browser/api/electron_api_base_window.cc | 8 +- shell/browser/api/electron_api_base_window.h | 1 + .../browser/api/electron_api_browser_view.cc | 6 +- .../api/electron_api_browser_window.cc | 102 +- .../browser/api/electron_api_browser_window.h | 6 +- .../electron_api_system_preferences_mac.mm | 9 +- .../browser/api/electron_api_web_contents.cc | 183 ++- shell/browser/api/electron_api_web_contents.h | 25 +- .../api/electron_api_web_contents_view.cc | 14 +- shell/browser/badging/badge_manager.cc | 21 + shell/browser/badging/badge_manager.h | 19 + shell/browser/electron_browser_client.cc | 8 + shell/browser/electron_browser_client.h | 4 + shell/browser/native_window_mac.mm | 6 +- shell/browser/native_window_views.cc | 5 +- shell/browser/resources/win/electron.rc | 4 +- .../electron_inspectable_web_contents_view.h | 2 +- .../electron_inspectable_web_contents_view.mm | 38 +- shell/browser/ui/inspectable_web_contents.cc | 12 +- .../ui/inspectable_web_contents_view_mac.mm | 1 - shell/browser/web_contents_preferences.cc | 5 - shell/common/api/BUILD.gn | 5 - shell/common/api/electron_api_asar.cc | 72 +- shell/common/api/electron_api_v8_util.cc | 5 + shell/common/api/features.cc | 5 - shell/common/asar/archive.cc | 86 +- shell/common/asar/archive.h | 8 +- shell/common/asar/scoped_temporary_file.cc | 23 + shell/common/asar/scoped_temporary_file.h | 6 + shell/common/color_util.cc | 10 + shell/common/color_util.h | 2 + shell/common/options_switches.cc | 4 - shell/common/options_switches.h | 4 - shell/renderer/api/electron_api_web_frame.cc | 4 - shell/renderer/renderer_client_base.cc | 16 - spec-main/api-app-spec.ts | 99 +- spec-main/api-browser-window-spec.ts | 165 +-- spec-main/api-callbacks-registry-spec.ts | 47 - spec-main/api-remote-spec.ts | 1049 ----------------- spec-main/chromium-spec.ts | 123 +- spec-main/extensions-spec.ts | 6 +- .../index.js | 14 + spec-main/fixtures/remote/call.js | 7 - spec-main/fixtures/remote/circular.js | 3 - spec-main/fixtures/remote/class.js | 29 - spec-main/fixtures/remote/delete-buffer.js | 11 - spec-main/fixtures/remote/error-properties.js | 11 - spec-main/fixtures/remote/exception.js | 3 - .../remote/export-function-with-properties.js | 4 - .../fixtures/remote/function-with-args.js | 3 - .../function-with-missing-properties.js | 13 - .../remote/function-with-properties.js | 17 - spec-main/fixtures/remote/function.js | 1 - spec-main/fixtures/remote/id.js | 1 - spec-main/fixtures/remote/no-prototype.js | 11 - .../remote/preload-remote-function.js | 5 - spec-main/fixtures/remote/preload-remote.js | 5 - spec-main/fixtures/remote/print_name.js | 36 - spec-main/fixtures/remote/promise.js | 5 - spec-main/fixtures/remote/property.js | 11 - spec-main/fixtures/remote/rejected-promise.js | 5 - .../fixtures/remote/remote-event-handler.html | 18 - .../fixtures/remote/remote-object-set.js | 11 - spec-main/fixtures/remote/remote-static.js | 15 - .../fixtures/remote/render-view-deleted.html | 32 - spec-main/fixtures/remote/send-on-exit.html | 11 - .../fixtures/remote/to-string-non-function.js | 4 - .../fixtures/remote/unhandled-rejection.js | 3 - spec-main/index.js | 4 + spec-main/security-warnings-spec.ts | 33 +- spec-main/spellchecker-spec.ts | 74 +- spec-main/webview-spec.ts | 49 - spec/fixtures/api/relaunch/main.js | 7 +- .../fixtures/module/preload-disable-remote.js | 8 - .../pages/service-worker/badge-index.html | 31 + .../service-worker/service-worker-badge.js | 33 + spec/static/index.html | 4 + spec/static/main.js | 1 - spec/ts-smoke/electron/renderer.ts | 62 - spec/webview-spec.js | 11 - typings/internal-ambient.d.ts | 7 +- 137 files changed, 876 insertions(+), 4289 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/Bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml delete mode 100644 .github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.md create mode 100644 .github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.yml delete mode 100644 docs/api/remote.md delete mode 100644 lib/browser/api/module-names.ts delete mode 100644 lib/browser/remote/objects-registry.ts delete mode 100644 lib/browser/remote/server.ts delete mode 100644 lib/common/remote/types.ts delete mode 100644 lib/renderer/api/remote.ts delete mode 100644 lib/renderer/remote/callbacks-registry.ts create mode 100644 patches/chromium/moves_background_color_setter_of_webview_to_blinks_webprefs_logic.patch delete mode 100644 patches/node/build_bring_back_node_with_ltcg_configuration.patch create mode 100644 patches/node/src_inline_asynccleanuphookhandle_in_headers.patch delete mode 100644 spec-main/api-callbacks-registry-spec.ts delete mode 100644 spec-main/api-remote-spec.ts create mode 100644 spec-main/fixtures/crash-cases/transparent-window-get-background-color/index.js delete mode 100644 spec-main/fixtures/remote/call.js delete mode 100644 spec-main/fixtures/remote/circular.js delete mode 100644 spec-main/fixtures/remote/class.js delete mode 100644 spec-main/fixtures/remote/delete-buffer.js delete mode 100644 spec-main/fixtures/remote/error-properties.js delete mode 100644 spec-main/fixtures/remote/exception.js delete mode 100644 spec-main/fixtures/remote/export-function-with-properties.js delete mode 100644 spec-main/fixtures/remote/function-with-args.js delete mode 100644 spec-main/fixtures/remote/function-with-missing-properties.js delete mode 100644 spec-main/fixtures/remote/function-with-properties.js delete mode 100644 spec-main/fixtures/remote/function.js delete mode 100644 spec-main/fixtures/remote/id.js delete mode 100644 spec-main/fixtures/remote/no-prototype.js delete mode 100644 spec-main/fixtures/remote/preload-remote-function.js delete mode 100644 spec-main/fixtures/remote/preload-remote.js delete mode 100644 spec-main/fixtures/remote/print_name.js delete mode 100644 spec-main/fixtures/remote/promise.js delete mode 100644 spec-main/fixtures/remote/property.js delete mode 100644 spec-main/fixtures/remote/rejected-promise.js delete mode 100644 spec-main/fixtures/remote/remote-event-handler.html delete mode 100644 spec-main/fixtures/remote/remote-object-set.js delete mode 100644 spec-main/fixtures/remote/remote-static.js delete mode 100644 spec-main/fixtures/remote/render-view-deleted.html delete mode 100644 spec-main/fixtures/remote/send-on-exit.html delete mode 100644 spec-main/fixtures/remote/to-string-non-function.js delete mode 100644 spec-main/fixtures/remote/unhandled-rejection.js delete mode 100644 spec/fixtures/module/preload-disable-remote.js create mode 100644 spec/fixtures/pages/service-worker/badge-index.html create mode 100644 spec/fixtures/pages/service-worker/service-worker-badge.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 078e934443dd..5ee057c7f974 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -313,7 +313,7 @@ step-setup-goma-for-build: &step-setup-goma-for-build npm install mkdir third_party node -e "require('./src/utils/goma.js').downloadAndPrepare({ gomaOneForAll: true })" - node -e "require('./src/utils/goma.js').ensure()" + third_party/goma/goma_ctl.py ensure_start echo 'export GN_GOMA_FILE='`node -e "console.log(require('./src/utils/goma.js').gnFilePath)"` >> $BASH_ENV echo 'export LOCAL_GOMA_DIR='`node -e "console.log(require('./src/utils/goma.js').dir)"` >> $BASH_ENV cd .. diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ab2ac48d731a..d10b60555cb0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -13,9 +13,3 @@ DEPS @electron/wg-upgrades # Security WG /lib/browser/rpc-server.ts @electron/wg-security - -# Remote Change Disliker -/lib/browser/remote/ @nornagon -/lib/renderer/remote/ @nornagon -/lib/renderer/api/remote.ts @nornagon -/docs/api/remote.md @nornagon diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md deleted file mode 100644 index a1a336a131e1..000000000000 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve Electron - ---- - - - -### Preflight Checklist - - -* [ ] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project. -* [ ] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to. -* [ ] I have searched the issue tracker for an issue that matches the one I want to file, without success. - -### Issue Details - -* **Electron Version:** - * -* **Operating System:** - * -* **Last Known Working Electron version:** - * - -### Expected Behavior - - -### Actual Behavior - - -### To Reproduce - - - - - - - - -### Screenshots - - -### Additional Information - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000000..fdb80175f21f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,73 @@ +name: Bug Report +description: Report an Electron bug +title: "[Bug]: " +labels: "bug :beetle:" +body: +- type: checkboxes + attributes: + label: Preflight Checklist + description: Please ensure you've completed all of the following. + options: + - label: I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project. + required: true + - label: I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to. + required: true + - label: I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success. + required: true +- type: input + attributes: + label: Electron Version + description: What version of Electron are you using? + placeholder: 12.0.0 + validations: + required: true +- type: dropdown + attributes: + label: What operating system are you using? + options: + - Windows + - macOS + - Ubuntu + - Other Linux + - Other (specify below) + validations: + required: true +- type: input + attributes: + label: Operating System Version + description: What operating system version are you using? On Windows, click Start button > Settings > System > About. On macOS, click the Apple Menu > About This Mac. On Linux, use lsb_release or uname -a. + placeholder: "e.g. Windows 10 version 1909, macOS Catalina 10.15.7, or Ubuntu 20.04" + validations: + required: true +- type: dropdown + attributes: + label: What arch are you using? + options: + - x64 + - ia32 + - arm64 (including Apple Silicon) + - Other (specify below) + validations: + required: true +- type: input + attributes: + label: Last Known Working Electron version + description: What is the last version of Electron this worked in, if applicable? + placeholder: 11.0.0 +- type: textarea + attributes: + label: Expected Behavior + description: A clear and concise description of what you expected to happen. + validations: + required: true +- type: textarea + attributes: + label: Actual Behavior + description: A clear description of what actually happens. + validations: + required: true +- type: input + attributes: + label: Testcase Gist URL + description: If you can reproduce the issue in a standalone test case, please use [Electron Fiddle](https://github.com/electron/fiddle) to create one and to publish it as a [GitHub gist](https://gist.github.com) and put the gist URL here. This is **the best way** to ensure this issue is triaged quickly. + placeholder: https://gist.github.com/... diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 182c8dc9c394..807685c5fd72 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,18 +1,19 @@ name: Feature Request -about: Suggest an idea for Electron +description: Suggest an idea for Electron title: "[Feature Request]: " -labels: "enhancement ✨" +labels: "enhancement :sparkles:" body: -- type: textarea +- type: checkboxes attributes: label: Preflight Checklist - description: Please ensure you've completed the following steps by replacing [ ] with [x] - value: | - * [ ] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project. - * [ ] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to. - * [ ] I have searched the issue tracker for a feature request that matches the one I want to file, without success. - validations: - required: true + description: Please ensure you've completed all of the following. + options: + - label: I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project. + required: true + - label: I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to. + required: true + - label: I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success. + required: true - type: textarea attributes: label: Problem Description diff --git a/.github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.md b/.github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.md deleted file mode 100644 index cefd5800e2a7..000000000000 --- a/.github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Mac App Store Private API Rejection -about: Your app was rejected from the Mac App Store for using private API's - ---- - - - -### Preflight Checklist - - -* [ ] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project. -* [ ] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to. - -### Issue Details - -* **Electron Version:** - * - -### Rejection Email - - -### Additional Information - diff --git a/.github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.yml b/.github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.yml new file mode 100644 index 000000000000..497816fe3372 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/mac_app_store_private_api_rejection.yml @@ -0,0 +1,30 @@ +name: Report Mac App Store Private API Rejection +description: Your app was rejected from the Mac App Store for using private API's +title: "[MAS Rejection]: " +body: +- type: checkboxes + attributes: + label: Preflight Checklist + description: Please ensure you've completed all of the following. + options: + - label: I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project. + required: true + - label: I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to. + required: true +- type: input + attributes: + label: Electron Version + description: What version of Electron are you using? + placeholder: 12.0.0 + validations: + required: true +- type: textarea + attributes: + label: Rejection Email + description: Paste the contents of your rejection email here, censoring any private information such as app names. + validations: + required: true +- type: textarea + attributes: + label: Additional Information + description: Add any other context about the problem here. diff --git a/ELECTRON_VERSION b/ELECTRON_VERSION index 0c1238f208e5..85caea238e4a 100644 --- a/ELECTRON_VERSION +++ b/ELECTRON_VERSION @@ -1 +1 @@ -14.0.0-nightly.20210304 \ No newline at end of file +14.0.0-nightly.20210315 \ No newline at end of file diff --git a/build/webpack/webpack.config.base.js b/build/webpack/webpack.config.base.js index b23ffb95e774..8d2ff9929b4a 100644 --- a/build/webpack/webpack.config.base.js +++ b/build/webpack/webpack.config.base.js @@ -61,13 +61,6 @@ module.exports = ({ ); } - if (defines.ENABLE_REMOTE_MODULE === 'false') { - ignoredModules.push( - '@electron/internal/browser/remote/server', - '@electron/internal/renderer/api/remote' - ); - } - if (defines.ENABLE_VIEWS_API === 'false') { ignoredModules.push( '@electron/internal/browser/api/views/image-view.js' diff --git a/buildflags/BUILD.gn b/buildflags/BUILD.gn index 9bd2aba0036a..9cbb8227f5f5 100644 --- a/buildflags/BUILD.gn +++ b/buildflags/BUILD.gn @@ -12,7 +12,6 @@ buildflag_header("buildflags") { "ENABLE_DESKTOP_CAPTURER=$enable_desktop_capturer", "ENABLE_RUN_AS_NODE=$enable_run_as_node", "ENABLE_OSR=$enable_osr", - "ENABLE_REMOTE_MODULE=$enable_remote_module", "ENABLE_VIEWS_API=$enable_views_api", "ENABLE_PDF_VIEWER=$enable_pdf_viewer", "ENABLE_TTS=$enable_tts", diff --git a/buildflags/buildflags.gni b/buildflags/buildflags.gni index 95de99fe0a33..5adc739ef7bb 100644 --- a/buildflags/buildflags.gni +++ b/buildflags/buildflags.gni @@ -10,8 +10,6 @@ declare_args() { enable_osr = true - enable_remote_module = true - enable_views_api = true enable_pdf_viewer = true diff --git a/default_app/default_app.ts b/default_app/default_app.ts index 7c2d8a3b9eec..6fe7b11c128b 100644 --- a/default_app/default_app.ts +++ b/default_app/default_app.ts @@ -52,8 +52,7 @@ async function createWindow () { webPreferences: { preload: path.resolve(__dirname, 'preload.js'), contextIsolation: true, - sandbox: true, - enableRemoteModule: false + sandbox: true }, useContentSize: true, show: false diff --git a/docs/README.md b/docs/README.md index dee27988c76c..e94ca55e2456 100644 --- a/docs/README.md +++ b/docs/README.md @@ -146,7 +146,6 @@ These individual tutorials expand on topics discussed in the guide above. * [contextBridge](api/context-bridge.md) * [desktopCapturer](api/desktop-capturer.md) * [ipcRenderer](api/ipc-renderer.md) -* [remote](api/remote.md) * [webFrame](api/web-frame.md) ### Modules for Both Processes: diff --git a/docs/api/app.md b/docs/api/app.md index 2f01e65a91f6..9bafce2dc192 100755 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -507,64 +507,6 @@ Returns: Emitted when `desktopCapturer.getSources()` is called in the renderer process of `webContents`. Calling `event.preventDefault()` will make it return empty sources. -### Event: 'remote-require' _Deprecated_ - -Returns: - -* `event` Event -* `webContents` [WebContents](web-contents.md) -* `moduleName` String - -Emitted when `remote.require()` is called in the renderer process of `webContents`. -Calling `event.preventDefault()` will prevent the module from being returned. -Custom value can be returned by setting `event.returnValue`. - -### Event: 'remote-get-global' _Deprecated_ - -Returns: - -* `event` Event -* `webContents` [WebContents](web-contents.md) -* `globalName` String - -Emitted when `remote.getGlobal()` is called in the renderer process of `webContents`. -Calling `event.preventDefault()` will prevent the global from being returned. -Custom value can be returned by setting `event.returnValue`. - -### Event: 'remote-get-builtin' _Deprecated_ - -Returns: - -* `event` Event -* `webContents` [WebContents](web-contents.md) -* `moduleName` String - -Emitted when `remote.getBuiltin()` is called in the renderer process of `webContents`. -Calling `event.preventDefault()` will prevent the module from being returned. -Custom value can be returned by setting `event.returnValue`. - -### Event: 'remote-get-current-window' _Deprecated_ - -Returns: - -* `event` Event -* `webContents` [WebContents](web-contents.md) - -Emitted when `remote.getCurrentWindow()` is called in the renderer process of `webContents`. -Calling `event.preventDefault()` will prevent the object from being returned. -Custom value can be returned by setting `event.returnValue`. - -### Event: 'remote-get-current-web-contents' _Deprecated_ - -Returns: - -* `event` Event -* `webContents` [WebContents](web-contents.md) - -Emitted when `remote.getCurrentWebContents()` is called in the renderer process of `webContents`. -Calling `event.preventDefault()` will prevent the object from being returned. -Custom value can be returned by setting `event.returnValue`. - ## Methods The `app` object has the following methods: diff --git a/docs/api/auto-updater.md b/docs/api/auto-updater.md index 77d3e4c4d514..cc6c7a189871 100644 --- a/docs/api/auto-updater.md +++ b/docs/api/auto-updater.md @@ -118,6 +118,9 @@ Returns `String` - The current update feed URL. Asks the server whether there is an update. You must call `setFeedURL` before using this API. +**Note:** If an update is available it will be downloaded automatically. +Calling `autoUpdater.checkForUpdates()` twice will download the update two times. + ### `autoUpdater.quitAndInstall()` Restarts the app and installs the update after it has been downloaded. It diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 9b0b475435a4..edac2f406325 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -273,8 +273,6 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. OS-level sandbox and disabling the Node.js engine. This is not the same as the `nodeIntegration` option and the APIs available to the preload script are more limited. Read more about the option [here](sandbox-option.md). - * `enableRemoteModule` Boolean (optional) - Whether to enable the [`remote`](remote.md) module. - Default is `false`. * `session` [Session](session.md#class-session) (optional) - Sets the session used by the page. Instead of passing the Session object directly, you can also choose to use the `partition` option instead, which accepts a partition string. When @@ -339,7 +337,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. more details. * `contextIsolation` Boolean (optional) - Whether to run Electron APIs and the specified `preload` script in a separate JavaScript context. Defaults - to `false`. The context that the `preload` script runs in will only have + to `true`. The context that the `preload` script runs in will only have access to its own dedicated `document` and `window` globals, as well as its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.), which are all invisible to the loaded content. The Electron API will only @@ -351,8 +349,7 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. context in the dev tools by selecting the 'Electron Isolated Context' entry in the combo box at the top of the Console tab. * `worldSafeExecuteJavaScript` Boolean (optional) - If true, values returned from `webFrame.executeJavaScript` will be sanitized to ensure JS values - can't unsafely cross between worlds when using `contextIsolation`. The default - is `false`. In Electron 12, the default will be changed to `true`. _Deprecated_ + can't unsafely cross between worlds when using `contextIsolation`. Defaults to `true`. _Deprecated_ * `nativeWindowOpen` Boolean (optional) - Whether to use native `window.open()`. Defaults to `false`. Child windows will always have node integration disabled unless `nodeIntegrationInSubFrames` is true. **Note:** This option is currently @@ -1371,7 +1368,7 @@ Returns `Boolean` - Whether the window's document has been edited. Returns `Promise` - Resolves with a [NativeImage](native-image.md) -Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. +Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page. If the page is not visible, `rect` may be empty. #### `win.loadURL(url[, options])` diff --git a/docs/api/command-line-switches.md b/docs/api/command-line-switches.md index 902e2c836c84..fe8e7c75aebf 100644 --- a/docs/api/command-line-switches.md +++ b/docs/api/command-line-switches.md @@ -66,11 +66,6 @@ Forces the maximum disk space to be used by the disk cache, in bytes. Enables caller stack logging for the following APIs (filtering events): * `desktopCapturer.getSources()` / `desktop-capturer-get-sources` -* `remote.require()` / `remote-require` -* `remote.getGlobal()` / `remote-get-builtin` -* `remote.getBuiltin()` / `remote-get-global` -* `remote.getCurrentWindow()` / `remote-get-current-window` -* `remote.getCurrentWebContents()` / `remote-get-current-web-contents` ### --enable-logging diff --git a/docs/api/cookies.md b/docs/api/cookies.md index 4eab77d4d599..cd598bfeece8 100644 --- a/docs/api/cookies.md +++ b/docs/api/cookies.md @@ -45,6 +45,8 @@ The following events are available on instances of `Cookies`: #### Event: 'changed' +Returns: + * `event` Event * `cookie` [Cookie](structures/cookie.md) - The cookie that was changed. * `cause` String - The cause of the change with one of the following values: diff --git a/docs/api/power-monitor.md b/docs/api/power-monitor.md index 0f5e5b53ac78..846389932b3e 100644 --- a/docs/api/power-monitor.md +++ b/docs/api/power-monitor.md @@ -8,11 +8,11 @@ Process: [Main](../glossary.md#main-process) The `powerMonitor` module emits the following events: -### Event: 'suspend' _macOS_ _Windows_ +### Event: 'suspend' Emitted when the system is suspending. -### Event: 'resume' _macOS_ _Windows_ +### Event: 'resume' Emitted when system is resuming. diff --git a/docs/api/remote.md b/docs/api/remote.md deleted file mode 100644 index 063330550d3a..000000000000 --- a/docs/api/remote.md +++ /dev/null @@ -1,217 +0,0 @@ -# remote - -> Use main process modules from the renderer process. - -Process: [Renderer](../glossary.md#renderer-process) - -> ⚠️ WARNING ⚠️ -> The `remote` module is [deprecated](https://github.com/electron/electron/issues/21408). -> Instead of `remote`, use [`ipcRenderer`](ipc-renderer.md) and -> [`ipcMain`](ipc-main.md). -> -> Read more about why the `remote` module is deprecated [here](https://medium.com/@nornagon/electrons-remote-module-considered-harmful-70d69500f31). -> -> If you still want to use `remote` despite the performance and security -> concerns, see [@electron/remote](https://github.com/electron/remote). - -The `remote` module provides a simple way to do inter-process communication -(IPC) between the renderer process (web page) and the main process. - -In Electron, GUI-related modules (such as `dialog`, `menu` etc.) are only -available in the main process, not in the renderer process. In order to use them -from the renderer process, the `ipc` module is necessary to send inter-process -messages to the main process. With the `remote` module, you can invoke methods -of the main process object without explicitly sending inter-process messages, -similar to Java's [RMI][rmi]. An example of creating a browser window from a -renderer process: - -```javascript -const { BrowserWindow } = require('electron').remote -const win = new BrowserWindow({ width: 800, height: 600 }) -win.loadURL('https://github.com') -``` - -**Note:** For the reverse (access the renderer process from the main process), -you can use [webContents.executeJavaScript](web-contents.md#contentsexecutejavascriptcode-usergesture). - -**Note:** The remote module can be disabled for security reasons in the following contexts: - -* [`BrowserWindow`](browser-window.md) - by setting the `enableRemoteModule` option to `false`. -* [``](webview-tag.md) - by setting the `enableremotemodule` attribute to `false`. - -## Remote Objects - -Each object (including functions) returned by the `remote` module represents an -object in the main process (we call it a remote object or remote function). -When you invoke methods of a remote object, call a remote function, or create -a new object with the remote constructor (function), you are actually sending -synchronous inter-process messages. - -In the example above, both [`BrowserWindow`](browser-window.md) and `win` were remote objects and -`new BrowserWindow` didn't create a `BrowserWindow` object in the renderer -process. Instead, it created a `BrowserWindow` object in the main process and -returned the corresponding remote object in the renderer process, namely the -`win` object. - -**Note:** Only [enumerable properties][enumerable-properties] which are present -when the remote object is first referenced are accessible via remote. - -**Note:** Arrays and Buffers are copied over IPC when accessed via the `remote` -module. Modifying them in the renderer process does not modify them in the main -process and vice versa. - -## Lifetime of Remote Objects - -Electron makes sure that as long as the remote object in the renderer process -lives (in other words, has not been garbage collected), the corresponding object -in the main process will not be released. When the remote object has been -garbage collected, the corresponding object in the main process will be -dereferenced. - -If the remote object is leaked in the renderer process (e.g. stored in a map but -never freed), the corresponding object in the main process will also be leaked, -so you should be very careful not to leak remote objects. - -Primary value types like strings and numbers, however, are sent by copy. - -## Passing callbacks to the main process - -Code in the main process can accept callbacks from the renderer - for instance -the `remote` module - but you should be extremely careful when using this -feature. - -First, in order to avoid deadlocks, the callbacks passed to the main process -are called asynchronously. You should not expect the main process to -get the return value of the passed callbacks. - -For instance you can't use a function from the renderer process in an -`Array.map` called in the main process: - -```javascript -// main process mapNumbers.js -exports.withRendererCallback = (mapper) => { - return [1, 2, 3].map(mapper) -} - -exports.withLocalCallback = () => { - return [1, 2, 3].map(x => x + 1) -} -``` - -```javascript -// renderer process -const mapNumbers = require('electron').remote.require('./mapNumbers') -const withRendererCb = mapNumbers.withRendererCallback(x => x + 1) -const withLocalCb = mapNumbers.withLocalCallback() - -console.log(withRendererCb, withLocalCb) -// [undefined, undefined, undefined], [2, 3, 4] -``` - -As you can see, the renderer callback's synchronous return value was not as -expected, and didn't match the return value of an identical callback that lives -in the main process. - -Second, the callbacks passed to the main process will persist until the -main process garbage-collects them. - -For example, the following code seems innocent at first glance. It installs a -callback for the `close` event on a remote object: - -```javascript -require('electron').remote.getCurrentWindow().on('close', () => { - // window was closed... -}) -``` - -But remember the callback is referenced by the main process until you -explicitly uninstall it. If you do not, each time you reload your window the -callback will be installed again, leaking one callback for each restart. - -To make things worse, since the context of previously installed callbacks has -been released, exceptions will be raised in the main process when the `close` -event is emitted. - -To avoid this problem, ensure you clean up any references to renderer callbacks -passed to the main process. This involves cleaning up event handlers, or -ensuring the main process is explicitly told to dereference callbacks that came -from a renderer process that is exiting. - -## Accessing built-in modules in the main process - -The built-in modules in the main process are added as getters in the `remote` -module, so you can use them directly like the `electron` module. - -```javascript -const app = require('electron').remote.app -console.log(app) -``` - -## Methods - -The `remote` module has the following methods: - -### `remote.getCurrentWindow()` - -Returns [`BrowserWindow`](browser-window.md) - The window to which this web page -belongs. - -**Note:** Do not use `removeAllListeners` on [`BrowserWindow`](browser-window.md). -Use of this can remove all [`blur`](https://developer.mozilla.org/en-US/docs/Web/Events/blur) -listeners, disable click events on touch bar buttons, and other unintended -consequences. - -### `remote.getCurrentWebContents()` - -Returns [`WebContents`](web-contents.md) - The web contents of this web page. - -### `remote.getGlobal(name)` - -* `name` String - -Returns `any` - The global variable of `name` (e.g. `global[name]`) in the main -process. - -## Properties - -### `remote.require` - -A `NodeJS.Require` function equivalent to `require(module)` in the main process. -Modules specified by their relative path will resolve relative to the entrypoint -of the main process. - -e.g. - -```sh -project/ -├── main -│   ├── foo.js -│   └── index.js -├── package.json -└── renderer - └── index.js -``` - -```js -// main process: main/index.js -const { app } = require('electron') -app.whenReady().then(() => { /* ... */ }) -``` - -```js -// some relative module: main/foo.js -module.exports = 'bar' -``` - -```js -// renderer process: renderer/index.js -const foo = require('electron').remote.require('./foo') // bar -``` - -### `remote.process` _Readonly_ - -A `NodeJS.Process` object. The `process` object in the main process. This is the same as -`remote.getGlobal('process')` but is cached. - -[rmi]: https://en.wikipedia.org/wiki/Java_remote_method_invocation -[enumerable-properties]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties diff --git a/docs/api/session.md b/docs/api/session.md index 25b3af870453..c89ef396d72a 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -197,9 +197,7 @@ be managed by using [ses.setPermissionCheckHandler(handler)](#sessetpermissionch with the `serial` permission. Because this is an experimental feature it is disabled by default. To enable this feature, you -will need to use the `--enable-features=ElectronSerialChooser` command line switch. Additionally -because this is an experimental Chromium feature you will need to set `enableBlinkFeatures: 'Serial'` -on the `webPreferences` property when opening a BrowserWindow. +will need to use the `--enable-features=ElectronSerialChooser` command line switch. ```javascript const { app, BrowserWindow } = require('electron') @@ -210,10 +208,7 @@ app.commandLine.appendSwitch('enable-features', 'ElectronSerialChooser') app.whenReady().then(() => { win = new BrowserWindow({ width: 800, - height: 600, - webPreferences: { - enableBlinkFeatures: 'Serial' - } + height: 600 }) win.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => { event.preventDefault() diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 43a799836ed7..9cc07bca670f 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -839,59 +839,6 @@ Returns: Emitted when `desktopCapturer.getSources()` is called in the renderer process. Calling `event.preventDefault()` will make it return empty sources. -#### Event: 'remote-require' _Deprecated_ - -Returns: - -* `event` IpcMainEvent -* `moduleName` String - -Emitted when `remote.require()` is called in the renderer process. -Calling `event.preventDefault()` will prevent the module from being returned. -Custom value can be returned by setting `event.returnValue`. - -#### Event: 'remote-get-global' _Deprecated_ - -Returns: - -* `event` IpcMainEvent -* `globalName` String - -Emitted when `remote.getGlobal()` is called in the renderer process. -Calling `event.preventDefault()` will prevent the global from being returned. -Custom value can be returned by setting `event.returnValue`. - -#### Event: 'remote-get-builtin' _Deprecated_ - -Returns: - -* `event` IpcMainEvent -* `moduleName` String - -Emitted when `remote.getBuiltin()` is called in the renderer process. -Calling `event.preventDefault()` will prevent the module from being returned. -Custom value can be returned by setting `event.returnValue`. - -#### Event: 'remote-get-current-window' _Deprecated_ - -Returns: - -* `event` IpcMainEvent - -Emitted when `remote.getCurrentWindow()` is called in the renderer process. -Calling `event.preventDefault()` will prevent the object from being returned. -Custom value can be returned by setting `event.returnValue`. - -#### Event: 'remote-get-current-web-contents' _Deprecated_ - -Returns: - -* `event` IpcMainEvent - -Emitted when `remote.getCurrentWebContents()` is called in the renderer process. -Calling `event.preventDefault()` will prevent the object from being returned. -Custom value can be returned by setting `event.returnValue`. - #### Event: 'preferred-size-changed' Returns: diff --git a/docs/api/webview-tag.md b/docs/api/webview-tag.md index 10fbd67bb23c..f08f7f5f6b9a 100644 --- a/docs/api/webview-tag.md +++ b/docs/api/webview-tag.md @@ -130,15 +130,6 @@ inside the `webview`. All your preloads will load for every iframe, you can use `process.isMainFrame` to determine if you are in the main frame or not. This option is disabled by default in the guest page. -### `enableremotemodule` - -```html - -``` - -A `Boolean`. When this attribute is `false` the guest page in `webview` will not have access -to the [`remote`](remote.md) module. The remote module is unavailable by default. - ### `plugins` ```html diff --git a/docs/api/window-open.md b/docs/api/window-open.md index 8ff7aae726b9..2d523a91f0d1 100644 --- a/docs/api/window-open.md +++ b/docs/api/window-open.md @@ -83,14 +83,14 @@ const mainWindow = new BrowserWindow() mainWindow.webContents.setWindowOpenHandler(({ url }) => { if (url.startsWith('https://github.com/')) { - return true + return { action: 'allow' } } - return false + return { action: 'deny' } }) mainWindow.webContents.on('did-create-window', (childWindow) => { // For example... - childWindow.webContents('will-navigate', (e) => { + childWindow.webContents.on('will-navigate', (e) => { e.preventDefault() }) }) diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index f3128cf33518..23c0c9cf09a2 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -160,6 +160,9 @@ the previous behavior, `contextIsolation: false` must be specified in WebPrefere We [recommend having contextIsolation enabled](https://github.com/electron/electron/blob/master/docs/tutorial/security.md#3-enable-context-isolation-for-remote-content) for the security of your application. +Another implication is that `require()` cannot be used in the renderer process unless +`nodeIntegration` is `true` and `contextIsolation` is `false`. + For more details see: https://github.com/electron/electron/issues/23506 ### Removed: `crashReporter.getCrashesDirectory()` diff --git a/docs/tutorial/quick-start.md b/docs/tutorial/quick-start.md index 9c22244c509d..1358e523f920 100644 --- a/docs/tutorial/quick-start.md +++ b/docs/tutorial/quick-start.md @@ -167,7 +167,8 @@ The simplest and the fastest way to distribute your newly created app is using 1. Import Electron Forge to your app folder: ```sh - npx @electron-forge/cli import + npm install --save-dev @electron-forge/cli + npx electron-forge import ✔ Checking your system ✔ Initializing Git Repository diff --git a/docs/tutorial/security.md b/docs/tutorial/security.md index 4667b26e647a..f22de2a6befe 100644 --- a/docs/tutorial/security.md +++ b/docs/tutorial/security.md @@ -44,7 +44,7 @@ Chromium shared library and Node.js. Vulnerabilities affecting these components may impact the security of your application. By updating Electron to the latest version, you ensure that critical vulnerabilities (such as *nodeIntegration bypasses*) are already patched and cannot be exploited in your application. For more information, -see "[Use a current version of Electron](#17-use-a-current-version-of-electron)". +see "[Use a current version of Electron](#15-use-a-current-version-of-electron)". * **Evaluate your dependencies.** While NPM provides half a million reusable packages, it is your responsibility to choose trusted 3rd-party libraries. If you use outdated @@ -99,9 +99,7 @@ You should at least follow these steps to improve the security of your applicati 12. [Disable or limit navigation](#12-disable-or-limit-navigation) 13. [Disable or limit creation of new windows](#13-disable-or-limit-creation-of-new-windows) 14. [Do not use `openExternal` with untrusted content](#14-do-not-use-openexternal-with-untrusted-content) -15. [Disable the `remote` module](#15-disable-the-remote-module) -16. [Filter the `remote` module](#16-filter-the-remote-module) -17. [Use a current version of Electron](#17-use-a-current-version-of-electron) +15. [Use a current version of Electron](#15-use-a-current-version-of-electron) To automate the detection of misconfigurations and insecure patterns, it is possible to use @@ -665,134 +663,7 @@ const { shell } = require('electron') shell.openExternal('https://example.com/index.html') ``` -## 15) Disable the `remote` module - -The `remote` module provides a way for the renderer processes to -access APIs normally only available in the main process. Using it, a -renderer can invoke methods of a main process object without explicitly sending -inter-process messages. If your desktop application does not run untrusted -content, this can be a useful way to have your renderer processes access and -work with modules that are only available to the main process, such as -GUI-related modules (dialogs, menus, etc.). - -However, if your app can run untrusted content and even if you -[sandbox][sandbox] your renderer processes accordingly, the `remote` module -makes it easy for malicious code to escape the sandbox and have access to -system resources via the higher privileges of the main process. Therefore, -it should be disabled in such circumstances. - -### Why? - -`remote` uses an internal IPC channel to communicate with the main process. -"Prototype pollution" attacks can grant malicious code access to the internal -IPC channel, which can then be used to escape the sandbox by mimicking `remote` -IPC messages and getting access to main process modules running with higher -privileges. - -Additionally, it's possible for preload scripts to accidentally leak modules to a -sandboxed renderer. Leaking `remote` arms malicious code with a multitude -of main process modules with which to perform an attack. - -Disabling the `remote` module eliminates these attack vectors. Enabling -context isolation also prevents the "prototype pollution" attacks from -succeeding. - -### How? - -```js -// Bad if the renderer can run untrusted content -const mainWindow = new BrowserWindow({ - webPreferences: { - enableRemoteModule: true - } -}) -``` - -```js -// Good -const mainWindow = new BrowserWindow({ - webPreferences: { - enableRemoteModule: false - } -}) -``` - -```html - - - - - -``` - -> **Note:** The default value of `enableRemoteModule` is `false` starting -> from Electron 10. For prior versions, you need to explicitly disable -> the `remote` module by the means above. - -## 16) Filter the `remote` module - -If you cannot disable the `remote` module, you should filter the globals, -Node, and Electron modules (so-called built-ins) accessible via `remote` -that your application does not require. This can be done by blocking -certain modules entirely and by replacing others with proxies that -expose only the functionality that your app needs. - -### Why? - -Due to the system access privileges of the main process, functionality -provided by the main process modules may be dangerous in the hands of -malicious code running in a compromised renderer process. By limiting -the set of accessible modules to the minimum that your app needs and -filtering out the others, you reduce the toolset that malicious code -can use to attack the system. - -Note that the safest option is to -[fully disable the remote module](#15-disable-the-remote-module). If -you choose to filter access rather than completely disable the module, -you must be very careful to ensure that no escalation of privilege is -possible through the modules you allow past the filter. - -### How? - -```js -const readOnlyFsProxy = require(/* ... */) // exposes only file read functionality - -const allowedModules = new Set(['crypto']) -const proxiedModules = new Map([['fs', readOnlyFsProxy]]) -const allowedElectronModules = new Set(['shell']) -const allowedGlobals = new Set() - -app.on('remote-require', (event, webContents, moduleName) => { - if (proxiedModules.has(moduleName)) { - event.returnValue = proxiedModules.get(moduleName) - } - if (!allowedModules.has(moduleName)) { - event.preventDefault() - } -}) - -app.on('remote-get-builtin', (event, webContents, moduleName) => { - if (!allowedElectronModules.has(moduleName)) { - event.preventDefault() - } -}) - -app.on('remote-get-global', (event, webContents, globalName) => { - if (!allowedGlobals.has(globalName)) { - event.preventDefault() - } -}) - -app.on('remote-get-current-window', (event, webContents) => { - event.preventDefault() -}) - -app.on('remote-get-current-web-contents', (event, webContents) => { - event.preventDefault() -}) -``` - -## 17) Use a current version of Electron +## 15) Use a current version of Electron You should strive for always using the latest available version of Electron. Whenever a new major version is released, you should attempt to update your diff --git a/filenames.auto.gni b/filenames.auto.gni index 7d09066af7f3..c3d558869129 100644 --- a/filenames.auto.gni +++ b/filenames.auto.gni @@ -43,7 +43,6 @@ auto_filenames = { "docs/api/power-save-blocker.md", "docs/api/process.md", "docs/api/protocol.md", - "docs/api/remote.md", "docs/api/sandbox-option.md", "docs/api/screen.md", "docs/api/service-workers.md", @@ -135,29 +134,21 @@ auto_filenames = { ] sandbox_bundle_deps = [ - "lib/browser/api/module-names.ts", - "lib/common/api/clipboard.ts", "lib/common/api/deprecate.ts", - "lib/common/api/module-list.ts", - "lib/common/api/shell.ts", "lib/common/define-properties.ts", "lib/common/ipc-messages.ts", - "lib/common/remote/ipc-messages.ts", "lib/common/type-utils.ts", "lib/common/web-view-events.ts", "lib/common/web-view-methods.ts", - "lib/common/webpack-globals-provider.ts", "lib/renderer/api/context-bridge.ts", "lib/renderer/api/crash-reporter.ts", "lib/renderer/api/desktop-capturer.ts", "lib/renderer/api/ipc-renderer.ts", "lib/renderer/api/native-image.ts", - "lib/renderer/api/remote.ts", "lib/renderer/api/web-frame.ts", "lib/renderer/inspector.ts", "lib/renderer/ipc-renderer-internal-utils.ts", "lib/renderer/ipc-renderer-internal.ts", - "lib/renderer/remote/callbacks-registry.ts", "lib/renderer/security-warnings.ts", "lib/renderer/web-frame-init.ts", "lib/renderer/web-view/guest-view-internal.ts", @@ -242,8 +233,6 @@ auto_filenames = { "lib/browser/ipc-main-internal.ts", "lib/browser/message-port-main.ts", "lib/browser/navigation-controller.ts", - "lib/browser/remote/objects-registry.ts", - "lib/browser/remote/server.ts", "lib/browser/rpc-server.ts", "lib/common/api/clipboard.ts", "lib/common/api/deprecate.ts", @@ -253,7 +242,6 @@ auto_filenames = { "lib/common/init.ts", "lib/common/ipc-messages.ts", "lib/common/parse-features-string.ts", - "lib/common/remote/ipc-messages.ts", "lib/common/reset-search-paths.ts", "lib/common/type-utils.ts", "lib/common/web-view-events.ts", @@ -269,7 +257,6 @@ auto_filenames = { ] renderer_bundle_deps = [ - "lib/browser/api/module-names.ts", "lib/common/api/clipboard.ts", "lib/common/api/deprecate.ts", "lib/common/api/module-list.ts", @@ -277,12 +264,10 @@ auto_filenames = { "lib/common/define-properties.ts", "lib/common/init.ts", "lib/common/ipc-messages.ts", - "lib/common/remote/ipc-messages.ts", "lib/common/reset-search-paths.ts", "lib/common/type-utils.ts", "lib/common/web-view-events.ts", "lib/common/web-view-methods.ts", - "lib/common/webpack-globals-provider.ts", "lib/common/webpack-provider.ts", "lib/renderer/api/context-bridge.ts", "lib/renderer/api/crash-reporter.ts", @@ -291,13 +276,11 @@ auto_filenames = { "lib/renderer/api/ipc-renderer.ts", "lib/renderer/api/module-list.ts", "lib/renderer/api/native-image.ts", - "lib/renderer/api/remote.ts", "lib/renderer/api/web-frame.ts", "lib/renderer/init.ts", "lib/renderer/inspector.ts", "lib/renderer/ipc-renderer-internal-utils.ts", "lib/renderer/ipc-renderer-internal.ts", - "lib/renderer/remote/callbacks-registry.ts", "lib/renderer/security-warnings.ts", "lib/renderer/web-frame-init.ts", "lib/renderer/web-view/guest-view-internal.ts", @@ -315,7 +298,6 @@ auto_filenames = { ] worker_bundle_deps = [ - "lib/browser/api/module-names.ts", "lib/common/api/clipboard.ts", "lib/common/api/deprecate.ts", "lib/common/api/module-list.ts", @@ -323,10 +305,8 @@ auto_filenames = { "lib/common/define-properties.ts", "lib/common/init.ts", "lib/common/ipc-messages.ts", - "lib/common/remote/ipc-messages.ts", "lib/common/reset-search-paths.ts", "lib/common/type-utils.ts", - "lib/common/webpack-globals-provider.ts", "lib/common/webpack-provider.ts", "lib/renderer/api/context-bridge.ts", "lib/renderer/api/crash-reporter.ts", @@ -335,11 +315,9 @@ auto_filenames = { "lib/renderer/api/ipc-renderer.ts", "lib/renderer/api/module-list.ts", "lib/renderer/api/native-image.ts", - "lib/renderer/api/remote.ts", "lib/renderer/api/web-frame.ts", "lib/renderer/ipc-renderer-internal-utils.ts", "lib/renderer/ipc-renderer-internal.ts", - "lib/renderer/remote/callbacks-registry.ts", "lib/worker/init.ts", "package.json", "tsconfig.electron.json", diff --git a/lib/asar/fs-wrapper.ts b/lib/asar/fs-wrapper.ts index 569e19ff7fc9..5f0d0587a31f 100644 --- a/lib/asar/fs-wrapper.ts +++ b/lib/asar/fs-wrapper.ts @@ -532,15 +532,17 @@ export const wrapFsWithAsar = (fs: Record) => { return fs.readFile(realPath, options, callback); } + const buffer = Buffer.alloc(info.size); + const fd = archive.getFd(); + if (!(fd >= 0)) { + const error = createError(AsarError.NOT_FOUND, { asarPath, filePath }); + nextTick(callback, [error]); + return; + } + logASARAccess(asarPath, filePath, info.offset); - archive.read(info.offset, info.size).then((buf) => { - const buffer = Buffer.from(buf); - callback(null, encoding ? buffer.toString(encoding) : buffer); - }, (err) => { - const error: AsarErrorObject = new Error(`EINVAL, ${err.message} while reading ${filePath} in ${asarPath}`); - error.code = 'EINVAL'; - error.errno = -22; - callback(error); + fs.read(fd, buffer, 0, info.size, info.offset, (error: Error) => { + callback(error, encoding ? buffer.toString(encoding) : buffer); }); }; @@ -573,19 +575,13 @@ export const wrapFsWithAsar = (fs: Record) => { } const { encoding } = options; + const buffer = Buffer.alloc(info.size); + const fd = archive.getFd(); + if (!(fd >= 0)) throw createError(AsarError.NOT_FOUND, { asarPath, filePath }); logASARAccess(asarPath, filePath, info.offset); - let arrayBuffer: ArrayBuffer; - try { - arrayBuffer = archive.readSync(info.offset, info.size); - } catch (err) { - const error: AsarErrorObject = new Error(`EINVAL, ${err.message} while reading ${filePath} in ${asarPath}`); - error.code = 'EINVAL'; - error.errno = -22; - throw error; - } - const buffer = Buffer.from(arrayBuffer); - return encoding ? buffer.toString(encoding) : buffer; + fs.readSync(fd, buffer, 0, info.size, info.offset); + return (encoding) ? buffer.toString(encoding) : buffer; }; const { readdir } = fs; @@ -697,17 +693,12 @@ export const wrapFsWithAsar = (fs: Record) => { return [str, str.length > 0]; } + const buffer = Buffer.alloc(info.size); + const fd = archive.getFd(); + if (!(fd >= 0)) return []; + logASARAccess(asarPath, filePath, info.offset); - let arrayBuffer: ArrayBuffer; - try { - arrayBuffer = archive.readSync(info.offset, info.size); - } catch (err) { - const error: AsarErrorObject = new Error(`EINVAL, ${err.message} while reading ${filePath} in ${asarPath}`); - error.code = 'EINVAL'; - error.errno = -22; - throw error; - } - const buffer = Buffer.from(arrayBuffer); + fs.readSync(fd, buffer, 0, info.size, info.offset); const str = buffer.toString('utf8'); return [str, str.length > 0]; }; diff --git a/lib/browser/api/crash-reporter.ts b/lib/browser/api/crash-reporter.ts index 14c3ff347a59..99672c690d8b 100644 --- a/lib/browser/api/crash-reporter.ts +++ b/lib/browser/api/crash-reporter.ts @@ -18,7 +18,7 @@ class CrashReporter { if (submitURL == null) throw new Error('submitURL is a required option to crashReporter.start'); - if (!compress) { + if (!compress && uploadToServer) { deprecate.log('Sending uncompressed crash reports is deprecated and will be removed in a future version of Electron. Set { compress: true } to opt-in to the new behavior. Crash reports will be uploaded gzipped, which most crash reporting servers support.'); } diff --git a/lib/browser/api/module-names.ts b/lib/browser/api/module-names.ts deleted file mode 100644 index ba628497f86a..000000000000 --- a/lib/browser/api/module-names.ts +++ /dev/null @@ -1,50 +0,0 @@ -// TODO: Figure out a way to not duplicate this information between here and module-list -// It is currently duplicated as module-list "require"s all the browser API file and the -// remote module in the renderer process depends on that file. As a result webpack -// includes all the browser API files in the renderer process as well and we want to avoid that - -// Browser side modules, please sort alphabetically. -export const browserModuleNames = [ - 'app', - 'autoUpdater', - 'BaseWindow', - 'BrowserView', - 'BrowserWindow', - 'contentTracing', - 'crashReporter', - 'dialog', - 'globalShortcut', - 'ipcMain', - 'inAppPurchase', - 'Menu', - 'MenuItem', - 'nativeImage', - 'nativeTheme', - 'net', - 'netLog', - 'MessageChannelMain', - 'Notification', - 'powerMonitor', - 'powerSaveBlocker', - 'protocol', - 'screen', - 'session', - 'ShareMenu', - 'systemPreferences', - 'TouchBar', - 'Tray', - 'View', - 'webContents', - 'WebContentsView', - 'webFrameMain' -]; - -if (BUILDFLAG(ENABLE_DESKTOP_CAPTURER)) { - browserModuleNames.push('desktopCapturer'); -} - -if (BUILDFLAG(ENABLE_VIEWS_API)) { - browserModuleNames.push( - 'ImageView' - ); -} diff --git a/lib/browser/api/web-contents.ts b/lib/browser/api/web-contents.ts index 63d8a6de5d45..01fd54aa3b9d 100644 --- a/lib/browser/api/web-contents.ts +++ b/lib/browser/api/web-contents.ts @@ -498,10 +498,6 @@ WebContents.prototype._init = function () { this._windowOpenHandler = null; - // Every remote callback from renderer process would add a listener to the - // render-view-deleted event, so ignore the listeners warning. - this.setMaxListeners(0); - // Dispatch IPC messages to the ipc module. this.on('-ipc-message' as any, function (this: Electron.WebContents, event: Electron.IpcMainEvent, internal: boolean, channel: string, args: any[]) { addSenderFrameToEvent(event); @@ -592,6 +588,7 @@ WebContents.prototype._init = function () { // it's technically a BrowserWindowConstructorOptions option because // we need to access it in the renderer at init time. backgroundColor: windowOpenOverriddenOptions.backgroundColor, + transparent: windowOpenOverriddenOptions.transparent, ...windowOpenOverriddenOptions.webPreferences } : undefined; this._setNextChildWebPreferences( diff --git a/lib/browser/guest-view-manager.ts b/lib/browser/guest-view-manager.ts index 6aa9ed821323..f33339d7723a 100644 --- a/lib/browser/guest-view-manager.ts +++ b/lib/browser/guest-view-manager.ts @@ -168,7 +168,6 @@ const attachGuest = function (event: Electron.IpcMainInvokeEvent, guestInstanceId: guestInstanceId, nodeIntegration: params.nodeintegration != null ? params.nodeintegration : false, nodeIntegrationInSubFrames: params.nodeintegrationinsubframes != null ? params.nodeintegrationinsubframes : false, - enableRemoteModule: params.enableremotemodule, plugins: params.plugins, zoomFactor: embedder.zoomFactor, disablePopups: !params.allowpopups, @@ -188,7 +187,6 @@ const attachGuest = function (event: Electron.IpcMainInvokeEvent, ['javascript', false], ['nativeWindowOpen', true], ['nodeIntegration', false], - ['enableRemoteModule', false], ['sandbox', true], ['nodeIntegrationInSubFrames', false], ['enableWebSQL', false] diff --git a/lib/browser/guest-window-manager.ts b/lib/browser/guest-window-manager.ts index 3ad1665799ac..0200151447bd 100644 --- a/lib/browser/guest-window-manager.ts +++ b/lib/browser/guest-window-manager.ts @@ -191,7 +191,6 @@ const securityWebPreferences: { [key: string]: boolean } = { javascript: false, nativeWindowOpen: true, nodeIntegration: false, - enableRemoteModule: false, sandbox: true, webviewTag: false, nodeIntegrationInSubFrames: false, diff --git a/lib/browser/init.ts b/lib/browser/init.ts index 1b07488c6f08..cd40032de8db 100644 --- a/lib/browser/init.ts +++ b/lib/browser/init.ts @@ -132,10 +132,6 @@ app._setDefaultAppPaths(packagePath); // Load the chrome devtools support. require('@electron/internal/browser/devtools'); -if (BUILDFLAG(ENABLE_REMOTE_MODULE)) { - require('@electron/internal/browser/remote/server'); -} - // Load protocol module to ensure it is populated on app ready require('@electron/internal/browser/api/protocol'); diff --git a/lib/browser/remote/objects-registry.ts b/lib/browser/remote/objects-registry.ts deleted file mode 100644 index ba146106469f..000000000000 --- a/lib/browser/remote/objects-registry.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { WebContents } from 'electron/main'; - -const getOwnerKey = (webContents: WebContents, contextId: string) => { - return `${webContents.id}-${contextId}`; -}; - -class ObjectsRegistry { - private nextId: number = 0 - - // Stores all objects by ref-counting. - // (id) => {object, count} - private storage: Record = {} - - // Stores the IDs + refCounts of objects referenced by WebContents. - // (ownerKey) => { id: refCount } - private owners: Record> = {} - - private electronIds = new WeakMap(); - - // Register a new object and return its assigned ID. If the object is already - // registered then the already assigned ID would be returned. - add (webContents: WebContents, contextId: string, obj: any) { - // Get or assign an ID to the object. - const id = this.saveToStorage(obj); - - // Add object to the set of referenced objects. - const ownerKey = getOwnerKey(webContents, contextId); - let owner = this.owners[ownerKey]; - if (!owner) { - owner = this.owners[ownerKey] = new Map(); - this.registerDeleteListener(webContents, contextId); - } - if (!owner.has(id)) { - owner.set(id, 0); - // Increase reference count if not referenced before. - this.storage[id].count++; - } - - owner.set(id, owner.get(id)! + 1); - return id; - } - - // Get an object according to its ID. - get (id: number) { - const pointer = this.storage[id]; - if (pointer != null) return pointer.object; - } - - // Dereference an object according to its ID. - // Note that an object may be double-freed (cleared when page is reloaded, and - // then garbage collected in old page). - remove (webContents: WebContents, contextId: string, id: number) { - const ownerKey = getOwnerKey(webContents, contextId); - const owner = this.owners[ownerKey]; - if (owner && owner.has(id)) { - const newRefCount = owner.get(id)! - 1; - - // Only completely remove if the number of references GCed in the - // renderer is the same as the number of references we sent them - if (newRefCount <= 0) { - // Remove the reference in owner. - owner.delete(id); - // Dereference from the storage. - this.dereference(id); - } else { - owner.set(id, newRefCount); - } - } - } - - // Clear all references to objects refrenced by the WebContents. - clear (webContents: WebContents, contextId: string) { - const ownerKey = getOwnerKey(webContents, contextId); - const owner = this.owners[ownerKey]; - if (!owner) return; - - for (const id of owner.keys()) this.dereference(id); - - delete this.owners[ownerKey]; - } - - // Private: Saves the object into storage and assigns an ID for it. - saveToStorage (object: any) { - let id = this.electronIds.get(object); - if (!id) { - id = ++this.nextId; - this.storage[id] = { - count: 0, - object: object - }; - this.electronIds.set(object, id); - } - return id; - } - - // Private: Dereference the object from store. - dereference (id: number) { - const pointer = this.storage[id]; - if (pointer == null) { - return; - } - pointer.count -= 1; - if (pointer.count === 0) { - this.electronIds.delete(pointer.object); - delete this.storage[id]; - } - } - - // Private: Clear the storage when renderer process is destroyed. - registerDeleteListener (webContents: WebContents, contextId: string) { - // contextId => ${processHostId}-${contextCount} - const processHostId = contextId.split('-')[0]; - const listener = (_: any, deletedProcessHostId: string) => { - if (deletedProcessHostId && - deletedProcessHostId.toString() === processHostId) { - webContents.removeListener('render-view-deleted' as any, listener); - this.clear(webContents, contextId); - } - }; - // Note that the "render-view-deleted" event may not be emitted on time when - // the renderer process get destroyed because of navigation, we rely on the - // renderer process to send "ELECTRON_BROWSER_CONTEXT_RELEASE" message to - // guard this situation. - webContents.on('render-view-deleted' as any, listener); - } -} - -export default new ObjectsRegistry(); diff --git a/lib/browser/remote/server.ts b/lib/browser/remote/server.ts deleted file mode 100644 index 5dd28bed3e1c..000000000000 --- a/lib/browser/remote/server.ts +++ /dev/null @@ -1,519 +0,0 @@ -import * as electron from 'electron/main'; -import { EventEmitter } from 'events'; -import objectsRegistry from '@electron/internal/browser/remote/objects-registry'; -import { ipcMainInternal } from '@electron/internal/browser/ipc-main-internal'; -import { isPromise, isSerializableObject, deserialize, serialize } from '@electron/internal/common/type-utils'; -import type { MetaTypeFromRenderer, ObjectMember, MetaType, ObjProtoDescriptor } from '@electron/internal/common/remote/types'; -import { IPC_MESSAGES } from '@electron/internal/common/remote/ipc-messages'; - -const v8Util = process._linkedBinding('electron_common_v8_util'); -const eventBinding = process._linkedBinding('electron_browser_event'); -const features = process._linkedBinding('electron_common_features'); - -if (!features.isRemoteModuleEnabled()) { - throw new Error('remote module is disabled'); -} - -// The internal properties of Function. -const FUNCTION_PROPERTIES = [ - 'length', 'name', 'arguments', 'caller', 'prototype' -]; - -type RendererFunctionId = [string, number] // [contextId, funcId] -type FinalizerInfo = { id: RendererFunctionId, webContents: electron.WebContents, frameId: [number, number] }; -type CallIntoRenderer = (...args: any[]) => void - -// The remote functions in renderer processes. -const rendererFunctionCache = new Map>(); -// eslint-disable-next-line no-undef -const finalizationRegistry = new FinalizationRegistry((fi: FinalizerInfo) => { - const mapKey = fi.id[0] + '~' + fi.id[1]; - const ref = rendererFunctionCache.get(mapKey); - if (ref !== undefined && ref.deref() === undefined) { - rendererFunctionCache.delete(mapKey); - if (!fi.webContents.isDestroyed()) { - try { - fi.webContents._sendToFrameInternal(fi.frameId, IPC_MESSAGES.RENDERER_RELEASE_CALLBACK, fi.id[0], fi.id[1]); - } catch (error) { - console.warn(`_sendToFrameInternal() failed: ${error}`); - } - } - } -}); - -function getCachedRendererFunction (id: RendererFunctionId): CallIntoRenderer | undefined { - const mapKey = id[0] + '~' + id[1]; - const ref = rendererFunctionCache.get(mapKey); - if (ref !== undefined) { - const deref = ref.deref(); - if (deref !== undefined) return deref; - } -} -function setCachedRendererFunction (id: RendererFunctionId, wc: electron.WebContents, frameId: [number, number], value: CallIntoRenderer) { - // eslint-disable-next-line no-undef - const wr = new WeakRef(value); - const mapKey = id[0] + '~' + id[1]; - rendererFunctionCache.set(mapKey, wr); - finalizationRegistry.register(value, { - id, - webContents: wc, - frameId - } as FinalizerInfo); - return value; -} - -const locationInfo = new WeakMap(); - -// Return the description of object's members: -const getObjectMembers = function (object: any): ObjectMember[] { - let names = Object.getOwnPropertyNames(object); - // For Function, we should not override following properties even though they - // are "own" properties. - if (typeof object === 'function') { - names = names.filter((name) => { - return !FUNCTION_PROPERTIES.includes(name); - }); - } - // Map properties to descriptors. - return names.map((name) => { - const descriptor = Object.getOwnPropertyDescriptor(object, name)!; - let type: ObjectMember['type']; - let writable = false; - if (descriptor.get === undefined && typeof object[name] === 'function') { - type = 'method'; - } else { - if (descriptor.set || descriptor.writable) writable = true; - type = 'get'; - } - return { name, enumerable: descriptor.enumerable, writable, type }; - }); -}; - -// Return the description of object's prototype. -const getObjectPrototype = function (object: any): ObjProtoDescriptor { - const proto = Object.getPrototypeOf(object); - if (proto === null || proto === Object.prototype) return null; - return { - members: getObjectMembers(proto), - proto: getObjectPrototype(proto) - }; -}; - -// Convert a real value into meta data. -const valueToMeta = function (sender: electron.WebContents, contextId: string, value: any, optimizeSimpleObject = false): MetaType { - // Determine the type of value. - let type: MetaType['type']; - - switch (typeof value) { - case 'object': - // Recognize certain types of objects. - if (value instanceof Buffer) { - type = 'buffer'; - } else if (value && value.constructor && value.constructor.name === 'NativeImage') { - type = 'nativeimage'; - } else if (Array.isArray(value)) { - type = 'array'; - } else if (value instanceof Error) { - type = 'error'; - } else if (isSerializableObject(value)) { - type = 'value'; - } else if (isPromise(value)) { - type = 'promise'; - } else if (Object.prototype.hasOwnProperty.call(value, 'callee') && value.length != null) { - // Treat the arguments object as array. - type = 'array'; - } else if (optimizeSimpleObject && v8Util.getHiddenValue(value, 'simple')) { - // Treat simple objects as value. - type = 'value'; - } else { - type = 'object'; - } - break; - case 'function': - type = 'function'; - break; - default: - type = 'value'; - break; - } - - // Fill the meta object according to value's type. - if (type === 'array') { - return { - type, - members: value.map((el: any) => valueToMeta(sender, contextId, el, optimizeSimpleObject)) - }; - } else if (type === 'nativeimage') { - return { type, value: serialize(value) }; - } else if (type === 'object' || type === 'function') { - return { - type, - name: value.constructor ? value.constructor.name : '', - // Reference the original value if it's an object, because when it's - // passed to renderer we would assume the renderer keeps a reference of - // it. - id: objectsRegistry.add(sender, contextId, value), - members: getObjectMembers(value), - proto: getObjectPrototype(value) - }; - } else if (type === 'buffer') { - return { type, value }; - } else if (type === 'promise') { - // Add default handler to prevent unhandled rejections in main process - // Instead they should appear in the renderer process - value.then(function () {}, function () {}); - - return { - type, - then: valueToMeta(sender, contextId, function (onFulfilled: Function, onRejected: Function) { - value.then(onFulfilled, onRejected); - }) - }; - } else if (type === 'error') { - return { - type, - value, - members: Object.keys(value).map(name => ({ - name, - value: valueToMeta(sender, contextId, value[name]) - })) - }; - } else { - return { - type: 'value', - value - }; - } -}; - -const throwRPCError = function (message: string) { - const error = new Error(message) as Error & {code: string, errno: number}; - error.code = 'EBADRPC'; - error.errno = -72; - throw error; -}; - -const removeRemoteListenersAndLogWarning = (sender: any, callIntoRenderer: (...args: any[]) => void) => { - const location = locationInfo.get(callIntoRenderer); - let message = 'Attempting to call a function in a renderer window that has been closed or released.' + - `\nFunction provided here: ${location}`; - - if (sender instanceof EventEmitter) { - const remoteEvents = sender.eventNames().filter((eventName) => { - return sender.listeners(eventName).includes(callIntoRenderer); - }); - - if (remoteEvents.length > 0) { - message += `\nRemote event names: ${remoteEvents.join(', ')}`; - remoteEvents.forEach((eventName) => { - sender.removeListener(eventName, callIntoRenderer); - }); - } - } - - console.warn(message); -}; - -const fakeConstructor = (constructor: Function, name: string) => - new Proxy(Object, { - get (target, prop, receiver) { - if (prop === 'name') { - return name; - } else { - return Reflect.get(target, prop, receiver); - } - } - }); - -// Convert array of meta data from renderer into array of real values. -const unwrapArgs = function (sender: electron.WebContents, frameId: [number, number], contextId: string, args: any[]) { - const metaToValue = function (meta: MetaTypeFromRenderer): any { - switch (meta.type) { - case 'nativeimage': - return deserialize(meta.value); - case 'value': - return meta.value; - case 'remote-object': - return objectsRegistry.get(meta.id); - case 'array': - return unwrapArgs(sender, frameId, contextId, meta.value); - case 'buffer': - return Buffer.from(meta.value.buffer, meta.value.byteOffset, meta.value.byteLength); - case 'promise': - return Promise.resolve({ - then: metaToValue(meta.then) - }); - case 'object': { - const ret: any = meta.name !== 'Object' ? Object.create({ - constructor: fakeConstructor(Object, meta.name) - }) : {}; - - for (const { name, value } of meta.members) { - ret[name] = metaToValue(value); - } - return ret; - } - case 'function-with-return-value': { - const returnValue = metaToValue(meta.value); - return function () { - return returnValue; - }; - } - case 'function': { - // Merge contextId and meta.id, since meta.id can be the same in - // different webContents. - const objectId: [string, number] = [contextId, meta.id]; - - // Cache the callbacks in renderer. - const cachedFunction = getCachedRendererFunction(objectId); - if (cachedFunction !== undefined) { return cachedFunction; } - - const callIntoRenderer = function (this: any, ...args: any[]) { - let succeed = false; - if (!sender.isDestroyed()) { - try { - succeed = sender._sendToFrameInternal(frameId, IPC_MESSAGES.RENDERER_CALLBACK, contextId, meta.id, valueToMeta(sender, contextId, args)); - } catch (error) { - console.warn(`_sendToFrameInternal() failed: ${error}`); - } - } - if (!succeed) { - removeRemoteListenersAndLogWarning(this, callIntoRenderer); - } - }; - locationInfo.set(callIntoRenderer, meta.location); - Object.defineProperty(callIntoRenderer, 'length', { value: meta.length }); - - setCachedRendererFunction(objectId, sender, frameId, callIntoRenderer); - return callIntoRenderer; - } - default: - throw new TypeError(`Unknown type: ${(meta as any).type}`); - } - }; - return args.map(metaToValue); -}; - -const isRemoteModuleEnabledImpl = function (contents: electron.WebContents) { - const webPreferences = contents.getLastWebPreferences() || {}; - return webPreferences.enableRemoteModule != null ? !!webPreferences.enableRemoteModule : false; -}; - -const isRemoteModuleEnabledCache = new WeakMap(); - -export const isRemoteModuleEnabled = function (contents: electron.WebContents) { - if (!isRemoteModuleEnabledCache.has(contents)) { - isRemoteModuleEnabledCache.set(contents, isRemoteModuleEnabledImpl(contents)); - } - - return isRemoteModuleEnabledCache.get(contents); -}; - -const handleRemoteCommand = function (channel: string, handler: (event: ElectronInternal.IpcMainInternalEvent, contextId: string, ...args: any[]) => void) { - ipcMainInternal.on(channel, (event, contextId: string, ...args: any[]) => { - let returnValue; - if (!isRemoteModuleEnabled(event.sender)) { - event.returnValue = null; - return; - } - - try { - returnValue = handler(event, contextId, ...args); - } catch (error) { - returnValue = { - type: 'exception', - value: valueToMeta(event.sender, contextId, error) - }; - } - - if (returnValue !== undefined) { - event.returnValue = returnValue; - } - }); -}; - -const emitCustomEvent = function (contents: electron.WebContents, eventName: string, ...args: any[]) { - const event = eventBinding.createWithSender(contents); - - electron.app.emit(eventName, event, contents, ...args); - contents.emit(eventName, event, ...args); - - return event; -}; - -const logStack = function (contents: electron.WebContents, code: string, stack: string | undefined) { - if (stack) { - console.warn(`WebContents (${contents.id}): ${code}`, stack); - } -}; - -handleRemoteCommand(IPC_MESSAGES.BROWSER_WRONG_CONTEXT_ERROR, function (event, contextId, passedContextId, id) { - const objectId: [string, number] = [passedContextId, id]; - const cachedFunction = getCachedRendererFunction(objectId); - if (cachedFunction === undefined) { - // Do nothing if the error has already been reported before. - return; - } - removeRemoteListenersAndLogWarning(event.sender, cachedFunction); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_REQUIRE, function (event, contextId, moduleName, stack) { - logStack(event.sender, `remote.require('${moduleName}')`, stack); - const customEvent = emitCustomEvent(event.sender, 'remote-require', moduleName); - - if (customEvent.returnValue === undefined) { - if (customEvent.defaultPrevented) { - throw new Error(`Blocked remote.require('${moduleName}')`); - } else { - customEvent.returnValue = process.mainModule.require(moduleName); - } - } - - return valueToMeta(event.sender, contextId, customEvent.returnValue); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_GET_BUILTIN, function (event, contextId, moduleName, stack) { - logStack(event.sender, `remote.getBuiltin('${moduleName}')`, stack); - const customEvent = emitCustomEvent(event.sender, 'remote-get-builtin', moduleName); - - if (customEvent.returnValue === undefined) { - if (customEvent.defaultPrevented) { - throw new Error(`Blocked remote.getBuiltin('${moduleName}')`); - } else { - customEvent.returnValue = (electron as any)[moduleName]; - } - } - - return valueToMeta(event.sender, contextId, customEvent.returnValue); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_GET_GLOBAL, function (event, contextId, globalName, stack) { - logStack(event.sender, `remote.getGlobal('${globalName}')`, stack); - const customEvent = emitCustomEvent(event.sender, 'remote-get-global', globalName); - - if (customEvent.returnValue === undefined) { - if (customEvent.defaultPrevented) { - throw new Error(`Blocked remote.getGlobal('${globalName}')`); - } else { - customEvent.returnValue = (global as any)[globalName]; - } - } - - return valueToMeta(event.sender, contextId, customEvent.returnValue); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_GET_CURRENT_WINDOW, function (event, contextId, stack) { - logStack(event.sender, 'remote.getCurrentWindow()', stack); - const customEvent = emitCustomEvent(event.sender, 'remote-get-current-window'); - - if (customEvent.returnValue === undefined) { - if (customEvent.defaultPrevented) { - throw new Error('Blocked remote.getCurrentWindow()'); - } else { - customEvent.returnValue = event.sender.getOwnerBrowserWindow(); - } - } - - return valueToMeta(event.sender, contextId, customEvent.returnValue); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_GET_CURRENT_WEB_CONTENTS, function (event, contextId, stack) { - logStack(event.sender, 'remote.getCurrentWebContents()', stack); - const customEvent = emitCustomEvent(event.sender, 'remote-get-current-web-contents'); - - if (customEvent.returnValue === undefined) { - if (customEvent.defaultPrevented) { - throw new Error('Blocked remote.getCurrentWebContents()'); - } else { - customEvent.returnValue = event.sender; - } - } - - return valueToMeta(event.sender, contextId, customEvent.returnValue); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_CONSTRUCTOR, function (event, contextId, id, args) { - args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args); - const constructor = objectsRegistry.get(id); - - if (constructor == null) { - throwRPCError(`Cannot call constructor on missing remote object ${id}`); - } - - return valueToMeta(event.sender, contextId, new constructor(...args)); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_FUNCTION_CALL, function (event, contextId, id, args) { - args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args); - const func = objectsRegistry.get(id); - - if (func == null) { - throwRPCError(`Cannot call function on missing remote object ${id}`); - } - - try { - return valueToMeta(event.sender, contextId, func(...args), true); - } catch (error) { - const err = new Error(`Could not call remote function '${func.name || 'anonymous'}'. Check that the function signature is correct. Underlying error: ${error.message}\nUnderlying stack: ${error.stack}\n`); - (err as any).cause = error; - throw err; - } -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_MEMBER_CONSTRUCTOR, function (event, contextId, id, method, args) { - args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args); - const object = objectsRegistry.get(id); - - if (object == null) { - throwRPCError(`Cannot call constructor '${method}' on missing remote object ${id}`); - } - - return valueToMeta(event.sender, contextId, new object[method](...args)); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_MEMBER_CALL, function (event, contextId, id, method, args) { - args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args); - const object = objectsRegistry.get(id); - - if (object == null) { - throwRPCError(`Cannot call method '${method}' on missing remote object ${id}`); - } - - try { - return valueToMeta(event.sender, contextId, object[method](...args), true); - } catch (error) { - const err = new Error(`Could not call remote method '${method}'. Check that the method signature is correct. Underlying error: ${error.message}\nUnderlying stack: ${error.stack}\n`); - (err as any).cause = error; - throw err; - } -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_MEMBER_SET, function (event, contextId, id, name, args) { - args = unwrapArgs(event.sender, [event.processId, event.frameId], contextId, args); - const obj = objectsRegistry.get(id); - - if (obj == null) { - throwRPCError(`Cannot set property '${name}' on missing remote object ${id}`); - } - - obj[name] = args[0]; - return null; -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_MEMBER_GET, function (event, contextId, id, name) { - const obj = objectsRegistry.get(id); - - if (obj == null) { - throwRPCError(`Cannot get property '${name}' on missing remote object ${id}`); - } - - return valueToMeta(event.sender, contextId, obj[name]); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_DEREFERENCE, function (event, contextId, id) { - objectsRegistry.remove(event.sender, contextId, id); -}); - -handleRemoteCommand(IPC_MESSAGES.BROWSER_CONTEXT_RELEASE, (event, contextId) => { - objectsRegistry.clear(event.sender, contextId); -}); diff --git a/lib/common/parse-features-string.ts b/lib/common/parse-features-string.ts index 57c481a775fb..21731be2a7d8 100644 --- a/lib/common/parse-features-string.ts +++ b/lib/common/parse-features-string.ts @@ -75,7 +75,7 @@ export function parseWebViewWebPreferences (preferences: string) { return parseCommaSeparatedKeyValue(preferences, false).parsed; } -const allowedWebPreferences = ['zoomFactor', 'nodeIntegration', 'enableRemoteModule', 'javascript', 'contextIsolation', 'webviewTag'] as const; +const allowedWebPreferences = ['zoomFactor', 'nodeIntegration', 'javascript', 'contextIsolation', 'webviewTag'] as const; type AllowedWebPreference = (typeof allowedWebPreferences)[number]; /** diff --git a/lib/common/remote/types.ts b/lib/common/remote/types.ts deleted file mode 100644 index 7fab28905158..000000000000 --- a/lib/common/remote/types.ts +++ /dev/null @@ -1,85 +0,0 @@ -import type { Size } from 'electron/main'; -import type { NativeImage } from 'electron/common'; - -export type ObjectMember = { - name: string, - value?: any, - enumerable?: boolean, - writable?: boolean, - type?: 'method' | 'get' -} - -export type ObjProtoDescriptor = { - members: ObjectMember[], - proto: ObjProtoDescriptor -} | null - -export type MetaType = { - type: 'object' | 'function', - name: string, - members: ObjectMember[], - proto: ObjProtoDescriptor, - id: number, -} | { - type: 'value', - value: any, -} | { - type: 'buffer', - value: Uint8Array, -} | { - type: 'array', - members: MetaType[] -} | { - type: 'error', - value: Error, - members: ObjectMember[] -} | { - type: 'exception', - value: MetaType, -} | { - type: 'promise', - then: MetaType -} | { - type: 'nativeimage' - value: NativeImage -} - -export type MetaTypeFromRenderer = { - type: 'value', - value: any -} | { - type: 'remote-object', - id: number -} | { - type: 'array', - value: MetaTypeFromRenderer[] -} | { - type: 'buffer', - value: Uint8Array -} | { - type: 'promise', - then: MetaTypeFromRenderer -} | { - type: 'object', - name: string, - members: { - name: string, - value: MetaTypeFromRenderer - }[] -} | { - type: 'function-with-return-value', - value: MetaTypeFromRenderer -} | { - type: 'function', - id: number, - location: string, - length: number -} | { - type: 'nativeimage', - value: { - size: Size, - buffer: Buffer, - scaleFactor: number, - dataURL: string - }[] -} diff --git a/lib/renderer/api/module-list.ts b/lib/renderer/api/module-list.ts index 0263284d9a64..4ae57b180e1b 100644 --- a/lib/renderer/api/module-list.ts +++ b/lib/renderer/api/module-list.ts @@ -1,7 +1,3 @@ -const { getWebPreference } = process._linkedBinding('electron_renderer_web_frame'); - -const enableRemoteModule = getWebPreference(window, 'enableRemoteModule'); - // Renderer side modules, please sort alphabetically. export const rendererModuleList: ElectronInternal.ModuleEntry[] = [ { name: 'contextBridge', loader: () => require('./context-bridge') }, @@ -17,10 +13,3 @@ if (BUILDFLAG(ENABLE_DESKTOP_CAPTURER)) { loader: () => require('@electron/internal/renderer/api/desktop-capturer') }); } - -if (BUILDFLAG(ENABLE_REMOTE_MODULE) && enableRemoteModule) { - rendererModuleList.push({ - name: 'remote', - loader: () => require('@electron/internal/renderer/api/remote') - }); -} diff --git a/lib/renderer/api/remote.ts b/lib/renderer/api/remote.ts deleted file mode 100644 index 35a9a5b1ba9e..000000000000 --- a/lib/renderer/api/remote.ts +++ /dev/null @@ -1,395 +0,0 @@ -import { CallbacksRegistry } from '../remote/callbacks-registry'; -import { isPromise, isSerializableObject, serialize, deserialize } from '../../common/type-utils'; -import { MetaTypeFromRenderer, ObjectMember, ObjProtoDescriptor, MetaType } from '../../common/remote/types'; -import { ipcRendererInternal } from '../ipc-renderer-internal'; -import type { BrowserWindow, WebContents } from 'electron/main'; -import deprecate from '@electron/internal/common/api/deprecate'; -import { browserModuleNames } from '@electron/internal/browser/api/module-names'; -import { commonModuleList } from '@electron/internal/common/api/module-list'; -import { IPC_MESSAGES } from '@electron/internal/common/remote/ipc-messages'; - -deprecate.log('The remote module is deprecated. Use https://github.com/electron/remote instead.'); - -const v8Util = process._linkedBinding('electron_common_v8_util'); -const { hasSwitch } = process._linkedBinding('electron_common_command_line'); - -const callbacksRegistry = new CallbacksRegistry(); -const remoteObjectCache = new Map(); -const finalizationRegistry = new FinalizationRegistry((id: number) => { - const ref = remoteObjectCache.get(id); - if (ref !== undefined && ref.deref() === undefined) { - remoteObjectCache.delete(id); - ipcRendererInternal.send(IPC_MESSAGES.BROWSER_DEREFERENCE, contextId, id, 0); - } -}); - -const electronIds = new WeakMap(); -const isReturnValue = new WeakSet(); - -function getCachedRemoteObject (id: number) { - const ref = remoteObjectCache.get(id); - if (ref !== undefined) { - const deref = ref.deref(); - if (deref !== undefined) return deref; - } -} -function setCachedRemoteObject (id: number, value: any) { - const wr = new WeakRef(value); - remoteObjectCache.set(id, wr); - finalizationRegistry.register(value, id); - return value; -} - -// An unique ID that can represent current context. -const contextId = v8Util.getHiddenValue(global, 'contextId'); - -// Notify the main process when current context is going to be released. -// Note that when the renderer process is destroyed, the message may not be -// sent, we also listen to the "render-view-deleted" event in the main process -// to guard that situation. -process.on('exit', () => { - const command = IPC_MESSAGES.BROWSER_CONTEXT_RELEASE; - ipcRendererInternal.send(command, contextId); -}); - -const IS_REMOTE_PROXY = Symbol('is-remote-proxy'); - -// Convert the arguments object into an array of meta data. -function wrapArgs (args: any[], visited = new Set()): any { - const valueToMeta = (value: any): any => { - // Check for circular reference. - if (visited.has(value)) { - return { - type: 'value', - value: null - }; - } - - if (value && value.constructor && value.constructor.name === 'NativeImage') { - return { type: 'nativeimage', value: serialize(value) }; - } else if (Array.isArray(value)) { - visited.add(value); - const meta = { - type: 'array', - value: wrapArgs(value, visited) - }; - visited.delete(value); - return meta; - } else if (value instanceof Buffer) { - return { - type: 'buffer', - value - }; - } else if (isSerializableObject(value)) { - return { - type: 'value', - value - }; - } else if (typeof value === 'object') { - if (isPromise(value)) { - return { - type: 'promise', - then: valueToMeta(function (onFulfilled: Function, onRejected: Function) { - value.then(onFulfilled, onRejected); - }) - }; - } else if (electronIds.has(value)) { - return { - type: 'remote-object', - id: electronIds.get(value) - }; - } - - const meta: MetaTypeFromRenderer = { - type: 'object', - name: value.constructor ? value.constructor.name : '', - members: [] - }; - visited.add(value); - for (const prop in value) { // eslint-disable-line guard-for-in - meta.members.push({ - name: prop, - value: valueToMeta(value[prop]) - }); - } - visited.delete(value); - return meta; - } else if (typeof value === 'function' && isReturnValue.has(value)) { - return { - type: 'function-with-return-value', - value: valueToMeta(value()) - }; - } else if (typeof value === 'function') { - return { - type: 'function', - id: callbacksRegistry.add(value), - location: callbacksRegistry.getLocation(value), - length: value.length - }; - } else { - return { - type: 'value', - value - }; - } - }; - return args.map(valueToMeta); -} - -// Populate object's members from descriptors. -// The |ref| will be kept referenced by |members|. -// This matches |getObjectMembers| in rpc-server. -function setObjectMembers (ref: any, object: any, metaId: number, members: ObjectMember[]) { - if (!Array.isArray(members)) return; - - for (const member of members) { - if (Object.prototype.hasOwnProperty.call(object, member.name)) continue; - - const descriptor: PropertyDescriptor = { enumerable: member.enumerable }; - if (member.type === 'method') { - const remoteMemberFunction = function (this: any, ...args: any[]) { - let command; - if (this && this.constructor === remoteMemberFunction) { - command = IPC_MESSAGES.BROWSER_MEMBER_CONSTRUCTOR; - } else { - command = IPC_MESSAGES.BROWSER_MEMBER_CALL; - } - const ret = ipcRendererInternal.sendSync(command, contextId, metaId, member.name, wrapArgs(args)); - return metaToValue(ret); - }; - - let descriptorFunction = proxyFunctionProperties(remoteMemberFunction, metaId, member.name); - - descriptor.get = () => { - descriptorFunction.ref = ref; // The member should reference its object. - return descriptorFunction; - }; - // Enable monkey-patch the method - descriptor.set = (value) => { - descriptorFunction = value; - return value; - }; - descriptor.configurable = true; - } else if (member.type === 'get') { - descriptor.get = () => { - const command = IPC_MESSAGES.BROWSER_MEMBER_GET; - const meta = ipcRendererInternal.sendSync(command, contextId, metaId, member.name); - return metaToValue(meta); - }; - - if (member.writable) { - descriptor.set = (value) => { - const args = wrapArgs([value]); - const command = IPC_MESSAGES.BROWSER_MEMBER_SET; - const meta = ipcRendererInternal.sendSync(command, contextId, metaId, member.name, args); - if (meta != null) metaToValue(meta); - return value; - }; - } - } - - Object.defineProperty(object, member.name, descriptor); - } -} - -// Populate object's prototype from descriptor. -// This matches |getObjectPrototype| in rpc-server. -function setObjectPrototype (ref: any, object: any, metaId: number, descriptor: ObjProtoDescriptor) { - if (descriptor === null) return; - const proto = {}; - setObjectMembers(ref, proto, metaId, descriptor.members); - setObjectPrototype(ref, proto, metaId, descriptor.proto); - Object.setPrototypeOf(object, proto); -} - -// Wrap function in Proxy for accessing remote properties -function proxyFunctionProperties (remoteMemberFunction: Function, metaId: number, name: string) { - let loaded = false; - - // Lazily load function properties - const loadRemoteProperties = () => { - if (loaded) return; - loaded = true; - const command = IPC_MESSAGES.BROWSER_MEMBER_GET; - const meta = ipcRendererInternal.sendSync(command, contextId, metaId, name); - setObjectMembers(remoteMemberFunction, remoteMemberFunction, meta.id, meta.members); - }; - - return new Proxy(remoteMemberFunction as any, { - set: (target, property, value) => { - if (property !== 'ref') loadRemoteProperties(); - target[property] = value; - return true; - }, - get: (target, property) => { - if (property === IS_REMOTE_PROXY) return true; - if (!Object.prototype.hasOwnProperty.call(target, property)) loadRemoteProperties(); - const value = target[property]; - if (property === 'toString' && typeof value === 'function') { - return value.bind(target); - } - return value; - }, - ownKeys: (target) => { - loadRemoteProperties(); - return Object.getOwnPropertyNames(target); - }, - getOwnPropertyDescriptor: (target, property) => { - const descriptor = Object.getOwnPropertyDescriptor(target, property); - if (descriptor) return descriptor; - loadRemoteProperties(); - return Object.getOwnPropertyDescriptor(target, property); - } - }); -} - -// Convert meta data from browser into real value. -function metaToValue (meta: MetaType): any { - if (meta.type === 'value') { - return meta.value; - } else if (meta.type === 'array') { - return meta.members.map((member) => metaToValue(member)); - } else if (meta.type === 'nativeimage') { - return deserialize(meta.value); - } else if (meta.type === 'buffer') { - return Buffer.from(meta.value.buffer, meta.value.byteOffset, meta.value.byteLength); - } else if (meta.type === 'promise') { - return Promise.resolve({ then: metaToValue(meta.then) }); - } else if (meta.type === 'error') { - return metaToError(meta); - } else if (meta.type === 'exception') { - if (meta.value.type === 'error') { throw metaToError(meta.value); } else { throw new Error(`Unexpected value type in exception: ${meta.value.type}`); } - } else { - let ret; - if ('id' in meta) { - const cached = getCachedRemoteObject(meta.id); - if (cached !== undefined) { return cached; } - } - - // A shadow class to represent the remote function object. - if (meta.type === 'function') { - const remoteFunction = function (this: any, ...args: any[]) { - let command; - if (this && this.constructor === remoteFunction) { - command = IPC_MESSAGES.BROWSER_CONSTRUCTOR; - } else { - command = IPC_MESSAGES.BROWSER_FUNCTION_CALL; - } - const obj = ipcRendererInternal.sendSync(command, contextId, meta.id, wrapArgs(args)); - return metaToValue(obj); - }; - ret = remoteFunction; - } else { - ret = {}; - } - - setObjectMembers(ret, ret, meta.id, meta.members); - setObjectPrototype(ret, ret, meta.id, meta.proto); - if (ret.constructor && (ret.constructor as any)[IS_REMOTE_PROXY]) { - Object.defineProperty(ret.constructor, 'name', { value: meta.name }); - } - - // Track delegate obj's lifetime & tell browser to clean up when object is GCed. - electronIds.set(ret, meta.id); - setCachedRemoteObject(meta.id, ret); - return ret; - } -} - -function metaToError (meta: { type: 'error', value: any, members: ObjectMember[] }) { - const obj = meta.value; - for (const { name, value } of meta.members) { - obj[name] = metaToValue(value); - } - return obj; -} - -function handleMessage (channel: string, handler: Function) { - ipcRendererInternal.on(channel, (event, passedContextId, id, ...args) => { - if (passedContextId === contextId) { - handler(id, ...args); - } else { - // Message sent to an un-exist context, notify the error to main process. - ipcRendererInternal.send(IPC_MESSAGES.BROWSER_WRONG_CONTEXT_ERROR, contextId, passedContextId, id); - } - }); -} - -const enableStacks = hasSwitch('enable-api-filtering-logging'); - -function getCurrentStack (): string | undefined { - const target = { stack: undefined as string | undefined }; - if (enableStacks) { - Error.captureStackTrace(target, getCurrentStack); - } - return target.stack; -} - -// Browser calls a callback in renderer. -handleMessage(IPC_MESSAGES.RENDERER_CALLBACK, (id: number, args: any) => { - callbacksRegistry.apply(id, metaToValue(args)); -}); - -// A callback in browser is released. -handleMessage(IPC_MESSAGES.RENDERER_RELEASE_CALLBACK, (id: number) => { - callbacksRegistry.remove(id); -}); - -exports.require = (module: string) => { - const command = IPC_MESSAGES.BROWSER_REQUIRE; - const meta = ipcRendererInternal.sendSync(command, contextId, module, getCurrentStack()); - return metaToValue(meta); -}; - -// Alias to remote.require('electron').xxx. -export function getBuiltin (module: string) { - const command = IPC_MESSAGES.BROWSER_GET_BUILTIN; - const meta = ipcRendererInternal.sendSync(command, contextId, module, getCurrentStack()); - return metaToValue(meta); -} - -export function getCurrentWindow (): BrowserWindow { - const command = IPC_MESSAGES.BROWSER_GET_CURRENT_WINDOW; - const meta = ipcRendererInternal.sendSync(command, contextId, getCurrentStack()); - return metaToValue(meta); -} - -// Get current WebContents object. -export function getCurrentWebContents (): WebContents { - const command = IPC_MESSAGES.BROWSER_GET_CURRENT_WEB_CONTENTS; - const meta = ipcRendererInternal.sendSync(command, contextId, getCurrentStack()); - return metaToValue(meta); -} - -// Get a global object in browser. -export function getGlobal (name: string): T { - const command = IPC_MESSAGES.BROWSER_GET_GLOBAL; - const meta = ipcRendererInternal.sendSync(command, contextId, name, getCurrentStack()); - return metaToValue(meta); -} - -// Get the process object in browser. -Object.defineProperty(exports, 'process', { - get: () => exports.getGlobal('process') -}); - -// Create a function that will return the specified value when called in browser. -export function createFunctionWithReturnValue (returnValue: T): () => T { - const func = () => returnValue; - isReturnValue.add(func); - return func; -} - -const addBuiltinProperty = (name: string) => { - Object.defineProperty(exports, name, { - get: () => exports.getBuiltin(name) - }); -}; - -const browserModules = commonModuleList.concat(browserModuleNames.map(name => ({ name, loader: () => {} }))); - -// And add a helper receiver for each one. -browserModules - .filter((m) => !m.private) - .map((m) => m.name) - .forEach(addBuiltinProperty); diff --git a/lib/renderer/remote/callbacks-registry.ts b/lib/renderer/remote/callbacks-registry.ts deleted file mode 100644 index a413214d1c83..000000000000 --- a/lib/renderer/remote/callbacks-registry.ts +++ /dev/null @@ -1,59 +0,0 @@ -export class CallbacksRegistry { - private nextId: number = 0 - private callbacks = new Map() - private callbackIds = new WeakMap(); - private locationInfo = new WeakMap(); - - add (callback: Function) { - // The callback is already added. - let id = this.callbackIds.get(callback); - if (id != null) return id; - - id = this.nextId += 1; - - // Capture the location of the function and put it in the ID string, - // so that release errors can be tracked down easily. - const regexp = /at (.*)/gi; - const stackString = (new Error()).stack; - if (!stackString) return; - - let filenameAndLine: string; - let match; - - while ((match = regexp.exec(stackString)) !== null) { - const location = match[1]; - if (location.includes('(native)')) continue; - if (location.includes('()')) continue; - if (location.includes('electron/js2c')) continue; - - const ref = /([^/^)]*)\)?$/gi.exec(location); - if (ref) filenameAndLine = ref![1]; - break; - } - - this.callbacks.set(id, callback); - this.callbackIds.set(callback, id); - this.locationInfo.set(callback, filenameAndLine!); - return id; - } - - get (id: number) { - return this.callbacks.get(id) || function () {}; - } - - getLocation (callback: Function) { - return this.locationInfo.get(callback); - } - - apply (id: number, ...args: any[]) { - return this.get(id).apply(global, ...args); - } - - remove (id: number) { - const callback = this.callbacks.get(id); - if (callback) { - this.callbackIds.delete(callback); - this.callbacks.delete(id); - } - } -} diff --git a/lib/renderer/security-warnings.ts b/lib/renderer/security-warnings.ts index 23f538fb1d36..bae73abf6636 100644 --- a/lib/renderer/security-warnings.ts +++ b/lib/renderer/security-warnings.ts @@ -266,27 +266,6 @@ const warnAboutAllowedPopups = function () { // #13 Disable or limit creation of new windows // #14 Do not use `openExternal` with untrusted content -// #15 on the checklist: Disable the `remote` module -// Logs a warning message about the remote module - -const warnAboutRemoteModuleWithRemoteContent = function (webPreferences?: Electron.WebPreferences) { - if (!webPreferences || isLocalhost()) return; - const remoteModuleEnabled = webPreferences.enableRemoteModule != null ? !!webPreferences.enableRemoteModule : true; - if (!remoteModuleEnabled) return; - - if (getIsRemoteProtocol()) { - const warning = `This renderer process has "enableRemoteModule" enabled - and attempted to load remote content from '${window.location}'. This - exposes users of this app to unnecessary security risks.\n${moreInformation}`; - - console.warn('%cElectron Security Warning (enableRemoteModule)', - 'font-weight: bold;', warning); - } -}; - -// Currently missing since we can't easily programmatically check for it: -// #16 Filter the `remote` module - const logSecurityWarnings = function ( webPreferences: Electron.WebPreferences | undefined, nodeIntegration: boolean ) { @@ -298,7 +277,6 @@ const logSecurityWarnings = function ( warnAboutEnableBlinkFeatures(webPreferences); warnAboutInsecureCSP(); warnAboutAllowedPopups(); - warnAboutRemoteModuleWithRemoteContent(webPreferences); }; const getWebPreferences = async function () { diff --git a/lib/renderer/web-view/web-view-attributes.ts b/lib/renderer/web-view/web-view-attributes.ts index 764088bb11ae..253baf1b9310 100644 --- a/lib/renderer/web-view/web-view-attributes.ts +++ b/lib/renderer/web-view/web-view-attributes.ts @@ -259,20 +259,6 @@ class WebPreferencesAttribute extends WebViewAttribute { } } -class EnableRemoteModuleAttribute extends WebViewAttribute { - constructor (webViewImpl: WebViewImpl) { - super(WEB_VIEW_CONSTANTS.ATTRIBUTE_ENABLEREMOTEMODULE, webViewImpl); - } - - public getValue () { - return this.webViewImpl.webviewNode.getAttribute(this.name) !== 'false'; - } - - public setValue (value: any) { - this.webViewImpl.webviewNode.setAttribute(this.name, value ? 'true' : 'false'); - } -} - // Sets up all of the webview attributes. WebViewImpl.prototype.setupWebViewAttributes = function () { this.attributes.set(WEB_VIEW_CONSTANTS.ATTRIBUTE_PARTITION, new PartitionAttribute(this)); @@ -284,7 +270,6 @@ WebViewImpl.prototype.setupWebViewAttributes = function () { this.attributes.set(WEB_VIEW_CONSTANTS.ATTRIBUTE_PLUGINS, new BooleanAttribute(WEB_VIEW_CONSTANTS.ATTRIBUTE_PLUGINS, this)); this.attributes.set(WEB_VIEW_CONSTANTS.ATTRIBUTE_DISABLEWEBSECURITY, new BooleanAttribute(WEB_VIEW_CONSTANTS.ATTRIBUTE_DISABLEWEBSECURITY, this)); this.attributes.set(WEB_VIEW_CONSTANTS.ATTRIBUTE_ALLOWPOPUPS, new BooleanAttribute(WEB_VIEW_CONSTANTS.ATTRIBUTE_ALLOWPOPUPS, this)); - this.attributes.set(WEB_VIEW_CONSTANTS.ATTRIBUTE_ENABLEREMOTEMODULE, new EnableRemoteModuleAttribute(this)); this.attributes.set(WEB_VIEW_CONSTANTS.ATTRIBUTE_PRELOAD, new PreloadAttribute(this)); this.attributes.set(WEB_VIEW_CONSTANTS.ATTRIBUTE_BLINKFEATURES, new BlinkFeaturesAttribute(this)); this.attributes.set(WEB_VIEW_CONSTANTS.ATTRIBUTE_DISABLEBLINKFEATURES, new DisableBlinkFeaturesAttribute(this)); diff --git a/lib/renderer/web-view/web-view-constants.ts b/lib/renderer/web-view/web-view-constants.ts index 02bf33400f48..2ee9ba8dcffd 100644 --- a/lib/renderer/web-view/web-view-constants.ts +++ b/lib/renderer/web-view/web-view-constants.ts @@ -6,7 +6,6 @@ export const enum WEB_VIEW_CONSTANTS { ATTRIBUTE_HTTPREFERRER = 'httpreferrer', ATTRIBUTE_NODEINTEGRATION = 'nodeintegration', ATTRIBUTE_NODEINTEGRATIONINSUBFRAMES = 'nodeintegrationinsubframes', - ATTRIBUTE_ENABLEREMOTEMODULE = 'enableremotemodule', ATTRIBUTE_PLUGINS = 'plugins', ATTRIBUTE_DISABLEWEBSECURITY = 'disablewebsecurity', ATTRIBUTE_ALLOWPOPUPS = 'allowpopups', diff --git a/lib/renderer/web-view/web-view-element.ts b/lib/renderer/web-view/web-view-element.ts index 6034ef587bc7..4b15d45be4f2 100644 --- a/lib/renderer/web-view/web-view-element.ts +++ b/lib/renderer/web-view/web-view-element.ts @@ -29,7 +29,6 @@ const defineWebViewElement = (v8Util: NodeJS.V8UtilBinding, webViewImpl: typeof WEB_VIEW_CONSTANTS.ATTRIBUTE_PLUGINS, WEB_VIEW_CONSTANTS.ATTRIBUTE_DISABLEWEBSECURITY, WEB_VIEW_CONSTANTS.ATTRIBUTE_ALLOWPOPUPS, - WEB_VIEW_CONSTANTS.ATTRIBUTE_ENABLEREMOTEMODULE, WEB_VIEW_CONSTANTS.ATTRIBUTE_PRELOAD, WEB_VIEW_CONSTANTS.ATTRIBUTE_BLINKFEATURES, WEB_VIEW_CONSTANTS.ATTRIBUTE_DISABLEBLINKFEATURES, diff --git a/lib/sandboxed_renderer/api/module-list.ts b/lib/sandboxed_renderer/api/module-list.ts index 69f78937ad40..3c148ecee36b 100644 --- a/lib/sandboxed_renderer/api/module-list.ts +++ b/lib/sandboxed_renderer/api/module-list.ts @@ -1,7 +1,3 @@ -const { getWebPreference } = process._linkedBinding('electron_renderer_web_frame'); - -const enableRemoteModule = getWebPreference(window, 'enableRemoteModule'); - export const moduleList: ElectronInternal.ModuleEntry[] = [ { name: 'contextBridge', @@ -37,10 +33,3 @@ if (BUILDFLAG(ENABLE_DESKTOP_CAPTURER)) { loader: () => require('@electron/internal/renderer/api/desktop-capturer') }); } - -if (BUILDFLAG(ENABLE_REMOTE_MODULE) && enableRemoteModule) { - moduleList.push({ - name: 'remote', - loader: () => require('@electron/internal/renderer/api/remote') - }); -} diff --git a/package.json b/package.json index 273ff45a7f33..dd820127f834 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "electron", - "version": "14.0.0-nightly.20210304", + "version": "14.0.0-nightly.20210315", "repository": "https://github.com/electron/electron", "description": "Build cross platform desktop apps with JavaScript, HTML, and CSS", "devDependencies": { diff --git a/patches/chromium/.patches b/patches/chromium/.patches index ad688acde96e..e4a5d7b50b97 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -107,3 +107,4 @@ add_trustedauthclient_to_urlloaderfactory.patch fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch disable_unload_metrics.patch fix_add_check_for_sandbox_then_result.patch +moves_background_color_setter_of_webview_to_blinks_webprefs_logic.patch diff --git a/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch index 2aaa6a59c2a5..f658016d747f 100644 --- a/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch @@ -8,10 +8,10 @@ WebPreferences of in-process child windows, rather than relying on process-level command line switches, as before. diff --git a/third_party/blink/common/web_preferences/web_preferences.cc b/third_party/blink/common/web_preferences/web_preferences.cc -index 758b0b1616ecf86b7dd090adce94395851d9baf2..55f20eb6266368c65fc0ec80d52caa332f85ecfb 100644 +index 758b0b1616ecf86b7dd090adce94395851d9baf2..43eed39329d5d4337471a2ae8512714d6c6cb841 100644 --- a/third_party/blink/common/web_preferences/web_preferences.cc +++ b/third_party/blink/common/web_preferences/web_preferences.cc -@@ -146,6 +146,29 @@ WebPreferences::WebPreferences() +@@ -146,6 +146,28 @@ WebPreferences::WebPreferences() navigate_on_drag_drop(true), v8_cache_options(blink::mojom::V8CacheOptions::kDefault), record_whole_document(false), @@ -21,7 +21,6 @@ index 758b0b1616ecf86b7dd090adce94395851d9baf2..55f20eb6266368c65fc0ec80d52caa33 + background_color(base::EmptyString()), + opener_id(0), + context_isolation(false), -+ enable_remote_module(false), + world_safe_execute_javascript(false), + guest_instance_id(0), + hidden_page(false), @@ -42,7 +41,7 @@ index 758b0b1616ecf86b7dd090adce94395851d9baf2..55f20eb6266368c65fc0ec80d52caa33 accelerated_video_decode_enabled(false), animation_policy( diff --git a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc -index ba1ba323ec45296c33b5931652a001d6bd24dbe0..663d47894592499531ff924c78b518325020dc04 100644 +index ba1ba323ec45296c33b5931652a001d6bd24dbe0..178cae9c389e48733fde982f4906d9748004dbe3 100644 --- a/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc +++ b/third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc @@ -24,6 +24,11 @@ bool StructTraitslazy_frame_loading_distance_thresholds_px) || !data.ReadLazyImageLoadingDistanceThresholdsPx( -@@ -152,6 +157,27 @@ bool StructTraitsnavigate_on_drag_drop = data.navigate_on_drag_drop(); out->v8_cache_options = data.v8_cache_options(); out->record_whole_document = data.record_whole_document(); @@ -66,7 +65,6 @@ index ba1ba323ec45296c33b5931652a001d6bd24dbe0..663d47894592499531ff924c78b51832 + out->disable_electron_site_instance_overrides = data.disable_electron_site_instance_overrides(); + out->opener_id = data.opener_id(); + out->context_isolation = data.context_isolation(); -+ out->enable_remote_module = data.enable_remote_module(); + out->world_safe_execute_javascript = data.world_safe_execute_javascript(); + out->guest_instance_id = data.guest_instance_id(); + out->hidden_page = data.hidden_page(); @@ -86,7 +84,7 @@ index ba1ba323ec45296c33b5931652a001d6bd24dbe0..663d47894592499531ff924c78b51832 out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index e1fb30cfba2656989141f0a53ec3e6202c9b0409..ff9da0f6e66ed6565a64c33cc60f39510075c1f4 100644 +index e1fb30cfba2656989141f0a53ec3e6202c9b0409..f630fe020bd426e9093ce352a8e9ac17170101ca 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -97,7 +95,7 @@ index e1fb30cfba2656989141f0a53ec3e6202c9b0409..ff9da0f6e66ed6565a64c33cc60f3951 #include "base/strings/string16.h" #include "base/time/time.h" #include "build/build_config.h" -@@ -161,6 +162,29 @@ struct BLINK_COMMON_EXPORT WebPreferences { +@@ -161,6 +162,28 @@ struct BLINK_COMMON_EXPORT WebPreferences { blink::mojom::V8CacheOptions v8_cache_options; bool record_whole_document; @@ -107,7 +105,6 @@ index e1fb30cfba2656989141f0a53ec3e6202c9b0409..ff9da0f6e66ed6565a64c33cc60f3951 + std::string background_color; + int opener_id; + bool context_isolation; -+ bool enable_remote_module; + bool world_safe_execute_javascript; + int guest_instance_id; + bool hidden_page; @@ -128,7 +125,7 @@ index e1fb30cfba2656989141f0a53ec3e6202c9b0409..ff9da0f6e66ed6565a64c33cc60f3951 // only controls whether or not the "document.cookie" field is properly // connected to the backing store, for instance if you wanted to be able to diff --git a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h -index ae180b30284c17c7319925531440161f66b873c7..2857c7fdcb18b6f9d858c038ee2a9784c141766b 100644 +index ae180b30284c17c7319925531440161f66b873c7..6ba055814a8385052d7798be56de53691dbe3343 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h +++ b/third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h @@ -6,6 +6,7 @@ @@ -139,7 +136,7 @@ index ae180b30284c17c7319925531440161f66b873c7..2857c7fdcb18b6f9d858c038ee2a9784 #include "mojo/public/cpp/bindings/struct_traits.h" #include "net/nqe/effective_connection_type.h" #include "third_party/blink/public/common/common_export.h" -@@ -441,6 +442,88 @@ struct BLINK_COMMON_EXPORT StructTraits +Date: Mon, 8 Mar 2021 16:27:39 -0800 +Subject: moves background_color setter of WebView to blinks webprefs logic + +background_color can be updated at runtime, as such we need to apply the +new background color to the WebView in the ApplyPreferences method. +There is no current way to attach an observer to these prefs so patching +is our only option. + +Ideally we could add an embedder observer pattern here but that can be +done in future work. + +diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc +index ba01fb7cbbff1535401cdc687570c9a86e2011dd..fdb61d9116a2822709e3fb3ea9c4803a8c99511d 100644 +--- a/third_party/blink/renderer/core/exported/web_view_impl.cc ++++ b/third_party/blink/renderer/core/exported/web_view_impl.cc +@@ -154,6 +154,7 @@ + #include "third_party/blink/renderer/core/timing/dom_window_performance.h" + #include "third_party/blink/renderer/core/timing/window_performance.h" + #include "third_party/blink/renderer/platform/fonts/font_cache.h" ++#include "third_party/blink/renderer/platform/graphics/color.h" + #include "third_party/blink/renderer/platform/graphics/image.h" + #include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h" + #include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h" +@@ -1765,6 +1766,14 @@ void WebView::ApplyWebPreferences(const web_pref::WebPreferences& prefs, + + RuntimeEnabledFeatures::SetTranslateServiceEnabled( + prefs.translate_service_available); ++ ++ SkColor color = SK_ColorTRANSPARENT; ++ if (!prefs.guest_instance_id) { // not inside electron tag, which is always transparent. ++ Color blink_color; ++ if (blink_color.SetFromString(WebString::FromASCII(prefs.background_color))) ++ color = static_cast(blink_color); ++ } ++ web_view->SetBaseBackgroundColor(color); + } + + void WebViewImpl::ThemeChanged() { diff --git a/patches/node/.patches b/patches/node/.patches index bf2a25bdc4ec..2a5106fe3a9b 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -16,7 +16,6 @@ build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.pa refactor_allow_embedder_overriding_of_internal_fs_calls.patch chore_prevent_warn_non_context-aware_native_modules_being_loaded.patch chore_read_nobrowserglobals_from_global_not_process.patch -build_bring_back_node_with_ltcg_configuration.patch enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch fix_use_crypto_impls_for_compat.patch fix_comment_out_incompatible_crypto_modules.patch @@ -32,3 +31,4 @@ remove_makeexternal_case_for_uncached_internal_strings.patch fix_remove_outdated_--experimental-wasm-bigint_flag.patch fix_crypto_tests_to_run_with_bssl.patch build_add_mjs_support_to_js2c.patch +src_inline_asynccleanuphookhandle_in_headers.patch diff --git a/patches/node/build_bring_back_node_with_ltcg_configuration.patch b/patches/node/build_bring_back_node_with_ltcg_configuration.patch deleted file mode 100644 index f4305a8c6742..000000000000 --- a/patches/node/build_bring_back_node_with_ltcg_configuration.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Deepak Mohan -Date: Wed, 16 Oct 2019 13:41:12 -0700 -Subject: build: bring back node_with_ltcg configuration - -This was moved to code node.gyp as part of https://github.com/nodejs/node/pull/25931 -which caused native modules size increase which were depending on -this configuration transitively https://github.com/nodejs/node/issues/29501. -THe fix for this should land in node-gyp as discussed in above issue, -landing this as temporary patch. - -diff --git a/common.gypi b/common.gypi -index d37d29736ead82aca6c89cc7625ca4d9a053da32..ffb80656d4a2117b7ee4cd5bd2d7aabfef16122b 100644 ---- a/common.gypi -+++ b/common.gypi -@@ -19,7 +19,7 @@ - 'node_use_v8_platform%': 'true', - 'node_use_bundled_v8%': 'true', - 'node_module_version%': '', -- 'node_with_ltcg%': '', -+ 'node_with_ltcg%': 'true', - 'node_shared_openssl%': 'false', - - 'node_tag%': '', -@@ -232,6 +232,26 @@ - 'cflags': [ '-fPIC' ], - 'ldflags': [ '-fPIC' ] - }], -+ ['node_with_ltcg=="true"', { -+ 'msvs_settings': { -+ 'VCCLCompilerTool': { -+ 'WholeProgramOptimization': 'true' # /GL, whole program optimization, needed for LTCG -+ }, -+ 'VCLibrarianTool': { -+ 'AdditionalOptions': [ -+ '/LTCG:INCREMENTAL', # incremental link-time code generation -+ ] -+ }, -+ 'VCLinkerTool': { -+ 'OptimizeReferences': 2, # /OPT:REF -+ 'EnableCOMDATFolding': 2, # /OPT:ICF -+ 'LinkIncremental': 1, # disable incremental linking -+ 'AdditionalOptions': [ -+ '/LTCG:INCREMENTAL', # incremental link-time code generation -+ ] -+ } -+ } -+ }] - ], - 'msvs_settings': { - 'VCCLCompilerTool': { diff --git a/patches/node/enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch b/patches/node/enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch index ee48ebfa929a..860a6ab4b5a6 100644 --- a/patches/node/enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch +++ b/patches/node/enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch @@ -8,7 +8,7 @@ node modules will have different (wrong) ideas about how v8 structs are laid out in memory on 64-bit machines, and will summarily fail to work. diff --git a/common.gypi b/common.gypi -index ffb80656d4a2117b7ee4cd5bd2d7aabfef16122b..2f6e8fbb302d133631acd33e90dd1b6661364b32 100644 +index d37d29736ead82aca6c89cc7625ca4d9a053da32..b6aa3c0504fd108ada368d30f3021d1c171a4879 100644 --- a/common.gypi +++ b/common.gypi @@ -64,7 +64,7 @@ diff --git a/patches/node/fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch b/patches/node/fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch index 2af238f4199a..2678bc722865 100644 --- a/patches/node/fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch +++ b/patches/node/fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch @@ -6,7 +6,7 @@ Subject: fix: add v8_enable_reverse_jsargs defines in common.gypi This can be removed once node upgrades V8 and inevitably has to do this exact same thing. Also hi node people if you are looking at this. diff --git a/common.gypi b/common.gypi -index 2f6e8fbb302d133631acd33e90dd1b6661364b32..1f05305dee3fe5558d41765b5fac4ccfdd843eb5 100644 +index b6aa3c0504fd108ada368d30f3021d1c171a4879..9a2552ab3c1ba44b57b2d3b1ddf2becaa32ebbda 100644 --- a/common.gypi +++ b/common.gypi @@ -65,6 +65,7 @@ @@ -25,7 +25,7 @@ index 2f6e8fbb302d133631acd33e90dd1b6661364b32..1f05305dee3fe5558d41765b5fac4ccf ##### end V8 defaults ##### # When building native modules using 'npm install' with the system npm, -@@ -392,6 +394,9 @@ +@@ -372,6 +374,9 @@ ['v8_enable_pointer_compression == 1 or v8_enable_31bit_smis_on_64bit_arch == 1', { 'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'], }], diff --git a/patches/node/src_inline_asynccleanuphookhandle_in_headers.patch b/patches/node/src_inline_asynccleanuphookhandle_in_headers.patch new file mode 100644 index 000000000000..9ecdeed761ca --- /dev/null +++ b/patches/node/src_inline_asynccleanuphookhandle_in_headers.patch @@ -0,0 +1,73 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tyler Ang-Wanek +Date: Tue, 19 Jan 2021 07:39:14 -0700 +Subject: src: inline AsyncCleanupHookHandle in headers + +Fixes: https://github.com/nodejs/node/issues/36349 + +PR-URL: https://github.com/nodejs/node/pull/37000 +Reviewed-By: Anna Henningsen +Reviewed-By: Rich Trott +Reviewed-By: James M Snell + +diff --git a/src/api/hooks.cc b/src/api/hooks.cc +index a719a861dbe9d8d9ca67c3bb5920b14b0df16d83..8f191aad7e2dcfbedddeaeb88f47ed721ef51cf1 100644 +--- a/src/api/hooks.cc ++++ b/src/api/hooks.cc +@@ -133,7 +133,7 @@ static void RunAsyncCleanupHook(void* arg) { + info->fun(info->arg, FinishAsyncCleanupHook, info); + } + +-AsyncCleanupHookHandle AddEnvironmentCleanupHook( ++ACHHandle* AddEnvironmentCleanupHookInternal( + Isolate* isolate, + AsyncCleanupHook fun, + void* arg) { +@@ -145,11 +145,11 @@ AsyncCleanupHookHandle AddEnvironmentCleanupHook( + info->arg = arg; + info->self = info; + env->AddCleanupHook(RunAsyncCleanupHook, info.get()); +- return AsyncCleanupHookHandle(new ACHHandle { info }); ++ return new ACHHandle { info }; + } + +-void RemoveEnvironmentCleanupHook( +- AsyncCleanupHookHandle handle) { ++void RemoveEnvironmentCleanupHookInternal( ++ ACHHandle* handle) { + if (handle->info->started) return; + handle->info->self.reset(); + handle->info->env->RemoveCleanupHook(RunAsyncCleanupHook, handle->info.get()); +diff --git a/src/node.h b/src/node.h +index f150725b54ee1315476d202797963369490d5152..7ab2ed9345c83cb4c1f51c0cc3050abc6571e3fa 100644 +--- a/src/node.h ++++ b/src/node.h +@@ -905,12 +905,26 @@ struct ACHHandle; + struct NODE_EXTERN DeleteACHHandle { void operator()(ACHHandle*) const; }; + typedef std::unique_ptr AsyncCleanupHookHandle; + +-NODE_EXTERN AsyncCleanupHookHandle AddEnvironmentCleanupHook( ++/* This function is not intended to be used externally, it exists to aid in ++ * keeping ABI compatibility between Node and Electron. */ ++NODE_EXTERN ACHHandle* AddEnvironmentCleanupHookInternal( + v8::Isolate* isolate, + void (*fun)(void* arg, void (*cb)(void*), void* cbarg), + void* arg); ++inline AsyncCleanupHookHandle AddEnvironmentCleanupHook( ++ v8::Isolate* isolate, ++ void (*fun)(void* arg, void (*cb)(void*), void* cbarg), ++ void* arg) { ++ return AsyncCleanupHookHandle(AddEnvironmentCleanupHookInternal(isolate, fun, ++ arg)); ++} + +-NODE_EXTERN void RemoveEnvironmentCleanupHook(AsyncCleanupHookHandle holder); ++/* This function is not intended to be used externally, it exists to aid in ++ * keeping ABI compatibility between Node and Electron. */ ++NODE_EXTERN void RemoveEnvironmentCleanupHookInternal(ACHHandle* holder); ++inline void RemoveEnvironmentCleanupHook(AsyncCleanupHookHandle holder) { ++ RemoveEnvironmentCleanupHookInternal(holder.get()); ++} + + /* Returns the id of the current execution context. If the return value is + * zero then no execution has been set. This will happen if the user handles diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 3b0164cbe983..ff233e56bcbf 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -114,8 +114,7 @@ BaseWindow::BaseWindow(gin_helper::Arguments* args, } BaseWindow::~BaseWindow() { - if (!window_->IsClosed()) - window_->CloseImmediately(); + CloseImmediately(); // Destroy the native window in next tick because the native code might be // iterating all windows. @@ -318,6 +317,11 @@ void BaseWindow::SetContentView(gin::Handle view) { window_->SetContentView(view->view()); } +void BaseWindow::CloseImmediately() { + if (!window_->IsClosed()) + window_->CloseImmediately(); +} + void BaseWindow::Close() { window_->Close(); } diff --git a/shell/browser/api/electron_api_base_window.h b/shell/browser/api/electron_api_base_window.h index 02a2e258dc64..25b2c9e7c5ba 100644 --- a/shell/browser/api/electron_api_base_window.h +++ b/shell/browser/api/electron_api_base_window.h @@ -92,6 +92,7 @@ class BaseWindow : public gin_helper::TrackableObject, // Public APIs of NativeWindow. void SetContentView(gin::Handle view); void Close(); + virtual void CloseImmediately(); virtual void Focus(); virtual void Blur(); bool IsFocused(); diff --git a/shell/browser/api/electron_api_browser_view.cc b/shell/browser/api/electron_api_browser_view.cc index ac8137ab2cbe..3cb2a6fa6a66 100644 --- a/shell/browser/api/electron_api_browser_view.cc +++ b/shell/browser/api/electron_api_browser_view.cc @@ -100,11 +100,9 @@ BrowserView::BrowserView(gin::Arguments* args, } BrowserView::~BrowserView() { - if (api_web_contents_) { // destroy() is called - // Destroy WebContents asynchronously unless app is shutting down, - // because destroy() might be called inside WebContents's event handler. + if (api_web_contents_) { // destroy() called without closing WebContents api_web_contents_->RemoveObserver(this); - api_web_contents_->DestroyWebContents(!Browser::Get()->is_shutting_down()); + api_web_contents_->Destroy(); } } diff --git a/shell/browser/api/electron_api_browser_window.cc b/shell/browser/api/electron_api_browser_window.cc index 75d4daf51c4c..1ba361cbc379 100644 --- a/shell/browser/api/electron_api_browser_window.cc +++ b/shell/browser/api/electron_api_browser_window.cc @@ -104,13 +104,16 @@ BrowserWindow::BrowserWindow(gin::Arguments* args, } BrowserWindow::~BrowserWindow() { - // FIXME This is a hack rather than a proper fix preventing shutdown crashes. - if (api_web_contents_) + if (api_web_contents_) { + // Cleanup the observers if user destroyed this instance directly instead of + // gracefully closing content::WebContents. + auto* host = web_contents()->GetRenderViewHost(); + if (host) + host->GetWidget()->RemoveInputEventObserver(this); api_web_contents_->RemoveObserver(this); - // Note that the OnWindowClosed will not be called after the destructor runs, - // since the window object is managed by the BaseWindow class. - if (web_contents()) - Cleanup(); + // Destroy the WebContents. + OnCloseContents(); + } } void BrowserWindow::OnInputEvent(const blink::WebInputEvent& event) { @@ -173,34 +176,14 @@ void BrowserWindow::OnRendererUnresponsive(content::RenderProcessHost*) { ScheduleUnresponsiveEvent(50); } +void BrowserWindow::WebContentsDestroyed() { + api_web_contents_ = nullptr; + CloseImmediately(); +} + void BrowserWindow::OnCloseContents() { - // On some machines it may happen that the window gets destroyed for twice, - // checking web_contents() can effectively guard against that. - // https://github.com/electron/electron/issues/16202. - // - // TODO(zcbenz): We should find out the root cause and improve the closing - // procedure of BrowserWindow. - if (!web_contents()) - return; - - // Close all child windows before closing current window. - v8::Locker locker(isolate()); - v8::HandleScope handle_scope(isolate()); - for (v8::Local value : child_windows_.Values(isolate())) { - gin::Handle child; - if (gin::ConvertFromV8(isolate(), value, &child) && !child.IsEmpty()) - child->window()->CloseImmediately(); - } - - // When the web contents is gone, close the window immediately, but the - // memory will not be freed until you call delete. - // In this way, it would be safe to manage windows via smart pointers. If you - // want to free memory when the window is closed, you can do deleting by - // overriding the OnWindowClosed method in the observer. - window()->CloseImmediately(); - - // Do not sent "unresponsive" event after window is closed. - window_unresponsive_closure_.Cancel(); + BaseWindow::ResetBrowserViews(); + api_web_contents_->Destroy(); } void BrowserWindow::OnRendererResponsive(content::RenderProcessHost*) { @@ -268,30 +251,22 @@ void BrowserWindow::OnCloseButtonClicked(bool* prevent_default) { web_contents()->Close(); } -void BrowserWindow::OnWindowClosed() { - // We need to reset the browser views before we call Cleanup, because the - // browser views are child views of the main web contents view, which will be - // deleted by Cleanup. - BaseWindow::ResetBrowserViews(); - Cleanup(); - // See BaseWindow::OnWindowClosed on why calling InvalidateWeakPtrs. - weak_factory_.InvalidateWeakPtrs(); - BaseWindow::OnWindowClosed(); -} - void BrowserWindow::OnWindowBlur() { - web_contents()->StoreFocus(); + if (api_web_contents_) + web_contents()->StoreFocus(); BaseWindow::OnWindowBlur(); } void BrowserWindow::OnWindowFocus() { - web_contents()->RestoreFocus(); - + // focus/blur events might be emitted while closing window. + if (api_web_contents_) { + web_contents()->RestoreFocus(); #if !defined(OS_MAC) - if (!api_web_contents_->IsDevToolsOpened()) - web_contents()->Focus(); + if (!api_web_contents_->IsDevToolsOpened()) + web_contents()->Focus(); #endif + } BaseWindow::OnWindowFocus(); } @@ -325,6 +300,22 @@ void BrowserWindow::OnWindowLeaveFullScreen() { BaseWindow::OnWindowLeaveFullScreen(); } +void BrowserWindow::CloseImmediately() { + // Close all child windows before closing current window. + v8::Locker locker(isolate()); + v8::HandleScope handle_scope(isolate()); + for (v8::Local value : child_windows_.Values(isolate())) { + gin::Handle child; + if (gin::ConvertFromV8(isolate(), value, &child) && !child.IsEmpty()) + child->window()->CloseImmediately(); + } + + BaseWindow::CloseImmediately(); + + // Do not sent "unresponsive" event after window is closed. + window_unresponsive_closure_.Cancel(); +} + void BrowserWindow::Focus() { if (api_web_contents_->IsOffScreen()) FocusOnWebView(); @@ -381,7 +372,7 @@ void BrowserWindow::RemoveBrowserView(v8::Local value) { void BrowserWindow::SetTopBrowserView(v8::Local value, gin_helper::Arguments* args) { BaseWindow::SetTopBrowserView(value, args); -#if defined(OS_MACOSX) +#if defined(OS_MAC) UpdateDraggableRegions(draggable_regions_); #endif } @@ -448,17 +439,6 @@ void BrowserWindow::NotifyWindowUnresponsive() { } } -void BrowserWindow::Cleanup() { - auto* host = web_contents()->GetRenderViewHost(); - if (host) - host->GetWidget()->RemoveInputEventObserver(this); - - // Destroy WebContents asynchronously unless app is shutting down, - // because destroy() might be called inside WebContents's event handler. - api_web_contents_->DestroyWebContents(!Browser::Get()->is_shutting_down()); - Observe(nullptr); -} - void BrowserWindow::OnWindowShow() { web_contents()->WasShown(); BaseWindow::OnWindowShow(); diff --git a/shell/browser/api/electron_api_browser_window.h b/shell/browser/api/electron_api_browser_window.h index a3423b3a83fb..f0547d8039ad 100644 --- a/shell/browser/api/electron_api_browser_window.h +++ b/shell/browser/api/electron_api_browser_window.h @@ -54,6 +54,7 @@ class BrowserWindow : public BaseWindow, void OnRendererUnresponsive(content::RenderProcessHost*) override; void OnRendererResponsive( content::RenderProcessHost* render_process_host) override; + void WebContentsDestroyed() override; // ExtendedWebContentsObserver: void OnCloseContents() override; @@ -73,11 +74,11 @@ class BrowserWindow : public BaseWindow, void OnWindowIsKeyChanged(bool is_key) override; // BaseWindow: - void OnWindowClosed() override; void OnWindowBlur() override; void OnWindowFocus() override; void OnWindowResize() override; void OnWindowLeaveFullScreen() override; + void CloseImmediately() override; void Focus() override; void Blur() override; void SetBackgroundColor(const std::string& color_name) override; @@ -114,9 +115,6 @@ class BrowserWindow : public BaseWindow, // Dispatch unresponsive event to observers. void NotifyWindowUnresponsive(); - // Cleanup our WebContents observers. - void Cleanup(); - // Closure that would be called when window is unresponsive when closing, // it should be cancelled when we can prove that the window is responsive. base::CancelableClosure window_unresponsive_closure_; diff --git a/shell/browser/api/electron_api_system_preferences_mac.mm b/shell/browser/api/electron_api_system_preferences_mac.mm index 96d757f5f975..2595a1c7eedb 100644 --- a/shell/browser/api/electron_api_system_preferences_mac.mm +++ b/shell/browser/api/electron_api_system_preferences_mac.mm @@ -26,9 +26,11 @@ #include "shell/browser/mac/dict_util.h" #include "shell/browser/mac/electron_application.h" #include "shell/browser/ui/cocoa/NSColor+Hex.h" +#include "shell/common/color_util.h" #include "shell/common/gin_converters/gurl_converter.h" #include "shell/common/gin_converters/value_converter.h" #include "shell/common/process_util.h" +#include "skia/ext/skia_utils_mac.h" #include "ui/native_theme/native_theme.h" namespace gin { @@ -388,7 +390,8 @@ std::string SystemPreferences::GetAccentColor() { if (@available(macOS 10.14, *)) sysColor = [NSColor controlAccentColor]; - return base::SysNSStringToUTF8([sysColor RGBAValue]); + return ToRGBAHex(skia::NSSystemColorToSkColor(sysColor), + false /* include_hash */); } std::string SystemPreferences::GetSystemColor(gin_helper::ErrorThrower thrower, @@ -417,7 +420,7 @@ std::string SystemPreferences::GetSystemColor(gin_helper::ErrorThrower thrower, return ""; } - return base::SysNSStringToUTF8([sysColor hexadecimalValue]); + return ToRGBHex(skia::NSSystemColorToSkColor(sysColor)); } bool SystemPreferences::CanPromptTouchID() { @@ -575,7 +578,7 @@ std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower, } if (sysColor) - return base::SysNSStringToUTF8([sysColor hexadecimalValue]); + return ToRGBHex(skia::NSSystemColorToSkColor(sysColor)); return ""; } diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index cf97c5b2c4fd..60a75e4e9378 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -910,51 +910,49 @@ void WebContents::InitWithWebContents(content::WebContents* web_contents, } WebContents::~WebContents() { - MarkDestroyed(); - // The destroy() is called. - if (inspectable_web_contents_) { -#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) - if (type_ == Type::kBackgroundPage) { - // Background pages are owned by extensions::ExtensionHost - inspectable_web_contents_->ReleaseWebContents(); - } -#endif - - inspectable_web_contents_->GetView()->SetDelegate(nullptr); - - if (web_contents()) { - RenderViewDeleted(web_contents()->GetRenderViewHost()); - } - - if (type_ == Type::kBrowserWindow && owner_window()) { - // For BrowserWindow we should close the window and clean up everything - // before WebContents is destroyed. - for (ExtendedWebContentsObserver& observer : observers_) - observer.OnCloseContents(); - // BrowserWindow destroys WebContents asynchronously, manually emit the - // destroyed event here. - WebContentsDestroyed(); - } else if (Browser::Get()->is_shutting_down()) { - // Destroy WebContents directly when app is shutting down. - DestroyWebContents(false /* async */); - } else { - // Destroy WebContents asynchronously unless app is shutting down, - // because destroy() might be called inside WebContents's event handler. - bool is_browser_view = type_ == Type::kBrowserView; - DestroyWebContents(!(IsGuest() || is_browser_view) /* async */); - // The WebContentsDestroyed will not be called automatically because we - // destroy the webContents in the next tick. So we have to manually - // call it here to make sure "destroyed" event is emitted. - WebContentsDestroyed(); - } + if (!inspectable_web_contents_) { + WebContentsDestroyed(); + return; } -} -void WebContents::DestroyWebContents(bool async) { + if (guest_delegate_) + guest_delegate_->WillDestroy(); + // This event is only for internal use, which is emitted when WebContents is // being destroyed. Emit("will-destroy"); - ResetManagedWebContents(async); + + // For guest view based on OOPIF, the WebContents is released by the embedder + // frame, and we need to clear the reference to the memory. + bool not_owned_by_this = IsGuest() && attached_; +#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) + // And background pages are owned by extensions::ExtensionHost. + if (type_ == Type::kBackgroundPage) + not_owned_by_this = true; +#endif + if (not_owned_by_this) { + inspectable_web_contents_->ReleaseWebContents(); + WebContentsDestroyed(); + } + + // InspectableWebContents will be automatically destroyed. +} + +void WebContents::Destroy() { + // The content::WebContents should be destroyed asyncronously when possible + // as user may choose to destroy WebContents during an event of it. + if (Browser::Get()->is_shutting_down() || IsGuest() || + type_ == Type::kBrowserView) { + delete this; + } else { + base::PostTask(FROM_HERE, {content::BrowserThread::UI}, + base::BindOnce( + [](base::WeakPtr contents) { + if (contents) + delete contents.get(); + }, + GetWeakPtr())); + } } bool WebContents::DidAddMessageToConsole( @@ -1060,11 +1058,21 @@ void WebContents::AddNewContents( v8::HandleScope handle_scope(isolate); auto api_web_contents = CreateAndTake(isolate, std::move(new_contents), Type::kBrowserWindow); + + // We call RenderFrameCreated here as at this point the empty "about:blank" + // render frame has already been created. If the window never navigates again + // RenderFrameCreated won't be called and certain prefs like + // "kBackgroundColor" will not be applied. + auto* frame = api_web_contents->MainFrame(); + if (frame) { + api_web_contents->HandleNewRenderFrame(frame); + } + if (Emit("-add-new-contents", api_web_contents, disposition, user_gesture, initial_rect.x(), initial_rect.y(), initial_rect.width(), initial_rect.height(), tracker->url, tracker->frame_name, tracker->referrer, tracker->raw_features, tracker->body)) { - api_web_contents->DestroyWebContents(false /* async */); + api_web_contents->Destroy(); } } @@ -1134,8 +1142,6 @@ void WebContents::CloseContents(content::WebContents* source) { autofill_driver_factory->CloseAllPopups(); } - if (inspectable_web_contents_) - inspectable_web_contents_->GetView()->SetDelegate(nullptr); for (ExtendedWebContentsObserver& observer : observers_) observer.OnCloseContents(); } @@ -1351,7 +1357,7 @@ void WebContents::BeforeUnloadFired(bool proceed, // there are two virtual functions named BeforeUnloadFired. } -void WebContents::RenderFrameCreated( +void WebContents::HandleNewRenderFrame( content::RenderFrameHost* render_frame_host) { auto* rwhv = render_frame_host->GetView(); if (!rwhv) @@ -1380,6 +1386,11 @@ void WebContents::RenderFrameCreated( WebFrameMain::RenderFrameCreated(render_frame_host); } +void WebContents::RenderFrameCreated( + content::RenderFrameHost* render_frame_host) { + HandleNewRenderFrame(render_frame_host); +} + void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) { // This event is necessary for tracking any states with respect to // intermediate render view hosts aka speculative render view hosts. Currently @@ -1812,21 +1823,6 @@ void WebContents::SetOwnerWindow(content::WebContents* web_contents, #endif } -void WebContents::ResetManagedWebContents(bool async) { - if (async) { - // Browser context should be destroyed only after the WebContents, - // this is guaranteed in the sync mode by the order of declaration, - // in the async version we maintain a reference until the WebContents - // is destroyed. - // //electron/patches/chromium/content_browser_main_loop.patch - // is required to get the right quit closure for the main message loop. - base::ThreadTaskRunnerHandle::Get()->DeleteSoon( - FROM_HERE, inspectable_web_contents_.release()); - } else { - inspectable_web_contents_.reset(); - } -} - content::WebContents* WebContents::GetWebContents() const { if (!inspectable_web_contents_) return nullptr; @@ -1839,7 +1835,8 @@ content::WebContents* WebContents::GetDevToolsWebContents() const { return inspectable_web_contents_->GetDevToolsWebContents(); } -void WebContents::MarkDestroyed() { +void WebContents::WebContentsDestroyed() { + // Clear the pointer stored in wrapper. if (GetAllWebContents().Lookup(id_)) GetAllWebContents().Remove(id_); v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); @@ -1848,52 +1845,9 @@ void WebContents::MarkDestroyed() { if (!GetWrapper(isolate).ToLocal(&wrapper)) return; wrapper->SetAlignedPointerInInternalField(0, nullptr); -} -// There are three ways of destroying a webContents: -// 1. call webContents.destroy(); -// 2. garbage collection; -// 3. user closes the window of webContents; -// 4. the embedder detaches the frame. -// For webview only #4 will happen, for BrowserWindow both #1 and #3 may -// happen. The #2 should never happen for webContents, because webview is -// managed by GuestViewManager, and BrowserWindow's webContents is managed -// by api::BrowserWindow. -// For #1, the destructor will do the cleanup work and we only need to make -// sure "destroyed" event is emitted. For #3, the content::WebContents will -// be destroyed on close, and WebContentsDestroyed would be called for it, so -// we need to make sure the api::WebContents is also deleted. -// For #4, the WebContents will be destroyed by embedder. -void WebContents::WebContentsDestroyed() { - // Give chance for guest delegate to cleanup its observers - // since the native class is only destroyed in the next tick. - if (guest_delegate_) - guest_delegate_->WillDestroy(); - - // Cleanup relationships with other parts. - - // We can not call Destroy here because we need to call Emit first, but we - // also do not want any method to be used, so just mark as destroyed here. - MarkDestroyed(); - - Observe(nullptr); // this->web_contents() will return nullptr + Observe(nullptr); Emit("destroyed"); - - // For guest view based on OOPIF, the WebContents is released by the embedder - // frame, and we need to clear the reference to the memory. - if (IsGuest() && inspectable_web_contents_) { - inspectable_web_contents_->ReleaseWebContents(); - ResetManagedWebContents(false); - } - - // Destroy the native class in next tick. - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::BindOnce( - [](base::WeakPtr wc) { - if (wc) - delete wc.get(); - }, - GetWeakPtr())); } void WebContents::NavigationEntryCommitted( @@ -2820,6 +2774,18 @@ v8::Local WebContents::CapturePage(gin::Arguments* args) { return handle; } +#if !defined(OS_MAC) + // If the view's renderer is suspended this may fail on Windows/Linux - + // bail if so. See CopyFromSurface in + // content/public/browser/render_widget_host_view.h. + auto* rfh = web_contents()->GetMainFrame(); + if (rfh && + rfh->GetVisibilityState() == blink::mojom::PageVisibilityState::kHidden) { + promise.Resolve(gfx::Image()); + return handle; + } +#endif // defined(OS_MAC) + // Capture full page if user doesn't specify a |rect|. const gfx::Size view_size = rect.IsEmpty() ? view->GetViewBounds().size() : rect.size(); @@ -2886,6 +2852,7 @@ bool WebContents::IsGuest() const { void WebContents::AttachToIframe(content::WebContents* embedder_web_contents, int embedder_frame_id) { + attached_ = true; if (guest_delegate_) guest_delegate_->AttachToIframe(embedder_web_contents, embedder_frame_id); } @@ -3538,17 +3505,11 @@ v8::Local WebContents::FillObjectTemplate( gin::CreateFunctionTemplate( isolate, base::BindRepeating(&gin_helper::Destroyable::IsDestroyed), options)); - templ->Set( - gin::StringToSymbol(isolate, "destroy"), - gin::CreateFunctionTemplate( - isolate, base::BindRepeating([](gin::Handle handle) { - delete handle.get(); - }), - options)); // We use gin_helper::ObjectTemplateBuilder instead of // gin::ObjectTemplateBuilder here to handle the fact that WebContents is // destroyable. return gin_helper::ObjectTemplateBuilder(isolate, templ) + .SetMethod("destroy", &WebContents::Destroy) .SetMethod("getBackgroundThrottling", &WebContents::GetBackgroundThrottling) .SetMethod("setBackgroundThrottling", diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index acf560fb78ff..2c3dacc63dab 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -144,23 +144,9 @@ class WebContents : public gin::Wrappable, v8::Local); const char* GetTypeName() override; + void Destroy(); base::WeakPtr GetWeakPtr() { return weak_factory_.GetWeakPtr(); } - // Destroy the managed content::WebContents instance. - // - // Note: The |async| should only be |true| when users are expecting to use the - // webContents immediately after the call. Always pass |false| if you are not - // sure. - // See https://github.com/electron/electron/issues/8930. - // - // Note: When destroying a webContents member inside a destructor, the |async| - // should always be |false|, otherwise the destroy task might be delayed after - // normal shutdown procedure, resulting in an assertion. - // The normal pattern for calling this method in destructor is: - // api_web_contents_->DestroyWebContents(!Browser::Get()->is_shutting_down()) - // See https://github.com/electron/electron/issues/15133. - void DestroyWebContents(bool async); - bool GetBackgroundThrottling() const; void SetBackgroundThrottling(bool allowed); int GetProcessID() const; @@ -210,6 +196,7 @@ class WebContents : public gin::Wrappable, void IncrementCapturerCount(gin::Arguments* args); void DecrementCapturerCount(gin::Arguments* args); bool IsBeingCaptured(); + void HandleNewRenderFrame(content::RenderFrameHost* render_frame_host); #if BUILDFLAG(ENABLE_PRINTING) void OnGetDefaultPrinter(base::Value print_settings, @@ -362,8 +349,6 @@ class WebContents : public gin::Wrappable, return EmitCustomEvent(name, event, std::forward(args)...); } - void MarkDestroyed(); - WebContents* embedder() { return embedder_; } #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) @@ -672,9 +657,6 @@ class WebContents : public gin::Wrappable, std::string* class_name) override; #endif - // Destroy the managed InspectableWebContents object. - void ResetManagedWebContents(bool async); - // DevTools index event callbacks. void OnDevToolsIndexingWorkCalculated(int request_id, const std::string& file_system_path, @@ -706,6 +688,9 @@ class WebContents : public gin::Wrappable, // The host webcontents that may contain this webcontents. WebContents* embedder_ = nullptr; + // Whether the guest view has been attached. + bool attached_ = false; + // The zoom controller for this webContents. WebContentsZoomController* zoom_controller_ = nullptr; diff --git a/shell/browser/api/electron_api_web_contents_view.cc b/shell/browser/api/electron_api_web_contents_view.cc index 48e32af4d0e9..cb89c927422e 100644 --- a/shell/browser/api/electron_api_web_contents_view.cc +++ b/shell/browser/api/electron_api_web_contents_view.cc @@ -44,18 +44,8 @@ WebContentsView::WebContentsView(v8::Isolate* isolate, } WebContentsView::~WebContentsView() { - if (api_web_contents_) { // destroy() is called - // Destroy WebContents asynchronously, as we might be in GC currently and - // WebContents emits an event in its destructor. - base::PostTask(FROM_HERE, {content::BrowserThread::UI}, - base::BindOnce( - [](base::WeakPtr contents) { - if (contents) - contents->DestroyWebContents( - !Browser::Get()->is_shutting_down()); - }, - api_web_contents_->GetWeakPtr())); - } + if (api_web_contents_) // destroy() called without closing WebContents + api_web_contents_->Destroy(); } gin::Handle WebContentsView::GetWebContents(v8::Isolate* isolate) { diff --git a/shell/browser/badging/badge_manager.cc b/shell/browser/badging/badge_manager.cc index 4cbd5595b01d..d99be915ca9e 100755 --- a/shell/browser/badging/badge_manager.cc +++ b/shell/browser/badging/badge_manager.cc @@ -47,6 +47,27 @@ void BadgeManager::BindFrameReceiver( std::move(context)); } +void BadgeManager::BindServiceWorkerReceiver( + content::RenderProcessHost* service_worker_process_host, + const GURL& service_worker_scope, + mojo::PendingReceiver receiver) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + auto* browser_context = service_worker_process_host->GetBrowserContext(); + + auto* badge_manager = + badging::BadgeManagerFactory::GetInstance()->GetForBrowserContext( + browser_context); + if (!badge_manager) + return; + + auto context = std::make_unique( + service_worker_process_host->GetID(), service_worker_scope); + + badge_manager->receivers_.Add(badge_manager, std::move(receiver), + std::move(context)); +} + std::string BadgeManager::GetBadgeString(base::Optional badge_content) { if (!badge_content) return "•"; diff --git a/shell/browser/badging/badge_manager.h b/shell/browser/badging/badge_manager.h index a4cb546b986f..5df9679b5d14 100644 --- a/shell/browser/badging/badge_manager.h +++ b/shell/browser/badging/badge_manager.h @@ -37,6 +37,10 @@ class BadgeManager : public KeyedService, public blink::mojom::BadgeService { static void BindFrameReceiver( content::RenderFrameHost* frame, mojo::PendingReceiver receiver); + static void BindServiceWorkerReceiver( + content::RenderProcessHost* service_worker_process_host, + const GURL& service_worker_scope, + mojo::PendingReceiver receiver); // Determines the text to put on the badge based on some badge_content. static std::string GetBadgeString(base::Optional badge_content); @@ -66,6 +70,21 @@ class BadgeManager : public KeyedService, public blink::mojom::BadgeService { int frame_id_; }; + // The BindingContext for ServiceWorkerGlobalScope execution contexts. + class ServiceWorkerBindingContext final : public BindingContext { + public: + ServiceWorkerBindingContext(int process_id, const GURL& scope) + : process_id_(process_id), scope_(scope) {} + ~ServiceWorkerBindingContext() override = default; + + int GetProcessId() { return process_id_; } + GURL GetScope() { return scope_; } + + private: + int process_id_; + GURL scope_; + }; + // blink::mojom::BadgeService: // Note: These are private to stop them being called outside of mojo as they // require a mojo binding context. diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 2aa0087658ec..c87941672fa1 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -1785,4 +1785,12 @@ content::BluetoothDelegate* ElectronBrowserClient::GetBluetoothDelegate() { return bluetooth_delegate_.get(); } +void ElectronBrowserClient::BindBadgeServiceReceiverFromServiceWorker( + content::RenderProcessHost* service_worker_process_host, + const GURL& service_worker_scope, + mojo::PendingReceiver receiver) { + badging::BadgeManager::BindServiceWorkerReceiver( + service_worker_process_host, service_worker_scope, std::move(receiver)); +} + } // namespace electron diff --git a/shell/browser/electron_browser_client.h b/shell/browser/electron_browser_client.h index 3a73958b01db..68df0626de3e 100644 --- a/shell/browser/electron_browser_client.h +++ b/shell/browser/electron_browser_client.h @@ -73,6 +73,10 @@ class ElectronBrowserClient : public content::ContentBrowserClient, void RegisterBrowserInterfaceBindersForFrame( content::RenderFrameHost* render_frame_host, mojo::BinderMapWithContext* map) override; + void BindBadgeServiceReceiverFromServiceWorker( + content::RenderProcessHost* service_worker_process_host, + const GURL& service_worker_scope, + mojo::PendingReceiver receiver) override; #if defined(OS_LINUX) void GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index ea13ec7978a6..21fff3e72474 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -996,8 +996,10 @@ void NativeWindowMac::SetBackgroundColor(SkColor color) { } SkColor NativeWindowMac::GetBackgroundColor() { - return skia::CGColorRefToSkColor( - [[[window_ contentView] layer] backgroundColor]); + CGColorRef color = [[[window_ contentView] layer] backgroundColor]; + if (!color) + return SK_ColorTRANSPARENT; + return skia::CGColorRefToSkColor(color); } void NativeWindowMac::SetHasShadow(bool has_shadow) { diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 646a0368ed52..480445142b31 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -956,7 +956,10 @@ bool NativeWindowViews::IsTabletMode() const { } SkColor NativeWindowViews::GetBackgroundColor() { - return root_view_->background()->get_color(); + auto* background = root_view_->background(); + if (!background) + return SK_ColorTRANSPARENT; + return background->get_color(); } void NativeWindowViews::SetBackgroundColor(SkColor background_color) { diff --git a/shell/browser/resources/win/electron.rc b/shell/browser/resources/win/electron.rc index 643696f3c7bc..edc04e307ff5 100644 --- a/shell/browser/resources/win/electron.rc +++ b/shell/browser/resources/win/electron.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 14,0,0,20210304 - PRODUCTVERSION 14,0,0,20210304 + FILEVERSION 14,0,0,20210315 + PRODUCTVERSION 14,0,0,20210315 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L diff --git a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h index ba247812bb8b..e82d2e3df8c3 100644 --- a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h +++ b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h @@ -34,13 +34,13 @@ using electron::InspectableWebContentsViewMac; BOOL devtools_visible_; BOOL devtools_docked_; BOOL devtools_is_first_responder_; + BOOL attached_to_window_; DevToolsContentsResizingStrategy strategy_; } - (instancetype)initWithInspectableWebContentsViewMac: (InspectableWebContentsViewMac*)view; -- (void)removeObservers; - (void)notifyDevToolsFocused; - (void)setDevToolsVisible:(BOOL)visible activate:(BOOL)activate; - (BOOL)isDevToolsVisible; diff --git a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm index cdd10716c0ee..1d69831c23fa 100644 --- a/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm +++ b/shell/browser/ui/cocoa/electron_inspectable_web_contents_view.mm @@ -35,18 +35,7 @@ devtools_visible_ = NO; devtools_docked_ = NO; devtools_is_first_responder_ = NO; - - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(viewDidBecomeFirstResponder:) - name:kViewDidBecomeFirstResponder - object:nil]; - - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(parentWindowBecameMain:) - name:NSWindowDidBecomeMainNotification - object:nil]; + attached_to_window_ = NO; if (inspectableWebContentsView_->inspectable_web_contents()->IsGuest()) { fake_view_.reset([[NSView alloc] init]); @@ -69,14 +58,34 @@ return self; } -- (void)removeObservers { +- (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; + [super dealloc]; } - (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize { [self adjustSubviews]; } +- (void)viewDidMoveToWindow { + if (attached_to_window_ && !self.window) { + attached_to_window_ = NO; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + } else if (!attached_to_window_ && self.window) { + attached_to_window_ = YES; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(viewDidBecomeFirstResponder:) + name:kViewDidBecomeFirstResponder + object:nil]; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(parentWindowBecameMain:) + name:NSWindowDidBecomeMainNotification + object:nil]; + } +} + - (IBAction)showDevTools:(id)sender { inspectableWebContentsView_->inspectable_web_contents()->ShowDevTools(true); } @@ -253,8 +262,7 @@ - (void)viewDidBecomeFirstResponder:(NSNotification*)notification { auto* inspectable_web_contents = inspectableWebContentsView_->inspectable_web_contents(); - if (!inspectable_web_contents || inspectable_web_contents->IsGuest()) - return; + DCHECK(inspectable_web_contents); auto* webContents = inspectable_web_contents->GetWebContents(); auto* webContentsView = webContents->GetNativeView().GetNativeNSView(); diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index 041de4ffe400..6d804138fa3b 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -371,13 +371,8 @@ InspectableWebContents::InspectableWebContents( InspectableWebContents::~InspectableWebContents() { g_web_contents_instances_.remove(this); // Unsubscribe from devtools and Clean up resources. - if (GetDevToolsWebContents()) { - if (managed_devtools_web_contents_) - managed_devtools_web_contents_->SetDelegate(nullptr); - // Calling this also unsubscribes the observer, so WebContentsDestroyed - // won't be called again. + if (GetDevToolsWebContents()) WebContentsDestroyed(); - } // Let destructor destroy managed_devtools_web_contents_. } @@ -416,6 +411,8 @@ bool InspectableWebContents::IsGuest() const { void InspectableWebContents::ReleaseWebContents() { web_contents_.release(); + WebContentsDestroyed(); + view_.reset(); } void InspectableWebContents::SetDockState(const std::string& state) { @@ -936,6 +933,9 @@ void InspectableWebContents::RenderFrameHostChanged( } void InspectableWebContents::WebContentsDestroyed() { + if (managed_devtools_web_contents_) + managed_devtools_web_contents_->SetDelegate(nullptr); + frontend_loaded_ = false; external_devtools_web_contents_ = nullptr; Observe(nullptr); diff --git a/shell/browser/ui/inspectable_web_contents_view_mac.mm b/shell/browser/ui/inspectable_web_contents_view_mac.mm index 9d3aaa0830e5..2523a933e5b2 100644 --- a/shell/browser/ui/inspectable_web_contents_view_mac.mm +++ b/shell/browser/ui/inspectable_web_contents_view_mac.mm @@ -26,7 +26,6 @@ InspectableWebContentsViewMac::InspectableWebContentsViewMac( initWithInspectableWebContentsViewMac:this]) {} InspectableWebContentsViewMac::~InspectableWebContentsViewMac() { - [view_ removeObservers]; CloseDevTools(); } diff --git a/shell/browser/web_contents_preferences.cc b/shell/browser/web_contents_preferences.cc index 32029ef99f19..8cab86df11f9 100644 --- a/shell/browser/web_contents_preferences.cc +++ b/shell/browser/web_contents_preferences.cc @@ -422,11 +422,6 @@ void WebContentsPreferences::OverrideWebkitPrefs( // Run Electron APIs and preload script in isolated world prefs->context_isolation = IsEnabled(options::kContextIsolation, true); -#if BUILDFLAG(ENABLE_REMOTE_MODULE) - // Whether to enable the remote module - prefs->enable_remote_module = IsEnabled(options::kEnableRemoteModule, false); -#endif - prefs->world_safe_execute_javascript = IsEnabled(options::kWorldSafeExecuteJavaScript, true); diff --git a/shell/common/api/BUILD.gn b/shell/common/api/BUILD.gn index a9faed10a3fc..f018422d560f 100644 --- a/shell/common/api/BUILD.gn +++ b/shell/common/api/BUILD.gn @@ -14,9 +14,4 @@ mojom("mojo") { # interfaces aready included in blink_common.dll overridden_deps = [ "//third_party/blink/public/mojom:mojom_core" ] component_deps = [ "//third_party/blink/public/common" ] - - enabled_features = [] - if (enable_remote_module) { - enabled_features += [ "enable_remote_module" ] - } } diff --git a/shell/common/api/electron_api_asar.cc b/shell/common/api/electron_api_asar.cc index b72c9304e02a..d449e29db791 100644 --- a/shell/common/api/electron_api_asar.cc +++ b/shell/common/api/electron_api_asar.cc @@ -4,7 +4,6 @@ #include -#include "base/numerics/safe_math.h" #include "gin/handle.h" #include "gin/object_template_builder.h" #include "gin/wrappable.h" @@ -13,9 +12,6 @@ #include "shell/common/gin_converters/callback_converter.h" #include "shell/common/gin_converters/file_path_converter.h" #include "shell/common/gin_helper/dictionary.h" -#include "shell/common/gin_helper/error_thrower.h" -#include "shell/common/gin_helper/function_template_extensions.h" -#include "shell/common/gin_helper/promise.h" #include "shell/common/node_includes.h" #include "shell/common/node_util.h" @@ -42,8 +38,7 @@ class Archive : public gin::Wrappable { .SetMethod("readdir", &Archive::Readdir) .SetMethod("realpath", &Archive::Realpath) .SetMethod("copyFileOut", &Archive::CopyFileOut) - .SetMethod("read", &Archive::Read) - .SetMethod("readSync", &Archive::ReadSync); + .SetMethod("getFd", &Archive::GetFD); } const char* GetTypeName() override { return "Archive"; } @@ -109,68 +104,15 @@ class Archive : public gin::Wrappable { return gin::ConvertToV8(isolate, new_path); } - v8::Local ReadSync(gin_helper::ErrorThrower thrower, - uint64_t offset, - uint64_t length) { - base::CheckedNumeric safe_offset(offset); - base::CheckedNumeric safe_end = safe_offset + length; - if (!safe_end.IsValid() || - safe_end.ValueOrDie() > archive_->file()->length()) { - thrower.ThrowError("Out of bounds read"); - return v8::Local(); - } - auto array_buffer = v8::ArrayBuffer::New(thrower.isolate(), length); - auto backing_store = array_buffer->GetBackingStore(); - memcpy(backing_store->Data(), archive_->file()->data() + offset, length); - return array_buffer; - } - - v8::Local Read(v8::Isolate* isolate, - uint64_t offset, - uint64_t length) { - gin_helper::Promise> promise(isolate); - v8::Local handle = promise.GetHandle(); - - base::CheckedNumeric safe_offset(offset); - base::CheckedNumeric safe_end = safe_offset + length; - if (!safe_end.IsValid() || - safe_end.ValueOrDie() > archive_->file()->length()) { - promise.RejectWithErrorMessage("Out of bounds read"); - return handle; - } - - auto backing_store = v8::ArrayBuffer::NewBackingStore(isolate, length); - base::ThreadPool::PostTaskAndReplyWithResult( - FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE}, - base::BindOnce(&Archive::ReadOnIO, isolate, archive_, - std::move(backing_store), offset, length), - base::BindOnce(&Archive::ResolveReadOnUI, std::move(promise))); - - return handle; + // Return the file descriptor. + int GetFD() const { + if (!archive_) + return -1; + return archive_->GetFD(); } private: - static std::unique_ptr ReadOnIO( - v8::Isolate* isolate, - std::shared_ptr archive, - std::unique_ptr backing_store, - uint64_t offset, - uint64_t length) { - memcpy(backing_store->Data(), archive->file()->data() + offset, length); - return backing_store; - } - - static void ResolveReadOnUI( - gin_helper::Promise> promise, - std::unique_ptr backing_store) { - v8::HandleScope scope(promise.isolate()); - v8::Context::Scope context_scope(promise.GetContext()); - auto array_buffer = - v8::ArrayBuffer::New(promise.isolate(), std::move(backing_store)); - promise.Resolve(array_buffer); - } - - std::shared_ptr archive_; + std::unique_ptr archive_; DISALLOW_COPY_AND_ASSIGN(Archive); }; diff --git a/shell/common/api/electron_api_v8_util.cc b/shell/common/api/electron_api_v8_util.cc index 1879d302a501..a0133ec52584 100644 --- a/shell/common/api/electron_api_v8_util.cc +++ b/shell/common/api/electron_api_v8_util.cc @@ -138,6 +138,10 @@ void TriggerFatalErrorForTesting(v8::Isolate* isolate) { v8::ExtensionConfiguration config(1, bDeps); v8::Context::New(isolate, &config); } + +void RunUntilIdle() { + base::RunLoop().RunUntilIdle(); +} #endif void Initialize(v8::Local exports, @@ -158,6 +162,7 @@ void Initialize(v8::Local exports, dict.SetMethod("getWeaklyTrackedValues", &GetWeaklyTrackedValues); dict.SetMethod("clearWeaklyTrackedValues", &ClearWeaklyTrackedValues); dict.SetMethod("weaklyTrackValue", &WeaklyTrackValue); + dict.SetMethod("runUntilIdle", &RunUntilIdle); #endif } diff --git a/shell/common/api/features.cc b/shell/common/api/features.cc index a53573f7c8f5..92208cfba036 100644 --- a/shell/common/api/features.cc +++ b/shell/common/api/features.cc @@ -22,10 +22,6 @@ bool IsOffscreenRenderingEnabled() { return BUILDFLAG(ENABLE_OSR); } -bool IsRemoteModuleEnabled() { - return BUILDFLAG(ENABLE_REMOTE_MODULE); -} - bool IsPDFViewerEnabled() { return BUILDFLAG(ENABLE_PDF_VIEWER); } @@ -78,7 +74,6 @@ void Initialize(v8::Local exports, dict.SetMethod("isBuiltinSpellCheckerEnabled", &IsBuiltinSpellCheckerEnabled); dict.SetMethod("isDesktopCapturerEnabled", &IsDesktopCapturerEnabled); dict.SetMethod("isOffscreenRenderingEnabled", &IsOffscreenRenderingEnabled); - dict.SetMethod("isRemoteModuleEnabled", &IsRemoteModuleEnabled); dict.SetMethod("isPDFViewerEnabled", &IsPDFViewerEnabled); dict.SetMethod("isRunAsNodeEnabled", &IsRunAsNodeEnabled); dict.SetMethod("isFakeLocationProviderEnabled", diff --git a/shell/common/asar/archive.cc b/shell/common/asar/archive.cc index 06ba2c7e2504..89c5a8d418c9 100644 --- a/shell/common/asar/archive.cc +++ b/shell/common/asar/archive.cc @@ -117,51 +117,78 @@ bool FillFileInfoWithNode(Archive::FileInfo* info, } // namespace -Archive::Archive(const base::FilePath& path) : path_(path) { +Archive::Archive(const base::FilePath& path) + : path_(path), file_(base::File::FILE_OK) { base::ThreadRestrictions::ScopedAllowIO allow_io; - if (base::PathExists(path_) && !file_.Initialize(path_)) { - LOG(ERROR) << "Failed to open ASAR archive at '" << path_.value() << "'"; - } + file_.Initialize(path_, base::File::FLAG_OPEN | base::File::FLAG_READ); +#if defined(OS_WIN) + fd_ = _open_osfhandle(reinterpret_cast(file_.GetPlatformFile()), 0); +#elif defined(OS_POSIX) + fd_ = file_.GetPlatformFile(); +#endif } -Archive::~Archive() {} +Archive::~Archive() { +#if defined(OS_WIN) + if (fd_ != -1) { + _close(fd_); + // Don't close the handle since we already closed the fd. + file_.TakePlatformFile(); + } +#endif + base::ThreadRestrictions::ScopedAllowIO allow_io; + file_.Close(); +} bool Archive::Init() { if (!file_.IsValid()) { + if (file_.error_details() != base::File::FILE_ERROR_NOT_FOUND) { + LOG(WARNING) << "Opening " << path_.value() << ": " + << base::File::ErrorToString(file_.error_details()); + } return false; } - if (file_.length() < 8) { - LOG(ERROR) << "Malformed ASAR file at '" << path_.value() - << "' (too short)"; + std::vector buf; + int len; + + buf.resize(8); + { + base::ThreadRestrictions::ScopedAllowIO allow_io; + len = file_.ReadAtCurrentPos(buf.data(), buf.size()); + } + if (len != static_cast(buf.size())) { + PLOG(ERROR) << "Failed to read header size from " << path_.value(); return false; } uint32_t size; - base::PickleIterator size_pickle( - base::Pickle(reinterpret_cast(file_.data()), 8)); - if (!size_pickle.ReadUInt32(&size)) { - LOG(ERROR) << "Failed to read header size at '" << path_.value() << "'"; + if (!base::PickleIterator(base::Pickle(buf.data(), buf.size())) + .ReadUInt32(&size)) { + LOG(ERROR) << "Failed to parse header size from " << path_.value(); return false; } - if (file_.length() - 8 < size) { - LOG(ERROR) << "Malformed ASAR file at '" << path_.value() - << "' (incorrect header)"; + buf.resize(size); + { + base::ThreadRestrictions::ScopedAllowIO allow_io; + len = file_.ReadAtCurrentPos(buf.data(), buf.size()); + } + if (len != static_cast(buf.size())) { + PLOG(ERROR) << "Failed to read header from " << path_.value(); return false; } - base::PickleIterator header_pickle( - base::Pickle(reinterpret_cast(file_.data() + 8), size)); std::string header; - if (!header_pickle.ReadString(&header)) { - LOG(ERROR) << "Failed to read header string at '" << path_.value() << "'"; + if (!base::PickleIterator(base::Pickle(buf.data(), buf.size())) + .ReadString(&header)) { + LOG(ERROR) << "Failed to parse header from " << path_.value(); return false; } base::Optional value = base::JSONReader::Read(header); if (!value || !value->is_dict()) { - LOG(ERROR) << "Header was not valid JSON at '" << path_.value() << "'"; + LOG(ERROR) << "Failed to parse header"; return false; } @@ -264,24 +291,11 @@ bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) { return true; } - base::CheckedNumeric safe_offset(info.offset); - auto safe_end = safe_offset + info.size; - if (!safe_end.IsValid() || safe_end.ValueOrDie() > file_.length()) - return false; - auto temp_file = std::make_unique(); base::FilePath::StringType ext = path.Extension(); - if (!temp_file->Init(ext)) + if (!temp_file->InitFromFile(&file_, ext, info.offset, info.size)) return false; - base::File dest(temp_file->path(), - base::File::FLAG_OPEN | base::File::FLAG_WRITE); - if (!dest.IsValid()) - return false; - - dest.WriteAtCurrentPos( - reinterpret_cast(file_.data() + info.offset), info.size); - #if defined(OS_POSIX) if (info.executable) { // chmod a+x temp_file; @@ -294,4 +308,8 @@ bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) { return true; } +int Archive::GetFD() const { + return fd_; +} + } // namespace asar diff --git a/shell/common/asar/archive.h b/shell/common/asar/archive.h index 86d84aa8e7f8..d97cb03cc781 100644 --- a/shell/common/asar/archive.h +++ b/shell/common/asar/archive.h @@ -11,7 +11,6 @@ #include "base/files/file.h" #include "base/files/file_path.h" -#include "base/files/memory_mapped_file.h" namespace base { class DictionaryValue; @@ -62,13 +61,16 @@ class Archive { // For unpacked file, this method will return its real path. bool CopyFileOut(const base::FilePath& path, base::FilePath* out); - base::MemoryMappedFile* file() { return &file_; } + // Returns the file's fd. + int GetFD() const; + base::FilePath path() const { return path_; } base::DictionaryValue* header() const { return header_.get(); } private: base::FilePath path_; - base::MemoryMappedFile file_; + base::File file_; + int fd_ = -1; uint32_t header_size_ = 0; std::unique_ptr header_; diff --git a/shell/common/asar/scoped_temporary_file.cc b/shell/common/asar/scoped_temporary_file.cc index e51b9dad3b87..b9bc500f04fb 100644 --- a/shell/common/asar/scoped_temporary_file.cc +++ b/shell/common/asar/scoped_temporary_file.cc @@ -48,4 +48,27 @@ bool ScopedTemporaryFile::Init(const base::FilePath::StringType& ext) { return true; } +bool ScopedTemporaryFile::InitFromFile(base::File* src, + const base::FilePath::StringType& ext, + uint64_t offset, + uint64_t size) { + if (!src->IsValid()) + return false; + + if (!Init(ext)) + return false; + + std::vector buf(size); + int len = src->Read(offset, buf.data(), buf.size()); + if (len != static_cast(size)) + return false; + + base::File dest(path_, base::File::FLAG_OPEN | base::File::FLAG_WRITE); + if (!dest.IsValid()) + return false; + + return dest.WriteAtCurrentPos(buf.data(), buf.size()) == + static_cast(size); +} + } // namespace asar diff --git a/shell/common/asar/scoped_temporary_file.h b/shell/common/asar/scoped_temporary_file.h index 15f65290a926..e42a244e1220 100644 --- a/shell/common/asar/scoped_temporary_file.h +++ b/shell/common/asar/scoped_temporary_file.h @@ -27,6 +27,12 @@ class ScopedTemporaryFile { // Init an empty temporary file with a certain extension. bool Init(const base::FilePath::StringType& ext); + // Init an temporary file and fill it with content of |path|. + bool InitFromFile(base::File* src, + const base::FilePath::StringType& ext, + uint64_t offset, + uint64_t size); + base::FilePath path() const { return path_; } private: diff --git a/shell/common/color_util.cc b/shell/common/color_util.cc index 69b5e3593818..9e15bc618f39 100644 --- a/shell/common/color_util.cc +++ b/shell/common/color_util.cc @@ -51,4 +51,14 @@ std::string ToRGBHex(SkColor color) { SkColorGetG(color), SkColorGetB(color)); } +std::string ToRGBAHex(SkColor color, bool include_hash) { + std::string color_str = base::StringPrintf( + "%02X%02X%02X%02X", SkColorGetR(color), SkColorGetG(color), + SkColorGetB(color), SkColorGetA(color)); + if (include_hash) { + return "#" + color_str; + } + return color_str; +} + } // namespace electron diff --git a/shell/common/color_util.h b/shell/common/color_util.h index 9329185a8142..9411e8ae352e 100644 --- a/shell/common/color_util.h +++ b/shell/common/color_util.h @@ -17,6 +17,8 @@ SkColor ParseHexColor(const std::string& color_string); // Convert color to RGB hex value like "#ABCDEF" std::string ToRGBHex(SkColor color); +std::string ToRGBAHex(SkColor color, bool include_hash = true); + } // namespace electron #endif // SHELL_COMMON_COLOR_UTIL_H_ diff --git a/shell/common/options_switches.cc b/shell/common/options_switches.cc index 61d746badbe4..fd8aa10844f1 100644 --- a/shell/common/options_switches.cc +++ b/shell/common/options_switches.cc @@ -193,10 +193,6 @@ const char kHiddenPage[] = "hiddenPage"; const char kSpellcheck[] = "spellcheck"; #endif -#if BUILDFLAG(ENABLE_REMOTE_MODULE) -const char kEnableRemoteModule[] = "enableRemoteModule"; -#endif - const char kEnableWebSQL[] = "enableWebSQL"; const char kEnablePreferredSizeMode[] = "enablePreferredSizeMode"; diff --git a/shell/common/options_switches.h b/shell/common/options_switches.h index 9b51f46d1753..4a46a1c781e8 100644 --- a/shell/common/options_switches.h +++ b/shell/common/options_switches.h @@ -99,10 +99,6 @@ extern const char kHiddenPage[]; extern const char kSpellcheck[]; #endif -#if BUILDFLAG(ENABLE_REMOTE_MODULE) -extern const char kEnableRemoteModule[]; -#endif - } // namespace options // Following are actually command line switches, should be moved to other files. diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index 460dbaa8fc49..af814a9916dc 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -427,10 +427,6 @@ v8::Local GetWebPreference(v8::Isolate* isolate, return gin::ConvertToV8(isolate, prefs.opener_id); } else if (pref_name == options::kContextIsolation) { return gin::ConvertToV8(isolate, prefs.context_isolation); -#if BUILDFLAG(ENABLE_REMOTE_MODULE) - } else if (pref_name == options::kEnableRemoteModule) { - return gin::ConvertToV8(isolate, prefs.enable_remote_module); -#endif } else if (pref_name == options::kWorldSafeExecuteJavaScript) { return gin::ConvertToV8(isolate, prefs.world_safe_execute_javascript); } else if (pref_name == options::kGuestInstanceID) { diff --git a/shell/renderer/renderer_client_base.cc b/shell/renderer/renderer_client_base.cc index 9189c3f878a9..e1fde902b1d6 100644 --- a/shell/renderer/renderer_client_base.cc +++ b/shell/renderer/renderer_client_base.cc @@ -253,22 +253,6 @@ void RendererClientBase::RenderFrameCreated( // DidCreateDocumentElement event. new ElectronApiServiceImpl(render_frame, this); - content::RenderView* render_view = render_frame->GetRenderView(); - if (render_frame->IsMainFrame() && render_view) { - blink::WebView* webview = render_view->GetWebView(); - if (webview) { - auto prefs = render_frame->GetBlinkPreferences(); - if (prefs.guest_instance_id) { // webview. - webview->SetBaseBackgroundColor(SK_ColorTRANSPARENT); - } else { // normal window. - std::string name = prefs.background_color; - SkColor color = - name.empty() ? SK_ColorTRANSPARENT : ParseHexColor(name); - webview->SetBaseBackgroundColor(color); - } - } - } - #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS) auto* dispatcher = extensions_renderer_client_->GetDispatcher(); // ExtensionFrameHelper destroys itself when the RenderFrame is destroyed. diff --git a/spec-main/api-app-spec.ts b/spec-main/api-app-spec.ts index c2f442778a53..cbbcee18956f 100644 --- a/spec-main/api-app-spec.ts +++ b/spec-main/api-app-spec.ts @@ -295,9 +295,9 @@ describe('app module', () => { const child = cp.spawn(process.execPath, [appPath]); child.stdout.on('data', (c) => console.log(c.toString())); child.stderr.on('data', (c) => console.log(c.toString())); - child.on('exit', (code) => { + child.on('exit', (code, signal) => { if (code !== 0) { - done(`Process exited with code ${code}`); + console.log(`Process exited with code "${code}" signal "${signal}"`); } }); }); @@ -466,101 +466,6 @@ describe('app module', () => { expect(webContents).to.equal(w.webContents); }); }); - - ifdescribe(features.isRemoteModuleEnabled())('remote module filtering', () => { - it('should emit remote-require event when remote.require() is invoked', async () => { - w = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true, - enableRemoteModule: true, - contextIsolation: false - } - }); - await w.loadURL('about:blank'); - - const promise = emittedOnce(app, 'remote-require'); - w.webContents.executeJavaScript('require(\'electron\').remote.require(\'test\')'); - - const [, webContents, moduleName] = await promise; - expect(webContents).to.equal(w.webContents); - expect(moduleName).to.equal('test'); - }); - - it('should emit remote-get-global event when remote.getGlobal() is invoked', async () => { - w = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true, - enableRemoteModule: true, - contextIsolation: false - } - }); - await w.loadURL('about:blank'); - - const promise = emittedOnce(app, 'remote-get-global'); - w.webContents.executeJavaScript('require(\'electron\').remote.getGlobal(\'test\')'); - - const [, webContents, globalName] = await promise; - expect(webContents).to.equal(w.webContents); - expect(globalName).to.equal('test'); - }); - - it('should emit remote-get-builtin event when remote.getBuiltin() is invoked', async () => { - w = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true, - enableRemoteModule: true, - contextIsolation: false - } - }); - await w.loadURL('about:blank'); - - const promise = emittedOnce(app, 'remote-get-builtin'); - w.webContents.executeJavaScript('require(\'electron\').remote.app'); - - const [, webContents, moduleName] = await promise; - expect(webContents).to.equal(w.webContents); - expect(moduleName).to.equal('app'); - }); - - it('should emit remote-get-current-window event when remote.getCurrentWindow() is invoked', async () => { - w = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true, - enableRemoteModule: true, - contextIsolation: false - } - }); - await w.loadURL('about:blank'); - - const promise = emittedOnce(app, 'remote-get-current-window'); - w.webContents.executeJavaScript('{ require(\'electron\').remote.getCurrentWindow() }'); - - const [, webContents] = await promise; - expect(webContents).to.equal(w.webContents); - }); - - it('should emit remote-get-current-web-contents event when remote.getCurrentWebContents() is invoked', async () => { - w = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true, - enableRemoteModule: true, - contextIsolation: false - } - }); - await w.loadURL('about:blank'); - - const promise = emittedOnce(app, 'remote-get-current-web-contents'); - w.webContents.executeJavaScript('{ require(\'electron\').remote.getCurrentWebContents() }'); - - const [, webContents] = await promise; - expect(webContents).to.equal(w.webContents); - }); - }); }); describe('app.badgeCount', () => { diff --git a/spec-main/api-browser-window-spec.ts b/spec-main/api-browser-window-spec.ts index dd02458ff676..bc673855bbfa 100644 --- a/spec-main/api-browser-window-spec.ts +++ b/spec-main/api-browser-window-spec.ts @@ -1338,6 +1338,22 @@ describe('BrowserWindow module', () => { expect(image.isEmpty()).to.equal(true); }); + it('resolves after the window is hidden', async () => { + const w = new BrowserWindow({ show: false }); + w.loadFile(path.join(fixtures, 'pages', 'a.html')); + await emittedOnce(w, 'ready-to-show'); + w.show(); + + const visibleImage = await w.capturePage(); + expect(visibleImage.isEmpty()).to.equal(false); + + w.hide(); + + const hiddenImage = await w.capturePage(); + const isEmpty = process.platform !== 'darwin'; + expect(hiddenImage.isEmpty()).to.equal(isEmpty); + }); + it('preserves transparency', async () => { const w = new BrowserWindow({ show: false, transparent: true }); w.loadFile(path.join(fixtures, 'pages', 'theme-color.html')); @@ -2015,21 +2031,6 @@ describe('BrowserWindow module', () => { const [, test] = await emittedOnce(ipcMain, 'answer'); expect(test).to.eql('preload'); }); - ifit(features.isRemoteModuleEnabled())('can successfully delete the Buffer global', async () => { - const preload = path.join(__dirname, 'fixtures', 'remote', 'delete-buffer.js'); - const w = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true, - enableRemoteModule: true, - contextIsolation: false, - preload - } - }); - w.loadFile(path.join(fixtures, 'api', 'preload.html')); - const [, test] = await emittedOnce(ipcMain, 'answer'); - expect(test).to.eql(Buffer.from('buffer')); - }); it('has synchronous access to all eventual window APIs', async () => { const preload = path.join(fixtures, 'module', 'access-blink-apis.js'); const w = new BrowserWindow({ @@ -2142,61 +2143,6 @@ describe('BrowserWindow module', () => { }); }); - ifdescribe(features.isRemoteModuleEnabled())('"enableRemoteModule" option', () => { - const generateSpecs = (description: string, sandbox: boolean) => { - describe(description, () => { - const preload = path.join(__dirname, 'fixtures', 'remote', 'preload-remote.js'); - - it('disables the remote module by default', async () => { - const w = new BrowserWindow({ - show: false, - webPreferences: { - preload, - sandbox - } - }); - const p = emittedOnce(ipcMain, 'remote'); - w.loadFile(path.join(fixtures, 'api', 'blank.html')); - const [, remote] = await p; - expect(remote).to.equal('undefined'); - }); - - it('disables the remote module when false', async () => { - const w = new BrowserWindow({ - show: false, - webPreferences: { - preload, - sandbox, - enableRemoteModule: false - } - }); - const p = emittedOnce(ipcMain, 'remote'); - w.loadFile(path.join(fixtures, 'api', 'blank.html')); - const [, remote] = await p; - expect(remote).to.equal('undefined'); - }); - - it('enables the remote module when true', async () => { - const w = new BrowserWindow({ - show: false, - webPreferences: { - preload, - sandbox, - enableRemoteModule: true - } - }); - const p = emittedOnce(ipcMain, 'remote'); - w.loadFile(path.join(fixtures, 'api', 'blank.html')); - const [, remote] = await p; - expect(remote).to.equal('object'); - }); - }); - }; - - generateSpecs('without sandbox', false); - generateSpecs('with sandbox', true); - }); - describe('"sandbox" option', () => { const preload = path.join(path.resolve(__dirname, 'fixtures'), 'module', 'preload-sandbox.js'); @@ -2512,85 +2458,6 @@ describe('BrowserWindow module', () => { w.loadFile(path.join(fixtures, 'pages', 'window-open.html')); }); - // see #9387 - ifit(features.isRemoteModuleEnabled())('properly manages remote object references after page reload', (done) => { - const w = new BrowserWindow({ - show: false, - webPreferences: { - preload, - sandbox: true, - enableRemoteModule: true, - contextIsolation: false - } - }); - w.loadFile(path.join(__dirname, 'fixtures', 'api', 'sandbox.html'), { search: 'reload-remote' }); - - ipcMain.on('get-remote-module-path', (event) => { - event.returnValue = path.join(fixtures, 'module', 'hello.js'); - }); - - let reload = false; - ipcMain.on('reloaded', (event) => { - event.returnValue = reload; - reload = !reload; - }); - - ipcMain.once('reload', (event) => { - event.sender.reload(); - }); - - ipcMain.once('answer', (event, arg) => { - ipcMain.removeAllListeners('reloaded'); - ipcMain.removeAllListeners('get-remote-module-path'); - try { - expect(arg).to.equal('hi'); - done(); - } catch (e) { - done(e); - } - }); - }); - - ifit(features.isRemoteModuleEnabled())('properly manages remote object references after page reload in child window', (done) => { - const w = new BrowserWindow({ - show: false, - webPreferences: { - preload, - sandbox: true, - enableRemoteModule: true, - contextIsolation: false - } - }); - w.webContents.setWindowOpenHandler(() => ({ action: 'allow', overrideBrowserWindowOptions: { webPreferences: { preload } } })); - - w.loadFile(path.join(__dirname, 'fixtures', 'api', 'sandbox.html'), { search: 'reload-remote-child' }); - - ipcMain.on('get-remote-module-path', (event) => { - event.returnValue = path.join(fixtures, 'module', 'hello-child.js'); - }); - - let reload = false; - ipcMain.on('reloaded', (event) => { - event.returnValue = reload; - reload = !reload; - }); - - ipcMain.once('reload', (event) => { - event.sender.reload(); - }); - - ipcMain.once('answer', (event, arg) => { - ipcMain.removeAllListeners('reloaded'); - ipcMain.removeAllListeners('get-remote-module-path'); - try { - expect(arg).to.equal('hi child window'); - done(); - } catch (e) { - done(e); - } - }); - }); - it('validates process APIs access in sandboxed renderer', async () => { const w = new BrowserWindow({ show: false, diff --git a/spec-main/api-callbacks-registry-spec.ts b/spec-main/api-callbacks-registry-spec.ts deleted file mode 100644 index 6753518d9cb0..000000000000 --- a/spec-main/api-callbacks-registry-spec.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { expect } from 'chai'; -import { CallbacksRegistry } from '../lib/renderer/remote/callbacks-registry'; -import { ifdescribe } from './spec-helpers'; - -const features = process._linkedBinding('electron_common_features'); - -ifdescribe(features.isRemoteModuleEnabled())('CallbacksRegistry module', () => { - let registry: CallbacksRegistry; - - beforeEach(() => { - registry = new CallbacksRegistry(); - }); - - it('adds a callback to the registry', () => { - const cb = () => [1, 2, 3, 4, 5]; - const key = registry.add(cb); - - expect(key).to.exist('key'); - }); - - it('returns a specified callback if it is in the registry', () => { - const cb = () => [1, 2, 3, 4, 5]; - const key = registry.add(cb); - expect(key).to.exist('key'); - const callback = registry.get(key!); - - expect(callback.toString()).equal(cb.toString()); - }); - - it('returns an empty function if the cb doesnt exist', () => { - const callback = registry.get(1); - - expect(callback).to.be.a('function'); - }); - - it('removes a callback to the registry', () => { - const cb = () => [1, 2, 3, 4, 5]; - const key = registry.add(cb); - expect(key).to.exist('key'); - - registry.remove(key!); - const afterCB = registry.get(key!); - - expect(afterCB).to.be.a('function'); - expect(afterCB.toString()).to.not.equal(cb.toString()); - }); -}); diff --git a/spec-main/api-remote-spec.ts b/spec-main/api-remote-spec.ts deleted file mode 100644 index e9934a73e5fb..000000000000 --- a/spec-main/api-remote-spec.ts +++ /dev/null @@ -1,1049 +0,0 @@ -import * as path from 'path'; -import { expect } from 'chai'; -import { closeAllWindows } from './window-helpers'; -import { ifdescribe } from './spec-helpers'; - -import { ipcMain, BrowserWindow } from 'electron/main'; -import { emittedOnce } from './events-helpers'; -import { NativeImage } from 'electron/common'; -import { serialize, deserialize } from '../lib/common/type-utils'; -import { protocol, nativeImage } from 'electron'; - -const features = process._linkedBinding('electron_common_features'); - -const expectPathsEqual = (path1: string, path2: string) => { - if (process.platform === 'win32') { - path1 = path1.toLowerCase(); - path2 = path2.toLowerCase(); - } - expect(path1).to.equal(path2); -}; - -function makeRemotely (windowGetter: () => BrowserWindow) { - async function remotely (script: Function, ...args: any[]) { - // executeJavaScript obfuscates the error if the script throws, so catch any - // errors manually. - const assembledScript = `(async function() { - try { - return { result: await Promise.resolve((${script})(...${JSON.stringify(args)})) } - } catch (e) { - return { error: e.message, stack: e.stack } - } - })()`; - const { result, error, stack } = await windowGetter().webContents.executeJavaScript(assembledScript); - if (error) { - const e = new Error(error); - e.stack = stack; - throw e; - } - return result; - } - remotely.it = (...vars: any[]) => (name: string, fn: Function) => { - it(name, async () => { - await remotely(fn, ...vars); - }); - }; - return remotely; -} - -function makeWindow () { - let w: BrowserWindow; - before(async () => { - w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, enableRemoteModule: true, contextIsolation: false } }); - await w.loadURL('about:blank'); - await w.webContents.executeJavaScript(`{ - const chai_1 = window.chai_1 = require('chai') - chai_1.use(require('chai-as-promised')) - chai_1.use(require('dirty-chai')) - null - }`); - }); - after(closeAllWindows); - return () => w; -} - -function makeEachWindow () { - let w: BrowserWindow; - beforeEach(async () => { - w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, enableRemoteModule: true, contextIsolation: false } }); - await w.loadURL('about:blank'); - await w.webContents.executeJavaScript(`{ - const chai_1 = window.chai_1 = require('chai') - chai_1.use(require('chai-as-promised')) - chai_1.use(require('dirty-chai')) - null - }`); - }); - afterEach(closeAllWindows); - return () => w; -} - -describe('typeUtils serialization/deserialization', () => { - it('serializes and deserializes an empty NativeImage', () => { - const image = nativeImage.createEmpty(); - const serializedImage = serialize(image); - const empty = deserialize(serializedImage); - - expect(empty.isEmpty()).to.be.true(); - expect(empty.getAspectRatio()).to.equal(1); - expect(empty.toDataURL()).to.equal('data:image/png;base64,'); - expect(empty.toDataURL({ scaleFactor: 2.0 })).to.equal('data:image/png;base64,'); - expect(empty.getSize()).to.deep.equal({ width: 0, height: 0 }); - expect(empty.getBitmap()).to.be.empty(); - expect(empty.getBitmap({ scaleFactor: 2.0 })).to.be.empty(); - expect(empty.toBitmap()).to.be.empty(); - expect(empty.toBitmap({ scaleFactor: 2.0 })).to.be.empty(); - expect(empty.toJPEG(100)).to.be.empty(); - expect(empty.toPNG()).to.be.empty(); - expect(empty.toPNG({ scaleFactor: 2.0 })).to.be.empty(); - }); - - it('serializes and deserializes a non-empty NativeImage', () => { - const dataURL = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAFklEQVQYlWP8//8/AwMDEwMDAwMDAwAkBgMBBMzldwAAAABJRU5ErkJggg=='; - const image = nativeImage.createFromDataURL(dataURL); - const serializedImage = serialize(image); - const nonEmpty = deserialize(serializedImage); - - expect(nonEmpty.isEmpty()).to.be.false(); - expect(nonEmpty.getAspectRatio()).to.equal(1); - expect(nonEmpty.toDataURL()).to.not.be.empty(); - expect(nonEmpty.toBitmap({ scaleFactor: 1.0 })).to.deep.equal(image.toBitmap({ scaleFactor: 1.0 })); - expect(nonEmpty.getSize()).to.deep.equal({ width: 2, height: 2 }); - expect(nonEmpty.getBitmap()).to.not.be.empty(); - expect(nonEmpty.toPNG()).to.not.be.empty(); - }); - - it('serializes and deserializes a non-empty NativeImage with multiple representations', () => { - const image = nativeImage.createEmpty(); - - const dataURL1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYlWNgAAIAAAUAAdafFs0AAAAASUVORK5CYII='; - image.addRepresentation({ scaleFactor: 1.0, dataURL: dataURL1 }); - - const dataURL2 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAFklEQVQYlWP8//8/AwMDEwMDAwMDAwAkBgMBBMzldwAAAABJRU5ErkJggg=='; - image.addRepresentation({ scaleFactor: 2.0, dataURL: dataURL2 }); - - const serializedImage = serialize(image); - const nonEmpty = deserialize(serializedImage); - - expect(nonEmpty.isEmpty()).to.be.false(); - expect(nonEmpty.getAspectRatio()).to.equal(1); - expect(nonEmpty.getSize()).to.deep.equal({ width: 1, height: 1 }); - expect(nonEmpty.getBitmap()).to.not.be.empty(); - expect(nonEmpty.getBitmap({ scaleFactor: 1.0 })).to.not.be.empty(); - expect(nonEmpty.getBitmap({ scaleFactor: 2.0 })).to.not.be.empty(); - expect(nonEmpty.toBitmap()).to.not.be.empty(); - expect(nonEmpty.toBitmap({ scaleFactor: 1.0 })).to.deep.equal(image.toBitmap({ scaleFactor: 1.0 })); - expect(nonEmpty.toBitmap({ scaleFactor: 2.0 })).to.deep.equal(image.toBitmap({ scaleFactor: 2.0 })); - expect(nonEmpty.toPNG()).to.not.be.empty(); - expect(nonEmpty.toPNG({ scaleFactor: 1.0 })).to.not.be.empty(); - expect(nonEmpty.toPNG({ scaleFactor: 2.0 })).to.not.be.empty(); - expect(nonEmpty.toDataURL()).to.not.be.empty(); - }); - - it('serializes and deserializes an Array', () => { - const array = [1, 2, 3, 4, 5]; - const serialized = serialize(array); - const deserialized = deserialize(serialized); - - expect(deserialized).to.deep.equal(array); - }); - - it('serializes and deserializes a Buffer', () => { - const buffer = Buffer.from('hello world!', 'utf-8'); - const serialized = serialize(buffer); - const deserialized = deserialize(serialized); - - expect(deserialized).to.deep.equal(buffer); - }); - - it('serializes and deserializes a Boolean', () => { - const bool = true; - const serialized = serialize(bool); - const deserialized = deserialize(serialized); - - expect(deserialized).to.equal(bool); - }); - - it('serializes and deserializes a Date', () => { - const date = new Date(); - const serialized = serialize(date); - const deserialized = deserialize(serialized); - - expect(deserialized).to.equal(date); - }); - - it('serializes and deserializes a Number', () => { - const number = 42; - const serialized = serialize(number); - const deserialized = deserialize(serialized); - - expect(deserialized).to.equal(number); - }); - - it('serializes and deserializes a Regexp', () => { - const regex = new RegExp('ab+c'); - const serialized = serialize(regex); - const deserialized = deserialize(serialized); - - expect(deserialized).to.equal(regex); - }); - - it('serializes and deserializes a String', () => { - const str = 'hello world'; - const serialized = serialize(str); - const deserialized = deserialize(serialized); - - expect(deserialized).to.equal(str); - }); - - it('serializes and deserializes an Error', () => { - const err = new Error('oh crap'); - const serialized = serialize(err); - const deserialized = deserialize(serialized); - - expect(deserialized).to.equal(err); - }); - - it('serializes and deserializes a simple Object', () => { - const obj = { hello: 'world', 'answer-to-everything': 42 }; - const serialized = serialize(obj); - const deserialized = deserialize(serialized); - - expect(deserialized).to.deep.equal(obj); - }); -}); - -ifdescribe(features.isRemoteModuleEnabled())('remote module', () => { - const fixtures = path.join(__dirname, 'fixtures', 'remote'); - - describe('', () => { - const w = makeWindow(); - const remotely = makeRemotely(w); - - describe('remote.getGlobal filtering', () => { - it('can return custom values', async () => { - w().webContents.once('remote-get-global', (event, name) => { - event.returnValue = name; - }); - expect(await remotely(() => require('electron').remote.getGlobal('test'))).to.equal('test'); - }); - - it('throws when no returnValue set', async () => { - w().webContents.once('remote-get-global', (event) => { - event.preventDefault(); - }); - await expect(remotely(() => require('electron').remote.getGlobal('test'))).to.eventually.be.rejected('Blocked remote.getGlobal(\'test\')'); - }); - }); - - describe('remote.getBuiltin filtering', () => { - it('can return custom values', async () => { - w().webContents.once('remote-get-builtin', (event, name) => { - event.returnValue = name; - }); - expect(await remotely(() => (require('electron').remote as any).getBuiltin('test'))).to.equal('test'); - }); - - it('throws when no returnValue set', async () => { - w().webContents.once('remote-get-builtin', (event) => { - event.preventDefault(); - }); - await expect(remotely(() => (require('electron').remote as any).getBuiltin('test'))).to.eventually.be.rejected('Blocked remote.getGlobal(\'test\')'); - }); - }); - - describe('remote.require filtering', () => { - it('can return custom values', async () => { - w().webContents.once('remote-require', (event, name) => { - event.returnValue = name; - }); - expect(await remotely(() => require('electron').remote.require('test'))).to.equal('test'); - }); - - it('throws when no returnValue set', async () => { - w().webContents.once('remote-require', (event) => { - event.preventDefault(); - }); - await expect(remotely(() => require('electron').remote.require('test'))).to.eventually.be.rejected('Blocked remote.require(\'test\')'); - }); - }); - - describe('remote.getCurrentWindow filtering', () => { - it('can return custom value', async () => { - w().webContents.once('remote-get-current-window', (e) => { - e.returnValue = 'some window'; - }); - expect(await remotely(() => require('electron').remote.getCurrentWindow())).to.equal('some window'); - }); - - it('throws when no returnValue set', async () => { - w().webContents.once('remote-get-current-window', (event) => { - event.preventDefault(); - }); - await expect(remotely(() => require('electron').remote.getCurrentWindow())).to.eventually.be.rejected('Blocked remote.getCurrentWindow()'); - }); - }); - - describe('remote.getCurrentWebContents filtering', () => { - it('can return custom value', async () => { - w().webContents.once('remote-get-current-web-contents', (event) => { - event.returnValue = 'some web contents'; - }); - expect(await remotely(() => require('electron').remote.getCurrentWebContents())).to.equal('some web contents'); - }); - - it('throws when no returnValue set', async () => { - w().webContents.once('remote-get-current-web-contents', (event) => { - event.preventDefault(); - }); - await expect(remotely(() => require('electron').remote.getCurrentWebContents())).to.eventually.be.rejected('Blocked remote.getCurrentWebContents()'); - }); - }); - }); - - describe('remote references', () => { - const w = makeEachWindow(); - it('render-view-deleted is sent when page is destroyed', (done) => { - w().webContents.once('render-view-deleted' as any, () => { - done(); - }); - w().destroy(); - }); - - // The ELECTRON_BROWSER_CONTEXT_RELEASE message relies on this to work. - it('message can be sent on exit when page is being navigated', async () => { - after(() => { ipcMain.removeAllListeners('SENT_ON_EXIT'); }); - w().webContents.once('did-finish-load', () => { - w().webContents.loadURL('about:blank'); - }); - w().loadFile(path.join(fixtures, 'send-on-exit.html')); - await emittedOnce(ipcMain, 'SENT_ON_EXIT'); - }); - }); - - describe('remote function in renderer', () => { - afterEach(() => { - ipcMain.removeAllListeners('done'); - }); - afterEach(closeAllWindows); - - it('works when created in preload script', async () => { - const preload = path.join(fixtures, 'preload-remote-function.js'); - const w = new BrowserWindow({ - show: false, - webPreferences: { - preload, - enableRemoteModule: true, - contextIsolation: false - } - }); - w.loadURL('about:blank'); - await emittedOnce(ipcMain, 'done'); - }); - }); - - describe('remote objects registry', () => { - it('does not dereference until the render view is deleted (regression)', async () => { - const w = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true, - enableRemoteModule: true, - contextIsolation: false - } - }); - - const message = emittedOnce(ipcMain, 'error-message'); - w.loadFile(path.join(fixtures, 'render-view-deleted.html')); - const [, msg] = await message; - expect(msg).to.match(/^Cannot call method 'getURL' on missing remote object/); - }); - }); - - describe('nativeImage serialization', () => { - const w = makeWindow(); - const remotely = makeRemotely(w); - - it('can serialize an empty nativeImage from renderer to main', async () => { - const getImageEmpty = (img: NativeImage) => img.isEmpty(); - - w().webContents.once('remote-get-global', (event) => { - event.returnValue = getImageEmpty; - }); - - await expect(remotely(() => { - const emptyImage = require('electron').nativeImage.createEmpty(); - return require('electron').remote.getGlobal('someFunction')(emptyImage); - })).to.eventually.be.true(); - }); - - it('can serialize an empty nativeImage from main to renderer', async () => { - w().webContents.once('remote-get-global', (event) => { - const emptyImage = require('electron').nativeImage.createEmpty(); - event.returnValue = emptyImage; - }); - - await expect(remotely(() => { - const image = require('electron').remote.getGlobal('someFunction'); - return image.isEmpty(); - })).to.eventually.be.true(); - }); - - it('can serialize a non-empty nativeImage from renderer to main', async () => { - const getImageSize = (img: NativeImage) => img.getSize(); - - w().webContents.once('remote-get-global', (event) => { - event.returnValue = getImageSize; - }); - - await expect(remotely(() => { - const { nativeImage } = require('electron'); - const nonEmptyImage = nativeImage.createFromDataURL('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAFklEQVQYlWP8//8/AwMDEwMDAwMDAwAkBgMBBMzldwAAAABJRU5ErkJggg=='); - return require('electron').remote.getGlobal('someFunction')(nonEmptyImage); - })).to.eventually.deep.equal({ width: 2, height: 2 }); - }); - - it('can serialize a non-empty nativeImage from main to renderer', async () => { - w().webContents.once('remote-get-global', (event) => { - const nonEmptyImage = nativeImage.createFromDataURL('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91JpzAAAAFklEQVQYlWP8//8/AwMDEwMDAwMDAwAkBgMBBMzldwAAAABJRU5ErkJggg=='); - event.returnValue = nonEmptyImage; - }); - - await expect(remotely(() => { - const image = require('electron').remote.getGlobal('someFunction'); - return image.getSize(); - })).to.eventually.deep.equal({ width: 2, height: 2 }); - }); - - it('can properly create a menu with an nativeImage icon in the renderer', async () => { - await expect(remotely(() => { - const { remote, nativeImage } = require('electron'); - remote.Menu.buildFromTemplate([ - { - label: 'hello', - icon: nativeImage.createEmpty() - } - ]); - })).to.be.fulfilled(); - }); - }); - - describe('remote listeners', () => { - afterEach(closeAllWindows); - - it('detaches listeners subscribed to destroyed renderers, and shows a warning', async () => { - const w = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true, - enableRemoteModule: true, - contextIsolation: false - } - }); - await w.loadFile(path.join(fixtures, 'remote-event-handler.html')); - w.webContents.reload(); - await emittedOnce(w.webContents, 'did-finish-load'); - - const expectedMessage = [ - 'Attempting to call a function in a renderer window that has been closed or released.', - 'Function provided here: remote-event-handler.html:11:33', - 'Remote event names: remote-handler, other-remote-handler' - ].join('\n'); - - expect(w.webContents.listenerCount('remote-handler')).to.equal(2); - let warnMessage: string | null = null; - const originalWarn = console.warn; - let warned: Function; - const warnPromise = new Promise(resolve => { - warned = resolve; - }); - try { - console.warn = (message: string) => { - warnMessage = message; - warned(); - }; - w.webContents.emit('remote-handler', { sender: w.webContents }); - await warnPromise; - } finally { - console.warn = originalWarn; - } - expect(w.webContents.listenerCount('remote-handler')).to.equal(1); - expect(warnMessage).to.equal(expectedMessage); - }); - }); - - describe('remote.require', () => { - const w = makeWindow(); - const remotely = makeRemotely(w); - - remotely.it()('should returns same object for the same module', () => { - const { remote } = require('electron'); - const a = remote.require('electron'); - const b = remote.require('electron'); - expect(a).to.equal(b); - }); - - remotely.it(path.join(fixtures, 'id.js'))('should work when object contains id property', (module: string) => { - const { id } = require('electron').remote.require(module); - expect(id).to.equal(1127); - }); - - remotely.it(path.join(fixtures, 'no-prototype.js'))('should work when object has no prototype', (module: string) => { - const a = require('electron').remote.require(module); - expect(a.foo.bar).to.equal('baz'); - expect(a.foo.baz).to.equal(false); - expect(a.bar).to.equal(1234); - expect(a.getConstructorName(Object.create(null))).to.equal(''); - expect(a.getConstructorName(new (class {})())).to.equal(''); - }); - - it('should search module from the user app', async () => { - expectPathsEqual( - path.normalize(await remotely(() => { - const { remote } = require('electron'); - return (remote as any).process.mainModule.filename; - })), - path.resolve(__dirname, 'index.js') - ); - expectPathsEqual( - path.normalize(await remotely(() => { - const { remote } = require('electron'); - return (remote as any).process.mainModule.paths[0]; - })), - path.resolve(__dirname, 'node_modules') - ); - }); - - remotely.it(fixtures)('should work with function properties', (fixtures: string) => { - const path = require('path'); - - { - const a = require('electron').remote.require(path.join(fixtures, 'export-function-with-properties.js')); - expect(typeof a).to.equal('function'); - expect(a.bar).to.equal('baz'); - } - - { - const a = require('electron').remote.require(path.join(fixtures, 'function-with-properties.js')); - expect(typeof a).to.equal('object'); - expect(a.foo()).to.equal('hello'); - expect(a.foo.bar).to.equal('baz'); - expect(a.foo.nested.prop).to.equal('yes'); - expect(a.foo.method1()).to.equal('world'); - expect(a.foo.method1.prop1()).to.equal(123); - } - - { - const a = require('electron').remote.require(path.join(fixtures, 'function-with-missing-properties.js')).setup(); - expect(a.bar()).to.equal(true); - expect(a.bar.baz).to.be.undefined(); - } - }); - - remotely.it(fixtures)('should work with static class members', (fixtures: string) => { - const path = require('path'); - const a = require('electron').remote.require(path.join(fixtures, 'remote-static.js')); - expect(typeof a.Foo).to.equal('function'); - expect(a.Foo.foo()).to.equal(3); - expect(a.Foo.bar).to.equal('baz'); - expect(new a.Foo().baz()).to.equal(123); - }); - - remotely.it(fixtures)('includes the length of functions specified as arguments', (fixtures: string) => { - const path = require('path'); - const a = require('electron').remote.require(path.join(fixtures, 'function-with-args.js')); - /* eslint-disable @typescript-eslint/no-unused-vars */ - expect(a((a: any, b: any, c: any) => {})).to.equal(3); - expect(a((a: any) => {})).to.equal(1); - expect(a((...args: any[]) => {})).to.equal(0); - /* eslint-enable @typescript-eslint/no-unused-vars */ - }); - - remotely.it(fixtures)('handles circular references in arrays and objects', (fixtures: string) => { - const path = require('path'); - const a = require('electron').remote.require(path.join(fixtures, 'circular.js')); - - let arrayA: any[] = ['foo']; - const arrayB = [arrayA, 'bar']; - arrayA.push(arrayB); - expect(a.returnArgs(arrayA, arrayB)).to.deep.equal([ - ['foo', [null, 'bar']], - [['foo', null], 'bar'] - ]); - - let objectA: any = { foo: 'bar' }; - const objectB = { baz: objectA }; - objectA.objectB = objectB; - expect(a.returnArgs(objectA, objectB)).to.deep.equal([ - { foo: 'bar', objectB: { baz: null } }, - { baz: { foo: 'bar', objectB: null } } - ]); - - arrayA = [1, 2, 3]; - expect(a.returnArgs({ foo: arrayA }, { bar: arrayA })).to.deep.equal([ - { foo: [1, 2, 3] }, - { bar: [1, 2, 3] } - ]); - - objectA = { foo: 'bar' }; - expect(a.returnArgs({ foo: objectA }, { bar: objectA })).to.deep.equal([ - { foo: { foo: 'bar' } }, - { bar: { foo: 'bar' } } - ]); - - arrayA = []; - arrayA.push(arrayA); - expect(a.returnArgs(arrayA)).to.deep.equal([ - [null] - ]); - - objectA = {}; - objectA.foo = objectA; - objectA.bar = 'baz'; - expect(a.returnArgs(objectA)).to.deep.equal([ - { foo: null, bar: 'baz' } - ]); - - objectA = {}; - objectA.foo = { bar: objectA }; - objectA.bar = 'baz'; - expect(a.returnArgs(objectA)).to.deep.equal([ - { foo: { bar: null }, bar: 'baz' } - ]); - }); - }); - - describe('remote.createFunctionWithReturnValue', () => { - const remotely = makeRemotely(makeWindow()); - - remotely.it(fixtures)('should be called in browser synchronously', async (fixtures: string) => { - const { remote } = require('electron'); - const path = require('path'); - const buf = Buffer.from('test'); - const call = remote.require(path.join(fixtures, 'call.js')); - const result = call.call((remote as any).createFunctionWithReturnValue(buf)); - expect(result).to.be.an.instanceOf(Uint8Array); - }); - }); - - describe('remote modules', () => { - const remotely = makeRemotely(makeWindow()); - - const mainModules = Object.keys(require('electron')); - remotely.it(mainModules)('includes browser process modules as properties', (mainModules: string[]) => { - const { remote } = require('electron'); - const remoteModules = mainModules.filter(name => (remote as any)[name]); - expect(remoteModules).to.be.deep.equal(mainModules); - }); - - remotely.it(fixtures)('returns toString() of original function via toString()', (fixtures: string) => { - const path = require('path'); - const { readText } = require('electron').remote.clipboard; - expect(readText.toString().startsWith('function')).to.be.true(); - - const { functionWithToStringProperty } = require('electron').remote.require(path.join(fixtures, 'to-string-non-function.js')); - expect(functionWithToStringProperty.toString).to.equal('hello'); - }); - - const protocolKeys = Object.getOwnPropertyNames(protocol); - remotely.it(protocolKeys)('remote.protocol returns all keys', (protocolKeys: [string]) => { - const protocol = require('electron').remote.protocol; - const remoteKeys = Object.getOwnPropertyNames(protocol); - expect(remoteKeys).to.deep.equal(protocolKeys); - for (const key of remoteKeys) { - expect(typeof (protocol as any)[key]).to.equal('function'); - } - }); - }); - - describe('remote object in renderer', () => { - const win = makeWindow(); - const remotely = makeRemotely(win); - - remotely.it(fixtures)('can change its properties', (fixtures: string) => { - const module = require('path').join(fixtures, 'property.js'); - const property = require('electron').remote.require(module); - expect(property.property).to.equal(1127); - property.property = null; - expect(property.property).to.equal(null); - property.property = undefined; - expect(property.property).to.equal(undefined); - property.property = 1007; - expect(property.property).to.equal(1007); - - expect(property.getFunctionProperty()).to.equal('foo-browser'); - property.func.property = 'bar'; - expect(property.getFunctionProperty()).to.equal('bar-browser'); - property.func.property = 'foo'; // revert back - - const property2 = require('electron').remote.require(module); - expect(property2.property).to.equal(1007); - - property.property = 1127; // revert back - }); - - remotely.it(fixtures)('rethrows errors getting/setting properties', (fixtures: string) => { - const foo = require('electron').remote.require(require('path').join(fixtures, 'error-properties.js')); - - expect(() => { - // eslint-disable-next-line - foo.bar - }).to.throw('getting error'); - - expect(() => { - foo.bar = 'test'; - }).to.throw('setting error'); - }); - - remotely.it(fixtures)('can set a remote property with a remote object', (fixtures: string) => { - const { remote } = require('electron'); - const foo = remote.require(require('path').join(fixtures, 'remote-object-set.js')); - foo.bar = remote.getCurrentWindow(); - }); - - remotely.it(fixtures)('can construct an object from its member', (fixtures: string) => { - const call = require('electron').remote.require(require('path').join(fixtures, 'call.js')); - const obj = new call.constructor(); - expect(obj.test).to.equal('test'); - }); - - remotely.it(fixtures)('can reassign and delete its member functions', (fixtures: string) => { - const remoteFunctions = require('electron').remote.require(require('path').join(fixtures, 'function.js')); - expect(remoteFunctions.aFunction()).to.equal(1127); - - remoteFunctions.aFunction = () => { return 1234; }; - expect(remoteFunctions.aFunction()).to.equal(1234); - - expect(delete remoteFunctions.aFunction).to.equal(true); - }); - - remotely.it('is referenced by its members', () => { - const stringify = require('electron').remote.getGlobal('JSON').stringify; - global.gc(); - stringify({}); - }); - - it('can handle objects without constructors', async () => { - win().webContents.once('remote-get-global', (event) => { - class Foo { bar () { return 'bar'; } } - Foo.prototype.constructor = undefined as any; - event.returnValue = new Foo(); - }); - expect(await remotely(() => require('electron').remote.getGlobal('test').bar())).to.equal('bar'); - }); - }); - - describe('remote value in browser', () => { - const remotely = makeRemotely(makeWindow()); - const print = path.join(fixtures, 'print_name.js'); - - remotely.it(print)('preserves NaN', (print: string) => { - const printName = require('electron').remote.require(print); - expect(printName.getNaN()).to.be.NaN(); - expect(printName.echo(NaN)).to.be.NaN(); - }); - - remotely.it(print)('preserves Infinity', (print: string) => { - const printName = require('electron').remote.require(print); - expect(printName.getInfinity()).to.equal(Infinity); - expect(printName.echo(Infinity)).to.equal(Infinity); - }); - - remotely.it(print)('keeps its constructor name for objects', (print: string) => { - const printName = require('electron').remote.require(print); - const buf = Buffer.from('test'); - expect(printName.print(buf)).to.equal('Buffer'); - }); - - remotely.it(print)('supports instanceof Boolean', (print: string) => { - const printName = require('electron').remote.require(print); - const obj = Boolean(true); - expect(printName.print(obj)).to.equal('Boolean'); - expect(printName.echo(obj)).to.deep.equal(obj); - }); - - remotely.it(print)('supports instanceof Number', (print: string) => { - const printName = require('electron').remote.require(print); - const obj = Number(42); - expect(printName.print(obj)).to.equal('Number'); - expect(printName.echo(obj)).to.deep.equal(obj); - }); - - remotely.it(print)('supports instanceof String', (print: string) => { - const printName = require('electron').remote.require(print); - const obj = String('Hello World!'); - expect(printName.print(obj)).to.equal('String'); - expect(printName.echo(obj)).to.deep.equal(obj); - }); - - remotely.it(print)('supports instanceof Date', (print: string) => { - const printName = require('electron').remote.require(print); - const now = new Date(); - expect(printName.print(now)).to.equal('Date'); - expect(printName.echo(now)).to.deep.equal(now); - }); - - remotely.it(print)('supports instanceof RegExp', (print: string) => { - const printName = require('electron').remote.require(print); - const regexp = RegExp('.*'); - expect(printName.print(regexp)).to.equal('RegExp'); - expect(printName.echo(regexp)).to.deep.equal(regexp); - }); - - remotely.it(print)('supports instanceof Buffer', (print: string) => { - const printName = require('electron').remote.require(print); - const buffer = Buffer.from('test'); - expect(buffer.equals(printName.echo(buffer))).to.be.true(); - - const objectWithBuffer = { a: 'foo', b: Buffer.from('bar') }; - expect(objectWithBuffer.b.equals(printName.echo(objectWithBuffer).b)).to.be.true(); - - const arrayWithBuffer = [1, 2, Buffer.from('baz')]; - expect((arrayWithBuffer[2] as Buffer).equals(printName.echo(arrayWithBuffer)[2])).to.be.true(); - }); - - remotely.it(print)('supports instanceof ArrayBuffer', (print: string) => { - const printName = require('electron').remote.require(print); - const buffer = new ArrayBuffer(8); - const view = new DataView(buffer); - - view.setFloat64(0, Math.PI); - expect(printName.echo(buffer)).to.deep.equal(buffer); - expect(printName.print(buffer)).to.equal('ArrayBuffer'); - }); - - const arrayTests: [string, number[]][] = [ - ['Int8Array', [1, 2, 3, 4]], - ['Uint8Array', [1, 2, 3, 4]], - ['Uint8ClampedArray', [1, 2, 3, 4]], - ['Int16Array', [0x1234, 0x2345, 0x3456, 0x4567]], - ['Uint16Array', [0x1234, 0x2345, 0x3456, 0x4567]], - ['Int32Array', [0x12345678, 0x23456789]], - ['Uint32Array', [0x12345678, 0x23456789]], - ['Float32Array', [0.5, 1.0, 1.5]], - ['Float64Array', [0.5, 1.0, 1.5]] - ]; - - arrayTests.forEach(([arrayType, values]) => { - remotely.it(print, arrayType, values)(`supports instanceof ${arrayType}`, (print: string, arrayType: string, values: number[]) => { - const printName = require('electron').remote.require(print); - expect([...printName.typedArray(arrayType, values)]).to.deep.equal(values); - - const int8values = new ((window as any)[arrayType])(values); - expect(printName.typedArray(arrayType, int8values)).to.deep.equal(int8values); - expect(printName.print(int8values)).to.equal(arrayType); - }); - }); - - describe('constructing a Uint8Array', () => { - remotely.it()('does not crash', () => { - const RUint8Array = require('electron').remote.getGlobal('Uint8Array'); - new RUint8Array() // eslint-disable-line - }); - }); - }); - - describe('remote promise', () => { - const remotely = makeRemotely(makeWindow()); - - remotely.it(fixtures)('can be used as promise in each side', async (fixtures: string) => { - const promise = require('electron').remote.require(require('path').join(fixtures, 'promise.js')); - const value = await promise.twicePromise(Promise.resolve(1234)); - expect(value).to.equal(2468); - }); - - remotely.it(fixtures)('handles rejections via catch(onRejected)', async (fixtures: string) => { - const promise = require('electron').remote.require(require('path').join(fixtures, 'rejected-promise.js')); - const error = await new Promise(resolve => { - promise.reject(Promise.resolve(1234)).catch(resolve); - }); - expect(error.message).to.equal('rejected'); - }); - - remotely.it(fixtures)('handles rejections via then(onFulfilled, onRejected)', async (fixtures: string) => { - const promise = require('electron').remote.require(require('path').join(fixtures, 'rejected-promise.js')); - const error = await new Promise(resolve => { - promise.reject(Promise.resolve(1234)).then(() => {}, resolve); - }); - expect(error.message).to.equal('rejected'); - }); - - it('does not emit unhandled rejection events in the main process', (done) => { - function onUnhandledRejection () { - done(new Error('Unexpected unhandledRejection event')); - } - process.once('unhandledRejection', onUnhandledRejection); - - remotely(async (fixtures: string) => { - const promise = require('electron').remote.require(require('path').join(fixtures, 'unhandled-rejection.js')); - return new Promise((resolve, reject) => { - promise.reject().then(() => { - reject(new Error('Promise was not rejected')); - }).catch((error: Error) => { - resolve(error); - }); - }); - }, fixtures).then(error => { - try { - expect(error.message).to.equal('rejected'); - done(); - } catch (e) { - done(e); - } finally { - process.off('unhandledRejection', onUnhandledRejection); - } - }); - }); - - it('emits unhandled rejection events in the renderer process', (done) => { - remotely((module: string) => new Promise((resolve, reject) => { - const promise = require('electron').remote.require(module); - - window.addEventListener('unhandledrejection', function handler (event) { - event.preventDefault(); - window.removeEventListener('unhandledrejection', handler); - resolve(event.reason.message); - }); - - promise.reject().then(() => { - reject(new Error('Promise was not rejected')); - }); - }), path.join(fixtures, 'unhandled-rejection.js')).then( - (message) => { - try { - expect(message).to.equal('rejected'); - done(); - } catch (e) { - done(e); - } - }, - done - ); - }); - - before(() => { - (global as any).returnAPromise = (value: any) => new Promise((resolve) => setTimeout(() => resolve(value), 100)); - }); - after(() => { - delete (global as any).returnAPromise; - }); - remotely.it()('using a promise based method resolves correctly when global Promise is overridden', async () => { - const { remote } = require('electron'); - const original = global.Promise; - try { - expect(await remote.getGlobal('returnAPromise')(123)).to.equal(123); - global.Promise = { resolve: () => ({}) } as any; - expect(await remote.getGlobal('returnAPromise')(456)).to.equal(456); - } finally { - global.Promise = original; - } - }); - }); - - describe('remote webContents', () => { - const remotely = makeRemotely(makeWindow()); - - it('can return same object with different getters', async () => { - const equal = await remotely(() => { - const { remote } = require('electron'); - const contents1 = remote.getCurrentWindow().webContents; - const contents2 = remote.getCurrentWebContents(); - return contents1 === contents2; - }); - expect(equal).to.be.true(); - }); - }); - - describe('remote class', () => { - const remotely = makeRemotely(makeWindow()); - - remotely.it(fixtures)('can get methods', (fixtures: string) => { - const { base } = require('electron').remote.require(require('path').join(fixtures, 'class.js')); - expect(base.method()).to.equal('method'); - }); - - remotely.it(fixtures)('can get properties', (fixtures: string) => { - const { base } = require('electron').remote.require(require('path').join(fixtures, 'class.js')); - expect(base.readonly).to.equal('readonly'); - }); - - remotely.it(fixtures)('can change properties', (fixtures: string) => { - const { base } = require('electron').remote.require(require('path').join(fixtures, 'class.js')); - expect(base.value).to.equal('old'); - base.value = 'new'; - expect(base.value).to.equal('new'); - base.value = 'old'; - }); - - remotely.it(fixtures)('has unenumerable methods', (fixtures: string) => { - const { base } = require('electron').remote.require(require('path').join(fixtures, 'class.js')); - expect(base).to.not.have.ownProperty('method'); - expect(Object.getPrototypeOf(base)).to.have.ownProperty('method'); - }); - - remotely.it(fixtures)('keeps prototype chain in derived class', (fixtures: string) => { - const { derived } = require('electron').remote.require(require('path').join(fixtures, 'class.js')); - expect(derived.method()).to.equal('method'); - expect(derived.readonly).to.equal('readonly'); - expect(derived).to.not.have.ownProperty('method'); - const proto = Object.getPrototypeOf(derived); - expect(proto).to.not.have.ownProperty('method'); - expect(Object.getPrototypeOf(proto)).to.have.ownProperty('method'); - }); - - remotely.it(fixtures)('is referenced by methods in prototype chain', (fixtures: string) => { - let { derived } = require('electron').remote.require(require('path').join(fixtures, 'class.js')); - const method = derived.method; - derived = null; - global.gc(); - expect(method()).to.equal('method'); - }); - }); - - describe('remote exception', () => { - const remotely = makeRemotely(makeWindow()); - - remotely.it(fixtures)('throws errors from the main process', (fixtures: string) => { - const throwFunction = require('electron').remote.require(require('path').join(fixtures, 'exception.js')); - expect(() => { - throwFunction(); - }).to.throw(/undefined/); - }); - - remotely.it(fixtures)('tracks error cause', (fixtures: string) => { - const throwFunction = require('electron').remote.require(require('path').join(fixtures, 'exception.js')); - try { - throwFunction(new Error('error from main')); - expect.fail(); - } catch (e) { - expect(e.message).to.match(/Could not call remote function/); - expect(e.cause.message).to.equal('error from main'); - } - }); - }); - - describe('gc behavior', () => { - const win = makeWindow(); - const remotely = makeRemotely(win); - it('is resilient to gc happening between request and response', async () => { - const obj = { x: 'y' }; - win().webContents.on('remote-get-global', (event) => { - event.returnValue = obj; - }); - await remotely(() => { - const { ipc } = process._linkedBinding('electron_renderer_ipc'); - const originalSendSync = ipc.sendSync.bind(ipc) as any; - ipc.sendSync = (...args: any[]): any => { - const ret = originalSendSync(...args); - (window as any).gc(); - return ret; - }; - - for (let i = 0; i < 100; i++) { - // eslint-disable-next-line - require('electron').remote.getGlobal('test').x; - } - }); - }); - }); -}); diff --git a/spec-main/chromium-spec.ts b/spec-main/chromium-spec.ts index 7d30afddb033..d75393206439 100644 --- a/spec-main/chromium-spec.ts +++ b/spec-main/chromium-spec.ts @@ -318,8 +318,14 @@ describe('command line switches', () => { let output = ''; appProcess.stdout.on('data', (data) => { output += data; }); + let stderr = ''; + appProcess.stderr.on('data', (data) => { stderr += data; }); + + const [code, signal] = await emittedOnce(appProcess, 'exit'); + if (code !== 0) { + throw new Error(`Process exited with code "${code}" signal "${signal}" output "${output}" stderr "${stderr}"`); + } - await emittedOnce(appProcess.stdout, 'end'); output = output.replace(/(\r\n|\n|\r)/gm, ''); expect(output).to.equal(result); }; @@ -332,8 +338,7 @@ describe('command line switches', () => { // The LC_ALL env should not be set to DOM locale string. expect(lcAll).to.not.equal(app.getLocale()); }); - // TODO(jeremy): figure out why this times out under ASan - ifit(process.platform === 'linux' && !process.env.IS_ASAN)('should not change LC_ALL', async () => testLocale('fr', lcAll, true)); + ifit(process.platform === 'linux')('should not change LC_ALL', async () => testLocale('fr', lcAll, true)); ifit(process.platform === 'linux')('should not change LC_ALL when setting invalid locale', async () => testLocale('asdfkl', lcAll, true)); ifit(process.platform === 'linux')('should not change LC_ALL when --lang is not set', async () => testLocale('', lcAll, true)); }); @@ -1578,12 +1583,6 @@ describe('navigator.clipboard', () => { ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.setAppBadge/clearAppBadge', () => { let w: BrowserWindow; - before(async () => { - w = new BrowserWindow({ - show: false - }); - await w.loadFile(path.join(fixturesPath, 'pages', 'blank.html')); - }); const expectedBadgeCount = 42; @@ -1603,30 +1602,96 @@ ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.se return badgeCount; } - after(() => { - app.badgeCount = 0; - closeAllWindows(); + describe('in the renderer', () => { + before(async () => { + w = new BrowserWindow({ + show: false + }); + await w.loadFile(path.join(fixturesPath, 'pages', 'blank.html')); + }); + + after(() => { + app.badgeCount = 0; + closeAllWindows(); + }); + + it('setAppBadge can set a numerical value', async () => { + const result = await fireAppBadgeAction('set', expectedBadgeCount); + expect(result).to.equal('success'); + expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount); + }); + + it('setAppBadge can set an empty(dot) value', async () => { + const result = await fireAppBadgeAction('set'); + expect(result).to.equal('success'); + expect(waitForBadgeCount(0)).to.eventually.equal(0); + }); + + it('clearAppBadge can clear a value', async () => { + let result = await fireAppBadgeAction('set', expectedBadgeCount); + expect(result).to.equal('success'); + expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount); + result = await fireAppBadgeAction('clear'); + expect(result).to.equal('success'); + expect(waitForBadgeCount(0)).to.eventually.equal(0); + }); }); - it('setAppBadge can set a numerical value', async () => { - const result = await fireAppBadgeAction('set', expectedBadgeCount); - expect(result).to.equal('success'); - expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount); - }); + describe('in a service worker', () => { + beforeEach(async () => { + w = new BrowserWindow({ + show: false, + webPreferences: { + nodeIntegration: true, + partition: 'sw-file-scheme-spec', + contextIsolation: false + } + }); + }); - it('setAppBadge can set an empty(dot) value', async () => { - const result = await fireAppBadgeAction('set'); - expect(result).to.equal('success'); - expect(waitForBadgeCount(0)).to.eventually.equal(0); - }); + afterEach(() => { + app.badgeCount = 0; + closeAllWindows(); + }); - it('clearAppBadge can clear a value', async () => { - let result = await fireAppBadgeAction('set', expectedBadgeCount); - expect(result).to.equal('success'); - expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount); - result = await fireAppBadgeAction('clear'); - expect(result).to.equal('success'); - expect(waitForBadgeCount(0)).to.eventually.equal(0); + it('setAppBadge can be called in a ServiceWorker', (done) => { + w.webContents.on('ipc-message', (event, channel, message) => { + if (channel === 'reload') { + w.webContents.reload(); + } else if (channel === 'error') { + done(message); + } else if (channel === 'response') { + expect(message).to.equal('SUCCESS setting app badge'); + expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount); + session.fromPartition('sw-file-scheme-spec').clearStorageData({ + storages: ['serviceworkers'] + }).then(() => done()); + } + }); + w.webContents.on('crashed', () => done(new Error('WebContents crashed.'))); + w.loadFile(path.join(fixturesPath, 'pages', 'service-worker', 'badge-index.html'), { search: '?setBadge' }); + }); + + it('clearAppBadge can be called in a ServiceWorker', (done) => { + w.webContents.on('ipc-message', (event, channel, message) => { + if (channel === 'reload') { + w.webContents.reload(); + } else if (channel === 'setAppBadge') { + expect(message).to.equal('SUCCESS setting app badge'); + expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount); + } else if (channel === 'error') { + done(message); + } else if (channel === 'response') { + expect(message).to.equal('SUCCESS clearing app badge'); + expect(waitForBadgeCount(expectedBadgeCount)).to.eventually.equal(expectedBadgeCount); + session.fromPartition('sw-file-scheme-spec').clearStorageData({ + storages: ['serviceworkers'] + }).then(() => done()); + } + }); + w.webContents.on('crashed', () => done(new Error('WebContents crashed.'))); + w.loadFile(path.join(fixturesPath, 'pages', 'service-worker', 'badge-index.html'), { search: '?clearBadge' }); + }); }); }); diff --git a/spec-main/extensions-spec.ts b/spec-main/extensions-spec.ts index fdd2bf8e20df..ade02bee72d0 100644 --- a/spec-main/extensions-spec.ts +++ b/spec-main/extensions-spec.ts @@ -6,7 +6,7 @@ import { AddressInfo } from 'net'; import * as path from 'path'; import * as fs from 'fs'; import * as WebSocket from 'ws'; -import { emittedOnce, emittedNTimes } from './events-helpers'; +import { emittedOnce, emittedNTimes, emittedUntil } from './events-helpers'; const uuid = require('uuid'); @@ -150,7 +150,9 @@ describe('chrome extensions', () => { const loadedPromise = emittedOnce(customSession, 'extension-loaded'); const extension = await customSession.loadExtension(path.join(fixtures, 'extensions', 'red-bg')); const [, loadedExtension] = await loadedPromise; - const [, readyExtension] = await emittedOnce(customSession, 'extension-ready'); + const [, readyExtension] = await emittedUntil(customSession, 'extension-ready', (event: Event, extension: Extension) => { + return extension.name !== 'Chromium PDF Viewer'; + }); expect(loadedExtension).to.deep.equal(extension); expect(readyExtension).to.deep.equal(extension); diff --git a/spec-main/fixtures/crash-cases/transparent-window-get-background-color/index.js b/spec-main/fixtures/crash-cases/transparent-window-get-background-color/index.js new file mode 100644 index 000000000000..5742ffa171e0 --- /dev/null +++ b/spec-main/fixtures/crash-cases/transparent-window-get-background-color/index.js @@ -0,0 +1,14 @@ +const { app, BrowserWindow } = require('electron'); + +function createWindow () { + // Create the browser window. + const mainWindow = new BrowserWindow({ + transparent: true + }); + mainWindow.getBackgroundColor(); +} + +app.on('ready', () => { + createWindow(); + setTimeout(() => app.quit()); +}); diff --git a/spec-main/fixtures/remote/call.js b/spec-main/fixtures/remote/call.js deleted file mode 100644 index 60315154e35e..000000000000 --- a/spec-main/fixtures/remote/call.js +++ /dev/null @@ -1,7 +0,0 @@ -exports.call = function (func) { - return func(); -}; - -exports.constructor = function () { - this.test = 'test'; -}; diff --git a/spec-main/fixtures/remote/circular.js b/spec-main/fixtures/remote/circular.js deleted file mode 100644 index e21b595bebb5..000000000000 --- a/spec-main/fixtures/remote/circular.js +++ /dev/null @@ -1,3 +0,0 @@ -exports.returnArgs = function (...args) { - return args; -}; diff --git a/spec-main/fixtures/remote/class.js b/spec-main/fixtures/remote/class.js deleted file mode 100644 index ca6a83685da5..000000000000 --- a/spec-main/fixtures/remote/class.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -let value = 'old'; - -class BaseClass { - method () { - return 'method'; - } - - get readonly () { - return 'readonly'; - } - - get value () { - return value; - } - - set value (val) { - value = val; - } -} - -class DerivedClass extends BaseClass { -} - -module.exports = { - base: new BaseClass(), - derived: new DerivedClass() -}; diff --git a/spec-main/fixtures/remote/delete-buffer.js b/spec-main/fixtures/remote/delete-buffer.js deleted file mode 100644 index abbacb741497..000000000000 --- a/spec-main/fixtures/remote/delete-buffer.js +++ /dev/null @@ -1,11 +0,0 @@ -const path = require('path'); -const { remote } = require('electron'); -const { Buffer } = window; - -delete window.Buffer; -delete global.Buffer; - -// Test that remote.js doesn't use Buffer global -remote.require(path.join(__dirname, 'print_name.js')).echo(Buffer.from('bar')); - -window.test = Buffer.from('buffer'); diff --git a/spec-main/fixtures/remote/error-properties.js b/spec-main/fixtures/remote/error-properties.js deleted file mode 100644 index ae7a30c0dcc0..000000000000 --- a/spec-main/fixtures/remote/error-properties.js +++ /dev/null @@ -1,11 +0,0 @@ -class Foo { - set bar (value) { - throw new Error('setting error'); - } - - get bar () { - throw new Error('getting error'); - } -} - -module.exports = new Foo(); diff --git a/spec-main/fixtures/remote/exception.js b/spec-main/fixtures/remote/exception.js deleted file mode 100644 index ca47ca0cf5f2..000000000000 --- a/spec-main/fixtures/remote/exception.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (error) { - throw error; -}; diff --git a/spec-main/fixtures/remote/export-function-with-properties.js b/spec-main/fixtures/remote/export-function-with-properties.js deleted file mode 100644 index a38142d20dfe..000000000000 --- a/spec-main/fixtures/remote/export-function-with-properties.js +++ /dev/null @@ -1,4 +0,0 @@ -function foo () {} -foo.bar = 'baz'; - -module.exports = foo; diff --git a/spec-main/fixtures/remote/function-with-args.js b/spec-main/fixtures/remote/function-with-args.js deleted file mode 100644 index b30317e975f0..000000000000 --- a/spec-main/fixtures/remote/function-with-args.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (cb) { - return cb.length; -}; diff --git a/spec-main/fixtures/remote/function-with-missing-properties.js b/spec-main/fixtures/remote/function-with-missing-properties.js deleted file mode 100644 index 3770eca4f5a8..000000000000 --- a/spec-main/fixtures/remote/function-with-missing-properties.js +++ /dev/null @@ -1,13 +0,0 @@ -exports.setup = function () { - const foo = {}; - - foo.bar = function () { - return delete foo.bar.baz && delete foo.bar; - }; - - foo.bar.baz = function () { - return 3; - }; - - return foo; -}; diff --git a/spec-main/fixtures/remote/function-with-properties.js b/spec-main/fixtures/remote/function-with-properties.js deleted file mode 100644 index d6d82d65b0be..000000000000 --- a/spec-main/fixtures/remote/function-with-properties.js +++ /dev/null @@ -1,17 +0,0 @@ -function foo () { - return 'hello'; -} -foo.bar = 'baz'; -foo.nested = { - prop: 'yes' -}; -foo.method1 = function () { - return 'world'; -}; -foo.method1.prop1 = function () { - return 123; -}; - -module.exports = { - foo: foo -}; diff --git a/spec-main/fixtures/remote/function.js b/spec-main/fixtures/remote/function.js deleted file mode 100644 index 485d990798bc..000000000000 --- a/spec-main/fixtures/remote/function.js +++ /dev/null @@ -1 +0,0 @@ -exports.aFunction = function () { return 1127; }; diff --git a/spec-main/fixtures/remote/id.js b/spec-main/fixtures/remote/id.js deleted file mode 100644 index 5bfae457fe0b..000000000000 --- a/spec-main/fixtures/remote/id.js +++ /dev/null @@ -1 +0,0 @@ -exports.id = 1127; diff --git a/spec-main/fixtures/remote/no-prototype.js b/spec-main/fixtures/remote/no-prototype.js deleted file mode 100644 index 54eaeb847721..000000000000 --- a/spec-main/fixtures/remote/no-prototype.js +++ /dev/null @@ -1,11 +0,0 @@ -const foo = Object.create(null); -foo.bar = 'baz'; -foo.baz = false; -module.exports = { - foo: foo, - bar: 1234, - anonymous: new (class {})(), - getConstructorName: function (value) { - return value.constructor.name; - } -}; diff --git a/spec-main/fixtures/remote/preload-remote-function.js b/spec-main/fixtures/remote/preload-remote-function.js deleted file mode 100644 index f33eff6ef611..000000000000 --- a/spec-main/fixtures/remote/preload-remote-function.js +++ /dev/null @@ -1,5 +0,0 @@ -const { remote, ipcRenderer } = require('electron'); -remote.getCurrentWindow().rendererFunc = () => { - ipcRenderer.send('done'); -}; -remote.getCurrentWindow().rendererFunc(); diff --git a/spec-main/fixtures/remote/preload-remote.js b/spec-main/fixtures/remote/preload-remote.js deleted file mode 100644 index 035487be29ac..000000000000 --- a/spec-main/fixtures/remote/preload-remote.js +++ /dev/null @@ -1,5 +0,0 @@ -const { ipcRenderer, remote } = require('electron'); - -window.onload = function () { - ipcRenderer.send('remote', typeof remote); -}; diff --git a/spec-main/fixtures/remote/print_name.js b/spec-main/fixtures/remote/print_name.js deleted file mode 100644 index 047cab14d2d5..000000000000 --- a/spec-main/fixtures/remote/print_name.js +++ /dev/null @@ -1,36 +0,0 @@ -exports.print = function (obj) { - return obj.constructor.name; -}; - -exports.echo = function (obj) { - return obj; -}; - -const typedArrays = { - Int8Array, - Uint8Array, - Uint8ClampedArray, - Int16Array, - Uint16Array, - Int32Array, - Uint32Array, - Float32Array, - Float64Array -}; - -exports.typedArray = function (type, values) { - const constructor = typedArrays[type]; - const array = new constructor(values.length); - for (let i = 0; i < values.length; ++i) { - array[i] = values[i]; - } - return array; -}; - -exports.getNaN = function () { - return NaN; -}; - -exports.getInfinity = function () { - return Infinity; -}; diff --git a/spec-main/fixtures/remote/promise.js b/spec-main/fixtures/remote/promise.js deleted file mode 100644 index b9b568855e30..000000000000 --- a/spec-main/fixtures/remote/promise.js +++ /dev/null @@ -1,5 +0,0 @@ -exports.twicePromise = function (promise) { - return promise.then(function (value) { - return value * 2; - }); -}; diff --git a/spec-main/fixtures/remote/property.js b/spec-main/fixtures/remote/property.js deleted file mode 100644 index 6d15b3d3f89f..000000000000 --- a/spec-main/fixtures/remote/property.js +++ /dev/null @@ -1,11 +0,0 @@ -exports.property = 1127; - -function func () { - -} -func.property = 'foo'; -exports.func = func; - -exports.getFunctionProperty = () => { - return `${func.property}-${process.type}`; -}; diff --git a/spec-main/fixtures/remote/rejected-promise.js b/spec-main/fixtures/remote/rejected-promise.js deleted file mode 100644 index 74c939b2d86c..000000000000 --- a/spec-main/fixtures/remote/rejected-promise.js +++ /dev/null @@ -1,5 +0,0 @@ -exports.reject = function (promise) { - return promise.then(function () { - throw Error('rejected'); - }); -}; diff --git a/spec-main/fixtures/remote/remote-event-handler.html b/spec-main/fixtures/remote/remote-event-handler.html deleted file mode 100644 index 30c3cfb36ad7..000000000000 --- a/spec-main/fixtures/remote/remote-event-handler.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - diff --git a/spec-main/fixtures/remote/remote-object-set.js b/spec-main/fixtures/remote/remote-object-set.js deleted file mode 100644 index c0e29ac3994a..000000000000 --- a/spec-main/fixtures/remote/remote-object-set.js +++ /dev/null @@ -1,11 +0,0 @@ -const { BrowserWindow } = require('electron'); - -class Foo { - set bar (value) { // eslint-disable-line accessor-pairs - if (!(value instanceof BrowserWindow)) { - throw new Error('setting error'); - } - } -} - -module.exports = new Foo(); diff --git a/spec-main/fixtures/remote/remote-static.js b/spec-main/fixtures/remote/remote-static.js deleted file mode 100644 index 1e005ef5dded..000000000000 --- a/spec-main/fixtures/remote/remote-static.js +++ /dev/null @@ -1,15 +0,0 @@ -class Foo { - static foo () { - return 3; - } - - baz () { - return 123; - } -} - -Foo.bar = 'baz'; - -module.exports = { - Foo: Foo -}; diff --git a/spec-main/fixtures/remote/render-view-deleted.html b/spec-main/fixtures/remote/render-view-deleted.html deleted file mode 100644 index bfc281eb4298..000000000000 --- a/spec-main/fixtures/remote/render-view-deleted.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - diff --git a/spec-main/fixtures/remote/send-on-exit.html b/spec-main/fixtures/remote/send-on-exit.html deleted file mode 100644 index 8be9b4b06a77..000000000000 --- a/spec-main/fixtures/remote/send-on-exit.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - diff --git a/spec-main/fixtures/remote/to-string-non-function.js b/spec-main/fixtures/remote/to-string-non-function.js deleted file mode 100644 index 1c47cfe29035..000000000000 --- a/spec-main/fixtures/remote/to-string-non-function.js +++ /dev/null @@ -1,4 +0,0 @@ -function hello () { -} -hello.toString = 'hello'; -module.exports = { functionWithToStringProperty: hello }; diff --git a/spec-main/fixtures/remote/unhandled-rejection.js b/spec-main/fixtures/remote/unhandled-rejection.js deleted file mode 100644 index bd0a7b653827..000000000000 --- a/spec-main/fixtures/remote/unhandled-rejection.js +++ /dev/null @@ -1,3 +0,0 @@ -exports.reject = function () { - return Promise.reject(new Error('rejected')); -}; diff --git a/spec-main/index.js b/spec-main/index.js index febd107f6cd7..60c6d10602e0 100644 --- a/spec-main/index.js +++ b/spec-main/index.js @@ -131,6 +131,10 @@ app.whenReady().then(async () => { chai.use(require('chai-as-promised')); chai.use(require('dirty-chai')); + // Show full object diff + // https://github.com/chaijs/chai/issues/469 + chai.config.truncateThreshold = 0; + const runner = mocha.run(cb); }).catch((err) => { console.error('An error occurred while running the spec-main spec runner'); diff --git a/spec-main/security-warnings-spec.ts b/spec-main/security-warnings-spec.ts index b1081202052a..cf25d8530dc8 100644 --- a/spec-main/security-warnings-spec.ts +++ b/spec-main/security-warnings-spec.ts @@ -123,10 +123,7 @@ describe('security warnings', () => { it('should warn about insecure Content-Security-Policy', async () => { w = new BrowserWindow({ show: false, - webPreferences: { - enableRemoteModule: false, - ...webPreferences - } + webPreferences }); useCsp = false; @@ -138,10 +135,7 @@ describe('security warnings', () => { it('should warn about insecure Content-Security-Policy (Trusted Types)', async () => { w = new BrowserWindow({ show: false, - webPreferences: { - enableRemoteModule: false, - ...webPreferences - } + webPreferences }); useCsp = false; @@ -207,7 +201,7 @@ describe('security warnings', () => { it('should warn about insecure resources', async () => { w = new BrowserWindow({ show: false, - webPreferences: { ...webPreferences } + webPreferences }); w.loadURL(`${serverUrl}/insecure-resources.html`); @@ -225,27 +219,6 @@ describe('security warnings', () => { const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning); expect(message).to.not.include('insecure-resources.html'); }); - - it('should warn about enabled remote module with remote content', async () => { - w = new BrowserWindow({ - show: false, - webPreferences - }); - - w.loadURL(`${serverUrl}/base-page-security.html`); - const [,, message] = await emittedUntil(w.webContents, 'console-message', messageContainsSecurityWarning); - expect(message).to.include('enableRemoteModule'); - }); - - it('should not warn about enabled remote module with remote content from localhost', async () => { - w = new BrowserWindow({ - show: false, - webPreferences - }); - w.loadURL(`${serverUrl}/base-page-security-onload-message.html`); - const [,, message] = await emittedUntil(w.webContents, 'console-message', isLoaded); - expect(message).to.not.include('enableRemoteModule'); - }); }); }; diff --git a/spec-main/spellchecker-spec.ts b/spec-main/spellchecker-spec.ts index 7a46cb21a823..e4ef5ae81e12 100644 --- a/spec-main/spellchecker-spec.ts +++ b/spec-main/spellchecker-spec.ts @@ -7,10 +7,36 @@ import { emittedOnce } from './events-helpers'; import { ifit, ifdescribe, delay } from './spec-helpers'; const features = process._linkedBinding('electron_common_features'); +const v8Util = process._linkedBinding('electron_common_v8_util'); ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', () => { let w: BrowserWindow; + async function rightClick () { + const contextMenuPromise = emittedOnce(w.webContents, 'context-menu'); + w.webContents.sendInputEvent({ + type: 'mouseDown', + button: 'right', + x: 43, + y: 42 + }); + return (await contextMenuPromise)[1] as Electron.ContextMenuParams; + } + + // When the page is just loaded, the spellchecker might not be ready yet. Since + // there is no event to know the state of spellchecker, the only reliable way + // to detect spellchecker is to keep checking with a busy loop. + async function rightClickUntil (fn: (params: Electron.ContextMenuParams) => boolean) { + const now = Date.now(); + const timeout = 10 * 1000; + let contextMenuParams = await rightClick(); + while (!fn(contextMenuParams) && (Date.now() - now < timeout)) { + await delay(100); + contextMenuParams = await rightClick(); + } + return contextMenuParams; + } + beforeEach(async () => { w = new BrowserWindow({ show: false, @@ -28,25 +54,13 @@ ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', () => { await closeWindow(w); }); - // Context menu test can not run on Windows, and it is not reliable on ARM - // CI machines. - const shouldRun = process.platform !== 'win32' && - process.arch !== 'arm' && - process.arch !== 'arm64'; + // Context menu test can not run on Windows. + const shouldRun = process.platform !== 'win32'; ifit(shouldRun)('should detect correctly spelled words as correct', async () => { await w.webContents.executeJavaScript('document.body.querySelector("textarea").value = "Beautiful and lovely"'); await w.webContents.executeJavaScript('document.body.querySelector("textarea").focus()'); - const contextMenuPromise = emittedOnce(w.webContents, 'context-menu'); - // Wait for spellchecker to load - await delay(500); - w.webContents.sendInputEvent({ - type: 'mouseDown', - button: 'right', - x: 43, - y: 42 - }); - const contextMenuParams: Electron.ContextMenuParams = (await contextMenuPromise)[1]; + const contextMenuParams = await rightClickUntil((contextMenuParams) => contextMenuParams.selectionText.length > 0); expect(contextMenuParams.misspelledWord).to.eq(''); expect(contextMenuParams.dictionarySuggestions).to.have.lengthOf(0); }); @@ -54,16 +68,7 @@ ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', () => { ifit(shouldRun)('should detect incorrectly spelled words as incorrect', async () => { await w.webContents.executeJavaScript('document.body.querySelector("textarea").value = "Beautifulllll asd asd"'); await w.webContents.executeJavaScript('document.body.querySelector("textarea").focus()'); - const contextMenuPromise = emittedOnce(w.webContents, 'context-menu'); - // Wait for spellchecker to load - await delay(500); - w.webContents.sendInputEvent({ - type: 'mouseDown', - button: 'right', - x: 43, - y: 42 - }); - const contextMenuParams: Electron.ContextMenuParams = (await contextMenuPromise)[1]; + const contextMenuParams = await rightClickUntil((contextMenuParams) => contextMenuParams.misspelledWord.length > 0); expect(contextMenuParams.misspelledWord).to.eq('Beautifulllll'); expect(contextMenuParams.dictionarySuggestions).to.have.length.of.at.least(1); }); @@ -74,16 +79,7 @@ ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', () => { w.webContents.session.setSpellCheckerLanguages(['en-US']); await w.webContents.executeJavaScript('document.body.querySelector("textarea").value = "Beautifulllll asd asd"'); await w.webContents.executeJavaScript('document.body.querySelector("textarea").focus()'); - const contextMenuPromise = emittedOnce(w.webContents, 'context-menu'); - // Wait for spellchecker to load - await delay(500); - w.webContents.sendInputEvent({ - type: 'mouseDown', - button: 'right', - x: 43, - y: 42 - }); - const contextMenuParams: Electron.ContextMenuParams = (await contextMenuPromise)[1]; + const contextMenuParams = await rightClickUntil((contextMenuParams) => contextMenuParams.misspelledWord.length > 0); expect(contextMenuParams.misspelledWord).to.eq('Beautifulllll'); expect(contextMenuParams.dictionarySuggestions).to.have.length.of.at.least(1); }); @@ -91,8 +87,7 @@ ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', () => { ifit(shouldRun)('should expose webFrame spellchecker correctly', async () => { await w.webContents.executeJavaScript('document.body.querySelector("textarea").value = "Beautifulllll asd asd"'); await w.webContents.executeJavaScript('document.body.querySelector("textarea").focus()'); - // Wait for spellchecker to load - await delay(500); + await rightClickUntil((contextMenuParams) => contextMenuParams.misspelledWord.length > 0); const callWebFrameFn = (expr: string) => w.webContents.executeJavaScript('require("electron").webFrame.' + expr); @@ -110,16 +105,17 @@ ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', () => { ifit(shouldRun)('can be dynamically changed', async () => { await w.webContents.executeJavaScript('document.body.querySelector("textarea").value = "Beautifulllll asd asd"'); await w.webContents.executeJavaScript('document.body.querySelector("textarea").focus()'); - // Wait for spellchecker to load - await delay(500); + await rightClickUntil((contextMenuParams) => contextMenuParams.misspelledWord.length > 0); const callWebFrameFn = (expr: string) => w.webContents.executeJavaScript('require("electron").webFrame.' + expr); w.webContents.session.spellCheckerEnabled = false; + v8Util.runUntilIdle(); expect(w.webContents.session.spellCheckerEnabled).to.be.false(); expect(await callWebFrameFn('isWordMisspelled("testt")')).to.equal(false); w.webContents.session.spellCheckerEnabled = true; + v8Util.runUntilIdle(); expect(w.webContents.session.spellCheckerEnabled).to.be.true(); expect(await callWebFrameFn('isWordMisspelled("testt")')).to.equal(true); }); diff --git a/spec-main/webview-spec.ts b/spec-main/webview-spec.ts index b9b67e975b73..46b164a9dc58 100644 --- a/spec-main/webview-spec.ts +++ b/spec-main/webview-spec.ts @@ -3,11 +3,8 @@ import * as url from 'url'; import { BrowserWindow, session, ipcMain, app, WebContents } from 'electron/main'; import { closeAllWindows } from './window-helpers'; import { emittedOnce, emittedUntil } from './events-helpers'; -import { ifdescribe } from './spec-helpers'; import { expect } from 'chai'; -const features = process._linkedBinding('electron_common_features'); - async function loadWebView (w: WebContents, attributes: Record, openDevTools: boolean = false): Promise { await w.executeJavaScript(` new Promise((resolve, reject) => { @@ -654,52 +651,6 @@ describe(' tag', function () { }); }); - ifdescribe(features.isRemoteModuleEnabled())('enableremotemodule attribute', () => { - let w: BrowserWindow; - beforeEach(async () => { - w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true, webviewTag: true } }); - await w.loadURL('about:blank'); - }); - afterEach(closeAllWindows); - - const generateSpecs = (description: string, sandbox: boolean) => { - describe(description, () => { - const preload = `file://${fixtures}/module/preload-disable-remote.js`; - const src = `file://${fixtures}/api/blank.html`; - - it('enables the remote module by default', async () => { - loadWebView(w.webContents, { - preload, - src, - sandbox: sandbox.toString() - }); - const [, webViewContents] = await emittedOnce(app, 'web-contents-created'); - const [, , message] = await emittedUntil(webViewContents, 'console-message', (event: any, level: any, message: string) => !/deprecated/.test(message)); - - const typeOfRemote = JSON.parse(message); - expect(typeOfRemote).to.equal('object'); - }); - - it('disables the remote module when false', async () => { - loadWebView(w.webContents, { - preload, - src, - sandbox: sandbox.toString(), - enableremotemodule: 'false' - }); - const [, webViewContents] = await emittedOnce(app, 'web-contents-created'); - const [, , message] = await emittedOnce(webViewContents, 'console-message'); - - const typeOfRemote = JSON.parse(message); - expect(typeOfRemote).to.equal('undefined'); - }); - }); - }; - - generateSpecs('without sandbox', false); - generateSpecs('with sandbox', true); - }); - describe('DOM events', () => { afterEach(closeAllWindows); it('receives extra properties on DOM events when contextIsolation is enabled', async () => { diff --git a/spec/fixtures/api/relaunch/main.js b/spec/fixtures/api/relaunch/main.js index 48da277383c3..272c41f4421a 100644 --- a/spec/fixtures/api/relaunch/main.js +++ b/spec/fixtures/api/relaunch/main.js @@ -14,10 +14,9 @@ app.whenReady().then(() => { client.end(String(lastArg === '--second')); }); client.once('end', () => { + if (lastArg !== '--second') { + app.relaunch({ args: process.argv.slice(1).concat('--second') }); + } app.exit(0); }); - - if (lastArg !== '--second') { - app.relaunch({ args: process.argv.slice(1).concat('--second') }); - } }); diff --git a/spec/fixtures/module/preload-disable-remote.js b/spec/fixtures/module/preload-disable-remote.js deleted file mode 100644 index 9b6b96cbf28f..000000000000 --- a/spec/fixtures/module/preload-disable-remote.js +++ /dev/null @@ -1,8 +0,0 @@ -setImmediate(function () { - try { - const { remote } = require('electron'); - console.log(JSON.stringify(typeof remote)); - } catch (e) { - console.log(e.message); - } -}); diff --git a/spec/fixtures/pages/service-worker/badge-index.html b/spec/fixtures/pages/service-worker/badge-index.html new file mode 100644 index 000000000000..480a60a9aee8 --- /dev/null +++ b/spec/fixtures/pages/service-worker/badge-index.html @@ -0,0 +1,31 @@ + diff --git a/spec/fixtures/pages/service-worker/service-worker-badge.js b/spec/fixtures/pages/service-worker/service-worker-badge.js new file mode 100644 index 000000000000..84215bfb3323 --- /dev/null +++ b/spec/fixtures/pages/service-worker/service-worker-badge.js @@ -0,0 +1,33 @@ +self.addEventListener('fetch', async function (event) { + const requestUrl = new URL(event.request.url); + let responseTxt; + if (requestUrl.pathname === '/echo' && + event.request.headers.has('X-Mock-Response')) { + if (requestUrl.search === '?setBadge') { + if (navigator.setAppBadge()) { + try { + await navigator.setAppBadge(42); + responseTxt = 'SUCCESS setting app badge'; + await navigator.clearAppBadge(); + } catch (ex) { + responseTxt = 'ERROR setting app badge ' + ex; + } + } else { + responseTxt = 'ERROR navigator.setAppBadge is not available in ServiceWorker!'; + } + } else if (requestUrl.search === '?clearBadge') { + if (navigator.clearAppBadge()) { + try { + await navigator.clearAppBadge(); + responseTxt = 'SUCCESS clearing app badge'; + } catch (ex) { + responseTxt = 'ERROR clearing app badge ' + ex; + } + } else { + responseTxt = 'ERROR navigator.clearAppBadge is not available in ServiceWorker!'; + } + } + const mockResponse = new Response(responseTxt); + event.respondWith(mockResponse); + } +}); diff --git a/spec/static/index.html b/spec/static/index.html index 9497bbcf8b20..1f710fc2b277 100644 --- a/spec/static/index.html +++ b/spec/static/index.html @@ -91,6 +91,10 @@ chai.use(require('chai-as-promised')) chai.use(require('dirty-chai')) + // Show full object diff + // https://github.com/chaijs/chai/issues/469 + chai.config.truncateThreshold = 0; + const runner = mocha.run(() => { // Ensure the callback is called after runner is defined setTimeout(() => { diff --git a/spec/static/main.js b/spec/static/main.js index c3ee64266038..f259a3612fd3 100644 --- a/spec/static/main.js +++ b/spec/static/main.js @@ -108,7 +108,6 @@ app.whenReady().then(async function () { webPreferences: { backgroundThrottling: false, nodeIntegration: true, - enableRemoteModule: false, webviewTag: true, contextIsolation: false } diff --git a/spec/ts-smoke/electron/renderer.ts b/spec/ts-smoke/electron/renderer.ts index 1ad24a9cc283..16bc8d2c51b0 100644 --- a/spec/ts-smoke/electron/renderer.ts +++ b/spec/ts-smoke/electron/renderer.ts @@ -2,11 +2,9 @@ import { desktopCapturer, ipcRenderer, - remote, webFrame, clipboard, crashReporter, - screen, shell } from 'electron' @@ -23,31 +21,6 @@ ipcRenderer.on('asynchronous-reply', (event, arg: any) => { ipcRenderer.send('asynchronous-message', 'ping') -// remote -// https://github.com/electron/electron/blob/master/docs/api/remote.md - -const BrowserWindow = remote.BrowserWindow -const win = new BrowserWindow({ width: 800, height: 600 }) -win.loadURL('https://github.com') - -remote.getCurrentWindow().on('close', () => { - // blabla... -}) - -remote.getCurrentWindow().capturePage().then(image => { - fs.writeFile('/tmp/screenshot.png', image.toBitmap(), err => { - console.log(err) - }) -}) - -remote.getCurrentWebContents().print() - -remote.getCurrentWindow().capturePage().then(image => { - remote.require('fs').writeFile('/tmp/screenshot.png', image.toBitmap(), (err: Error) => { - console.log(err) - }) -}) - // web-frame // https://github.com/electron/electron/blob/master/docs/api/web-frame.md @@ -166,12 +139,7 @@ holder.ondrop = function (e) { // nativeImage // https://github.com/electron/electron/blob/master/docs/api/native-image.md -const Tray = remote.Tray -const appIcon2 = new Tray('/Users/somebody/images/icon.png') -const window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' }) const image = clipboard.readImage() -const appIcon3 = new Tray(image) -const appIcon4 = new Tray('/Users/somebody/images/icon.png') // https://github.com/electron/electron/blob/master/docs/api/process.md @@ -183,36 +151,6 @@ process.once('loaded', function () { global.clearImmediate = _clearImmediate }) -// screen -// https://github.com/electron/electron/blob/master/docs/api/screen.md - -const app = remote.app - -let mainWindow: Electron.BrowserWindow = null - -app.whenReady().then(() => { - const size = screen.getPrimaryDisplay().workAreaSize - mainWindow = new BrowserWindow({ width: size.width, height: size.height }) -}) - -app.whenReady().then(() => { - const displays = screen.getAllDisplays() - let externalDisplay: any = null - for (const i in displays) { - if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { - externalDisplay = displays[i] - break - } - } - - if (externalDisplay) { - mainWindow = new BrowserWindow({ - x: externalDisplay.bounds.x + 50, - y: externalDisplay.bounds.y + 50 - }) - } -}) - // shell // https://github.com/electron/electron/blob/master/docs/api/shell.md diff --git a/spec/webview-spec.js b/spec/webview-spec.js index 9a4a601a2efa..8fb6a1722ba9 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -482,17 +482,6 @@ describe(' tag', function () { }); }); - ifit(features.isRemoteModuleEnabled())('can disable the remote module', async () => { - const message = await startLoadingWebViewAndWaitForMessage(webview, { - preload: `${fixtures}/module/preload-disable-remote.js`, - src: `file://${fixtures}/api/blank.html`, - webpreferences: 'enableRemoteModule=no' - }); - - const typeOfRemote = JSON.parse(message); - expect(typeOfRemote).to.equal('undefined'); - }); - it('can disables web security and enable nodeintegration', async () => { const jqueryPath = path.join(__dirname, '/static/jquery-2.0.3.min.js'); const src = ` `; diff --git a/typings/internal-ambient.d.ts b/typings/internal-ambient.d.ts index 85f9d1253c8c..c97d0864f165 100644 --- a/typings/internal-ambient.d.ts +++ b/typings/internal-ambient.d.ts @@ -7,7 +7,6 @@ declare var binding: { get: (name: string) => any; process: NodeJS.Process; crea declare const BUILDFLAG: (flag: boolean) => boolean; declare const ENABLE_DESKTOP_CAPTURER: boolean; -declare const ENABLE_REMOTE_MODULE: boolean; declare const ENABLE_VIEWS_API: boolean; declare namespace NodeJS { @@ -15,7 +14,6 @@ declare namespace NodeJS { isBuiltinSpellCheckerEnabled(): boolean; isDesktopCapturerEnabled(): boolean; isOffscreenRenderingEnabled(): boolean; - isRemoteModuleEnabled(): boolean; isPDFViewerEnabled(): boolean; isRunAsNodeEnabled(): boolean; isFakeLocationProviderEnabled(): boolean; @@ -45,7 +43,7 @@ declare namespace NodeJS { weaklyTrackValue(value: any): void; clearWeaklyTrackedValues(): void; getWeaklyTrackedValues(): any[]; - addRemoteObjectRef(contextId: string, id: number): void; + runUntilIdle(): void; isSameOrigin(a: string, b: string): boolean; triggerFatalErrorForTesting(): void; } @@ -78,8 +76,7 @@ declare namespace NodeJS { readdir(path: string): string[] | false; realpath(path: string): string | false; copyFileOut(path: string): string | false; - read(offset: number, size: number): Promise; - readSync(offset: number, size: number): ArrayBuffer; + getFd(): number | -1; } interface AsarBinding { From fae4d87a5ae43f449e62780602240eb4646a075c Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 15 Mar 2021 18:46:50 -0400 Subject: [PATCH 32/85] update to xcode 12.4.0 Needed because of https://chromium.googlesource.com/chromium/src/+/8008deb41cc7ee54a1ef08e2b8afec8046285468 --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5ee057c7f974..2e6d122b247b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -85,17 +85,17 @@ machine-linux-2xlarge: &machine-linux-2xlarge machine-mac: &machine-mac macos: - xcode: "12.2.0" + xcode: "12.4.0" machine-mac-large: &machine-mac-large resource_class: large macos: - xcode: "12.2.0" + xcode: "12.4.0" machine-mac-large-arm: &machine-mac-large-arm resource_class: large macos: - xcode: "12.2.0" + xcode: "12.4.0" machine-mac-arm64: &machine-mac-arm64 resource_class: electronjs/macos-arm64 From d4bec23bdee4680e34aba47785374e4ad0a0a22c Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 15 Mar 2021 20:33:49 -0400 Subject: [PATCH 33/85] 2752406: [LSC] Replace base::string16 with std::u16string in //ui https://chromium-review.googlesource.com/c/chromium/src/+/2752406 --- patches/chromium/accelerator.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/chromium/accelerator.patch b/patches/chromium/accelerator.patch index b8917189c22f..d3caffd5f54f 100644 --- a/patches/chromium/accelerator.patch +++ b/patches/chromium/accelerator.patch @@ -10,7 +10,7 @@ This patch makes three changes to Accelerator::GetShortcutText to improve shortc 3. Ctrl-Shift-= should show as Ctrl-+ diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc -index 1a2a154b743cd4ecccf1be9971f36896e982dc6e..cbd5ce0929b956456424c4e6a159418f7eb91638 100644 +index 1a2a154b743cd4ecccf1be9971f36896e982dc6e..b5cec83c479dfa584f496f1f73a81e8b9f64d08c 100644 --- a/ui/base/accelerators/accelerator.cc +++ b/ui/base/accelerators/accelerator.cc @@ -12,6 +12,7 @@ @@ -42,7 +42,7 @@ index 1a2a154b743cd4ecccf1be9971f36896e982dc6e..cbd5ce0929b956456424c4e6a159418f + if (c != 0) { + shortcut = + static_cast( -+ base::ToUpperASCII(static_cast(c))); ++ base::ToUpperASCII(static_cast(c))); + } #if defined(OS_WIN) // Our fallback is to try translate the key code to a regular character From 9e336f5d0cfd64228d814f99f395e26db67a2ba6 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 15 Mar 2021 21:21:27 -0400 Subject: [PATCH 34/85] 2752406: [LSC] Replace base::string16 with std::u16string in //ui https://chromium-review.googlesource.com/c/chromium/src/+/2752406 --- shell/browser/ui/views/menu_bar.cc | 6 +++--- shell/browser/ui/views/menu_bar.h | 6 +++--- shell/browser/ui/views/submenu_button.cc | 2 +- shell/browser/ui/views/submenu_button.h | 6 +++--- shell/common/gin_converters/blink_converter.cc | 4 ++-- shell/common/keyboard_util.cc | 2 +- shell/common/keyboard_util.h | 2 +- shell/renderer/api/electron_api_spell_check_client.cc | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/shell/browser/ui/views/menu_bar.cc b/shell/browser/ui/views/menu_bar.cc index fe4ed9f7ac1e..a55a8128dbd9 100644 --- a/shell/browser/ui/views/menu_bar.cc +++ b/shell/browser/ui/views/menu_bar.cc @@ -78,7 +78,7 @@ void MenuBar::SetAcceleratorVisibility(bool visible) { static_cast(child)->SetAcceleratorVisibility(visible); } -MenuBar::View* MenuBar::FindAccelChild(base::char16 key) { +MenuBar::View* MenuBar::FindAccelChild(char16_t key) { for (auto* child : GetChildrenInZOrder()) { if (static_cast(child)->accelerator() == key) return child; @@ -86,11 +86,11 @@ MenuBar::View* MenuBar::FindAccelChild(base::char16 key) { return nullptr; } -bool MenuBar::HasAccelerator(base::char16 key) { +bool MenuBar::HasAccelerator(char16_t key) { return FindAccelChild(key) != nullptr; } -void MenuBar::ActivateAccelerator(base::char16 key) { +void MenuBar::ActivateAccelerator(char16_t key) { auto* child = FindAccelChild(key); if (child) static_cast(child)->Activate(nullptr); diff --git a/shell/browser/ui/views/menu_bar.h b/shell/browser/ui/views/menu_bar.h index eb2e2d35ac57..1b2118381815 100644 --- a/shell/browser/ui/views/menu_bar.h +++ b/shell/browser/ui/views/menu_bar.h @@ -51,10 +51,10 @@ class MenuBar : public views::AccessiblePaneView, void SetAcceleratorVisibility(bool visible); // Returns true if the submenu has accelerator |key| - bool HasAccelerator(base::char16 key); + bool HasAccelerator(char16_t key); // Shows the submenu whose accelerator is |key|. - void ActivateAccelerator(base::char16 key); + void ActivateAccelerator(char16_t key); // Returns there are how many items in the root menu. int GetItemCount() const; @@ -95,7 +95,7 @@ class MenuBar : public views::AccessiblePaneView, RootView* window_ = nullptr; ElectronMenuModel* menu_model_ = nullptr; - View* FindAccelChild(base::char16 key); + View* FindAccelChild(char16_t key); bool has_focus_ = true; diff --git a/shell/browser/ui/views/submenu_button.cc b/shell/browser/ui/views/submenu_button.cc index 3e3c70356c25..89a51c8ed656 100644 --- a/shell/browser/ui/views/submenu_button.cc +++ b/shell/browser/ui/views/submenu_button.cc @@ -90,7 +90,7 @@ void SubmenuButton::PaintButtonContents(gfx::Canvas* canvas) { } bool SubmenuButton::GetUnderlinePosition(const base::string16& text, - base::char16* accelerator, + char16_t* accelerator, int* start, int* end) const { int pos, span; diff --git a/shell/browser/ui/views/submenu_button.h b/shell/browser/ui/views/submenu_button.h index a5685cd1b066..10344cd6842d 100644 --- a/shell/browser/ui/views/submenu_button.h +++ b/shell/browser/ui/views/submenu_button.h @@ -24,7 +24,7 @@ class SubmenuButton : public views::MenuButton { void SetAcceleratorVisibility(bool visible); void SetUnderlineColor(SkColor color); - base::char16 accelerator() const { return accelerator_; } + char16_t accelerator() const { return accelerator_; } void GetAccessibleNodeData(ui::AXNodeData* node_data) override; @@ -37,14 +37,14 @@ class SubmenuButton : public views::MenuButton { private: bool GetUnderlinePosition(const base::string16& text, - base::char16* accelerator, + char16_t* accelerator, int* start, int* end) const; void GetCharacterPosition(const base::string16& text, int index, int* pos) const; - base::char16 accelerator_ = 0; + char16_t accelerator_ = 0; bool show_underline_ = false; diff --git a/shell/common/gin_converters/blink_converter.cc b/shell/common/gin_converters/blink_converter.cc index c7cfb3a6be6b..e0316bab0cee 100644 --- a/shell/common/gin_converters/blink_converter.cc +++ b/shell/common/gin_converters/blink_converter.cc @@ -44,10 +44,10 @@ int VectorToBitArray(const std::vector& vec) { namespace gin { template <> -struct Converter { +struct Converter { static bool FromV8(v8::Isolate* isolate, v8::Handle val, - base::char16* out) { + char16_t* out) { base::string16 code = base::UTF8ToUTF16(gin::V8ToString(isolate, val)); if (code.length() != 1) return false; diff --git a/shell/common/keyboard_util.cc b/shell/common/keyboard_util.cc index dc77b9479379..c5dc82c540dc 100644 --- a/shell/common/keyboard_util.cc +++ b/shell/common/keyboard_util.cc @@ -138,7 +138,7 @@ ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& s, } // namespace -ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted) { +ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted) { c = base::ToLowerASCII(c); *shifted = false; switch (c) { diff --git a/shell/common/keyboard_util.h b/shell/common/keyboard_util.h index e444c327ce49..127c7bea1906 100644 --- a/shell/common/keyboard_util.h +++ b/shell/common/keyboard_util.h @@ -14,7 +14,7 @@ namespace electron { // Return key code of the char, and also determine whether the SHIFT key is // pressed. -ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted); +ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted); // Return key code of the |str|, and also determine whether the SHIFT key is // pressed. diff --git a/shell/renderer/api/electron_api_spell_check_client.cc b/shell/renderer/api/electron_api_spell_check_client.cc index f978f5f1f7b1..24221be890d9 100644 --- a/shell/renderer/api/electron_api_spell_check_client.cc +++ b/shell/renderer/api/electron_api_spell_check_client.cc @@ -29,7 +29,7 @@ namespace api { namespace { bool HasWordCharacters(const base::string16& text, int index) { - const base::char16* data = text.data(); + const char16_t* data = text.data(); int length = text.length(); while (index < length) { uint32_t code = 0; From 08036802cb53dd9ae65db83315adcc40ba16b9d0 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 15 Mar 2021 21:28:22 -0400 Subject: [PATCH 35/85] 2752932: Associate each AwProxyingURLLoaderFactory with a frame tree node id. https://chromium-review.googlesource.com/c/chromium/src/+/2752932 --- shell/browser/electron_browser_client.cc | 1 + shell/browser/electron_browser_client.h | 1 + 2 files changed, 2 insertions(+) diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index c87941672fa1..8e84daf1470d 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -1170,6 +1170,7 @@ bool ElectronBrowserClient::HandleExternalProtocol( const GURL& url, content::WebContents::OnceGetter web_contents_getter, int child_id, + int frame_tree_node_id, content::NavigationUIData* navigation_data, bool is_main_frame, ui::PageTransition page_transition, diff --git a/shell/browser/electron_browser_client.h b/shell/browser/electron_browser_client.h index 68df0626de3e..354d7a89b68e 100644 --- a/shell/browser/electron_browser_client.h +++ b/shell/browser/electron_browser_client.h @@ -239,6 +239,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient, const GURL& url, content::WebContents::OnceGetter web_contents_getter, int child_id, + int frame_tree_node_id, content::NavigationUIData* navigation_data, bool is_main_frame, ui::PageTransition page_transition, From 676f74f3dc2ce6a13eb9be8a813a8fc42fcdaa75 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 15 Mar 2021 21:45:19 -0400 Subject: [PATCH 36/85] 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer. https://chromium-review.googlesource.com/c/chromium/src/+/2651385 --- shell/browser/electron_browser_context.cc | 28 ----------------------- shell/browser/electron_browser_context.h | 12 ---------- 2 files changed, 40 deletions(-) diff --git a/shell/browser/electron_browser_context.cc b/shell/browser/electron_browser_context.cc index 2f48d7f2e86d..97b4cc29b4f7 100644 --- a/shell/browser/electron_browser_context.cc +++ b/shell/browser/electron_browser_context.cc @@ -433,34 +433,6 @@ ElectronBrowserContext::GetStorageNotificationService() { return nullptr; } -void ElectronBrowserContext::SetCorsOriginAccessListForOrigin( - TargetBrowserContexts target_mode, - const url::Origin& source_origin, - std::vector allow_patterns, - std::vector block_patterns, - base::OnceClosure closure) { - using content::CorsOriginPatternSetter; - // We ignore target_mode because we don't support extensions in in-memory - // sessions. - auto barrier_closure = BarrierClosure(2, std::move(closure)); - base::MakeRefCounted( - source_origin, CorsOriginPatternSetter::ClonePatterns(allow_patterns), - CorsOriginPatternSetter::ClonePatterns(block_patterns), barrier_closure) - ->ApplyToEachStoragePartition(this); - - // Keep the per-profile access list up to date so that we can use this to - // restore NetworkContext settings at anytime, e.g. on restarting the - // network service. - shared_cors_origin_access_list_->SetForOrigin( - source_origin, std::move(allow_patterns), std::move(block_patterns), - barrier_closure); -} - -content::SharedCorsOriginAccessList* -ElectronBrowserContext::GetSharedCorsOriginAccessList() { - return shared_cors_origin_access_list_.get(); -} - ResolveProxyHelper* ElectronBrowserContext::GetResolveProxyHelper() { if (!resolve_proxy_helper_) { resolve_proxy_helper_ = base::MakeRefCounted(this); diff --git a/shell/browser/electron_browser_context.h b/shell/browser/electron_browser_context.h index 1a55d7191cc8..1db419e0451b 100644 --- a/shell/browser/electron_browser_context.h +++ b/shell/browser/electron_browser_context.h @@ -113,15 +113,6 @@ class ElectronBrowserContext override; content::StorageNotificationService* GetStorageNotificationService() override; - // extensions deps - void SetCorsOriginAccessListForOrigin( - TargetBrowserContexts target_mode, - const url::Origin& source_origin, - std::vector allow_patterns, - std::vector block_patterns, - base::OnceClosure closure) override; - content::SharedCorsOriginAccessList* GetSharedCorsOriginAccessList() override; - CookieChangeNotifier* cookie_change_notifier() const { return cookie_change_notifier_.get(); } @@ -199,9 +190,6 @@ class ElectronBrowserContext network::mojom::SSLConfigPtr ssl_config_; mojo::Remote ssl_config_client_; - scoped_refptr - shared_cors_origin_access_list_; - base::WeakPtrFactory weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ElectronBrowserContext); From 76538d2d3811410a597ed0ad116cf72766e6d941 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 15 Mar 2021 21:57:12 -0400 Subject: [PATCH 37/85] 2734095: Introduce StoragePartitionId type to wrap current string representation. https://chromium-review.googlesource.com/c/chromium/src/+/2734095 --- shell/browser/api/electron_api_web_contents.cc | 2 +- shell/browser/api/electron_api_web_contents.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 60a75e4e9378..004f7323d85d 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -1036,7 +1036,7 @@ content::WebContents* WebContents::CreateCustomWebContents( const GURL& opener_url, const std::string& frame_name, const GURL& target_url, - const std::string& partition_id, + const content::StoragePartitionId& partition_id, content::SessionStorageNamespace* session_storage_namespace) { return nullptr; } diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 2c3dacc63dab..0ac3d3cc1d50 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -459,7 +459,7 @@ class WebContents : public gin::Wrappable, const GURL& opener_url, const std::string& frame_name, const GURL& target_url, - const std::string& partition_id, + const content::StoragePartitionId& partition_id, content::SessionStorageNamespace* session_storage_namespace) override; void WebContentsCreatedWithFullParams( content::WebContents* source_contents, From 003dd6c16cd87ed1a09fee8df36dc618eedafb3e Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Tue, 16 Mar 2021 06:00:23 -0700 Subject: [PATCH 38/85] chore: bump chromium in DEPS to 91.0.4448.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 260d2e6c279a..63692c6f3192 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4446.0', + '91.0.4448.0', 'node_version': 'v14.16.0', 'nan_version': From 9f5e3f668541b0ea4eb61808b4538df4a8e852ce Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 10:01:00 -0400 Subject: [PATCH 39/85] Update patches --- ...uclient_precreatemessageloop_callback.patch | 6 +++--- .../add_didinstallconditionalfeatures.patch | 8 ++++---- patches/chromium/add_realloc.patch | 2 +- ...s_windows_to_have_different_web_prefs.patch | 6 +++--- ...g_secondary_label_via_simplemenumodel.patch | 10 +++++----- patches/chromium/blink_world_context.patch | 2 +- patches/chromium/can_create_window.patch | 10 +++++----- ...e_v8_initialization_isolate_callbacks.patch | 2 +- ...tscreationoverridden_with_full_params.patch | 10 +++++----- ...resources_not_chrome_for_spellchecker.patch | 2 +- patches/chromium/chrome_key_systems.patch | 6 +++--- patches/chromium/desktop_media_list.patch | 6 +++--- patches/chromium/disable-redraw-lock.patch | 4 ++-- .../disable_color_correct_rendering.patch | 6 +++--- patches/chromium/disable_hidden.patch | 4 ++-- ...ull_getwebframe_-_view_when_get_blink.patch | 4 ++-- ...add_set_theme_source_to_allow_apps_to.patch | 4 ++-- ...k_scheduler_throttling_per_renderview.patch | 10 +++++----- ...fscreen_rendering_with_viz_compositor.patch | 2 +- ...ons_through_the_web_contents_delegate.patch | 2 +- patches/chromium/frame_host_manager.patch | 8 ++++---- patches/chromium/mas_no_private_api.patch | 18 +++++++++--------- ...r_of_webview_to_blinks_webprefs_logic.patch | 2 +- patches/chromium/notification_provenance.patch | 12 ++++++------ patches/chromium/printing.patch | 12 ++++++------ .../put_back_deleted_colors_for_autofill.patch | 2 +- ...or_changes_to_the_webcontentsobserver.patch | 2 +- .../render_widget_host_view_base.patch | 10 +++++----- .../chromium/render_widget_host_view_mac.patch | 12 ++++++------ ...move_contentrendererclient_shouldfork.patch | 12 ++++++------ patches/chromium/scroll_bounce_flag.patch | 4 ++-- .../support_mixed_sandbox_with_zygote.patch | 2 +- patches/chromium/web_contents.patch | 8 ++++---- .../chromium/worker_context_will_destroy.patch | 4 ++-- ..._feat_add_hook_to_notify_script_ready.patch | 4 ++-- patches/v8/add_realloc.patch | 4 ++-- patches/v8/build_gn.patch | 8 ++++---- patches/v8/dcheck.patch | 4 ++-- ..._export_private_v8_symbols_on_windows.patch | 4 ++-- patches/v8/expose_mksnapshot.patch | 4 ++-- 40 files changed, 121 insertions(+), 121 deletions(-) diff --git a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch index ab582702b19c..51602d55406c 100644 --- a/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch +++ b/patches/chromium/add_contentgpuclient_precreatemessageloop_callback.patch @@ -10,10 +10,10 @@ Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set. This should be upstreamed. diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc -index 5b4034b583163068c29b9aee3e2b8cd4687c67ed..ee0e1404fc06c591e6f26471d049d0a29d87e7ef 100644 +index cc0f150d08c13e5d06c7da5df7323a3b2463785a..f66af5d6b1336fe5de22150855b4416832b8522a 100644 --- a/content/gpu/gpu_main.cc +++ b/content/gpu/gpu_main.cc -@@ -259,6 +259,10 @@ int GpuMain(const MainFunctionParams& parameters) { +@@ -267,6 +267,10 @@ int GpuMain(const MainFunctionParams& parameters) { // to the GpuProcessHost once the GpuServiceImpl has started. viz::GpuServiceImpl::InstallPreInitializeLogHandler(); @@ -24,7 +24,7 @@ index 5b4034b583163068c29b9aee3e2b8cd4687c67ed..ee0e1404fc06c591e6f26471d049d0a2 // We are experiencing what appear to be memory-stomp issues in the GPU // process. These issues seem to be impacting the task executor and listeners // registered to it. Create the task executor on the heap to guard against -@@ -396,7 +400,6 @@ int GpuMain(const MainFunctionParams& parameters) { +@@ -404,7 +408,6 @@ int GpuMain(const MainFunctionParams& parameters) { } #endif diff --git a/patches/chromium/add_didinstallconditionalfeatures.patch b/patches/chromium/add_didinstallconditionalfeatures.patch index 6151cb80d74b..5892ecda4012 100644 --- a/patches/chromium/add_didinstallconditionalfeatures.patch +++ b/patches/chromium/add_didinstallconditionalfeatures.patch @@ -10,10 +10,10 @@ DidCreateScriptContext is called, not all JS APIs are available in the context, which can cause some preload scripts to trip. diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h -index 7255ccd1ab7128616ae45c7810a90821496becc0..9ed4547d784ee6e552cc31d7f6091c722218f565 100644 +index 5a733f2086ec10d3010da52a2758e1748d1178e1..d8c7ef2e3c03f5275c1ed58849ec892f811165ef 100644 --- a/content/public/renderer/render_frame_observer.h +++ b/content/public/renderer/render_frame_observer.h -@@ -129,6 +129,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, +@@ -128,6 +128,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, virtual void DidHandleOnloadEvents() {} virtual void DidCreateScriptContext(v8::Local context, int32_t world_id) {} @@ -23,10 +23,10 @@ index 7255ccd1ab7128616ae45c7810a90821496becc0..9ed4547d784ee6e552cc31d7f6091c72 int32_t world_id) {} virtual void DidClearWindowObject() {} diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 0970915229d119d5d45041a9b21846b054f6d1ae..2d6f936ade9cb1baceeea038df48e92f4ab3783a 100644 +index e2425d04e1008be3db9e6e887a7de589c18673a5..be3779de84dbda14c3425c5115da78ab703e9cfb 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -4578,6 +4578,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, +@@ -4577,6 +4577,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local context, observer.DidCreateScriptContext(context, world_id); } diff --git a/patches/chromium/add_realloc.patch b/patches/chromium/add_realloc.patch index 7692f2c4ce73..e23563d50706 100644 --- a/patches/chromium/add_realloc.patch +++ b/patches/chromium/add_realloc.patch @@ -39,7 +39,7 @@ index 086371af29bd8c7520485125deddca411e8b978b..2c6886ddcc47019be4d552d4fddfc1c3 GIN_EXPORT static ArrayBufferAllocator* SharedInstance(); diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index b7509d4f4a47987ac8f4e2ae3fdcb29d20b3d484..c05209010570867a8c08a60c2b32f853906bd03d 100644 +index 7f88acc40ec99f0ecd1b71270980ee6e0c3e203e..42cdbc706a33792859fece7741846c4cc922008a 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc @@ -699,6 +699,10 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { diff --git a/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch b/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch index f658016d747f..8fb7777f73d6 100644 --- a/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch +++ b/patches/chromium/allow_in_process_windows_to_have_different_web_prefs.patch @@ -84,7 +84,7 @@ index ba1ba323ec45296c33b5931652a001d6bd24dbe0..178cae9c389e48733fde982f4906d974 out->accelerated_video_decode_enabled = data.accelerated_video_decode_enabled(); diff --git a/third_party/blink/public/common/web_preferences/web_preferences.h b/third_party/blink/public/common/web_preferences/web_preferences.h -index e1fb30cfba2656989141f0a53ec3e6202c9b0409..f630fe020bd426e9093ce352a8e9ac17170101ca 100644 +index 74ed4b91cdd4c0cc0244491dfbbdf8e69e54e6f5..6795a5307ff49bbe366041e28c54dd2d9976c7f8 100644 --- a/third_party/blink/public/common/web_preferences/web_preferences.h +++ b/third_party/blink/public/common/web_preferences/web_preferences.h @@ -9,6 +9,7 @@ @@ -92,10 +92,10 @@ index e1fb30cfba2656989141f0a53ec3e6202c9b0409..f630fe020bd426e9093ce352a8e9ac17 #include +#include "base/files/file_path.h" - #include "base/strings/string16.h" #include "base/time/time.h" #include "build/build_config.h" -@@ -161,6 +162,28 @@ struct BLINK_COMMON_EXPORT WebPreferences { + #include "net/nqe/effective_connection_type.h" +@@ -160,6 +161,28 @@ struct BLINK_COMMON_EXPORT WebPreferences { blink::mojom::V8CacheOptions v8_cache_options; bool record_whole_document; diff --git a/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch b/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch index 97491c73a90d..4cbb97759730 100644 --- a/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch +++ b/patches/chromium/allow_setting_secondary_label_via_simplemenumodel.patch @@ -47,10 +47,10 @@ index 016dab7776139c8ea7eab60569f3e5c5aeff8014..022225c4c02300667c58dc61165cc19d return items_[ValidateItemIndex(index)].minor_text; } diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h -index 7dc52c90a032ae21db1e453f1f901c49131a11ca..f5df563276d97f4e0b4b20100e7b2474acaea461 100644 +index 5ab6c93bb3599b72952bdc8226e6c473477b7315..1132ec877298d5d5812547ffa12a4be2f2708dc4 100644 --- a/ui/base/models/simple_menu_model.h +++ b/ui/base/models/simple_menu_model.h -@@ -51,6 +51,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { +@@ -50,6 +50,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { // Some command ids have labels and icons that change over time. virtual bool IsItemForCommandIdDynamic(int command_id) const; virtual std::u16string GetLabelForCommandId(int command_id) const; @@ -58,7 +58,7 @@ index 7dc52c90a032ae21db1e453f1f901c49131a11ca..f5df563276d97f4e0b4b20100e7b2474 // Gets the icon for the item with the specified id. virtual ImageModel GetIconForCommandId(int command_id) const; -@@ -154,6 +155,9 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { +@@ -153,6 +154,9 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { // Sets the label for the item at |index|. void SetLabel(int index, const std::u16string& label); @@ -68,7 +68,7 @@ index 7dc52c90a032ae21db1e453f1f901c49131a11ca..f5df563276d97f4e0b4b20100e7b2474 // Sets the minor text for the item at |index|. void SetMinorText(int index, const std::u16string& minor_text); -@@ -186,6 +190,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { +@@ -185,6 +189,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override; int GetCommandIdAt(int index) const override; std::u16string GetLabelAt(int index) const override; @@ -76,7 +76,7 @@ index 7dc52c90a032ae21db1e453f1f901c49131a11ca..f5df563276d97f4e0b4b20100e7b2474 std::u16string GetMinorTextAt(int index) const override; ImageModel GetMinorIconAt(int index) const override; bool IsItemDynamicAt(int index) const override; -@@ -223,6 +228,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { +@@ -222,6 +227,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel { int command_id = 0; ItemType type = TYPE_COMMAND; std::u16string label; diff --git a/patches/chromium/blink_world_context.patch b/patches/chromium/blink_world_context.patch index 2bc1cd6a41e1..10c2b1715f65 100644 --- a/patches/chromium/blink_world_context.patch +++ b/patches/chromium/blink_world_context.patch @@ -20,7 +20,7 @@ index 315c95a0ba24ea675d82f1d1b1840683c012de82..01709c0c3ed79dad8cacb1c7075d4dfb // Executes script in the context of the current page and returns the value // that the script evaluated to with callback. Script execution can be diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index 1b180b94b247d7f39f61596a5a86ce38f595362a..99258a29d82ea0e37b226c8d6e2f3a810e615883 100644 +index 88312a9f7742ab6b085f4deb42806cd7372497b2..f2fe0c14f7205a76f1efe09c710154b8efc2e213 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc @@ -1037,6 +1037,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 023054e9f73b..039437590c6a 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -21,7 +21,7 @@ index f2d027d32e3cff2d1f0f03ed6c47ee689524ca1d..82dac3411b63e541d92b486f5e2108cc &no_javascript_access); diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index dfb04614aa0244934798870317f500751869b7ea..703f847c844fda3b9efbbd7ce28743c5a9d991a4 100644 +index 4094a543f7cedb290658b63c1c2f6c91517b6020..18564b3c0adbc8ecb5c930609204be207edfd3ea 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -3637,6 +3637,14 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( @@ -124,18 +124,18 @@ index ba416aebd7936d5cf7f890d071acf503765b47f6..412fa31a6fb853eb757e19e64efb0829 const OpenURLParams& params) { return nullptr; diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index 164d5d1d4d401ba2ff9a6d233d11d43346526f2e..dd7968c1eacc79eadd9b068e0cfb10a03c6ac311 100644 +index 96c3b9e9b7e10af7103c5ac85422ffcd10bbe5db..4982f8d2641c3d3162db4f553f3b6726d1bc3593 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -17,6 +17,7 @@ - #include "base/strings/string16.h" +@@ -16,6 +16,7 @@ + #include "base/memory/scoped_refptr.h" #include "build/build_config.h" #include "content/common/content_export.h" +#include "content/common/frame.mojom.h" #include "content/public/browser/eye_dropper.h" #include "content/public/browser/invalidate_type.h" #include "content/public/browser/media_stream_request.h" -@@ -341,6 +342,13 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -340,6 +341,13 @@ class CONTENT_EXPORT WebContentsDelegate { const StoragePartitionId& partition_id, SessionStorageNamespace* session_storage_namespace); diff --git a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch index b16c7c336015..4589c50ffb79 100644 --- a/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch +++ b/patches/chromium/chore_expose_v8_initialization_isolate_callbacks.patch @@ -9,7 +9,7 @@ we're running with contextIsolation enabled, we should be falling back to Blink's logic. This will be upstreamed in some form. diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc -index c05209010570867a8c08a60c2b32f853906bd03d..e6f849589acce264df002ff5dd3c37f8aadc8df4 100644 +index 42cdbc706a33792859fece7741846c4cc922008a..27c5a49f539ba438d3e58fc3a4cadb116d440c24 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc @@ -450,7 +450,7 @@ CodeGenerationCheckCallbackInMainThread(v8::Local context, diff --git a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch index 17d8535569fc..599af1f1faca 100644 --- a/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch +++ b/patches/chromium/chore_provide_iswebcontentscreationoverridden_with_full_params.patch @@ -159,10 +159,10 @@ index 19ca9ee265876d2d33ced262be84cda1d056372c..b41c489a683995c3aa582d7eccbabe67 WebContents* Browser::CreateCustomWebContents( diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h -index 32f9f251d2c3f8c5443f2284d6f70769848df532..a3729cf13b57607dabc6278634f6ff0c2a030097 100644 +index f1c66751bff73836e58c6550f16dba060b88bd8d..94550c33ac0c84cbc37e30a4a569098af20520ab 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h -@@ -796,8 +796,7 @@ class Browser : public TabStripModelObserver, +@@ -795,8 +795,7 @@ class Browser : public TabStripModelObserver, content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, @@ -264,7 +264,7 @@ index c5c5a7b63b5b3b62a9517cbef3ae23ce57a3c89c..4f1b7e88d6d2ae89a60311c8aeb1fcee void AddNewContents(content::WebContents* source, std::unique_ptr new_contents, diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index cd90a347277d1375251e4e4b9025ca1726010324..53f48964e6dfd0fb9b91762760b59a006ac7cc0c 100644 +index cee5507c240fb859420eb74326e67c444c3a127c..3311b6110666851b3946ebf8071f210752425695 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -3589,8 +3589,7 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow( @@ -292,10 +292,10 @@ index 412fa31a6fb853eb757e19e64efb0829753faed9..1378593a48932b8272bafbe70c4797be } diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h -index dd7968c1eacc79eadd9b068e0cfb10a03c6ac311..6ce899d5eab1d643d71e33a85653f8802122614c 100644 +index 4982f8d2641c3d3162db4f553f3b6726d1bc3593..87e11c21bd4a6f07f2897e0027b47f3e74d6e192 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h -@@ -320,8 +320,7 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -319,8 +319,7 @@ class CONTENT_EXPORT WebContentsDelegate { SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, const GURL& opener_url, diff --git a/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch b/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch index 9daceb6af1bf..2f66d0602281 100644 --- a/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch +++ b/patches/chromium/chore_use_electron_resources_not_chrome_for_spellchecker.patch @@ -7,7 +7,7 @@ spellchecker uses a few IDS_ resources. We need to load these from Electrons grit header instead of Chromes diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 8eebf372cfe6c17d5a7c807e557e085f8d569f19..bcab35896cfee95fa982e7f48a977addb62b02ec 100644 +index de3b455eded016ac567d5716ad9de60ab66f201c..93d5497b47f47a2ae66942ff6af240a5051d5c11 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn @@ -6233,6 +6233,7 @@ static_library("browser") { diff --git a/patches/chromium/chrome_key_systems.patch b/patches/chromium/chrome_key_systems.patch index ea3c39bc9929..e8973e071f39 100644 --- a/patches/chromium/chrome_key_systems.patch +++ b/patches/chromium/chrome_key_systems.patch @@ -7,10 +7,10 @@ Disable persiste licence support check for widevine cdm, as its not supported in the current version of chrome. diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc -index 31c97e3781818e424001f7f3b1bde6596123dc4b..e146262f3d4533388b8e2866c6008fe9dca5cfc3 100644 +index 11ab5f846976418badb6ad062588b781aa6142dd..aa372535b7342a01e2b0732148b56ca4d1b846de 100644 --- a/chrome/renderer/media/chrome_key_systems.cc +++ b/chrome/renderer/media/chrome_key_systems.cc -@@ -16,7 +16,9 @@ +@@ -15,7 +15,9 @@ #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" @@ -20,7 +20,7 @@ index 31c97e3781818e424001f7f3b1bde6596123dc4b..e146262f3d4533388b8e2866c6008fe9 #include "components/cdm/renderer/external_clear_key_key_system_properties.h" #include "components/cdm/renderer/widevine_key_system_properties.h" #include "content/public/renderer/render_thread.h" -@@ -203,12 +205,14 @@ static SupportedCodecs GetSupportedCodecs( +@@ -202,12 +204,14 @@ static SupportedCodecs GetSupportedCodecs( // Returns persistent-license session support. static EmeSessionTypeSupport GetPersistentLicenseSupport( bool supported_by_the_cdm) { diff --git a/patches/chromium/desktop_media_list.patch b/patches/chromium/desktop_media_list.patch index c335a7dc42c4..4c0c59d76036 100644 --- a/patches/chromium/desktop_media_list.patch +++ b/patches/chromium/desktop_media_list.patch @@ -7,10 +7,10 @@ Subject: desktop_media_list.patch * Free the one-time use capturer after thumbnails are fetched diff --git a/chrome/browser/media/webrtc/desktop_media_list.h b/chrome/browser/media/webrtc/desktop_media_list.h -index cb383b8d095f3fe82a88d811068d98f09d6c508c..dd05d1928ccfe10deb5f96bbcb35eb63b8a3672c 100644 +index d7b52b0d1b8cfb823513303ec0f6322d8dc8d153..f2dbf39f81abfc6fde4064345ab0d222ee98438c 100644 --- a/chrome/browser/media/webrtc/desktop_media_list.h +++ b/chrome/browser/media/webrtc/desktop_media_list.h -@@ -53,6 +53,9 @@ class DesktopMediaList { +@@ -52,6 +52,9 @@ class DesktopMediaList { virtual ~DesktopMediaList() {} @@ -20,7 +20,7 @@ index cb383b8d095f3fe82a88d811068d98f09d6c508c..dd05d1928ccfe10deb5f96bbcb35eb63 // Sets time interval between updates. By default list of sources and their // thumbnail are updated once per second. If called after StartUpdating() then // it will take effect only after the next update. -@@ -84,6 +87,7 @@ class DesktopMediaList { +@@ -83,6 +86,7 @@ class DesktopMediaList { virtual int GetSourceCount() const = 0; virtual const Source& GetSource(int index) const = 0; diff --git a/patches/chromium/disable-redraw-lock.patch b/patches/chromium/disable-redraw-lock.patch index 35e7fd1f416f..a367e313f9af 100644 --- a/patches/chromium/disable-redraw-lock.patch +++ b/patches/chromium/disable-redraw-lock.patch @@ -49,10 +49,10 @@ index 0cf04f6ee625d5d8b58c68f100a599e51ff65927..e92d9cd727d1347db2d455811cc9d4c7 // HWNDMessageHandler, gfx::WindowImpl overrides: diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h -index 3c2cfa7fec2c37fa4a57261e694fb071ab237791..8f7c1b6d383740f3ae825c08c3f929e4fee80ac9 100644 +index 56b25183faca61754617ac38dbd2972aa8d30759..40f9b694fcce86dd56233541b58055cb77d9e615 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h -@@ -202,6 +202,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, +@@ -201,6 +201,8 @@ class VIEWS_EXPORT HWNDMessageHandler : public gfx::WindowImpl, using TouchIDs = std::set; enum class DwmFrameState { kOff, kOn }; diff --git a/patches/chromium/disable_color_correct_rendering.patch b/patches/chromium/disable_color_correct_rendering.patch index 79650809347c..bd85b57792f0 100644 --- a/patches/chromium/disable_color_correct_rendering.patch +++ b/patches/chromium/disable_color_correct_rendering.patch @@ -20,7 +20,7 @@ to deal with color spaces. That is being tracked at https://crbug.com/634542 and https://crbug.com/711107. diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc -index 973eeeb28dfe7260144cd2026aa936dc6a15750c..6d2b701848f0b53ec9701b2a14d67b24ba5763cf 100644 +index 6423a98c5bc951446b88051de15df45ade308349..c1ef0256347ea5bc4fa9c90c91c6322ce4cc60fd 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -1785,6 +1785,10 @@ void LayerTreeHostImpl::SetIsLikelyToRequireADraw( @@ -229,7 +229,7 @@ index a0fc635ce92491cc3df706e3e52bd8b0cacb2f15..32c497ca0b40517d70639cb16829a628 + +#undef PATCH_CS diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc -index 25a5780a488191d970b780c1af6712187a5e9cde..2030f3857edfea997a7ff615b3882ec478b9512d 100644 +index 2425c2b99a949c3181e2b69ea8d607f103442e34..86c91453231ca4762f50387b9be51393176b9cb8 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -223,6 +223,7 @@ GpuTerminationStatus ConvertToGpuTerminationStatus( @@ -241,7 +241,7 @@ index 25a5780a488191d970b780c1af6712187a5e9cde..2030f3857edfea997a7ff615b3882ec4 sandbox::policy::switches::kGpuSandboxAllowSysVShm, sandbox::policy::switches::kGpuSandboxFailuresFatal, diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 24c3f7991246985947e567d90779ecb9416c8686..273b86362eb9eb801ef828f7073ee5c86ca97bd8 100644 +index ae1aed1f26ae6202b4709a1931c48c55e3fae956..5629dd09ca564100bb1eb592f1176c5987eb0b71 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -214,6 +214,7 @@ diff --git a/patches/chromium/disable_hidden.patch b/patches/chromium/disable_hidden.patch index fc6bd707c900..e13df90cfcb2 100644 --- a/patches/chromium/disable_hidden.patch +++ b/patches/chromium/disable_hidden.patch @@ -20,10 +20,10 @@ index 20c2816765f639ce6ecab16db124f885702064dd..d98336a4b552290aff88a0c14321a588 blink::mojom::PointerLockResult::kWrongDocument); diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h -index 36994e352ee697fe445f9b7f20bbb0db0d728cd4..a21adfbc22ed2199520121b8fe36244a735f0653 100644 +index c0ab310d13e3f567aebdb9bcf1824897dba6b637..84c0d0943007adca3ce3a9c61f123a50aa67bf37 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h -@@ -834,6 +834,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl +@@ -833,6 +833,9 @@ class CONTENT_EXPORT RenderWidgetHostImpl mojom::CreateFrameWidgetParamsPtr BindAndGenerateCreateFrameWidgetParamsForNewWindow(); diff --git a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch index bc082da171b2..47521b165f75 100644 --- a/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch +++ b/patches/chromium/don_t_use_potentially_null_getwebframe_-_view_when_get_blink.patch @@ -11,10 +11,10 @@ This regressed in https://chromium-review.googlesource.com/c/chromium/src/+/2572 Upstream: https://chromium-review.googlesource.com/c/chromium/src/+/2598393 diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 43e20435b41c2d682a361ff4f0681081bcf4eab0..b562c8b1f5e588d4a1e471c41e208a18df4482f2 100644 +index 6dfa89f3117cb7b0165c352feb79e95b4a315061..31ca76bb13643b8dc1a530841f9c1941ebb43838 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -2668,7 +2668,7 @@ blink::WebLocalFrame* RenderFrameImpl::GetWebFrame() { +@@ -2667,7 +2667,7 @@ blink::WebLocalFrame* RenderFrameImpl::GetWebFrame() { } const blink::web_pref::WebPreferences& RenderFrameImpl::GetBlinkPreferences() { diff --git a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch index 204e9ffa63af..734c46f19369 100644 --- a/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch +++ b/patches/chromium/feat_add_set_theme_source_to_allow_apps_to.patch @@ -13,10 +13,10 @@ uses internally for things like menus and devtools. We can remove this patch once it has in some shape been upstreamed. diff --git a/ui/native_theme/native_theme.cc b/ui/native_theme/native_theme.cc -index 2f4d54a14f47d39bf028842a8db8db3066bb4894..427c70e793d87eb6d0f0072adceae3ce98198d09 100644 +index 3ee65184e31e7851a5f192f12318b813a5d3949a..7bc2abc443eaae2860b9178cd6d04b07fe2dbfac 100644 --- a/ui/native_theme/native_theme.cc +++ b/ui/native_theme/native_theme.cc -@@ -274,6 +274,8 @@ base::Optional NativeTheme::GetColorProviderColor( +@@ -243,6 +243,8 @@ base::Optional NativeTheme::GetColorProviderColor( } bool NativeTheme::ShouldUseDarkColors() const { diff --git a/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch b/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch index ae04a6875a42..b8dd7facc4db 100644 --- a/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch +++ b/patches/chromium/feat_allow_disabling_blink_scheduler_throttling_per_renderview.patch @@ -48,10 +48,10 @@ index 0edd8ddc099b2e66869d2d4fff42f761d3be6079..bcc704efaf27f9b042b349fa0b097917 // This interface should only be implemented inside content. friend class RenderViewHostImpl; diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h -index 166b3d3aa70dc2d6e8123ea1df3d3cb400be747c..f3bccc47ab2fe2d192f7d11628c7bdcf04638d02 100644 +index cd191b07a0075245449035cfbe61c16ace913506..0364e1d649b10f998630f7775f8edb3e0585d536 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h -@@ -224,6 +224,8 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient, +@@ -223,6 +223,8 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient, static WindowOpenDisposition NavigationPolicyToDisposition( blink::WebNavigationPolicy policy); @@ -85,10 +85,10 @@ index e8212d4566666683d67590ef0fe11e452d71b6fc..b19500d4af881c795e84baff16e9973e // Visibility ----------------------------------------------------------- diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index 57d18d8d664bb06bc89aa83f27959f712684cca2..ba01fb7cbbff1535401cdc687570c9a86e2011dd 100644 +index 222c8cda640b7255a8779f559eeba8151d63a673..a802da73e37c772760ee989ceda943a7f3ab8d6b 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -3512,6 +3512,13 @@ PageScheduler* WebViewImpl::Scheduler() const { +@@ -3516,6 +3516,13 @@ PageScheduler* WebViewImpl::Scheduler() const { return GetPage()->GetPageScheduler(); } @@ -102,7 +102,7 @@ index 57d18d8d664bb06bc89aa83f27959f712684cca2..ba01fb7cbbff1535401cdc687570c9a8 void WebViewImpl::SetVisibilityState( mojom::blink::PageVisibilityState visibility_state, bool is_initial_state) { -@@ -3524,7 +3531,8 @@ void WebViewImpl::SetVisibilityState( +@@ -3528,7 +3535,8 @@ void WebViewImpl::SetVisibilityState( } GetPage()->SetVisibilityState(visibility_state, is_initial_state); GetPage()->GetPageScheduler()->SetPageVisible( diff --git a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch index 99b71c2696b0..858258858bbc 100644 --- a/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch +++ b/patches/chromium/feat_enable_offscreen_rendering_with_viz_compositor.patch @@ -532,7 +532,7 @@ index 11ac1649ed0f5be1d12e8a30b8d170f86b8e9bb8..05746d9a561c3933ae0c5578467f20b4 compositor_data.display_client->GetBoundRemote(resize_task_runner_); diff --git a/services/viz/privileged/mojom/compositing/display_private.mojom b/services/viz/privileged/mojom/compositing/display_private.mojom -index 0c9686f3c8070000bf5b180d9c06a8817d430c4a..4538b95f6e71708144eb7752438b1b31d60cb2ca 100644 +index 56268cca8cd15bc7ac676b9e12f726cccd30a0e1..ce32565a23b598a2af12943179e4d6b79c245ead 100644 --- a/services/viz/privileged/mojom/compositing/display_private.mojom +++ b/services/viz/privileged/mojom/compositing/display_private.mojom @@ -85,7 +85,6 @@ interface DisplayClient { diff --git a/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch b/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch index f2dd2f9da50d..3d36f8b2300f 100644 --- a/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch +++ b/patches/chromium/fix_route_mouse_event_navigations_through_the_web_contents_delegate.patch @@ -13,7 +13,7 @@ This patch can be removed once app.allowRendererProcessReuse is forced to true as then Chromiums assumptions around processes become correct. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index ce9d64d9770e53e501d561af25094dd8f79bf331..86e5356ec057fddd49e93c49e49156f95f4ed646 100644 +index b5750a26185df8deed608e5d1bda8479d4a54aac..f64f3680ea16d3857db32eb2d8da8ffd3173bae1 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -3056,11 +3056,13 @@ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) { diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index e65fb2328402..93e8f6b5f9bb 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -42,7 +42,7 @@ index 65e627f2fa89352b0be27b5813d71a622bf1d326..113f4fd00f1cf994b39f64c9da387855 // another SiteInstance for the same site. void RegisterSiteInstance(SiteInstanceImpl* site_instance); diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc -index 615b50b53728a37e7a60247cd66213dd4d5811b0..500668cd676911ee3bc871eb3ff6b33a66d01c6a 100644 +index 6425cd2197aed8ff8b3a905ed5f6d38d92a27df7..c1d29c2684ed3d09ae12446e841c2c749c67c28a 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc @@ -1570,6 +1570,21 @@ void NavigationRequest::BeginNavigation() { @@ -67,7 +67,7 @@ index 615b50b53728a37e7a60247cd66213dd4d5811b0..500668cd676911ee3bc871eb3ff6b33a // Select an appropriate RenderFrameHost. std::string frame_host_choice_reason; render_frame_host_ = -@@ -5750,6 +5765,7 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { +@@ -5746,6 +5761,7 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { {WILL_START_REQUEST, { WILL_REDIRECT_REQUEST, WILL_PROCESS_RESPONSE, @@ -75,7 +75,7 @@ index 615b50b53728a37e7a60247cd66213dd4d5811b0..500668cd676911ee3bc871eb3ff6b33a READY_TO_COMMIT, DID_COMMIT, CANCELING, -@@ -5763,10 +5779,14 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { +@@ -5759,10 +5775,14 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const { WILL_FAIL_REQUEST, }}, {WILL_PROCESS_RESPONSE, { @@ -91,7 +91,7 @@ index 615b50b53728a37e7a60247cd66213dd4d5811b0..500668cd676911ee3bc871eb3ff6b33a NOT_STARTED, DID_COMMIT, diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h -index fb6af6129bee6cb74dc8f41de6ebe1931b13494f..ac0aa6c2a808b9b696e408701bd114f402099ffa 100644 +index f9428e4c272254e0ddd7e564ef8ad6ef6ef30575..f518415b564c066c21a113869987436e0ae1fa4d 100644 --- a/content/browser/renderer_host/navigation_request.h +++ b/content/browser/renderer_host/navigation_request.h @@ -139,6 +139,10 @@ class CONTENT_EXPORT NavigationRequest diff --git a/patches/chromium/mas_no_private_api.patch b/patches/chromium/mas_no_private_api.patch index 941d23bd9b52..0a623ebdef29 100644 --- a/patches/chromium/mas_no_private_api.patch +++ b/patches/chromium/mas_no_private_api.patch @@ -7,10 +7,10 @@ Guard usages in blink of private Mac APIs by MAS_BUILD, so they can be excluded for people who want to submit their apps to the Mac App store. diff --git a/content/browser/accessibility/accessibility_tree_formatter_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_mac.mm -index f0824ada891710245f5ff8278f27613165a5f6bf..b4a70a2cfc41957846d26bdeb586bf086cd315ca 100644 +index 1659e070cae733cf2213d752fcc262fb2bce2b54..57a3a34365f723b6e75a5f90d50533a45773e395 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_mac.mm +++ b/content/browser/accessibility/accessibility_tree_formatter_mac.mm -@@ -238,7 +238,7 @@ +@@ -261,7 +261,7 @@ return PopulateSize([value sizeValue]); } } @@ -19,7 +19,7 @@ index f0824ada891710245f5ff8278f27613165a5f6bf..b4a70a2cfc41957846d26bdeb586bf08 // AXTextMarker if (content::IsAXTextMarker(value)) { return PopulateTextPosition(content::AXTextMarkerToAXPosition(value), -@@ -249,6 +249,7 @@ +@@ -272,6 +272,7 @@ if (content::IsAXTextMarkerRange(value)) { return PopulateTextMarkerRange(value, line_indexer); } @@ -27,7 +27,7 @@ index f0824ada891710245f5ff8278f27613165a5f6bf..b4a70a2cfc41957846d26bdeb586bf08 // AXValue if (CFGetTypeID(value) == AXValueGetTypeID()) { -@@ -361,7 +362,7 @@ +@@ -384,7 +385,7 @@ kConstValuePrefix + affinity); return set; } @@ -36,7 +36,7 @@ index f0824ada891710245f5ff8278f27613165a5f6bf..b4a70a2cfc41957846d26bdeb586bf08 base::Value AccessibilityTreeFormatterMac::PopulateTextMarkerRange( id marker_range, const LineIndexer* line_indexer) const { -@@ -377,7 +378,7 @@ +@@ -400,7 +401,7 @@ PopulateTextPosition(ax_range.focus()->Clone(), line_indexer)); return dict; } @@ -82,10 +82,10 @@ index 88f339d1669436db9c1e4d048a46fc28038c83fe..2e194c5174c24552eb684faa339ad92b OptionalNSObject MakePairArray(const OptionalNSObject& obj1, const OptionalNSObject& obj2) { diff --git a/content/browser/accessibility/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h -index eff8d3fe2d47c519952e74ca2d6238ad39429d74..ef74a8983171bb720e4be7b1efa0b1350550727d 100644 +index a7d6351854d08926c4e9c43c95e9075bd4d4c728..9c89595cb6c37527b96b4afde387133349ec5999 100644 --- a/content/browser/accessibility/browser_accessibility_cocoa.h +++ b/content/browser/accessibility/browser_accessibility_cocoa.h -@@ -157,7 +157,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); +@@ -156,7 +156,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); @property(nonatomic, readonly) NSNumber* enabled; // Returns a text marker that points to the last character in the document that // can be selected with Voiceover. @@ -95,7 +95,7 @@ index eff8d3fe2d47c519952e74ca2d6238ad39429d74..ef74a8983171bb720e4be7b1efa0b135 @property(nonatomic, readonly) NSNumber* expanded; @property(nonatomic, readonly) NSNumber* focused; @property(nonatomic, readonly) NSNumber* grabbed; -@@ -169,7 +171,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); +@@ -168,7 +170,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); // Index of a row, column, or tree item. @property(nonatomic, readonly) NSNumber* index; @property(nonatomic, readonly) NSNumber* treeItemRowIndex; @@ -105,7 +105,7 @@ index eff8d3fe2d47c519952e74ca2d6238ad39429d74..ef74a8983171bb720e4be7b1efa0b135 @property(nonatomic, readonly) NSString* invalid; @property(nonatomic, readonly) NSNumber* isMultiSelectable; @property(nonatomic, readonly) NSString* placeholderValue; -@@ -192,14 +196,18 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); +@@ -191,14 +195,18 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker); // The object is selected as a whole. @property(nonatomic, readonly) NSNumber* selected; @property(nonatomic, readonly) NSArray* selectedChildren; diff --git a/patches/chromium/moves_background_color_setter_of_webview_to_blinks_webprefs_logic.patch b/patches/chromium/moves_background_color_setter_of_webview_to_blinks_webprefs_logic.patch index 3cca8dc28d27..129531d28732 100644 --- a/patches/chromium/moves_background_color_setter_of_webview_to_blinks_webprefs_logic.patch +++ b/patches/chromium/moves_background_color_setter_of_webview_to_blinks_webprefs_logic.patch @@ -12,7 +12,7 @@ Ideally we could add an embedder observer pattern here but that can be done in future work. diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc -index ba01fb7cbbff1535401cdc687570c9a86e2011dd..fdb61d9116a2822709e3fb3ea9c4803a8c99511d 100644 +index a802da73e37c772760ee989ceda943a7f3ab8d6b..7993fe5b4fb13db3a3493b7f536da1446740ce2d 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc @@ -154,6 +154,7 @@ diff --git a/patches/chromium/notification_provenance.patch b/patches/chromium/notification_provenance.patch index f0a91855caf7..305c868029bf 100644 --- a/patches/chromium/notification_provenance.patch +++ b/patches/chromium/notification_provenance.patch @@ -7,10 +7,10 @@ Pass RenderProcessHost through to PlatformNotificationService so Electron can identify which renderer a notification came from. diff --git a/content/browser/notifications/blink_notification_service_impl.cc b/content/browser/notifications/blink_notification_service_impl.cc -index deacfeefaa2fde66378fed29bb29d4bfbcaecf85..d13758a82dc0a809d0812f07caf79316b4b321b4 100644 +index 13faa9c4587faf1d75efd0b454d72386d78ecf08..703739cf8ee486a2dd1396e6275b5b7ae8f54ffb 100644 --- a/content/browser/notifications/blink_notification_service_impl.cc +++ b/content/browser/notifications/blink_notification_service_impl.cc -@@ -88,9 +88,11 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl( +@@ -87,9 +87,11 @@ BlinkNotificationServiceImpl::BlinkNotificationServiceImpl( PlatformNotificationContextImpl* notification_context, BrowserContext* browser_context, scoped_refptr service_worker_context, @@ -22,7 +22,7 @@ index deacfeefaa2fde66378fed29bb29d4bfbcaecf85..d13758a82dc0a809d0812f07caf79316 browser_context_(browser_context), service_worker_context_(std::move(service_worker_context)), origin_(origin), -@@ -151,8 +153,9 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( +@@ -150,8 +152,9 @@ void BlinkNotificationServiceImpl::DisplayNonPersistentNotification( notification_id, std::move(event_listener_remote)); GetNotificationService(browser_context_) @@ -108,7 +108,7 @@ index 60558d5f40b765ed3ca2f7d1abc1b95f7518fee9..ab44370dc89f64fe2b86089fd9781b71 mojo::PendingReceiver receiver); diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index 1b7c03f529ec864c9fb30887137b92317dcd1f11..bb60223620f6aab8d48db90ddc9f8b511834f692 100644 +index 4ad8b7863cb001c741e0947d1e1fd5b195e81b53..8c7c5e9b0ee97e2471718cd50d1b0e1eab718df9 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -2107,7 +2107,7 @@ void RenderProcessHostImpl::CreateNotificationService( @@ -154,10 +154,10 @@ index 1d8a0687f9ec7e7894c74ac94f1648ad3c1621c8..05450dbe825552e00136837ee4ec4e53 const GURL& origin, const blink::PlatformNotificationData& notification_data, diff --git a/content/test/mock_platform_notification_service.h b/content/test/mock_platform_notification_service.h -index caf6118cc1f0d99b054d2361648751be31368387..ea906b97850c676951a554af288845bb95d6e2a8 100644 +index d5d2a3b413dfe73bdf9f1a561d85482512fb2e37..c550def2a79a12b618f855816da50f9dfe3db0bb 100644 --- a/content/test/mock_platform_notification_service.h +++ b/content/test/mock_platform_notification_service.h -@@ -47,6 +47,7 @@ class MockPlatformNotificationService : public PlatformNotificationService { +@@ -46,6 +46,7 @@ class MockPlatformNotificationService : public PlatformNotificationService { // PlatformNotificationService implementation. void DisplayNotification( diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index 15b877eeb340..3935d125f1f5 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -333,10 +333,10 @@ index 9aa99b764ad8620ca82c511ac22a981141cdf15c..3b6e1d2609af952fa825688833387518 if (!cookie) { diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h -index 17d25f0008699ce41158424a9d266d22952ab631..d22f7f8c16ffbc90db57004f7fb09aab7034e2bf 100644 +index a96e5a33643e4f1b214bea6143d9e2744bb4e5c3..ccb9808bdb334a78ed7b64dd3030caff52055ad6 100644 --- a/chrome/browser/printing/print_view_manager_base.h +++ b/chrome/browser/printing/print_view_manager_base.h -@@ -39,6 +39,8 @@ class PrintJob; +@@ -38,6 +38,8 @@ class PrintJob; class PrintQueriesQueue; class PrinterQuery; @@ -345,7 +345,7 @@ index 17d25f0008699ce41158424a9d266d22952ab631..d22f7f8c16ffbc90db57004f7fb09aab // Base class for managing the print commands for a WebContents. class PrintViewManagerBase : public content::NotificationObserver, public PrintManager { -@@ -48,7 +50,10 @@ class PrintViewManagerBase : public content::NotificationObserver, +@@ -47,7 +49,10 @@ class PrintViewManagerBase : public content::NotificationObserver, // Prints the current document immediately. Since the rendering is // asynchronous, the actual printing will not be completed on the return of // this function. Returns false if printing is impossible at the moment. @@ -357,7 +357,7 @@ index 17d25f0008699ce41158424a9d266d22952ab631..d22f7f8c16ffbc90db57004f7fb09aab #if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Prints the document in |print_data| with settings specified in -@@ -215,9 +220,15 @@ class PrintViewManagerBase : public content::NotificationObserver, +@@ -214,9 +219,15 @@ class PrintViewManagerBase : public content::NotificationObserver, // The current RFH that is printing with a system printing dialog. content::RenderFrameHost* printing_rfh_ = nullptr; @@ -622,10 +622,10 @@ index 92561ff7c6bce6febd8cd2f39f59e3df707f8bdb..241686fa8bdc346f073b5fb92f57c72c std::unique_ptr settings = PrintSettingsFromJobSettings(job_settings); diff --git a/printing/printing_context.h b/printing/printing_context.h -index de7861c6c620f573c72f4bd5fd877b4e919dd97d..337dcddcf611fcf0238de26c4981c8e34d3f6eeb 100644 +index 0a9bf2b3a6c1f2417c550bb0f523491eccccb56b..a322f1897a69a8a8ca7c4bcb7a46b34726ff8127 100644 --- a/printing/printing_context.h +++ b/printing/printing_context.h -@@ -134,12 +134,12 @@ class PRINTING_EXPORT PrintingContext { +@@ -133,12 +133,12 @@ class PRINTING_EXPORT PrintingContext { int job_id() const { return job_id_; } diff --git a/patches/chromium/put_back_deleted_colors_for_autofill.patch b/patches/chromium/put_back_deleted_colors_for_autofill.patch index de85a16c0efc..e4c917b37740 100644 --- a/patches/chromium/put_back_deleted_colors_for_autofill.patch +++ b/patches/chromium/put_back_deleted_colors_for_autofill.patch @@ -8,7 +8,7 @@ needed in chromium but our autofill implementation uses them. This patch can be our autofill implementation to work like Chromium's. diff --git a/ui/gtk/native_theme_gtk.cc b/ui/gtk/native_theme_gtk.cc -index 5882e183ffd353890c367e3ff44937bb6226ff84..3f1b45f5b2e54ffaf1e47e93389b4a945867523f 100644 +index 8bcc5c175f63ea29d513d47dfea09ca3ac423545..d8b40ab1e35a93bc1a31c4735de29bb06ee40c8f 100644 --- a/ui/gtk/native_theme_gtk.cc +++ b/ui/gtk/native_theme_gtk.cc @@ -364,6 +364,29 @@ base::Optional SkColorFromColorId( diff --git a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch index 11ce44b05718..9a41479d35bf 100644 --- a/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch +++ b/patches/chromium/refactor_expose_cursor_changes_to_the_webcontentsobserver.patch @@ -43,7 +43,7 @@ index d98336a4b552290aff88a0c14321a58807c7eb05..fd3eac0706be719433257c218abe5402 void RenderWidgetHostImpl::ShowContextMenuAtPoint( diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 703f847c844fda3b9efbbd7ce28743c5a9d991a4..cd90a347277d1375251e4e4b9025ca1726010324 100644 +index 18564b3c0adbc8ecb5c930609204be207edfd3ea..cee5507c240fb859420eb74326e67c444c3a127c 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -4188,6 +4188,11 @@ TextInputManager* WebContentsImpl::GetTextInputManager() { diff --git a/patches/chromium/render_widget_host_view_base.patch b/patches/chromium/render_widget_host_view_base.patch index b0a02e3ad92d..94beb303fca7 100644 --- a/patches/chromium/render_widget_host_view_base.patch +++ b/patches/chromium/render_widget_host_view_base.patch @@ -24,10 +24,10 @@ index fd202aae99a908a6dc7be45ed620b6a77cba6af8..97d28c588a4779141215f768c0b36960 const blink::WebMouseEvent& event, const ui::LatencyInfo& latency) { diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h -index 868c503052ce7f144da067f98b5b06ea98aa541a..9c57e660cfed6922479ea647ea43c7745bd6bec8 100644 +index db55b0b8383cd9499c9f91d4b6a1f679c2103703..7176614b64ec192be45690f4ac1632028f6bf9d6 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h -@@ -26,8 +26,10 @@ +@@ -25,8 +25,10 @@ #include "components/viz/host/hit_test/hit_test_query.h" #include "content/browser/renderer_host/display_feature.h" #include "content/browser/renderer_host/event_with_latency_info.h" @@ -38,7 +38,7 @@ index 868c503052ce7f144da067f98b5b06ea98aa541a..9c57e660cfed6922479ea647ea43c774 #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/visibility.h" #include "content/public/common/widget_type.h" -@@ -66,9 +68,11 @@ class CursorManager; +@@ -65,9 +67,11 @@ class CursorManager; class MouseWheelPhaseHandler; class RenderWidgetHostImpl; class RenderWidgetHostViewBaseObserver; @@ -50,7 +50,7 @@ index 868c503052ce7f144da067f98b5b06ea98aa541a..9c57e660cfed6922479ea647ea43c774 class WebCursor; class WebContentsAccessibility; class DelegatedFrameHost; -@@ -124,6 +128,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { +@@ -123,6 +127,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { bool show_reason_unoccluded, bool show_reason_bfcache_restore) final; @@ -60,7 +60,7 @@ index 868c503052ce7f144da067f98b5b06ea98aa541a..9c57e660cfed6922479ea647ea43c774 // This only needs to be overridden by RenderWidgetHostViewBase subclasses // that handle content embedded within other RenderWidgetHostViews. gfx::PointF TransformPointToRootCoordSpaceF( -@@ -283,6 +290,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { +@@ -282,6 +289,11 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView { virtual void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency); diff --git a/patches/chromium/render_widget_host_view_mac.patch b/patches/chromium/render_widget_host_view_mac.patch index ff694cb8b3b5..c65978e87dc4 100644 --- a/patches/chromium/render_widget_host_view_mac.patch +++ b/patches/chromium/render_widget_host_view_mac.patch @@ -10,7 +10,7 @@ kinds of utility windows. Similarly for `disableAutoHideCursor`. Additionally, disables usage of some private APIs in MAS builds. diff --git a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm -index cb8d2b79fd15c0178feedc6e4be1c5150d8e5d47..62f536126e6fd4335072172fa58dcf71837b4b98 100644 +index 86c10b377aafd4c3741900c112d94107ed841903..32fa5f0e099fab418344be1b939fd2f286b20999 100644 --- a/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm +++ b/content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm @@ -153,6 +153,15 @@ void ExtractUnderlines(NSAttributedString* string, @@ -29,7 +29,7 @@ index cb8d2b79fd15c0178feedc6e4be1c5150d8e5d47..62f536126e6fd4335072172fa58dcf71 // These are not documented, so use only after checking -respondsToSelector:. @interface NSApplication (UndocumentedSpeechMethods) - (void)speakString:(NSString*)string; -@@ -571,6 +580,9 @@ - (BOOL)acceptsMouseEventsWhenInactive { +@@ -575,6 +584,9 @@ - (BOOL)acceptsMouseEventsWhenInactive { } - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent { @@ -39,7 +39,7 @@ index cb8d2b79fd15c0178feedc6e4be1c5150d8e5d47..62f536126e6fd4335072172fa58dcf71 return [self acceptsMouseEventsWhenInactive]; } -@@ -646,6 +658,10 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent { +@@ -650,6 +662,10 @@ - (BOOL)shouldIgnoreMouseEvent:(NSEvent*)theEvent { // its parent view. BOOL hitSelf = NO; while (view) { @@ -50,7 +50,7 @@ index cb8d2b79fd15c0178feedc6e4be1c5150d8e5d47..62f536126e6fd4335072172fa58dcf71 if (view == self) hitSelf = YES; if ([view isKindOfClass:[self class]] && ![view isEqual:self] && -@@ -999,6 +1015,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { +@@ -1003,6 +1019,10 @@ - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv { eventType == NSKeyDown && !(modifierFlags & NSCommandKeyMask); @@ -61,7 +61,7 @@ index cb8d2b79fd15c0178feedc6e4be1c5150d8e5d47..62f536126e6fd4335072172fa58dcf71 // We only handle key down events and just simply forward other events. if (eventType != NSKeyDown) { _hostHelper->ForwardKeyboardEvent(event, latency_info); -@@ -1727,9 +1747,11 @@ - (NSAccessibilityRole)accessibilityRole { +@@ -1731,9 +1751,11 @@ - (NSAccessibilityRole)accessibilityRole { // Since this implementation doesn't have to wait any IPC calls, this doesn't // make any key-typing jank. --hbono 7/23/09 // @@ -73,7 +73,7 @@ index cb8d2b79fd15c0178feedc6e4be1c5150d8e5d47..62f536126e6fd4335072172fa58dcf71 - (NSArray*)validAttributesForMarkedText { // This code is just copied from WebKit except renaming variables. -@@ -1738,7 +1760,10 @@ - (NSArray*)validAttributesForMarkedText { +@@ -1742,7 +1764,10 @@ - (NSArray*)validAttributesForMarkedText { initWithObjects:NSUnderlineStyleAttributeName, NSUnderlineColorAttributeName, NSMarkedClauseSegmentAttributeName, diff --git a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch b/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch index 687bf4e45b95..0016796c61d8 100644 --- a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch +++ b/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch @@ -39,10 +39,10 @@ index 08dda0d5779cefcc0aa2d7d691d8f84137975b5e..d3439ac00ea7e58c2eee210831d38bb8 WebLocalFrame* frame, ui::PageTransition transition_type, diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h -index 0340221d15b589505065c287012a9aa8367d7301..e68ca8f3978a339e4deef2d91794b139e20c6907 100644 +index 4fb3926576c80881a9230bb91bfe7655fec12df1..988769f833354d16b68dd9ace603d17e157a666a 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h -@@ -122,6 +122,11 @@ class ChromeContentRendererClient +@@ -121,6 +121,11 @@ class ChromeContentRendererClient base::SingleThreadTaskRunner* compositor_thread_task_runner) override; bool RunIdleHandlerWhenWidgetsHidden() override; bool AllowPopup() override; @@ -74,10 +74,10 @@ index 9745f3208baaf1654c8386c11067958c0e47fd28..8ebebd91eb1216d5ccb4dd31dad0b977 blink::WebLocalFrame* frame, ui::PageTransition transition_type, diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index 04ef16a04e8597d49e1730b9ea11191e350d63d1..5735c09a753c5aaffe4bb75efe2a5bb7b0672ed6 100644 +index f259835ef4cabb8923f8b0fe9b3f6ae8f2b2b79f..205685f200d54e53829ddc29de3bc07e24ea13b1 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -208,6 +208,13 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -207,6 +207,13 @@ class CONTENT_EXPORT ContentRendererClient { bool is_redirect); #endif @@ -92,10 +92,10 @@ index 04ef16a04e8597d49e1730b9ea11191e350d63d1..5735c09a753c5aaffe4bb75efe2a5bb7 // |url|. If the function returns a valid |new_url|, the request must be // updated to use it. diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc -index 2d6f936ade9cb1baceeea038df48e92f4ab3783a..43e20435b41c2d682a361ff4f0681081bcf4eab0 100644 +index be3779de84dbda14c3425c5115da78ab703e9cfb..6dfa89f3117cb7b0165c352feb79e95b4a315061 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc -@@ -5347,6 +5347,23 @@ void RenderFrameImpl::BeginNavigation( +@@ -5346,6 +5346,23 @@ void RenderFrameImpl::BeginNavigation( // we can do a per-frame check here rather than a process-wide check. bool should_fork = HasWebUIScheme(url) || HasWebUIScheme(old_url) || (enabled_bindings_ & kWebUIBindingsPolicyMask); diff --git a/patches/chromium/scroll_bounce_flag.patch b/patches/chromium/scroll_bounce_flag.patch index cc47c65dac82..0100bfb8f4fd 100644 --- a/patches/chromium/scroll_bounce_flag.patch +++ b/patches/chromium/scroll_bounce_flag.patch @@ -6,10 +6,10 @@ Subject: scroll_bounce_flag.patch Patch to make scrollBounce option work. diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc -index 33e17936aa5410cf4074d19593949798db90d40e..47b32784f4299595891c35234045cb3d4939039f 100644 +index cac1c3290fb78457057f0e557ca35b49719c8bbd..173d78a5f2aa9b1c0da1f0916e7658b392f4c71a 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc -@@ -1268,7 +1268,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { +@@ -1267,7 +1267,7 @@ bool RenderThreadImpl::IsLcdTextEnabled() { } bool RenderThreadImpl::IsElasticOverscrollEnabled() { diff --git a/patches/chromium/support_mixed_sandbox_with_zygote.patch b/patches/chromium/support_mixed_sandbox_with_zygote.patch index 31a1c014d93e..6f27572e17f6 100644 --- a/patches/chromium/support_mixed_sandbox_with_zygote.patch +++ b/patches/chromium/support_mixed_sandbox_with_zygote.patch @@ -22,7 +22,7 @@ However, the patch would need to be reviewed by the security team, as it does touch a security-sensitive class. diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc -index bb60223620f6aab8d48db90ddc9f8b511834f692..24c3f7991246985947e567d90779ecb9416c8686 100644 +index 8c7c5e9b0ee97e2471718cd50d1b0e1eab718df9..ae1aed1f26ae6202b4709a1931c48c55e3fae956 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -392,10 +392,18 @@ class RendererSandboxedProcessLauncherDelegate diff --git a/patches/chromium/web_contents.patch b/patches/chromium/web_contents.patch index a395d40cab54..cdb4be2456b8 100644 --- a/patches/chromium/web_contents.patch +++ b/patches/chromium/web_contents.patch @@ -9,7 +9,7 @@ is needed for OSR. Originally landed in https://github.com/electron/libchromiumcontent/pull/226. diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc -index 53f48964e6dfd0fb9b91762760b59a006ac7cc0c..ce9d64d9770e53e501d561af25094dd8f79bf331 100644 +index 3311b6110666851b3946ebf8071f210752425695..b5750a26185df8deed608e5d1bda8479d4a54aac 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -2764,6 +2764,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { @@ -34,10 +34,10 @@ index 53f48964e6dfd0fb9b91762760b59a006ac7cc0c..ce9d64d9770e53e501d561af25094dd8 CHECK(view_.get()); diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h -index 7c81ae0070db8d4ed8712efc56a6af7d3f6261cf..b46afaac2bfbf349e759522498a1cfd6f53091c5 100644 +index b48367e41a8d4f0fa73dd33103e5eb796d8880a9..d6833aeaa09af7d0ec6937db7a1cca051aebe43e 100644 --- a/content/public/browser/web_contents.h +++ b/content/public/browser/web_contents.h -@@ -88,8 +88,11 @@ class BrowserContext; +@@ -87,8 +87,11 @@ class BrowserContext; class BrowserPluginGuestDelegate; class RenderFrameHost; class RenderViewHost; @@ -49,7 +49,7 @@ index 7c81ae0070db8d4ed8712efc56a6af7d3f6261cf..b46afaac2bfbf349e759522498a1cfd6 class WebUI; struct DropData; struct MHTMLGenerationParams; -@@ -229,6 +232,10 @@ class WebContents : public PageNavigator, +@@ -228,6 +231,10 @@ class WebContents : public PageNavigator, // Sandboxing flags set on the new WebContents. network::mojom::WebSandboxFlags starting_sandbox_flags; diff --git a/patches/chromium/worker_context_will_destroy.patch b/patches/chromium/worker_context_will_destroy.patch index a0e2ad1b25f1..81a54997555e 100644 --- a/patches/chromium/worker_context_will_destroy.patch +++ b/patches/chromium/worker_context_will_destroy.patch @@ -10,10 +10,10 @@ An attempt to upstream this was made, but rejected: https://chromium-review.googlesource.com/c/chromium/src/+/1954347 diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index bf03da5697646830ded4210544700faafb4f686f..04ef16a04e8597d49e1730b9ea11191e350d63d1 100644 +index f84df6e5816063072c7e32afcd90e7d590b83974..f259835ef4cabb8923f8b0fe9b3f6ae8f2b2b79f 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -372,6 +372,11 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -371,6 +371,11 @@ class CONTENT_EXPORT ContentRendererClient { virtual void DidInitializeWorkerContextOnWorkerThread( v8::Local context) {} diff --git a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch index 769a7e8eb7b5..0d3511dda94d 100644 --- a/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch +++ b/patches/chromium/worker_feat_add_hook_to_notify_script_ready.patch @@ -19,10 +19,10 @@ that clearly establishes the worker script is ready for evaluation with the scop initialized. diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h -index 5735c09a753c5aaffe4bb75efe2a5bb7b0672ed6..a4a014778522a685c62c73e751f74d5f647d3aff 100644 +index 205685f200d54e53829ddc29de3bc07e24ea13b1..31656a92b1e0be23ffc4f4fc3d1ba303c76ba234 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h -@@ -379,6 +379,11 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -378,6 +378,11 @@ class CONTENT_EXPORT ContentRendererClient { virtual void DidInitializeWorkerContextOnWorkerThread( v8::Local context) {} diff --git a/patches/v8/add_realloc.patch b/patches/v8/add_realloc.patch index 0bc27acc1a63..f4be06560fd6 100644 --- a/patches/v8/add_realloc.patch +++ b/patches/v8/add_realloc.patch @@ -12,7 +12,7 @@ when we override ReallocateBufferMemory, so we therefore need to implement Realloc on the v8 side. diff --git a/include/v8.h b/include/v8.h -index fb53ca0b8a14f0f7c6e48e149c84fcfe3709fa12..289e2e7f2e4767aa8476126739dfcb7b8d71b401 100644 +index 2947cd8f5472cbc48d639ff4d93757fc77fde96b..5e2fe09afb714920fefefe5c51a62af82c4b27f7 100644 --- a/include/v8.h +++ b/include/v8.h @@ -5373,6 +5373,13 @@ class V8_EXPORT ArrayBuffer : public Object { @@ -30,7 +30,7 @@ index fb53ca0b8a14f0f7c6e48e149c84fcfe3709fa12..289e2e7f2e4767aa8476126739dfcb7b * Free the memory block of size |length|, pointed to by |data|. * That memory is guaranteed to be previously allocated by |Allocate|. diff --git a/src/api/api.cc b/src/api/api.cc -index 335c161672e4d596dc87a80376330a03f295788f..2ee0731218f8565e48af4e37745ad95e914dfdf0 100644 +index acf8d69388c1e6ae6ed60d82bcc0b1f0ee5516cb..37a112d52ddf96dabd581a6053bc33082458a3fc 100644 --- a/src/api/api.cc +++ b/src/api/api.cc @@ -320,6 +320,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { diff --git a/patches/v8/build_gn.patch b/patches/v8/build_gn.patch index 5618848f69b5..98a81fb5253d 100644 --- a/patches/v8/build_gn.patch +++ b/patches/v8/build_gn.patch @@ -9,10 +9,10 @@ necessary for native modules to load. Also, some fixes relating to mksnapshot on ARM. diff --git a/BUILD.gn b/BUILD.gn -index b713df86b88286ce146e195d303483595bf22537..6e4ca3ff5f01adc9821d13650715b292b9a204b8 100644 +index 82151b6d1fef24c02eaf6048908b3399c4442946..4be98113938ca2e688f5f1e69dc1bfdb94501059 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -450,7 +450,7 @@ config("internal_config") { +@@ -453,7 +453,7 @@ config("internal_config") { ":cppgc_header_features", ] @@ -21,7 +21,7 @@ index b713df86b88286ce146e195d303483595bf22537..6e4ca3ff5f01adc9821d13650715b292 defines += [ "BUILDING_V8_SHARED" ] } } -@@ -5049,7 +5049,7 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -5057,7 +5057,7 @@ if (current_toolchain == v8_generator_toolchain) { "src/interpreter/bytecodes.h", ] @@ -30,7 +30,7 @@ index b713df86b88286ce146e195d303483595bf22537..6e4ca3ff5f01adc9821d13650715b292 deps = [ ":v8_libbase", -@@ -5087,6 +5087,8 @@ if (current_toolchain == v8_snapshot_toolchain) { +@@ -5095,6 +5095,8 @@ if (current_toolchain == v8_snapshot_toolchain) { configs = [ ":internal_config" ] diff --git a/patches/v8/dcheck.patch b/patches/v8/dcheck.patch index 6b88bd650109..31455d602519 100644 --- a/patches/v8/dcheck.patch +++ b/patches/v8/dcheck.patch @@ -6,10 +6,10 @@ Subject: dcheck.patch https://github.com/auchenberg/volkswagen diff --git a/src/api/api.cc b/src/api/api.cc -index 2ee0731218f8565e48af4e37745ad95e914dfdf0..26b4aa9b364524664d78d6ceaa0d342887bcfa27 100644 +index 37a112d52ddf96dabd581a6053bc33082458a3fc..2c12f19b287cf5e3c5aaa04d339f2301e1e57c47 100644 --- a/src/api/api.cc +++ b/src/api/api.cc -@@ -8917,7 +8917,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { +@@ -8615,7 +8615,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { } void Isolate::PerformMicrotaskCheckpoint() { diff --git a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch index 1530861a6542..fbab7c262a5f 100644 --- a/patches/v8/do_not_export_private_v8_symbols_on_windows.patch +++ b/patches/v8/do_not_export_private_v8_symbols_on_windows.patch @@ -12,10 +12,10 @@ This patch can be safely removed if, when it is removed, `node.lib` does not contain any standard C++ library exports (e.g. `std::ostringstream`). diff --git a/BUILD.gn b/BUILD.gn -index 27125e6525139c6aa39278ab1a52b7befd4ea108..e948fc4bbb99e204bf2a91592f588a3fc41d7761 100644 +index b1c9106a65eeb468a3cf5d11b0a88e50c7d1a6be..5eb0fd274fcc94af41abb5ad95856f98643c7bc1 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -450,6 +450,10 @@ config("internal_config") { +@@ -453,6 +453,10 @@ config("internal_config") { ":cppgc_header_features", ] diff --git a/patches/v8/expose_mksnapshot.patch b/patches/v8/expose_mksnapshot.patch index 87581a8fc876..4d0a66c62882 100644 --- a/patches/v8/expose_mksnapshot.patch +++ b/patches/v8/expose_mksnapshot.patch @@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch Needed in order to target mksnapshot for mksnapshot zip. diff --git a/BUILD.gn b/BUILD.gn -index 6e4ca3ff5f01adc9821d13650715b292b9a204b8..27125e6525139c6aa39278ab1a52b7befd4ea108 100644 +index 4be98113938ca2e688f5f1e69dc1bfdb94501059..b1c9106a65eeb468a3cf5d11b0a88e50c7d1a6be 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -5061,7 +5061,6 @@ if (current_toolchain == v8_generator_toolchain) { +@@ -5069,7 +5069,6 @@ if (current_toolchain == v8_generator_toolchain) { if (current_toolchain == v8_snapshot_toolchain) { v8_executable("mksnapshot") { From b15b820bca25712f58601c902fc3b2442c959574 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 10:01:47 -0400 Subject: [PATCH 40/85] 2743594: Remove WebSize from blink. https://chromium-review.googlesource.com/c/chromium/src/+/2743594 --- shell/common/gin_converters/blink_converter.cc | 10 ---------- shell/common/gin_converters/blink_converter.h | 7 ------- 2 files changed, 17 deletions(-) diff --git a/shell/common/gin_converters/blink_converter.cc b/shell/common/gin_converters/blink_converter.cc index e0316bab0cee..490e08def209 100644 --- a/shell/common/gin_converters/blink_converter.cc +++ b/shell/common/gin_converters/blink_converter.cc @@ -23,7 +23,6 @@ #include "third_party/blink/public/common/input/web_mouse_event.h" #include "third_party/blink/public/common/input/web_mouse_wheel_event.h" #include "third_party/blink/public/common/widget/device_emulation_params.h" -#include "third_party/blink/public/platform/web_size.h" #include "ui/base/clipboard/clipboard.h" #include "ui/events/blink/blink_event_util.h" #include "ui/events/keycodes/dom/keycode_converter.h" @@ -285,15 +284,6 @@ bool Converter::FromV8( return true; } -bool Converter::FromV8(v8::Isolate* isolate, - v8::Local val, - blink::WebSize* out) { - gin_helper::Dictionary dict; - if (!ConvertFromV8(isolate, val, &dict)) - return false; - return dict.Get("width", &out->width) && dict.Get("height", &out->height); -} - bool Converter::FromV8( v8::Isolate* isolate, v8::Local val, diff --git a/shell/common/gin_converters/blink_converter.h b/shell/common/gin_converters/blink_converter.h index 0ece2fb2e5aa..9f170bb42ac2 100644 --- a/shell/common/gin_converters/blink_converter.h +++ b/shell/common/gin_converters/blink_converter.h @@ -52,13 +52,6 @@ struct Converter { blink::WebMouseWheelEvent* out); }; -template <> -struct Converter { - static bool FromV8(v8::Isolate* isolate, - v8::Local val, - blink::WebSize* out); -}; - template <> struct Converter { static bool FromV8(v8::Isolate* isolate, From 185c343b2276308c198d3d0f7cce9a56f6a6cbeb Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 10:12:15 -0400 Subject: [PATCH 41/85] 2725403: Add URLLoaderClient::OnReceiveEarlyHints() https://chromium-review.googlesource.com/c/chromium/src/+/2725403 --- shell/browser/net/proxying_url_loader_factory.cc | 4 ++++ shell/browser/net/proxying_url_loader_factory.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/shell/browser/net/proxying_url_loader_factory.cc b/shell/browser/net/proxying_url_loader_factory.cc index b63960c11008..ca58e0a59ac2 100644 --- a/shell/browser/net/proxying_url_loader_factory.cc +++ b/shell/browser/net/proxying_url_loader_factory.cc @@ -240,6 +240,10 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse( } } +void OnReceiveEarlyHints(network::mojom::EarlyHintsPtr early_hints) { + target_client_->OnReceiveEarlyHints(std::move(early_hints)); +} + void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveRedirect( const net::RedirectInfo& redirect_info, network::mojom::URLResponseHeadPtr head) { diff --git a/shell/browser/net/proxying_url_loader_factory.h b/shell/browser/net/proxying_url_loader_factory.h index 6980890ac391..2ea819dd50ea 100644 --- a/shell/browser/net/proxying_url_loader_factory.h +++ b/shell/browser/net/proxying_url_loader_factory.h @@ -74,6 +74,8 @@ class ProxyingURLLoaderFactory // network::mojom::URLLoaderClient: void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override; + void OnReceiveEarlyHints( + network::mojom::EarlyHintsPtr early_hints) override; void OnReceiveRedirect(const net::RedirectInfo& redirect_info, network::mojom::URLResponseHeadPtr head) override; void OnUploadProgress(int64_t current_position, From 88bbe2a352d39b0c757d71eb6bfbb85008f48c58 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 10:27:05 -0400 Subject: [PATCH 42/85] 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer. https://chromium-review.googlesource.com/c/chromium/src/+/2651385 --- shell/browser/electron_browser_context.cc | 4 +--- shell/browser/net/network_context_service.cc | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/shell/browser/electron_browser_context.cc b/shell/browser/electron_browser_context.cc index 97b4cc29b4f7..810d7dba8fe4 100644 --- a/shell/browser/electron_browser_context.cc +++ b/shell/browser/electron_browser_context.cc @@ -108,9 +108,7 @@ ElectronBrowserContext::ElectronBrowserContext(const std::string& partition, : storage_policy_(new SpecialStoragePolicy), protocol_registry_(new ProtocolRegistry), in_memory_(in_memory), - ssl_config_(network::mojom::SSLConfig::New()), - shared_cors_origin_access_list_( - content::SharedCorsOriginAccessList::Create()) { + ssl_config_(network::mojom::SSLConfig::New())) { user_agent_ = ElectronBrowserClient::Get()->GetUserAgent(); // Read options. diff --git a/shell/browser/net/network_context_service.cc b/shell/browser/net/network_context_service.cc index a99cdb99eb2a..a1ee1d2dc381 100644 --- a/shell/browser/net/network_context_service.cc +++ b/shell/browser/net/network_context_service.cc @@ -44,7 +44,7 @@ void NetworkContextService::ConfigureNetworkContextParams( network_context_params->user_agent = browser_context_->GetUserAgent(); network_context_params->cors_origin_access_list = - browser_context_->GetSharedCorsOriginAccessList() + content::BrowserContext::GetSharedCorsOriginAccessList(browser_context_) ->GetOriginAccessList() .CreateCorsOriginAccessPatternsList(); From 3010dd93e384ecc245aff7600d331fbf877fdcdc Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 10:28:55 -0400 Subject: [PATCH 43/85] 2721718: Move HostID to extensions::mojom::HostID https://chromium-review.googlesource.com/c/chromium/src/+/2721718 --- shell/browser/extensions/api/tabs/tabs_api.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shell/browser/extensions/api/tabs/tabs_api.cc b/shell/browser/extensions/api/tabs/tabs_api.cc index ffc0124cff17..1c464deb04c2 100644 --- a/shell/browser/extensions/api/tabs/tabs_api.cc +++ b/shell/browser/extensions/api/tabs/tabs_api.cc @@ -10,6 +10,7 @@ #include "extensions/browser/extension_api_frame_id_map.h" #include "extensions/common/error_utils.h" #include "extensions/common/manifest_constants.h" +#include "extensions/common/mojom/host_id.mojom.h" #include "extensions/common/permissions/permissions_data.h" #include "shell/browser/api/electron_api_web_contents.h" #include "shell/browser/web_contents_zoom_controller.h" @@ -84,7 +85,8 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() { execute_tab_id_ = tab_id; details_ = std::move(details); - set_host_id(HostID(HostID::EXTENSIONS, extension()->id())); + set_host_id( + mojom::HostID(mojom::HostID::HostType::kExtensions, extension->id())); return set_init_result(SUCCESS); } From d54bee03d00ba3b1912d8705c35e220ee263b769 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 10:36:38 -0400 Subject: [PATCH 44/85] 2733070: Rename observer to URLLoaderNetworkServiceObserver https://chromium-review.googlesource.com/c/chromium/src/+/2733070 --- shell/browser/electron_browser_context.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/browser/electron_browser_context.cc b/shell/browser/electron_browser_context.cc index 810d7dba8fe4..bc5742f9f323 100644 --- a/shell/browser/electron_browser_context.cc +++ b/shell/browser/electron_browser_context.cc @@ -352,8 +352,8 @@ ElectronBrowserContext::GetURLLoaderFactory() { auto* storage_partition = content::BrowserContext::GetDefaultStoragePartition(this); - params->auth_cert_observer = - storage_partition->CreateAuthAndCertObserverForNavigationRequest(-1); + params->url_loader_network_observer = + storage_partition->CreateURLLoaderNetworkObserverForNavigationRequest(-1); storage_partition->GetNetworkContext()->CreateURLLoaderFactory( std::move(factory_receiver), std::move(params)); url_loader_factory_ = From 5fc298ee5f80c1c2be42c89eae9da4de97a3b858 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 10:45:47 -0400 Subject: [PATCH 45/85] Use nogncheck for content/browser/site_instance_impl.h This is needed because //content/browser:browser is not a visible target --- shell/browser/electron_browser_client.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 8e84daf1470d..8d4234ef808f 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -30,6 +30,7 @@ #include "chrome/common/chrome_version.h" #include "components/net_log/chrome_net_log.h" #include "components/network_hints/common/network_hints.mojom.h" +#include "content/browser/site_instance_impl.h" // nogncheck #include "content/public/browser/browser_main_runner.h" #include "content/public/browser/browser_ppapi_host.h" #include "content/public/browser/browser_task_traits.h" From 2cd53eb46a100ea3e6d168af7f0534c73f6ee032 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 10:59:05 -0400 Subject: [PATCH 46/85] 2648046: Introduce alert notification helper .app https://chromium-review.googlesource.com/c/chromium/src/+/2648046 --- BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.gn b/BUILD.gn index ed353ff671e7..53a04bfd6e52 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -619,6 +619,7 @@ source_set("electron_lib") { "shell/renderer/printing/print_render_frame_helper_delegate.h", ] deps += [ + "//chrome/services/mac_notifications/public/mojom", "//chrome/services/printing/public/mojom", "//components/printing/common:mojo_interfaces", ] From f1bb6be4b91f636a6a6298b7352823b01eb4c48b Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 11:17:38 -0400 Subject: [PATCH 47/85] 2752406: [LSC] Replace base::string16 with std::u16string in //ui https://chromium-review.googlesource.com/c/chromium/src/+/2752406 --- patches/chromium/accelerator.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/chromium/accelerator.patch b/patches/chromium/accelerator.patch index d3caffd5f54f..593215e83ccf 100644 --- a/patches/chromium/accelerator.patch +++ b/patches/chromium/accelerator.patch @@ -10,7 +10,7 @@ This patch makes three changes to Accelerator::GetShortcutText to improve shortc 3. Ctrl-Shift-= should show as Ctrl-+ diff --git a/ui/base/accelerators/accelerator.cc b/ui/base/accelerators/accelerator.cc -index 1a2a154b743cd4ecccf1be9971f36896e982dc6e..b5cec83c479dfa584f496f1f73a81e8b9f64d08c 100644 +index 1a2a154b743cd4ecccf1be9971f36896e982dc6e..f28a557ccc96c25fc4a93dca216e3184b88cbf8d 100644 --- a/ui/base/accelerators/accelerator.cc +++ b/ui/base/accelerators/accelerator.cc @@ -12,6 +12,7 @@ @@ -41,7 +41,7 @@ index 1a2a154b743cd4ecccf1be9971f36896e982dc6e..b5cec83c479dfa584f496f1f73a81e8b + UsLayoutKeyboardCodeToDomCode(key_code_), flags); + if (c != 0) { + shortcut = -+ static_cast( ++ static_cast( + base::ToUpperASCII(static_cast(c))); + } #if defined(OS_WIN) From 3160e608e23c98db9206b5fff340f44a9f1b1e5d Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 11:41:00 -0400 Subject: [PATCH 48/85] only include mac notifications on mac --- BUILD.gn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index 53a04bfd6e52..c206e1e5775c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -619,10 +619,12 @@ source_set("electron_lib") { "shell/renderer/printing/print_render_frame_helper_delegate.h", ] deps += [ - "//chrome/services/mac_notifications/public/mojom", "//chrome/services/printing/public/mojom", "//components/printing/common:mojo_interfaces", ] + if (is_mac) { + deps += [ "//chrome/services/mac_notifications/public/mojom" ] + } } if (enable_electron_extensions) { From 86d23cee40f2ce4cbf3b4ceaae684c3791c7b22d Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 12:05:15 -0400 Subject: [PATCH 49/85] add additional skipping of atk toolchain check --- patches/chromium/skip_atk_toolchain_check.patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/patches/chromium/skip_atk_toolchain_check.patch b/patches/chromium/skip_atk_toolchain_check.patch index c43c307f0155..f1067bf2ada7 100644 --- a/patches/chromium/skip_atk_toolchain_check.patch +++ b/patches/chromium/skip_atk_toolchain_check.patch @@ -33,3 +33,15 @@ index bc8e27894732a6d3e834d6b21f00441eca02dd63..f7381c1d5b5842521e0c35476ae468ab if (use_atk) { assert(use_glib, "use_atk=true requires that use_glib=true") +diff --git a/build/config/linux/atspi2/BUILD.gn b/build/config/linux/atspi2/BUILD.gn +index 988a9956813617456ee1945de8e857d43543e411..e6e17e9e8f5ff99404b52c0a42d508f97c61e7fc 100644 +--- a/build/config/linux/atspi2/BUILD.gn ++++ b/build/config/linux/atspi2/BUILD.gn +@@ -6,7 +6,6 @@ import("//build/config/linux/pkg_config.gni") + import("//build/config/ui.gni") + + # These packages should _only_ be expected when building for a target. +-assert(current_toolchain == default_toolchain) + + if (use_atk) { + pkg_config("atspi2") { From 22d8f22cfb698e9cd8667cdf14b1d68b76df8d4e Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 12:18:45 -0400 Subject: [PATCH 50/85] 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" https://chromium-review.googlesource.com/c/chromium/src/+/2757472 --- .../browser/certificate_manager_model.cc | 2 +- .../browser/certificate_manager_model.h | 2 +- shell/app/electron_content_client.cc | 2 +- shell/app/electron_content_client.h | 2 +- shell/browser/api/electron_api_app.cc | 2 +- shell/browser/api/electron_api_base_window.cc | 6 +- .../api/electron_api_browser_window.cc | 2 +- .../browser/api/electron_api_browser_window.h | 2 +- shell/browser/api/electron_api_menu.cc | 22 ++-- shell/browser/api/electron_api_menu.h | 22 ++-- .../browser/api/electron_api_notification.cc | 36 +++--- shell/browser/api/electron_api_notification.h | 56 ++++----- shell/browser/api/electron_api_url_loader.cc | 2 +- .../browser/api/electron_api_web_contents.cc | 26 ++--- shell/browser/api/electron_api_web_contents.h | 14 +-- .../api/electron_api_web_frame_main.cc | 2 +- .../browser/api/electron_api_web_frame_main.h | 2 +- shell/browser/browser.h | 24 ++-- shell/browser/browser_linux.cc | 4 +- shell/browser/browser_mac.mm | 14 +-- shell/browser/browser_win.cc | 106 +++++++++--------- shell/browser/electron_autofill_driver.cc | 4 +- shell/browser/electron_autofill_driver.h | 4 +- shell/browser/electron_browser_client.cc | 2 +- shell/browser/electron_browser_main_parts.cc | 4 +- .../electron_javascript_dialog_manager.cc | 14 +-- .../electron_javascript_dialog_manager.h | 4 +- .../browser/extended_web_contents_observer.h | 2 +- .../electron_management_api_delegate.cc | 2 +- .../electron_management_api_delegate.h | 2 +- shell/browser/file_select_helper.cc | 2 +- shell/browser/font_defaults.cc | 8 +- shell/browser/lib/bluetooth_chooser.cc | 2 +- shell/browser/lib/bluetooth_chooser.h | 6 +- shell/browser/login_handler.cc | 2 +- shell/browser/native_window.cc | 2 +- shell/browser/native_window.h | 4 +- shell/browser/native_window_observer.h | 2 +- shell/browser/native_window_views.cc | 2 +- shell/browser/native_window_views.h | 2 +- shell/browser/notifications/notification.h | 22 ++-- .../win/notification_presenter_win.cc | 2 +- .../win/notification_presenter_win.h | 2 +- .../osr/osr_render_widget_host_view.cc | 2 +- .../browser/osr/osr_render_widget_host_view.h | 2 +- shell/browser/osr/osr_web_contents_view.cc | 2 +- shell/browser/osr/osr_web_contents_view.h | 2 +- shell/browser/ui/autofill_popup.cc | 8 +- shell/browser/ui/autofill_popup.h | 12 +- .../ui/cocoa/electron_menu_controller.mm | 10 +- shell/browser/ui/electron_menu_model.cc | 18 +-- shell/browser/ui/electron_menu_model.h | 18 +-- shell/browser/ui/gtk/app_indicator_icon.cc | 4 +- shell/browser/ui/gtk/app_indicator_icon.h | 4 +- shell/browser/ui/gtk/gtk_status_icon.cc | 4 +- shell/browser/ui/gtk/gtk_status_icon.h | 4 +- shell/browser/ui/gtk/status_icon.cc | 2 +- shell/browser/ui/gtk/status_icon.h | 2 +- shell/browser/ui/inspectable_web_contents.cc | 8 +- shell/browser/ui/inspectable_web_contents.h | 4 +- .../ui/inspectable_web_contents_view.h | 2 +- .../ui/inspectable_web_contents_view_mac.h | 2 +- .../ui/inspectable_web_contents_view_mac.mm | 2 +- shell/browser/ui/message_box.h | 2 +- shell/browser/ui/message_box_gtk.cc | 2 +- shell/browser/ui/message_box_mac.mm | 2 +- shell/browser/ui/message_box_win.cc | 30 ++--- shell/browser/ui/tray_icon.h | 4 +- shell/browser/ui/tray_icon_gtk.cc | 2 +- shell/browser/ui/tray_icon_gtk.h | 4 +- shell/browser/ui/views/autofill_popup_view.h | 4 +- .../ui/views/electron_views_delegate.cc | 4 +- .../ui/views/electron_views_delegate.h | 4 +- shell/browser/ui/views/global_menu_bar_x11.cc | 2 +- .../inspectable_web_contents_view_views.cc | 4 +- .../inspectable_web_contents_view_views.h | 6 +- shell/browser/ui/views/menu_delegate.cc | 2 +- shell/browser/ui/views/menu_delegate.h | 2 +- shell/browser/ui/views/submenu_button.cc | 8 +- shell/browser/ui/views/submenu_button.h | 6 +- shell/browser/ui/win/jump_list.cc | 2 +- shell/browser/ui/win/jump_list.h | 12 +- shell/browser/web_contents_preferences.cc | 4 +- shell/browser/web_dialog_helper.cc | 4 +- shell/common/api/electron_api_clipboard.cc | 32 +++--- shell/common/api/electron_api_clipboard.h | 18 +-- .../common/api/electron_api_clipboard_mac.mm | 4 +- shell/common/api/electron_api_shell.cc | 2 +- shell/common/application_info.h | 2 +- shell/common/application_info_win.cc | 6 +- .../common/gin_converters/blink_converter.cc | 6 +- shell/common/language_util.h | 2 +- shell/common/language_util_win.cc | 4 +- shell/common/platform_util_win.cc | 4 +- .../api/electron_api_spell_check_client.cc | 30 ++--- .../api/electron_api_spell_check_client.h | 8 +- shell/renderer/api/electron_api_web_frame.cc | 22 ++-- shell/renderer/electron_autofill_agent.cc | 18 +-- shell/renderer/electron_autofill_agent.h | 6 +- shell/renderer/renderer_client_base.cc | 2 +- 100 files changed, 417 insertions(+), 417 deletions(-) diff --git a/chromium_src/chrome/browser/certificate_manager_model.cc b/chromium_src/chrome/browser/certificate_manager_model.cc index 8a38b5370853..4166c8b36d19 100644 --- a/chromium_src/chrome/browser/certificate_manager_model.cc +++ b/chromium_src/chrome/browser/certificate_manager_model.cc @@ -90,7 +90,7 @@ CertificateManagerModel::~CertificateManagerModel() = default; int CertificateManagerModel::ImportFromPKCS12( PK11SlotInfo* slot_info, const std::string& data, - const base::string16& password, + const std::u16string& password, bool is_extractable, net::ScopedCERTCertificateList* imported_certs) { return cert_db_->ImportFromPKCS12(slot_info, data, password, is_extractable, diff --git a/chromium_src/chrome/browser/certificate_manager_model.h b/chromium_src/chrome/browser/certificate_manager_model.h index b68a650e24b1..661a524aecd8 100644 --- a/chromium_src/chrome/browser/certificate_manager_model.h +++ b/chromium_src/chrome/browser/certificate_manager_model.h @@ -46,7 +46,7 @@ class CertificateManagerModel { // Returns a net error code on failure. int ImportFromPKCS12(PK11SlotInfo* slot_info, const std::string& data, - const base::string16& password, + const std::u16string& password, bool is_extractable, net::ScopedCERTCertificateList* imported_certs); diff --git a/shell/app/electron_content_client.cc b/shell/app/electron_content_client.cc index 530637ac4d54..421601aefb7e 100644 --- a/shell/app/electron_content_client.cc +++ b/shell/app/electron_content_client.cc @@ -161,7 +161,7 @@ ElectronContentClient::ElectronContentClient() = default; ElectronContentClient::~ElectronContentClient() = default; -base::string16 ElectronContentClient::GetLocalizedString(int message_id) { +std::u16string ElectronContentClient::GetLocalizedString(int message_id) { return l10n_util::GetStringUTF16(message_id); } diff --git a/shell/app/electron_content_client.h b/shell/app/electron_content_client.h index 0e6eb9715e06..8ac3a688da3a 100644 --- a/shell/app/electron_content_client.h +++ b/shell/app/electron_content_client.h @@ -21,7 +21,7 @@ class ElectronContentClient : public content::ContentClient { protected: // content::ContentClient: - base::string16 GetLocalizedString(int message_id) override; + std::u16string GetLocalizedString(int message_id) override; base::StringPiece GetDataResource(int resource_id, ui::ScaleFactor) override; gfx::Image& GetNativeImageNamed(int resource_id) override; base::RefCountedMemory* GetDataResourceBytes(int resource_id) override; diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index 9ffe14483f12..0bbd531f51a3 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -549,7 +549,7 @@ void OnClientCertificateSelected( #if defined(USE_NSS_CERTS) int ImportIntoCertStore(CertificateManagerModel* model, base::Value options) { std::string file_data, cert_path; - base::string16 password; + std::u16string password; net::ScopedCERTCertificateList imported_certs; int rv = -1; diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index ff233e56bcbf..ec3b6f7d223c 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -1089,11 +1089,11 @@ bool BaseWindow::SetThumbnailToolTip(const std::string& tooltip) { } void BaseWindow::SetAppDetails(const gin_helper::Dictionary& options) { - base::string16 app_id; + std::u16string app_id; base::FilePath app_icon_path; int app_icon_index = 0; - base::string16 relaunch_command; - base::string16 relaunch_display_name; + std::u16string relaunch_command; + std::u16string relaunch_display_name; options.Get("appId", &app_id); options.Get("appIconPath", &app_icon_path); diff --git a/shell/browser/api/electron_api_browser_window.cc b/shell/browser/api/electron_api_browser_window.cc index 1ba361cbc379..b7ade31bdcd5 100644 --- a/shell/browser/api/electron_api_browser_window.cc +++ b/shell/browser/api/electron_api_browser_window.cc @@ -210,7 +210,7 @@ void BrowserWindow::OnActivateContents() { #endif } -void BrowserWindow::OnPageTitleUpdated(const base::string16& title, +void BrowserWindow::OnPageTitleUpdated(const std::u16string& title, bool explicit_set) { // Change window title to page title. auto self = GetWeakPtr(); diff --git a/shell/browser/api/electron_api_browser_window.h b/shell/browser/api/electron_api_browser_window.h index f0547d8039ad..d398249aee77 100644 --- a/shell/browser/api/electron_api_browser_window.h +++ b/shell/browser/api/electron_api_browser_window.h @@ -62,7 +62,7 @@ class BrowserWindow : public BaseWindow, const std::vector& regions) override; void OnSetContentBounds(const gfx::Rect& rect) override; void OnActivateContents() override; - void OnPageTitleUpdated(const base::string16& title, + void OnPageTitleUpdated(const std::u16string& title, bool explicit_set) override; #if defined(OS_MAC) void OnDevToolsResized() override; diff --git a/shell/browser/api/electron_api_menu.cc b/shell/browser/api/electron_api_menu.cc index 2ae9d02dce15..c973fa714ef0 100644 --- a/shell/browser/api/electron_api_menu.cc +++ b/shell/browser/api/electron_api_menu.cc @@ -163,7 +163,7 @@ base::OnceClosure Menu::BindSelfToClosure(base::OnceClosure callback) { void Menu::InsertItemAt(int index, int command_id, - const base::string16& label) { + const std::u16string& label) { model_->InsertItemAt(index, command_id, label); } @@ -173,20 +173,20 @@ void Menu::InsertSeparatorAt(int index) { void Menu::InsertCheckItemAt(int index, int command_id, - const base::string16& label) { + const std::u16string& label) { model_->InsertCheckItemAt(index, command_id, label); } void Menu::InsertRadioItemAt(int index, int command_id, - const base::string16& label, + const std::u16string& label, int group_id) { model_->InsertRadioItemAt(index, command_id, label, group_id); } void Menu::InsertSubMenuAt(int index, int command_id, - const base::string16& label, + const std::u16string& label, Menu* menu) { menu->parent_ = this; model_->InsertSubMenuAt(index, command_id, label, menu->model_.get()); @@ -196,15 +196,15 @@ void Menu::SetIcon(int index, const gfx::Image& image) { model_->SetIcon(index, ui::ImageModel::FromImage(image)); } -void Menu::SetSublabel(int index, const base::string16& sublabel) { +void Menu::SetSublabel(int index, const std::u16string& sublabel) { model_->SetSecondaryLabel(index, sublabel); } -void Menu::SetToolTip(int index, const base::string16& toolTip) { +void Menu::SetToolTip(int index, const std::u16string& toolTip) { model_->SetToolTip(index, toolTip); } -void Menu::SetRole(int index, const base::string16& role) { +void Menu::SetRole(int index, const std::u16string& role) { model_->SetRole(index, role); } @@ -224,19 +224,19 @@ int Menu::GetCommandIdAt(int index) const { return model_->GetCommandIdAt(index); } -base::string16 Menu::GetLabelAt(int index) const { +std::u16string Menu::GetLabelAt(int index) const { return model_->GetLabelAt(index); } -base::string16 Menu::GetSublabelAt(int index) const { +std::u16string Menu::GetSublabelAt(int index) const { return model_->GetSecondaryLabelAt(index); } -base::string16 Menu::GetToolTipAt(int index) const { +std::u16string Menu::GetToolTipAt(int index) const { return model_->GetToolTipAt(index); } -base::string16 Menu::GetAcceleratorTextAt(int index) const { +std::u16string Menu::GetAcceleratorTextAt(int index) const { ui::Accelerator accelerator; model_->GetAcceleratorAtWithParams(index, true, &accelerator); return accelerator.GetShortcutText(); diff --git a/shell/browser/api/electron_api_menu.h b/shell/browser/api/electron_api_menu.h index 5c47990fa69f..89150f5bd341 100644 --- a/shell/browser/api/electron_api_menu.h +++ b/shell/browser/api/electron_api_menu.h @@ -87,31 +87,31 @@ class Menu : public gin::Wrappable, void OnMenuWillShow() override; private: - void InsertItemAt(int index, int command_id, const base::string16& label); + void InsertItemAt(int index, int command_id, const std::u16string& label); void InsertSeparatorAt(int index); void InsertCheckItemAt(int index, int command_id, - const base::string16& label); + const std::u16string& label); void InsertRadioItemAt(int index, int command_id, - const base::string16& label, + const std::u16string& label, int group_id); void InsertSubMenuAt(int index, int command_id, - const base::string16& label, + const std::u16string& label, Menu* menu); void SetIcon(int index, const gfx::Image& image); - void SetSublabel(int index, const base::string16& sublabel); - void SetToolTip(int index, const base::string16& toolTip); - void SetRole(int index, const base::string16& role); + void SetSublabel(int index, const std::u16string& sublabel); + void SetToolTip(int index, const std::u16string& toolTip); + void SetRole(int index, const std::u16string& role); void Clear(); int GetIndexOfCommandId(int command_id); int GetItemCount() const; int GetCommandIdAt(int index) const; - base::string16 GetLabelAt(int index) const; - base::string16 GetSublabelAt(int index) const; - base::string16 GetToolTipAt(int index) const; - base::string16 GetAcceleratorTextAt(int index) const; + std::u16string GetLabelAt(int index) const; + std::u16string GetSublabelAt(int index) const; + std::u16string GetToolTipAt(int index) const; + std::u16string GetAcceleratorTextAt(int index) const; bool IsItemCheckedAt(int index) const; bool IsEnabledAt(int index) const; bool IsVisibleAt(int index) const; diff --git a/shell/browser/api/electron_api_notification.cc b/shell/browser/api/electron_api_notification.cc index 501daa43232d..5216b7407df3 100644 --- a/shell/browser/api/electron_api_notification.cc +++ b/shell/browser/api/electron_api_notification.cc @@ -92,15 +92,15 @@ gin::Handle Notification::New(gin_helper::ErrorThrower thrower, } // Getters -base::string16 Notification::GetTitle() const { +std::u16string Notification::GetTitle() const { return title_; } -base::string16 Notification::GetSubtitle() const { +std::u16string Notification::GetSubtitle() const { return subtitle_; } -base::string16 Notification::GetBody() const { +std::u16string Notification::GetBody() const { return body_; } @@ -112,19 +112,19 @@ bool Notification::GetHasReply() const { return has_reply_; } -base::string16 Notification::GetTimeoutType() const { +std::u16string Notification::GetTimeoutType() const { return timeout_type_; } -base::string16 Notification::GetReplyPlaceholder() const { +std::u16string Notification::GetReplyPlaceholder() const { return reply_placeholder_; } -base::string16 Notification::GetSound() const { +std::u16string Notification::GetSound() const { return sound_; } -base::string16 Notification::GetUrgency() const { +std::u16string Notification::GetUrgency() const { return urgency_; } @@ -132,24 +132,24 @@ std::vector Notification::GetActions() const { return actions_; } -base::string16 Notification::GetCloseButtonText() const { +std::u16string Notification::GetCloseButtonText() const { return close_button_text_; } -base::string16 Notification::GetToastXml() const { +std::u16string Notification::GetToastXml() const { return toast_xml_; } // Setters -void Notification::SetTitle(const base::string16& new_title) { +void Notification::SetTitle(const std::u16string& new_title) { title_ = new_title; } -void Notification::SetSubtitle(const base::string16& new_subtitle) { +void Notification::SetSubtitle(const std::u16string& new_subtitle) { subtitle_ = new_subtitle; } -void Notification::SetBody(const base::string16& new_body) { +void Notification::SetBody(const std::u16string& new_body) { body_ = new_body; } @@ -161,19 +161,19 @@ void Notification::SetHasReply(bool new_has_reply) { has_reply_ = new_has_reply; } -void Notification::SetTimeoutType(const base::string16& new_timeout_type) { +void Notification::SetTimeoutType(const std::u16string& new_timeout_type) { timeout_type_ = new_timeout_type; } -void Notification::SetReplyPlaceholder(const base::string16& new_placeholder) { +void Notification::SetReplyPlaceholder(const std::u16string& new_placeholder) { reply_placeholder_ = new_placeholder; } -void Notification::SetSound(const base::string16& new_sound) { +void Notification::SetSound(const std::u16string& new_sound) { sound_ = new_sound; } -void Notification::SetUrgency(const base::string16& new_urgency) { +void Notification::SetUrgency(const std::u16string& new_urgency) { urgency_ = new_urgency; } @@ -182,11 +182,11 @@ void Notification::SetActions( actions_ = actions; } -void Notification::SetCloseButtonText(const base::string16& text) { +void Notification::SetCloseButtonText(const std::u16string& text) { close_button_text_ = text; } -void Notification::SetToastXml(const base::string16& new_toast_xml) { +void Notification::SetToastXml(const std::u16string& new_toast_xml) { toast_xml_ = new_toast_xml; } diff --git a/shell/browser/api/electron_api_notification.h b/shell/browser/api/electron_api_notification.h index a914f88082b4..64a6cbec319f 100644 --- a/shell/browser/api/electron_api_notification.h +++ b/shell/browser/api/electron_api_notification.h @@ -65,49 +65,49 @@ class Notification : public gin::Wrappable, void Close(); // Prop Getters - base::string16 GetTitle() const; - base::string16 GetSubtitle() const; - base::string16 GetBody() const; + std::u16string GetTitle() const; + std::u16string GetSubtitle() const; + std::u16string GetBody() const; bool GetSilent() const; bool GetHasReply() const; - base::string16 GetTimeoutType() const; - base::string16 GetReplyPlaceholder() const; - base::string16 GetUrgency() const; - base::string16 GetSound() const; + std::u16string GetTimeoutType() const; + std::u16string GetReplyPlaceholder() const; + std::u16string GetUrgency() const; + std::u16string GetSound() const; std::vector GetActions() const; - base::string16 GetCloseButtonText() const; - base::string16 GetToastXml() const; + std::u16string GetCloseButtonText() const; + std::u16string GetToastXml() const; // Prop Setters - void SetTitle(const base::string16& new_title); - void SetSubtitle(const base::string16& new_subtitle); - void SetBody(const base::string16& new_body); + void SetTitle(const std::u16string& new_title); + void SetSubtitle(const std::u16string& new_subtitle); + void SetBody(const std::u16string& new_body); void SetSilent(bool new_silent); void SetHasReply(bool new_has_reply); - void SetUrgency(const base::string16& new_urgency); - void SetTimeoutType(const base::string16& new_timeout_type); - void SetReplyPlaceholder(const base::string16& new_reply_placeholder); - void SetSound(const base::string16& sound); + void SetUrgency(const std::u16string& new_urgency); + void SetTimeoutType(const std::u16string& new_timeout_type); + void SetReplyPlaceholder(const std::u16string& new_reply_placeholder); + void SetSound(const std::u16string& sound); void SetActions(const std::vector& actions); - void SetCloseButtonText(const base::string16& text); - void SetToastXml(const base::string16& new_toast_xml); + void SetCloseButtonText(const std::u16string& text); + void SetToastXml(const std::u16string& new_toast_xml); private: - base::string16 title_; - base::string16 subtitle_; - base::string16 body_; + std::u16string title_; + std::u16string subtitle_; + std::u16string body_; gfx::Image icon_; - base::string16 icon_path_; + std::u16string icon_path_; bool has_icon_ = false; bool silent_ = false; bool has_reply_ = false; - base::string16 timeout_type_; - base::string16 reply_placeholder_; - base::string16 sound_; - base::string16 urgency_; + std::u16string timeout_type_; + std::u16string reply_placeholder_; + std::u16string sound_; + std::u16string urgency_; std::vector actions_; - base::string16 close_button_text_; - base::string16 toast_xml_; + std::u16string close_button_text_; + std::u16string toast_xml_; electron::NotificationPresenter* presenter_; diff --git a/shell/browser/api/electron_api_url_loader.cc b/shell/browser/api/electron_api_url_loader.cc index afe48e40cd27..25058ec12b1c 100644 --- a/shell/browser/api/electron_api_url_loader.cc +++ b/shell/browser/api/electron_api_url_loader.cc @@ -343,7 +343,7 @@ void SimpleURLLoaderWrapper::OnAuthRequired( auto cb = base::BindOnce( [](mojo::Remote auth_responder, gin::Arguments* args) { - base::string16 username_str, password_str; + std::u16string username_str, password_str; if (!args->GetNext(&username_str) || !args->GetNext(&password_str)) { auth_responder->OnAuthCredentials(base::nullopt); return; diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index 004f7323d85d..a56bf717a70e 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -408,7 +408,7 @@ base::Optional GetCursorBlinkInterval() { // This will return false if no printer with the provided device_name can be // found on the network. We need to check this because Chromium does not do // sanity checking of device_name validity and so will crash on invalid names. -bool IsDeviceNameValid(const base::string16& device_name) { +bool IsDeviceNameValid(const std::u16string& device_name) { #if defined(OS_MAC) base::ScopedCFTypeRef new_printer_id( base::SysUTF16ToCFStringRef(device_name)); @@ -423,7 +423,7 @@ bool IsDeviceNameValid(const base::string16& device_name) { return true; } -base::string16 GetDefaultPrinterAsync() { +std::u16string GetDefaultPrinterAsync() { #if defined(OS_WIN) // Blocking is needed here because Windows printer drivers are oftentimes // not thread-safe and have to be accessed on the UI thread. @@ -958,9 +958,9 @@ void WebContents::Destroy() { bool WebContents::DidAddMessageToConsole( content::WebContents* source, blink::mojom::ConsoleMessageLevel level, - const base::string16& message, + const std::u16string& message, int32_t line_no, - const base::string16& source_id) { + const std::u16string& source_id) { return Emit("console-message", static_cast(level), message, line_no, source_id); } @@ -1717,7 +1717,7 @@ void WebContents::DidFinishNavigation( } void WebContents::TitleWasSet(content::NavigationEntry* entry) { - base::string16 final_title; + std::u16string final_title; bool explicit_set = true; if (entry) { auto title = entry->GetTitle(); @@ -1983,7 +1983,7 @@ GURL WebContents::GetURL() const { return web_contents()->GetURL(); } -base::string16 WebContents::GetTitle() const { +std::u16string WebContents::GetTitle() const { return web_contents()->GetTitle(); } @@ -2292,9 +2292,9 @@ bool WebContents::IsCurrentlyAudible() { void WebContents::OnGetDefaultPrinter( base::Value print_settings, printing::CompletionCallback print_callback, - base::string16 device_name, + std::u16string device_name, bool silent, - base::string16 default_printer) { + std::u16string default_printer) { // The content::WebContents might be already deleted at this point, and the // PrintViewManagerBasic class does not do null check. if (!web_contents()) { @@ -2303,7 +2303,7 @@ void WebContents::OnGetDefaultPrinter( return; } - base::string16 printer_name = + std::u16string printer_name = device_name.empty() ? default_printer : device_name; // If there are no valid printers available on the network, we bail. @@ -2401,7 +2401,7 @@ void WebContents::Print(gin::Arguments* args) { // We set the default to the system's default printer and only update // if at the Chromium level if the user overrides. // Printer device name as opened by the OS. - base::string16 device_name; + std::u16string device_name; options.Get("deviceName", &device_name); if (!device_name.empty() && !IsDeviceNameValid(device_name)) { gin_helper::ErrorThrower(args->isolate()) @@ -2570,16 +2570,16 @@ void WebContents::Unselect() { web_contents()->CollapseSelection(); } -void WebContents::Replace(const base::string16& word) { +void WebContents::Replace(const std::u16string& word) { web_contents()->Replace(word); } -void WebContents::ReplaceMisspelling(const base::string16& word) { +void WebContents::ReplaceMisspelling(const std::u16string& word) { web_contents()->ReplaceMisspelling(word); } uint32_t WebContents::FindInPage(gin::Arguments* args) { - base::string16 search_text; + std::u16string search_text; if (!args->GetNext(&search_text) || search_text.empty()) { gin_helper::ErrorThrower(args->isolate()) .ThrowError("Must provide a non-empty search content"); diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 0ac3d3cc1d50..9d7eadc2384b 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -156,7 +156,7 @@ class WebContents : public gin::Wrappable, void LoadURL(const GURL& url, const gin_helper::Dictionary& options); void DownloadURL(const GURL& url); GURL GetURL() const; - base::string16 GetTitle() const; + std::u16string GetTitle() const; bool IsLoading() const; bool IsLoadingMainFrame() const; bool IsWaitingForResponse() const; @@ -201,9 +201,9 @@ class WebContents : public gin::Wrappable, #if BUILDFLAG(ENABLE_PRINTING) void OnGetDefaultPrinter(base::Value print_settings, printing::CompletionCallback print_callback, - base::string16 device_name, + std::u16string device_name, bool silent, - base::string16 default_printer); + std::u16string default_printer); void Print(gin::Arguments* args); // Print current page as PDF. v8::Local PrintToPDF(base::DictionaryValue settings); @@ -225,8 +225,8 @@ class WebContents : public gin::Wrappable, void Delete(); void SelectAll(); void Unselect(); - void Replace(const base::string16& word); - void ReplaceMisspelling(const base::string16& word); + void Replace(const std::u16string& word); + void ReplaceMisspelling(const std::u16string& word); uint32_t FindInPage(gin::Arguments* args); void StopFindInPage(content::StopFindAction action); void ShowDefinitionForSelection(); @@ -444,9 +444,9 @@ class WebContents : public gin::Wrappable, // content::WebContentsDelegate: bool DidAddMessageToConsole(content::WebContents* source, blink::mojom::ConsoleMessageLevel level, - const base::string16& message, + const std::u16string& message, int32_t line_no, - const base::string16& source_id) override; + const std::u16string& source_id) override; bool IsWebContentsCreationOverridden( content::SiteInstance* source_site_instance, content::mojom::WindowContainerType window_container_type, diff --git a/shell/browser/api/electron_api_web_frame_main.cc b/shell/browser/api/electron_api_web_frame_main.cc index 8834eef51c66..9ef45ea185ec 100644 --- a/shell/browser/api/electron_api_web_frame_main.cc +++ b/shell/browser/api/electron_api_web_frame_main.cc @@ -78,7 +78,7 @@ bool WebFrameMain::CheckRenderFrame() const { v8::Local WebFrameMain::ExecuteJavaScript( gin::Arguments* args, - const base::string16& code) { + const std::u16string& code) { gin_helper::Promise promise(args->isolate()); v8::Local handle = promise.GetHandle(); diff --git a/shell/browser/api/electron_api_web_frame_main.h b/shell/browser/api/electron_api_web_frame_main.h index 18e7515ec9c2..4d0dc989055e 100644 --- a/shell/browser/api/electron_api_web_frame_main.h +++ b/shell/browser/api/electron_api_web_frame_main.h @@ -78,7 +78,7 @@ class WebFrameMain : public gin::Wrappable, void Connect(); v8::Local ExecuteJavaScript(gin::Arguments* args, - const base::string16& code); + const std::u16string& code); bool Reload(); void Send(v8::Isolate* isolate, bool internal, diff --git a/shell/browser/browser.h b/shell/browser/browser.h index 07aae2b1a95f..21ff40453b32 100755 --- a/shell/browser/browser.h +++ b/shell/browser/browser.h @@ -85,7 +85,7 @@ class Browser : public WindowListObserver { void ClearRecentDocuments(); // Set the application user model ID. - void SetAppUserModelID(const base::string16& name); + void SetAppUserModelID(const std::u16string& name); // Remove the default protocol handler registry key bool RemoveAsDefaultProtocolClient(const std::string& protocol, @@ -99,7 +99,7 @@ class Browser : public WindowListObserver { bool IsDefaultProtocolClient(const std::string& protocol, gin::Arguments* args); - base::string16 GetApplicationNameForProtocol(const GURL& url); + std::u16string GetApplicationNameForProtocol(const GURL& url); #if !defined(OS_LINUX) // get the name, icon and path for an application @@ -113,10 +113,10 @@ class Browser : public WindowListObserver { #if defined(OS_WIN) struct LaunchItem { - base::string16 name; - base::string16 path; - base::string16 scope; - std::vector args; + std::u16string name; + std::u16string path; + std::u16string scope; + std::vector args; bool enabled = true; LaunchItem(); @@ -132,13 +132,13 @@ class Browser : public WindowListObserver { bool restore_state = false; bool opened_at_login = false; bool opened_as_hidden = false; - base::string16 path; - std::vector args; + std::u16string path; + std::vector args; #if defined(OS_WIN) // used in browser::setLoginItemSettings bool enabled = true; - base::string16 name = base::string16(); + std::u16string name = std::u16string(); // used in browser::getLoginItemSettings bool executable_will_launch_at_login = false; @@ -238,9 +238,9 @@ class Browser : public WindowListObserver { #if defined(OS_WIN) struct UserTask { base::FilePath program; - base::string16 arguments; - base::string16 title; - base::string16 description; + std::u16string arguments; + std::u16string title; + std::u16string description; base::FilePath working_dir; base::FilePath icon_path; int icon_index; diff --git a/shell/browser/browser_linux.cc b/shell/browser/browser_linux.cc index 8d3c26e95d0e..8c5e59e427dc 100644 --- a/shell/browser/browser_linux.cc +++ b/shell/browser/browser_linux.cc @@ -88,7 +88,7 @@ void Browser::AddRecentDocument(const base::FilePath& path) {} void Browser::ClearRecentDocuments() {} -void Browser::SetAppUserModelID(const base::string16& name) {} +void Browser::SetAppUserModelID(const std::u16string& name) {} bool Browser::SetAsDefaultProtocolClient(const std::string& protocol, gin::Arguments* args) { @@ -122,7 +122,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, return false; } -base::string16 Browser::GetApplicationNameForProtocol(const GURL& url) { +std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) { const std::vector argv = { "xdg-mime", "query", "default", std::string("x-scheme-handler/") + url.scheme()}; diff --git a/shell/browser/browser_mac.mm b/shell/browser/browser_mac.mm index 5bc184dd0b07..97daa1ded023 100644 --- a/shell/browser/browser_mac.mm +++ b/shell/browser/browser_mac.mm @@ -58,7 +58,7 @@ gfx::Image GetApplicationIconForProtocol(NSString* _Nonnull app_path) { return icon; } -base::string16 GetAppDisplayNameForProtocol(NSString* app_path) { +std::u16string GetAppDisplayNameForProtocol(NSString* app_path) { NSString* app_display_name = [[NSFileManager defaultManager] displayNameAtPath:app_path]; return base::SysNSStringToUTF16(app_display_name); @@ -81,8 +81,8 @@ v8::Local Browser::GetApplicationInfoForProtocol( return handle; } - base::string16 app_path = base::SysNSStringToUTF16(ns_app_path); - base::string16 app_display_name = GetAppDisplayNameForProtocol(ns_app_path); + std::u16string app_path = base::SysNSStringToUTF16(ns_app_path); + std::u16string app_display_name = GetAppDisplayNameForProtocol(ns_app_path); gfx::Image app_icon = GetApplicationIconForProtocol(ns_app_path); dict.Set("name", app_display_name); @@ -209,16 +209,16 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, return result == NSOrderedSame; } -base::string16 Browser::GetApplicationNameForProtocol(const GURL& url) { +std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) { NSString* app_path = GetAppPathForProtocol(url); if (!app_path) { - return base::string16(); + return std::u16string(); } - base::string16 app_display_name = GetAppDisplayNameForProtocol(app_path); + std::u16string app_display_name = GetAppDisplayNameForProtocol(app_path); return app_display_name; } -void Browser::SetAppUserModelID(const base::string16& name) {} +void Browser::SetAppUserModelID(const std::u16string& name) {} bool Browser::SetBadgeCount(base::Optional count) { DockSetBadgeText(!count.has_value() || count.value() != 0 diff --git a/shell/browser/browser_win.cc b/shell/browser/browser_win.cc index ce488e982ea8..5014bd5d7bb2 100755 --- a/shell/browser/browser_win.cc +++ b/shell/browser/browser_win.cc @@ -48,7 +48,7 @@ namespace electron { namespace { -bool GetProcessExecPath(base::string16* exe) { +bool GetProcessExecPath(std::u16string* exe) { base::FilePath path; if (!base::PathService::Get(base::FILE_EXE, &path)) { return false; @@ -57,13 +57,13 @@ bool GetProcessExecPath(base::string16* exe) { return true; } -bool GetProtocolLaunchPath(gin::Arguments* args, base::string16* exe) { +bool GetProtocolLaunchPath(gin::Arguments* args, std::u16string* exe) { if (!args->GetNext(exe) && !GetProcessExecPath(exe)) { return false; } // Read in optional args arg - std::vector launch_args; + std::vector launch_args; if (args->GetNext(&launch_args) && !launch_args.empty()) *exe = base::StringPrintf(L"\"%ls\" %ls \"%%1\"", exe->c_str(), base::JoinString(launch_args, L" ").c_str()); @@ -75,7 +75,7 @@ bool GetProtocolLaunchPath(gin::Arguments* args, base::string16* exe) { // Windows treats a given scheme as an Internet scheme only if its registry // entry has a "URL Protocol" key. Check this, otherwise we allow ProgIDs to be // used as custom protocols which leads to security bugs. -bool IsValidCustomProtocol(const base::string16& scheme) { +bool IsValidCustomProtocol(const std::u16string& scheme) { if (scheme.empty()) return false; base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, scheme.c_str(), KEY_QUERY_VALUE); @@ -90,11 +90,11 @@ bool IsValidCustomProtocol(const base::string16& scheme) { // Windows 8 introduced a new protocol->executable binding system which cannot // be retrieved in the HKCR registry subkey method implemented below. We call // AssocQueryString with the new Win8-only flag ASSOCF_IS_PROTOCOL instead. -base::string16 GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, +std::u16string GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, const GURL& url) { - const base::string16 url_scheme = base::ASCIIToUTF16(url.scheme()); + const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) - return base::string16(); + return std::u16string(); wchar_t out_buffer[1024]; DWORD buffer_size = base::size(out_buffer); @@ -103,13 +103,13 @@ base::string16 GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, out_buffer, &buffer_size); if (FAILED(hr)) { DLOG(WARNING) << "AssocQueryString failed!"; - return base::string16(); + return std::u16string(); } - return base::string16(out_buffer); + return std::u16string(out_buffer); } void OnIconDataAvailable(const base::FilePath& app_path, - const base::string16& app_display_name, + const std::u16string& app_display_name, gin_helper::Promise promise, gfx::Image icon) { if (!icon.IsEmpty()) { @@ -126,21 +126,21 @@ void OnIconDataAvailable(const base::FilePath& app_path, } } -base::string16 GetAppDisplayNameForProtocol(const GURL& url) { +std::u16string GetAppDisplayNameForProtocol(const GURL& url) { return GetAppInfoHelperForProtocol(ASSOCSTR_FRIENDLYAPPNAME, url); } -base::string16 GetAppPathForProtocol(const GURL& url) { +std::u16string GetAppPathForProtocol(const GURL& url) { return GetAppInfoHelperForProtocol(ASSOCSTR_EXECUTABLE, url); } -base::string16 GetAppForProtocolUsingRegistry(const GURL& url) { - const base::string16 url_scheme = base::ASCIIToUTF16(url.scheme()); +std::u16string GetAppForProtocolUsingRegistry(const GURL& url) { + const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) - return base::string16(); + return std::u16string(); // First, try and extract the application's display name. - base::string16 command_to_launch; + std::u16string command_to_launch; base::win::RegKey cmd_key_name(HKEY_CLASSES_ROOT, url_scheme.c_str(), KEY_READ); if (cmd_key_name.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS && @@ -150,7 +150,7 @@ base::string16 GetAppForProtocolUsingRegistry(const GURL& url) { // Otherwise, parse the command line in the registry, and return the basename // of the program path if it exists. - const base::string16 cmd_key_path = url_scheme + L"\\shell\\open\\command"; + const std::u16string cmd_key_path = url_scheme + L"\\shell\\open\\command"; base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) { @@ -159,11 +159,11 @@ base::string16 GetAppForProtocolUsingRegistry(const GURL& url) { return command_line.GetProgram().BaseName().value(); } - return base::string16(); + return std::u16string(); } -bool FormatCommandLineString(base::string16* exe, - const std::vector& launch_args) { +bool FormatCommandLineString(std::u16string* exe, + const std::vector& launch_args) { if (exe->empty() && !GetProcessExecPath(exe)) { return false; } @@ -184,13 +184,13 @@ bool FormatCommandLineString(base::string16* exe, std::vector GetLoginItemSettingsHelper( base::win::RegistryValueIterator* it, boolean* executable_will_launch_at_login, - base::string16 scope, + std::u16string scope, const Browser::LoginItemSettings& options) { std::vector launch_items; base::FilePath lookup_exe_path; if (options.path.empty()) { - base::string16 process_exe_path; + std::u16string process_exe_path; GetProcessExecPath(&process_exe_path); lookup_exe_path = base::CommandLine::FromString(process_exe_path).GetProgram(); @@ -287,7 +287,7 @@ Browser::UserTask::~UserTask() = default; void GetFileIcon(const base::FilePath& path, v8::Isolate* isolate, base::CancelableTaskTracker* cancelable_task_tracker_, - const base::string16 app_display_name, + const std::u16string app_display_name, gin_helper::Promise promise) { base::FilePath normalized_path = path.NormalizePathSeparators(); IconLoader::IconSize icon_size = IconLoader::IconSize::LARGE; @@ -316,13 +316,13 @@ void GetApplicationInfoForProtocolUsingRegistry( base::CancelableTaskTracker* cancelable_task_tracker_) { base::FilePath app_path; - const base::string16 url_scheme = base::ASCIIToUTF16(url.scheme()); + const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) { promise.RejectWithErrorMessage("invalid url_scheme"); return; } - base::string16 command_to_launch; - const base::string16 cmd_key_path = url_scheme + L"\\shell\\open\\command"; + std::u16string command_to_launch; + const std::u16string cmd_key_path = url_scheme + L"\\shell\\open\\command"; base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) { @@ -334,7 +334,7 @@ void GetApplicationInfoForProtocolUsingRegistry( "Unable to retrieve installation path to app"); return; } - const base::string16 app_display_name = GetAppForProtocolUsingRegistry(url); + const std::u16string app_display_name = GetAppForProtocolUsingRegistry(url); if (app_display_name.empty()) { promise.RejectWithErrorMessage( @@ -354,7 +354,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery( const GURL& url, gin_helper::Promise promise, base::CancelableTaskTracker* cancelable_task_tracker_) { - base::string16 app_path = GetAppPathForProtocol(url); + std::u16string app_path = GetAppPathForProtocol(url); if (app_path.empty()) { promise.RejectWithErrorMessage( @@ -362,7 +362,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery( return; } - base::string16 app_display_name = GetAppDisplayNameForProtocol(url); + std::u16string app_display_name = GetAppDisplayNameForProtocol(url); if (app_display_name.empty()) { promise.RejectWithErrorMessage("Unable to retrieve display name of app"); @@ -390,7 +390,7 @@ void Browser::ClearRecentDocuments() { SHAddToRecentDocs(SHARD_APPIDINFO, nullptr); } -void Browser::SetAppUserModelID(const base::string16& name) { +void Browser::SetAppUserModelID(const std::u16string& name) { electron::SetAppUserModelID(name); } @@ -426,12 +426,12 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, // Main Registry Key HKEY root = HKEY_CURRENT_USER; - base::string16 keyPath = L"Software\\Classes\\"; + std::u16string keyPath = L"Software\\Classes\\"; // Command Key - base::string16 wprotocol = base::UTF8ToUTF16(protocol); - base::string16 shellPath = wprotocol + L"\\shell"; - base::string16 cmdPath = keyPath + shellPath + L"\\open\\command"; + std::u16string wprotocol = base::UTF8ToUTF16(protocol); + std::u16string shellPath = wprotocol + L"\\shell"; + std::u16string cmdPath = keyPath + shellPath + L"\\open\\command"; base::win::RegKey classesKey; base::win::RegKey commandKey; @@ -445,12 +445,12 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, // Key doesn't even exist, we can confirm that it is not set return true; - base::string16 keyVal; + std::u16string keyVal; if (FAILED(commandKey.ReadValue(L"", &keyVal))) // Default value not set, we can confirm that it is not set return true; - base::string16 exe; + std::u16string exe; if (!GetProtocolLaunchPath(args, &exe)) return false; @@ -461,7 +461,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, // Let's clean up after ourselves base::win::RegKey protocolKey; - base::string16 protocolPath = keyPath + wprotocol; + std::u16string protocolPath = keyPath + wprotocol; if (SUCCEEDED( protocolKey.Open(root, protocolPath.c_str(), KEY_ALL_ACCESS))) { @@ -500,17 +500,17 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol, if (protocol.empty()) return false; - base::string16 exe; + std::u16string exe; if (!GetProtocolLaunchPath(args, &exe)) return false; // Main Registry Key HKEY root = HKEY_CURRENT_USER; - base::string16 keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); - base::string16 urlDecl = base::UTF8ToUTF16("URL:" + protocol); + std::u16string keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); + std::u16string urlDecl = base::UTF8ToUTF16("URL:" + protocol); // Command Key - base::string16 cmdPath = keyPath + L"\\shell\\open\\command"; + std::u16string cmdPath = keyPath + L"\\shell\\open\\command"; // Write information to registry base::win::RegKey key(root, keyPath.c_str(), KEY_ALL_ACCESS); @@ -530,16 +530,16 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, if (protocol.empty()) return false; - base::string16 exe; + std::u16string exe; if (!GetProtocolLaunchPath(args, &exe)) return false; // Main Registry Key HKEY root = HKEY_CURRENT_USER; - base::string16 keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); + std::u16string keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); // Command Key - base::string16 cmdPath = keyPath + L"\\shell\\open\\command"; + std::u16string cmdPath = keyPath + L"\\shell\\open\\command"; base::win::RegKey key; base::win::RegKey commandKey; @@ -551,7 +551,7 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, // Key doesn't exist, we can confirm that it is not set return false; - base::string16 keyVal; + std::u16string keyVal; if (FAILED(commandKey.ReadValue(L"", &keyVal))) // Default value not set, we can confirm that it is not set return false; @@ -560,10 +560,10 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, return keyVal == exe; } -base::string16 Browser::GetApplicationNameForProtocol(const GURL& url) { +std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) { // Windows 8 or above has a new protocol association query. if (base::win::GetVersion() >= base::win::Version::WIN8) { - base::string16 application_name = GetAppDisplayNameForProtocol(url); + std::u16string application_name = GetAppDisplayNameForProtocol(url); if (!application_name.empty()) return application_name; } @@ -686,11 +686,11 @@ void Browser::UpdateBadgeContents( } void Browser::SetLoginItemSettings(LoginItemSettings settings) { - base::string16 key_path = + std::u16string key_path = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; base::win::RegKey key(HKEY_CURRENT_USER, key_path.c_str(), KEY_ALL_ACCESS); - base::string16 startup_approved_key_path = + std::u16string startup_approved_key_path = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved" L"\\Run"; base::win::RegKey startup_approved_key( @@ -699,7 +699,7 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) { !settings.name.empty() ? settings.name.c_str() : GetAppUserModelID(); if (settings.open_at_login) { - base::string16 exe = settings.path; + std::u16string exe = settings.path; if (FormatCommandLineString(&exe, settings.args)) { key.WriteValue(key_name, exe.c_str()); @@ -732,13 +732,13 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) { Browser::LoginItemSettings Browser::GetLoginItemSettings( const LoginItemSettings& options) { LoginItemSettings settings; - base::string16 keyPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; + std::u16string keyPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; base::win::RegKey key(HKEY_CURRENT_USER, keyPath.c_str(), KEY_ALL_ACCESS); - base::string16 keyVal; + std::u16string keyVal; // keep old openAtLogin behaviour if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) { - base::string16 exe = options.path; + std::u16string exe = options.path; if (FormatCommandLineString(&exe, options.args)) { settings.open_at_login = keyVal == exe; } diff --git a/shell/browser/electron_autofill_driver.cc b/shell/browser/electron_autofill_driver.cc index 029df62158e7..fb541ac9f75e 100644 --- a/shell/browser/electron_autofill_driver.cc +++ b/shell/browser/electron_autofill_driver.cc @@ -27,8 +27,8 @@ AutofillDriver::~AutofillDriver() = default; void AutofillDriver::ShowAutofillPopup( const gfx::RectF& bounds, - const std::vector& values, - const std::vector& labels) { + const std::vector& values, + const std::vector& labels) { v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); v8::HandleScope scope(isolate); auto* web_contents = api::WebContents::From( diff --git a/shell/browser/electron_autofill_driver.h b/shell/browser/electron_autofill_driver.h index f1085e730901..2e3b0c489df9 100644 --- a/shell/browser/electron_autofill_driver.h +++ b/shell/browser/electron_autofill_driver.h @@ -27,8 +27,8 @@ class AutofillDriver : public mojom::ElectronAutofillDriver { ~AutofillDriver() override; void ShowAutofillPopup(const gfx::RectF& bounds, - const std::vector& values, - const std::vector& labels) override; + const std::vector& values, + const std::vector& labels) override; void HideAutofillPopup() override; private: diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 8d4234ef808f..7efd0359aced 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -920,7 +920,7 @@ ElectronBrowserClient::CreateWindowForPictureInPicture( content::PictureInPictureWindowController* controller) { auto overlay_window = content::OverlayWindow::Create(controller); #if defined(OS_WIN) - base::string16 app_user_model_id = Browser::Get()->GetAppUserModelID(); + std::u16string app_user_model_id = Browser::Get()->GetAppUserModelID(); if (!app_user_model_id.empty()) { auto* overlay_window_view = static_cast(overlay_window.get()); diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index e4ae699c6047..f5229da5b8a1 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -142,7 +142,7 @@ int GetMinimumFontSize() { } #endif -base::string16 MediaStringProvider(media::MessageId id) { +std::u16string MediaStringProvider(media::MessageId id) { switch (id) { case media::DEFAULT_AUDIO_DEVICE_NAME: return base::ASCIIToUTF16("Default"); @@ -151,7 +151,7 @@ base::string16 MediaStringProvider(media::MessageId id) { return base::ASCIIToUTF16("Communications"); #endif default: - return base::string16(); + return std::u16string(); } } diff --git a/shell/browser/electron_javascript_dialog_manager.cc b/shell/browser/electron_javascript_dialog_manager.cc index 519dc0aa98b5..b78d5c5f4247 100644 --- a/shell/browser/electron_javascript_dialog_manager.cc +++ b/shell/browser/electron_javascript_dialog_manager.cc @@ -34,8 +34,8 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog( content::WebContents* web_contents, content::RenderFrameHost* rfh, JavaScriptDialogType dialog_type, - const base::string16& message_text, - const base::string16& default_prompt_text, + const std::u16string& message_text, + const std::u16string& default_prompt_text, DialogClosedCallback callback, bool* did_suppress_message) { auto origin_url = rfh->GetLastCommittedURL(); @@ -50,19 +50,19 @@ void ElectronJavaScriptDialogManager::RunJavaScriptDialog( } if (origin_counts_[origin] == kUserWantsNoMoreDialogs) { - return std::move(callback).Run(false, base::string16()); + return std::move(callback).Run(false, std::u16string()); } if (dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_ALERT && dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_CONFIRM) { - std::move(callback).Run(false, base::string16()); + std::move(callback).Run(false, std::u16string()); return; } auto* web_preferences = WebContentsPreferences::From(web_contents); if (web_preferences && web_preferences->IsEnabled("disableDialogs")) { - return std::move(callback).Run(false, base::string16()); + return std::move(callback).Run(false, std::u16string()); } // No default button @@ -116,7 +116,7 @@ void ElectronJavaScriptDialogManager::RunBeforeUnloadDialog( auto* api_web_contents = api::WebContents::From(web_contents); if (api_web_contents) { bool default_prevented = api_web_contents->Emit("will-prevent-unload"); - std::move(callback).Run(default_prevented, base::string16()); + std::move(callback).Run(default_prevented, std::u16string()); } } @@ -131,7 +131,7 @@ void ElectronJavaScriptDialogManager::OnMessageBoxCallback( bool checkbox_checked) { if (checkbox_checked) origin_counts_[origin] = kUserWantsNoMoreDialogs; - std::move(callback).Run(code == 0, base::string16()); + std::move(callback).Run(code == 0, std::u16string()); } } // namespace electron diff --git a/shell/browser/electron_javascript_dialog_manager.h b/shell/browser/electron_javascript_dialog_manager.h index 0794a6aa063d..4c5135c9edaf 100644 --- a/shell/browser/electron_javascript_dialog_manager.h +++ b/shell/browser/electron_javascript_dialog_manager.h @@ -26,8 +26,8 @@ class ElectronJavaScriptDialogManager void RunJavaScriptDialog(content::WebContents* web_contents, content::RenderFrameHost* rfh, content::JavaScriptDialogType dialog_type, - const base::string16& message_text, - const base::string16& default_prompt_text, + const std::u16string& message_text, + const std::u16string& default_prompt_text, DialogClosedCallback callback, bool* did_suppress_message) override; void RunBeforeUnloadDialog(content::WebContents* web_contents, diff --git a/shell/browser/extended_web_contents_observer.h b/shell/browser/extended_web_contents_observer.h index 3914789eaf7c..49b1f30163de 100644 --- a/shell/browser/extended_web_contents_observer.h +++ b/shell/browser/extended_web_contents_observer.h @@ -23,7 +23,7 @@ class ExtendedWebContentsObserver : public base::CheckedObserver { const std::vector& regions) {} virtual void OnSetContentBounds(const gfx::Rect& rect) {} virtual void OnActivateContents() {} - virtual void OnPageTitleUpdated(const base::string16& title, + virtual void OnPageTitleUpdated(const std::u16string& title, bool explicit_set) {} virtual void OnDevToolsResized() {} diff --git a/shell/browser/extensions/api/management/electron_management_api_delegate.cc b/shell/browser/extensions/api/management/electron_management_api_delegate.cc index 8ff304855214..2239c8759c21 100644 --- a/shell/browser/extensions/api/management/electron_management_api_delegate.cc +++ b/shell/browser/extensions/api/management/electron_management_api_delegate.cc @@ -204,7 +204,7 @@ bool ElectronManagementAPIDelegate::UninstallExtension( content::BrowserContext* context, const std::string& transient_extension_id, extensions::UninstallReason reason, - base::string16* error) const { + std::u16string* error) const { // TODO(sentialx): we don't have ExtensionService // return extensions::ExtensionSystem::Get(context) // ->extension_service() diff --git a/shell/browser/extensions/api/management/electron_management_api_delegate.h b/shell/browser/extensions/api/management/electron_management_api_delegate.h index 553956132713..2a066b0cfc43 100644 --- a/shell/browser/extensions/api/management/electron_management_api_delegate.h +++ b/shell/browser/extensions/api/management/electron_management_api_delegate.h @@ -73,7 +73,7 @@ class ElectronManagementAPIDelegate : public extensions::ManagementAPIDelegate { bool UninstallExtension(content::BrowserContext* context, const std::string& transient_extension_id, extensions::UninstallReason reason, - base::string16* error) const override; + std::u16string* error) const override; void SetLaunchType(content::BrowserContext* context, const std::string& extension_id, extensions::LaunchType launch_type) const override; diff --git a/shell/browser/file_select_helper.cc b/shell/browser/file_select_helper.cc index 72066541e948..1bb02cc7a24a 100644 --- a/shell/browser/file_select_helper.cc +++ b/shell/browser/file_select_helper.cc @@ -125,7 +125,7 @@ void FileSelectHelper::OnListDone(int error) { std::vector file_info; for (const auto& path : lister_paths_) file_info.push_back(FileChooserFileInfo::NewNativeFile( - NativeFileInfo::New(path, base::string16()))); + NativeFileInfo::New(path, std::u16string()))); OnFilesSelected(std::move(file_info), lister_base_dir_); } diff --git a/shell/browser/font_defaults.cc b/shell/browser/font_defaults.cc index 9491af7f0b76..d704eea5e3b0 100644 --- a/shell/browser/font_defaults.cc +++ b/shell/browser/font_defaults.cc @@ -120,7 +120,7 @@ std::string GetDefaultFontForPref(const char* pref_name) { // Map from script to font. // Key comparison uses pointer equality. -using ScriptFontMap = std::unordered_map; +using ScriptFontMap = std::unordered_map; // Map from font family to ScriptFontMap. // Key comparison uses pointer equality. @@ -130,7 +130,7 @@ using FontFamilyMap = std::unordered_map; // e.g. ("sans-serif", "Zyyy") -> "Arial" FontFamilyMap g_font_cache; -base::string16 FetchFont(const char* script, const char* map_name) { +std::u16string FetchFont(const char* script, const char* map_name) { FontFamilyMap::const_iterator it = g_font_cache.find(map_name); if (it != g_font_cache.end()) { ScriptFontMap::const_iterator it2 = it->second.find(script); @@ -140,7 +140,7 @@ base::string16 FetchFont(const char* script, const char* map_name) { std::string pref_name = base::StringPrintf("%s.%s", map_name, script); std::string font = GetDefaultFontForPref(pref_name.c_str()); - base::string16 font16 = base::UTF8ToUTF16(font); + std::u16string font16 = base::UTF8ToUTF16(font); ScriptFontMap& map = g_font_cache[map_name]; map[script] = font16; @@ -151,7 +151,7 @@ void FillFontFamilyMap(const char* map_name, blink::web_pref::ScriptFontFamilyMap* map) { for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; - base::string16 result = FetchFont(script, map_name); + std::u16string result = FetchFont(script, map_name); if (!result.empty()) { (*map)[script] = result; } diff --git a/shell/browser/lib/bluetooth_chooser.cc b/shell/browser/lib/bluetooth_chooser.cc index 3233bb94ed2e..4aad929d9111 100644 --- a/shell/browser/lib/bluetooth_chooser.cc +++ b/shell/browser/lib/bluetooth_chooser.cc @@ -104,7 +104,7 @@ void BluetoothChooser::ShowDiscoveryState(DiscoveryState state) { void BluetoothChooser::AddOrUpdateDevice(const std::string& device_id, bool should_update_name, - const base::string16& device_name, + const std::u16string& device_name, bool is_gatt_connected, bool is_paired, int signal_strength_level) { diff --git a/shell/browser/lib/bluetooth_chooser.h b/shell/browser/lib/bluetooth_chooser.h index 1cff5df0bdb8..e7ada17fc7a3 100644 --- a/shell/browser/lib/bluetooth_chooser.h +++ b/shell/browser/lib/bluetooth_chooser.h @@ -18,7 +18,7 @@ class BluetoothChooser : public content::BluetoothChooser { public: struct DeviceInfo { std::string device_id; - base::string16 device_name; + std::u16string device_name; }; explicit BluetoothChooser(api::WebContents* contents, @@ -30,14 +30,14 @@ class BluetoothChooser : public content::BluetoothChooser { void ShowDiscoveryState(DiscoveryState state) override; void AddOrUpdateDevice(const std::string& device_id, bool should_update_name, - const base::string16& device_name, + const std::u16string& device_name, bool is_gatt_connected, bool is_paired, int signal_strength_level) override; std::vector GetDeviceList(); private: - std::map device_map_; + std::map device_map_; api::WebContents* api_web_contents_; EventHandler event_handler_; int num_retries_ = 0; diff --git a/shell/browser/login_handler.cc b/shell/browser/login_handler.cc index fa1bee995dc6..1c4cc45a562f 100644 --- a/shell/browser/login_handler.cc +++ b/shell/browser/login_handler.cc @@ -83,7 +83,7 @@ LoginHandler::~LoginHandler() = default; void LoginHandler::CallbackFromJS(gin::Arguments* args) { if (auth_required_callback_) { - base::string16 username, password; + std::u16string username, password; if (!args->GetNext(&username) || !args->GetNext(&password)) { std::move(auth_required_callback_).Run(base::nullopt); return; diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 3b1d65b9b3e5..3fa8315cb609 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -604,7 +604,7 @@ const views::Widget* NativeWindow::GetWidget() const { return widget(); } -base::string16 NativeWindow::GetAccessibleWindowTitle() const { +std::u16string NativeWindow::GetAccessibleWindowTitle() const { if (accessible_title_.empty()) { return views::WidgetDelegate::GetAccessibleWindowTitle(); } diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index 2bf22fc72c4e..e98801ef0034 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -325,7 +325,7 @@ class NativeWindow : public base::SupportsUserData, // views::WidgetDelegate: views::Widget* GetWidget() override; const views::Widget* GetWidget() const override; - base::string16 GetAccessibleWindowTitle() const override; + std::u16string GetAccessibleWindowTitle() const override; void set_content_view(views::View* view) { content_view_ = view; } @@ -383,7 +383,7 @@ class NativeWindow : public base::SupportsUserData, base::ObserverList observers_; // Accessible title. - base::string16 accessible_title_; + std::u16string accessible_title_; base::WeakPtrFactory weak_factory_{this}; diff --git a/shell/browser/native_window_observer.h b/shell/browser/native_window_observer.h index edf5c2408e16..32276cbdacfa 100644 --- a/shell/browser/native_window_observer.h +++ b/shell/browser/native_window_observer.h @@ -28,7 +28,7 @@ class NativeWindowObserver : public base::CheckedObserver { ~NativeWindowObserver() override {} // Called when the web page in window wants to create a popup window. - virtual void WillCreatePopupWindow(const base::string16& frame_name, + virtual void WillCreatePopupWindow(const std::u16string& frame_name, const GURL& target_url, const std::string& partition_id, WindowOpenDisposition disposition) {} diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index 480445142b31..61fbbc2067d6 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -1476,7 +1476,7 @@ bool NativeWindowViews::CanMinimize() const { #endif } -base::string16 NativeWindowViews::GetWindowTitle() const { +std::u16string NativeWindowViews::GetWindowTitle() const { return base::UTF8ToUTF16(title_); } diff --git a/shell/browser/native_window_views.h b/shell/browser/native_window_views.h index fbde6d0f6be5..3c7aba646bb0 100644 --- a/shell/browser/native_window_views.h +++ b/shell/browser/native_window_views.h @@ -184,7 +184,7 @@ class NativeWindowViews : public NativeWindow, bool CanResize() const override; bool CanMaximize() const override; bool CanMinimize() const override; - base::string16 GetWindowTitle() const override; + std::u16string GetWindowTitle() const override; views::View* GetContentsView() override; bool ShouldDescendIntoChildForEventHandling( gfx::NativeView child, diff --git a/shell/browser/notifications/notification.h b/shell/browser/notifications/notification.h index 28355cb46490..4edcc7b93fb5 100644 --- a/shell/browser/notifications/notification.h +++ b/shell/browser/notifications/notification.h @@ -19,26 +19,26 @@ class NotificationDelegate; class NotificationPresenter; struct NotificationAction { - base::string16 type; - base::string16 text; + std::u16string type; + std::u16string text; }; struct NotificationOptions { - base::string16 title; - base::string16 subtitle; - base::string16 msg; + std::u16string title; + std::u16string subtitle; + std::u16string msg; std::string tag; bool silent; GURL icon_url; SkBitmap icon; bool has_reply; - base::string16 timeout_type; - base::string16 reply_placeholder; - base::string16 sound; - base::string16 urgency; // Linux + std::u16string timeout_type; + std::u16string reply_placeholder; + std::u16string sound; + std::u16string urgency; // Linux std::vector actions; - base::string16 close_button_text; - base::string16 toast_xml; + std::u16string close_button_text; + std::u16string toast_xml; NotificationOptions(); ~NotificationOptions(); diff --git a/shell/browser/notifications/win/notification_presenter_win.cc b/shell/browser/notifications/win/notification_presenter_win.cc index bacf04481f5e..f74a26aef592 100644 --- a/shell/browser/notifications/win/notification_presenter_win.cc +++ b/shell/browser/notifications/win/notification_presenter_win.cc @@ -72,7 +72,7 @@ bool NotificationPresenterWin::Init() { return temp_dir_.CreateUniqueTempDir(); } -base::string16 NotificationPresenterWin::SaveIconToFilesystem( +std::u16string NotificationPresenterWin::SaveIconToFilesystem( const SkBitmap& icon, const GURL& origin) { std::string filename; diff --git a/shell/browser/notifications/win/notification_presenter_win.h b/shell/browser/notifications/win/notification_presenter_win.h index a5006c139b28..7e739ce9be03 100644 --- a/shell/browser/notifications/win/notification_presenter_win.h +++ b/shell/browser/notifications/win/notification_presenter_win.h @@ -39,7 +39,7 @@ class NotificationPresenterWin : public NotificationPresenter { bool Init(); - base::string16 SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin); + std::u16string SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin); private: Notification* CreateNotificationObject( diff --git a/shell/browser/osr/osr_render_widget_host_view.cc b/shell/browser/osr/osr_render_widget_host_view.cc index 59f0568a5aaa..343c62e84a5d 100644 --- a/shell/browser/osr/osr_render_widget_host_view.cc +++ b/shell/browser/osr/osr_render_widget_host_view.cc @@ -456,7 +456,7 @@ void OffScreenRenderWidgetHostView::Destroy() { delete this; } -void OffScreenRenderWidgetHostView::SetTooltipText(const base::string16&) {} +void OffScreenRenderWidgetHostView::SetTooltipText(const std::u16string&) {} uint32_t OffScreenRenderWidgetHostView::GetCaptureSequenceNumber() const { return latest_capture_sequence_number_; diff --git a/shell/browser/osr/osr_render_widget_host_view.h b/shell/browser/osr/osr_render_widget_host_view.h index 8fb46cfaa5a7..cd3b02796006 100644 --- a/shell/browser/osr/osr_render_widget_host_view.h +++ b/shell/browser/osr/osr_render_widget_host_view.h @@ -114,7 +114,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase, void ImeCancelComposition(void) override; void RenderProcessGone() override; void Destroy(void) override; - void SetTooltipText(const base::string16&) override; + void SetTooltipText(const std::u16string&) override; content::CursorManager* GetCursorManager() override; void CopyFromSurface( const gfx::Rect& src_rect, diff --git a/shell/browser/osr/osr_web_contents_view.cc b/shell/browser/osr/osr_web_contents_view.cc index 8c20818f911d..eed0be9cc7e8 100644 --- a/shell/browser/osr/osr_web_contents_view.cc +++ b/shell/browser/osr/osr_web_contents_view.cc @@ -139,7 +139,7 @@ OffScreenWebContentsView::CreateViewForChildWidget( render_widget_host, view, GetSize()); } -void OffScreenWebContentsView::SetPageTitle(const base::string16& title) {} +void OffScreenWebContentsView::SetPageTitle(const std::u16string& title) {} void OffScreenWebContentsView::RenderViewReady() { if (GetView()) diff --git a/shell/browser/osr/osr_web_contents_view.h b/shell/browser/osr/osr_web_contents_view.h index 193080aacdb3..d530ca0627cf 100644 --- a/shell/browser/osr/osr_web_contents_view.h +++ b/shell/browser/osr/osr_web_contents_view.h @@ -57,7 +57,7 @@ class OffScreenWebContentsView : public content::WebContentsView, content::RenderWidgetHost* render_widget_host) override; content::RenderWidgetHostViewBase* CreateViewForChildWidget( content::RenderWidgetHost* render_widget_host) override; - void SetPageTitle(const base::string16& title) override; + void SetPageTitle(const std::u16string& title) override; void RenderViewReady() override; void RenderViewHostChanged(content::RenderViewHost* old_host, content::RenderViewHost* new_host) override; diff --git a/shell/browser/ui/autofill_popup.cc b/shell/browser/ui/autofill_popup.cc index aad02085208f..81d6f1262b7e 100644 --- a/shell/browser/ui/autofill_popup.cc +++ b/shell/browser/ui/autofill_popup.cc @@ -89,8 +89,8 @@ void AutofillPopup::Hide() { } } -void AutofillPopup::SetItems(const std::vector& values, - const std::vector& labels) { +void AutofillPopup::SetItems(const std::vector& values, + const std::vector& labels) { DCHECK(view_); values_ = values; labels_ = labels; @@ -184,11 +184,11 @@ int AutofillPopup::GetLineCount() { return values_.size(); } -base::string16 AutofillPopup::GetValueAt(int i) { +std::u16string AutofillPopup::GetValueAt(int i) { return values_.at(i); } -base::string16 AutofillPopup::GetLabelAt(int i) { +std::u16string AutofillPopup::GetLabelAt(int i) { return labels_.at(i); } diff --git a/shell/browser/ui/autofill_popup.h b/shell/browser/ui/autofill_popup.h index 7ac961a8cfb6..1a7090d9f0d7 100644 --- a/shell/browser/ui/autofill_popup.h +++ b/shell/browser/ui/autofill_popup.h @@ -30,8 +30,8 @@ class AutofillPopup : public views::ViewObserver { const gfx::RectF& bounds); void Hide(); - void SetItems(const std::vector& values, - const std::vector& labels); + void SetItems(const std::vector& values, + const std::vector& labels); void UpdatePopupBounds(); gfx::Rect popup_bounds_in_view(); @@ -53,8 +53,8 @@ class AutofillPopup : public views::ViewObserver { ui::NativeTheme::ColorId GetBackgroundColorIDForRow(int index) const; int GetLineCount(); - base::string16 GetValueAt(int i); - base::string16 GetLabelAt(int i); + std::u16string GetValueAt(int i); + std::u16string GetLabelAt(int i); int LineFromY(int y) const; int selected_index_; @@ -66,8 +66,8 @@ class AutofillPopup : public views::ViewObserver { gfx::Rect element_bounds_; // Datalist suggestions - std::vector values_; - std::vector labels_; + std::vector values_; + std::vector labels_; // Font lists for the suggestions gfx::FontList smaller_font_list_; diff --git a/shell/browser/ui/cocoa/electron_menu_controller.mm b/shell/browser/ui/cocoa/electron_menu_controller.mm index 4de4248a5f6f..d543c27295f7 100644 --- a/shell/browser/ui/cocoa/electron_menu_controller.mm +++ b/shell/browser/ui/cocoa/electron_menu_controller.mm @@ -197,7 +197,7 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; // Locate & retain the recent documents menu item if (!recentDocumentsMenuItem_) { - base::string16 title = base::ASCIIToUTF16("Open Recent"); + std::u16string title = base::ASCIIToUTF16("Open Recent"); NSString* openTitle = l10n_util::FixUpWindowsStyleLabel(title); recentDocumentsMenuItem_.reset([[[[[NSApp mainMenu] @@ -320,7 +320,7 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; - (void)addItemToMenu:(NSMenu*)menu atIndex:(NSInteger)index fromModel:(electron::ElectronMenuModel*)model { - base::string16 label16 = model->GetLabelAt(index); + std::u16string label16 = model->GetLabelAt(index); NSString* label = l10n_util::FixUpWindowsStyleLabel(label16); base::scoped_nsobject item([[NSMenuItem alloc] @@ -333,14 +333,14 @@ static base::scoped_nsobject recentDocumentsMenuSwap_; if (icon.IsImage()) [item setImage:icon.GetImage().ToNSImage()]; - base::string16 toolTip = model->GetToolTipAt(index); + std::u16string toolTip = model->GetToolTipAt(index); [item setToolTip:base::SysUTF16ToNSString(toolTip)]; - base::string16 role = model->GetRoleAt(index); + std::u16string role = model->GetRoleAt(index); electron::ElectronMenuModel::ItemType type = model->GetTypeAt(index); if (role == base::ASCIIToUTF16("services")) { - base::string16 title = base::ASCIIToUTF16("Services"); + std::u16string title = base::ASCIIToUTF16("Services"); NSString* label = l10n_util::FixUpWindowsStyleLabel(title); [item setTarget:nil]; diff --git a/shell/browser/ui/electron_menu_model.cc b/shell/browser/ui/electron_menu_model.cc index b4680e64f92c..7b91850160c0 100644 --- a/shell/browser/ui/electron_menu_model.cc +++ b/shell/browser/ui/electron_menu_model.cc @@ -27,38 +27,38 @@ ElectronMenuModel::ElectronMenuModel(Delegate* delegate) ElectronMenuModel::~ElectronMenuModel() = default; -void ElectronMenuModel::SetToolTip(int index, const base::string16& toolTip) { +void ElectronMenuModel::SetToolTip(int index, const std::u16string& toolTip) { int command_id = GetCommandIdAt(index); toolTips_[command_id] = toolTip; } -base::string16 ElectronMenuModel::GetToolTipAt(int index) { +std::u16string ElectronMenuModel::GetToolTipAt(int index) { const int command_id = GetCommandIdAt(index); const auto iter = toolTips_.find(command_id); - return iter == std::end(toolTips_) ? base::string16() : iter->second; + return iter == std::end(toolTips_) ? std::u16string() : iter->second; } -void ElectronMenuModel::SetRole(int index, const base::string16& role) { +void ElectronMenuModel::SetRole(int index, const std::u16string& role) { int command_id = GetCommandIdAt(index); roles_[command_id] = role; } -base::string16 ElectronMenuModel::GetRoleAt(int index) { +std::u16string ElectronMenuModel::GetRoleAt(int index) { const int command_id = GetCommandIdAt(index); const auto iter = roles_.find(command_id); - return iter == std::end(roles_) ? base::string16() : iter->second; + return iter == std::end(roles_) ? std::u16string() : iter->second; } void ElectronMenuModel::SetSecondaryLabel(int index, - const base::string16& sublabel) { + const std::u16string& sublabel) { int command_id = GetCommandIdAt(index); sublabels_[command_id] = sublabel; } -base::string16 ElectronMenuModel::GetSecondaryLabelAt(int index) const { +std::u16string ElectronMenuModel::GetSecondaryLabelAt(int index) const { int command_id = GetCommandIdAt(index); const auto iter = sublabels_.find(command_id); - return iter == std::end(sublabels_) ? base::string16() : iter->second; + return iter == std::end(sublabels_) ? std::u16string() : iter->second; } bool ElectronMenuModel::GetAcceleratorAtWithParams( diff --git a/shell/browser/ui/electron_menu_model.h b/shell/browser/ui/electron_menu_model.h index de2ebd07899c..bf8dbcb95fef 100644 --- a/shell/browser/ui/electron_menu_model.h +++ b/shell/browser/ui/electron_menu_model.h @@ -77,12 +77,12 @@ class ElectronMenuModel : public ui::SimpleMenuModel { void AddObserver(Observer* obs) { observers_.AddObserver(obs); } void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); } - void SetToolTip(int index, const base::string16& toolTip); - base::string16 GetToolTipAt(int index); - void SetRole(int index, const base::string16& role); - base::string16 GetRoleAt(int index); - void SetSecondaryLabel(int index, const base::string16& sublabel); - base::string16 GetSecondaryLabelAt(int index) const override; + void SetToolTip(int index, const std::u16string& toolTip); + std::u16string GetToolTipAt(int index); + void SetRole(int index, const std::u16string& role); + std::u16string GetRoleAt(int index); + void SetSecondaryLabel(int index, const std::u16string& sublabel); + std::u16string GetSecondaryLabelAt(int index) const override; bool GetAcceleratorAtWithParams(int index, bool use_default_accelerator, ui::Accelerator* accelerator) const; @@ -114,9 +114,9 @@ class ElectronMenuModel : public ui::SimpleMenuModel { base::Optional sharing_item_; #endif - std::map toolTips_; // command id -> tooltip - std::map roles_; // command id -> role - std::map sublabels_; // command id -> sublabel + std::map toolTips_; // command id -> tooltip + std::map roles_; // command id -> role + std::map sublabels_; // command id -> sublabel base::ObserverList observers_; base::WeakPtrFactory weak_factory_{this}; diff --git a/shell/browser/ui/gtk/app_indicator_icon.cc b/shell/browser/ui/gtk/app_indicator_icon.cc index f87b752fbef1..6a530857163f 100644 --- a/shell/browser/ui/gtk/app_indicator_icon.cc +++ b/shell/browser/ui/gtk/app_indicator_icon.cc @@ -157,7 +157,7 @@ namespace gtkui { AppIndicatorIcon::AppIndicatorIcon(std::string id, const gfx::ImageSkia& image, - const base::string16& tool_tip) + const std::u16string& tool_tip) : id_(id) { std::unique_ptr env(base::Environment::Create()); desktop_env_ = base::nix::GetDesktopEnvironment(env.get()); @@ -215,7 +215,7 @@ void AppIndicatorIcon::SetIcon(const gfx::ImageSkia& image) { } } -void AppIndicatorIcon::SetToolTip(const base::string16& tool_tip) { +void AppIndicatorIcon::SetToolTip(const std::u16string& tool_tip) { DCHECK(!tool_tip_.empty()); tool_tip_ = base::UTF16ToUTF8(tool_tip); UpdateClickActionReplacementMenuItem(); diff --git a/shell/browser/ui/gtk/app_indicator_icon.h b/shell/browser/ui/gtk/app_indicator_icon.h index 7aa023919342..4174463ca84a 100644 --- a/shell/browser/ui/gtk/app_indicator_icon.h +++ b/shell/browser/ui/gtk/app_indicator_icon.h @@ -41,7 +41,7 @@ class AppIndicatorIcon : public views::StatusIconLinux { // icons. AppIndicatorIcon(std::string id, const gfx::ImageSkia& image, - const base::string16& tool_tip); + const std::u16string& tool_tip); ~AppIndicatorIcon() override; // Indicates whether libappindicator so could be opened. @@ -49,7 +49,7 @@ class AppIndicatorIcon : public views::StatusIconLinux { // Overridden from views::StatusIconLinux: void SetIcon(const gfx::ImageSkia& image) override; - void SetToolTip(const base::string16& tool_tip) override; + void SetToolTip(const std::u16string& tool_tip) override; void UpdatePlatformContextMenu(ui::MenuModel* menu) override; void RefreshPlatformContextMenu() override; diff --git a/shell/browser/ui/gtk/gtk_status_icon.cc b/shell/browser/ui/gtk/gtk_status_icon.cc index 244f3876f869..ecad7d470c5e 100644 --- a/shell/browser/ui/gtk/gtk_status_icon.cc +++ b/shell/browser/ui/gtk/gtk_status_icon.cc @@ -20,7 +20,7 @@ namespace electron { namespace gtkui { GtkStatusIcon::GtkStatusIcon(const gfx::ImageSkia& image, - const base::string16& tool_tip) { + const std::u16string& tool_tip) { GdkPixbuf* pixbuf = gtk_util::GdkPixbufFromSkBitmap(*image.bitmap()); { // GTK has a bug that leaks 384 bytes when creating a GtkStatusIcon. It @@ -50,7 +50,7 @@ void GtkStatusIcon::SetIcon(const gfx::ImageSkia& image) { g_object_unref(pixbuf); } -void GtkStatusIcon::SetToolTip(const base::string16& tool_tip) { +void GtkStatusIcon::SetToolTip(const std::u16string& tool_tip) { gtk_status_icon_set_tooltip_text(gtk_status_icon_, base::UTF16ToUTF8(tool_tip).c_str()); } diff --git a/shell/browser/ui/gtk/gtk_status_icon.h b/shell/browser/ui/gtk/gtk_status_icon.h index 07c49f25f868..fe1454505505 100644 --- a/shell/browser/ui/gtk/gtk_status_icon.h +++ b/shell/browser/ui/gtk/gtk_status_icon.h @@ -32,12 +32,12 @@ class AppIndicatorIconMenu; // GtkStatusIcon). class GtkStatusIcon : public views::StatusIconLinux { public: - GtkStatusIcon(const gfx::ImageSkia& image, const base::string16& tool_tip); + GtkStatusIcon(const gfx::ImageSkia& image, const std::u16string& tool_tip); ~GtkStatusIcon() override; // Overridden from views::StatusIconLinux: void SetIcon(const gfx::ImageSkia& image) override; - void SetToolTip(const base::string16& tool_tip) override; + void SetToolTip(const std::u16string& tool_tip) override; void UpdatePlatformContextMenu(ui::MenuModel* menu) override; void RefreshPlatformContextMenu() override; diff --git a/shell/browser/ui/gtk/status_icon.cc b/shell/browser/ui/gtk/status_icon.cc index 43b91c645eab..6a78f82d0c10 100644 --- a/shell/browser/ui/gtk/status_icon.cc +++ b/shell/browser/ui/gtk/status_icon.cc @@ -37,7 +37,7 @@ bool IsStatusIconSupported() { std::unique_ptr CreateLinuxStatusIcon( const gfx::ImageSkia& image, - const base::string16& tool_tip, + const std::u16string& tool_tip, const char* id_prefix) { #if GTK_CHECK_VERSION(3, 90, 0) NOTIMPLEMENTED(); diff --git a/shell/browser/ui/gtk/status_icon.h b/shell/browser/ui/gtk/status_icon.h index 3fd40dcf2704..384938ef8e85 100644 --- a/shell/browser/ui/gtk/status_icon.h +++ b/shell/browser/ui/gtk/status_icon.h @@ -22,7 +22,7 @@ namespace gtkui { bool IsStatusIconSupported(); std::unique_ptr CreateLinuxStatusIcon( const gfx::ImageSkia& image, - const base::string16& tool_tip, + const std::u16string& tool_tip, const char* id_prefix); } // namespace gtkui diff --git a/shell/browser/ui/inspectable_web_contents.cc b/shell/browser/ui/inspectable_web_contents.cc index 6d804138fa3b..87829e848a05 100644 --- a/shell/browser/ui/inspectable_web_contents.cc +++ b/shell/browser/ui/inspectable_web_contents.cc @@ -567,7 +567,7 @@ void InspectableWebContents::LoadCompleted() { prefs->GetString("currentDockState", ¤t_dock_state); base::RemoveChars(current_dock_state, "\"", &dock_state_); } - base::string16 javascript = base::UTF8ToUTF16( + std::u16string javascript = base::UTF8ToUTF16( "UI.DockController.instance().setDockSide(\"" + dock_state_ + "\");"); GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript( javascript, base::NullCallback()); @@ -902,7 +902,7 @@ void InspectableWebContents::DispatchProtocolMessage( if (str_message.size() < kMaxMessageChunkSize) { std::string param; base::EscapeJSONString(str_message, true, ¶m); - base::string16 javascript = + std::u16string javascript = base::UTF8ToUTF16("DevToolsAPI.dispatchMessage(" + param + ");"); GetDevToolsWebContents()->GetMainFrame()->ExecuteJavaScript( javascript, base::NullCallback()); @@ -949,9 +949,9 @@ void InspectableWebContents::WebContentsDestroyed() { bool InspectableWebContents::DidAddMessageToConsole( content::WebContents* source, blink::mojom::ConsoleMessageLevel level, - const base::string16& message, + const std::u16string& message, int32_t line_no, - const base::string16& source_id) { + const std::u16string& source_id) { logging::LogMessage("CONSOLE", line_no, blink::ConsoleMessageLevelToLogSeverity(level)) .stream() diff --git a/shell/browser/ui/inspectable_web_contents.h b/shell/browser/ui/inspectable_web_contents.h index f49179815859..69a000ccf152 100644 --- a/shell/browser/ui/inspectable_web_contents.h +++ b/shell/browser/ui/inspectable_web_contents.h @@ -177,9 +177,9 @@ class InspectableWebContents // content::WebContentsDelegate: bool DidAddMessageToConsole(content::WebContents* source, blink::mojom::ConsoleMessageLevel level, - const base::string16& message, + const std::u16string& message, int32_t line_no, - const base::string16& source_id) override; + const std::u16string& source_id) override; bool HandleKeyboardEvent(content::WebContents*, const content::NativeWebKeyboardEvent&) override; void CloseContents(content::WebContents* source) override; diff --git a/shell/browser/ui/inspectable_web_contents_view.h b/shell/browser/ui/inspectable_web_contents_view.h index 4fbd3d7fd849..233a1276f252 100644 --- a/shell/browser/ui/inspectable_web_contents_view.h +++ b/shell/browser/ui/inspectable_web_contents_view.h @@ -51,7 +51,7 @@ class InspectableWebContentsView { virtual void SetIsDocked(bool docked, bool activate) = 0; virtual void SetContentsResizingStrategy( const DevToolsContentsResizingStrategy& strategy) = 0; - virtual void SetTitle(const base::string16& title) = 0; + virtual void SetTitle(const std::u16string& title) = 0; private: InspectableWebContentsViewDelegate* delegate_ = nullptr; // weak references. diff --git a/shell/browser/ui/inspectable_web_contents_view_mac.h b/shell/browser/ui/inspectable_web_contents_view_mac.h index 3ab732f96f34..8a30bc532917 100644 --- a/shell/browser/ui/inspectable_web_contents_view_mac.h +++ b/shell/browser/ui/inspectable_web_contents_view_mac.h @@ -33,7 +33,7 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView { void SetIsDocked(bool docked, bool activate) override; void SetContentsResizingStrategy( const DevToolsContentsResizingStrategy& strategy) override; - void SetTitle(const base::string16& title) override; + void SetTitle(const std::u16string& title) override; InspectableWebContents* inspectable_web_contents() { return inspectable_web_contents_; diff --git a/shell/browser/ui/inspectable_web_contents_view_mac.mm b/shell/browser/ui/inspectable_web_contents_view_mac.mm index 2523a933e5b2..f9e9011669d0 100644 --- a/shell/browser/ui/inspectable_web_contents_view_mac.mm +++ b/shell/browser/ui/inspectable_web_contents_view_mac.mm @@ -58,7 +58,7 @@ void InspectableWebContentsViewMac::SetContentsResizingStrategy( [view_ setContentsResizingStrategy:strategy]; } -void InspectableWebContentsViewMac::SetTitle(const base::string16& title) { +void InspectableWebContentsViewMac::SetTitle(const std::u16string& title) { [view_ setTitle:base::SysUTF16ToNSString(title)]; } diff --git a/shell/browser/ui/message_box.h b/shell/browser/ui/message_box.h index d2548ffa5366..9126b9940736 100644 --- a/shell/browser/ui/message_box.h +++ b/shell/browser/ui/message_box.h @@ -56,7 +56,7 @@ void ShowMessageBox(const MessageBoxSettings& settings, // Like ShowMessageBox with simplest settings, but safe to call at very early // stage of application. -void ShowErrorBox(const base::string16& title, const base::string16& content); +void ShowErrorBox(const std::u16string& title, const std::u16string& content); } // namespace electron diff --git a/shell/browser/ui/message_box_gtk.cc b/shell/browser/ui/message_box_gtk.cc index 739f4a8de8e2..b1290a6a5783 100644 --- a/shell/browser/ui/message_box_gtk.cc +++ b/shell/browser/ui/message_box_gtk.cc @@ -220,7 +220,7 @@ void ShowMessageBox(const MessageBoxSettings& settings, (new GtkMessageBox(settings))->RunAsynchronous(std::move(callback)); } -void ShowErrorBox(const base::string16& title, const base::string16& content) { +void ShowErrorBox(const std::u16string& title, const std::u16string& content) { if (Browser::Get()->is_ready()) { electron::MessageBoxSettings settings; settings.type = electron::MessageBoxType::kError; diff --git a/shell/browser/ui/message_box_mac.mm b/shell/browser/ui/message_box_mac.mm index fe24fe963ce4..55fbf746e538 100644 --- a/shell/browser/ui/message_box_mac.mm +++ b/shell/browser/ui/message_box_mac.mm @@ -146,7 +146,7 @@ void ShowMessageBox(const MessageBoxSettings& settings, } } -void ShowErrorBox(const base::string16& title, const base::string16& content) { +void ShowErrorBox(const std::u16string& title, const std::u16string& content) { NSAlert* alert = [[NSAlert alloc] init]; [alert setMessageText:base::SysUTF16ToNSString(title)]; [alert setInformativeText:base::SysUTF16ToNSString(content)]; diff --git a/shell/browser/ui/message_box_win.cc b/shell/browser/ui/message_box_win.cc index 19e0190f0501..2e5751e72390 100644 --- a/shell/browser/ui/message_box_win.cc +++ b/shell/browser/ui/message_box_win.cc @@ -39,8 +39,8 @@ struct CommonButtonID { int button; int id; }; -CommonButtonID GetCommonID(const base::string16& button) { - base::string16 lower = base::ToLowerASCII(button); +CommonButtonID GetCommonID(const std::u16string& button) { + std::u16string lower = base::ToLowerASCII(button); if (lower == L"ok") return {TDCBF_OK_BUTTON, IDOK}; else if (lower == L"yes") @@ -58,7 +58,7 @@ CommonButtonID GetCommonID(const base::string16& button) { // Determine whether the buttons are common buttons, if so map common ID // to button ID. -void MapToCommonID(const std::vector& buttons, +void MapToCommonID(const std::vector& buttons, std::map* id_map, TASKDIALOG_COMMON_BUTTON_FLAGS* button_flags, std::vector* dialog_buttons) { @@ -78,14 +78,14 @@ void MapToCommonID(const std::vector& buttons, DialogResult ShowTaskDialogUTF16(NativeWindow* parent, MessageBoxType type, - const std::vector& buttons, + const std::vector& buttons, int default_id, int cancel_id, bool no_link, - const base::string16& title, - const base::string16& message, - const base::string16& detail, - const base::string16& checkbox_label, + const std::u16string& title, + const std::u16string& message, + const std::u16string& detail, + const std::u16string& checkbox_label, bool checkbox_checked, const gfx::ImageSkia& icon) { TASKDIALOG_FLAGS flags = @@ -107,7 +107,7 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, // TaskDialogIndirect doesn't allow empty name, if we set empty title it // will show "electron.exe" in title. - base::string16 app_name = base::UTF8ToUTF16(Browser::Get()->GetName()); + std::u16string app_name = base::UTF8ToUTF16(Browser::Get()->GetName()); if (title.empty()) config.pszWindowTitle = app_name.c_str(); else @@ -185,14 +185,14 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, } DialogResult ShowTaskDialogUTF8(const MessageBoxSettings& settings) { - std::vector utf16_buttons; + std::vector utf16_buttons; for (const auto& button : settings.buttons) utf16_buttons.push_back(base::UTF8ToUTF16(button)); - const base::string16 title_16 = base::UTF8ToUTF16(settings.title); - const base::string16 message_16 = base::UTF8ToUTF16(settings.message); - const base::string16 detail_16 = base::UTF8ToUTF16(settings.detail); - const base::string16 checkbox_label_16 = + const std::u16string title_16 = base::UTF8ToUTF16(settings.title); + const std::u16string message_16 = base::UTF8ToUTF16(settings.message); + const std::u16string detail_16 = base::UTF8ToUTF16(settings.detail); + const std::u16string checkbox_label_16 = base::UTF8ToUTF16(settings.checkbox_label); return ShowTaskDialogUTF16( @@ -219,7 +219,7 @@ void ShowMessageBox(const MessageBoxSettings& settings, std::move(callback))); } -void ShowErrorBox(const base::string16& title, const base::string16& content) { +void ShowErrorBox(const std::u16string& title, const std::u16string& content) { electron::UnresponsiveSuppressor suppressor; ShowTaskDialogUTF16(nullptr, MessageBoxType::kError, {}, -1, 0, false, L"Error", title, content, L"", false, gfx::ImageSkia()); diff --git a/shell/browser/ui/tray_icon.h b/shell/browser/ui/tray_icon.h index 307bf49bf89c..16f1ef05135d 100644 --- a/shell/browser/ui/tray_icon.h +++ b/shell/browser/ui/tray_icon.h @@ -64,8 +64,8 @@ class TrayIcon { #else gfx::Image icon; #endif - base::string16 title; - base::string16 content; + std::u16string title; + std::u16string content; bool large_icon = true; bool no_sound = false; bool respect_quiet_time = false; diff --git a/shell/browser/ui/tray_icon_gtk.cc b/shell/browser/ui/tray_icon_gtk.cc index 1c97aa61be74..a1205e27f78d 100644 --- a/shell/browser/ui/tray_icon_gtk.cc +++ b/shell/browser/ui/tray_icon_gtk.cc @@ -47,7 +47,7 @@ const gfx::ImageSkia& TrayIconGtk::GetImage() const { return image_; } -const base::string16& TrayIconGtk::GetToolTip() const { +const std::u16string& TrayIconGtk::GetToolTip() const { return tool_tip_; } diff --git a/shell/browser/ui/tray_icon_gtk.h b/shell/browser/ui/tray_icon_gtk.h index 1580d60bf502..41193af329d7 100644 --- a/shell/browser/ui/tray_icon_gtk.h +++ b/shell/browser/ui/tray_icon_gtk.h @@ -33,14 +33,14 @@ class TrayIconGtk : public TrayIcon, public views::StatusIconLinux::Delegate { // The following four methods are only used by StatusIconLinuxDbus, which we // aren't yet using, so they are given stub implementations. const gfx::ImageSkia& GetImage() const override; - const base::string16& GetToolTip() const override; + const std::u16string& GetToolTip() const override; ui::MenuModel* GetMenuModel() const override; void OnImplInitializationFailed() override; private: std::unique_ptr icon_; gfx::ImageSkia image_; - base::string16 tool_tip_; + std::u16string tool_tip_; ui::MenuModel* menu_model_; DISALLOW_COPY_AND_ASSIGN(TrayIconGtk); diff --git a/shell/browser/ui/views/autofill_popup_view.h b/shell/browser/ui/views/autofill_popup_view.h index c6e0da1d457d..1209bdd7a2ab 100644 --- a/shell/browser/ui/views/autofill_popup_view.h +++ b/shell/browser/ui/views/autofill_popup_view.h @@ -37,7 +37,7 @@ class AutofillPopup; // by |AutofillPopupViewViews|. class AutofillPopupChildView : public views::View { public: - explicit AutofillPopupChildView(const base::string16& suggestion) + explicit AutofillPopupChildView(const std::u16string& suggestion) : suggestion_(suggestion) { SetFocusBehavior(FocusBehavior::ALWAYS); } @@ -48,7 +48,7 @@ class AutofillPopupChildView : public views::View { // views::Views implementation void GetAccessibleNodeData(ui::AXNodeData* node_data) override; - base::string16 suggestion_; + std::u16string suggestion_; DISALLOW_COPY_AND_ASSIGN(AutofillPopupChildView); }; diff --git a/shell/browser/ui/views/electron_views_delegate.cc b/shell/browser/ui/views/electron_views_delegate.cc index bdc206f7d40c..faf123fc09d7 100644 --- a/shell/browser/ui/views/electron_views_delegate.cc +++ b/shell/browser/ui/views/electron_views_delegate.cc @@ -47,8 +47,8 @@ bool ViewsDelegate::GetSavedWindowPlacement( return false; } -void ViewsDelegate::NotifyMenuItemFocused(const base::string16& menu_name, - const base::string16& menu_item_name, +void ViewsDelegate::NotifyMenuItemFocused(const std::u16string& menu_name, + const std::u16string& menu_item_name, int item_index, int item_count, bool has_submenu) {} diff --git a/shell/browser/ui/views/electron_views_delegate.h b/shell/browser/ui/views/electron_views_delegate.h index 58c4e33cb850..6c06a7ff18e3 100644 --- a/shell/browser/ui/views/electron_views_delegate.h +++ b/shell/browser/ui/views/electron_views_delegate.h @@ -29,8 +29,8 @@ class ViewsDelegate : public views::ViewsDelegate { const std::string& window_name, gfx::Rect* bounds, ui::WindowShowState* show_state) const override; - void NotifyMenuItemFocused(const base::string16& menu_name, - const base::string16& menu_item_name, + void NotifyMenuItemFocused(const std::u16string& menu_name, + const std::u16string& menu_item_name, int item_index, int item_count, bool has_submenu) override; diff --git a/shell/browser/ui/views/global_menu_bar_x11.cc b/shell/browser/ui/views/global_menu_bar_x11.cc index d96fad6e0e35..387cc1b0f6ef 100644 --- a/shell/browser/ui/views/global_menu_bar_x11.cc +++ b/shell/browser/ui/views/global_menu_bar_x11.cc @@ -297,7 +297,7 @@ void GlobalMenuBarX11::RegisterAccelerator(DbusmenuMenuitem* item, NOTIMPLEMENTED(); return; } - std::string name = base::UTF16ToUTF8(base::string16(1, keysym)); + std::string name = base::UTF16ToUTF8(std::u16string(1, keysym)); g_variant_builder_add(&builder, "s", name.c_str()); GVariant* inside_array = g_variant_builder_end(&builder); diff --git a/shell/browser/ui/views/inspectable_web_contents_view_views.cc b/shell/browser/ui/views/inspectable_web_contents_view_views.cc index cbeab44decf7..74b1f706cf42 100644 --- a/shell/browser/ui/views/inspectable_web_contents_view_views.cc +++ b/shell/browser/ui/views/inspectable_web_contents_view_views.cc @@ -46,7 +46,7 @@ class DevToolsWindowDelegate : public views::ClientView, bool CanResize() const override { return true; } bool CanMaximize() const override { return true; } bool CanMinimize() const override { return true; } - base::string16 GetWindowTitle() const override { return shell_->GetTitle(); } + std::u16string GetWindowTitle() const override { return shell_->GetTitle(); } gfx::ImageSkia GetWindowAppIcon() override { return GetWindowIcon(); } gfx::ImageSkia GetWindowIcon() override { return icon_; } views::Widget* GetWidget() override { return widget_; } @@ -202,7 +202,7 @@ void InspectableWebContentsViewViews::SetContentsResizingStrategy( Layout(); } -void InspectableWebContentsViewViews::SetTitle(const base::string16& title) { +void InspectableWebContentsViewViews::SetTitle(const std::u16string& title) { if (devtools_window_) { title_ = title; devtools_window_->UpdateWindowTitle(); diff --git a/shell/browser/ui/views/inspectable_web_contents_view_views.h b/shell/browser/ui/views/inspectable_web_contents_view_views.h index 69864f96bb1c..3b209152889d 100644 --- a/shell/browser/ui/views/inspectable_web_contents_view_views.h +++ b/shell/browser/ui/views/inspectable_web_contents_view_views.h @@ -39,13 +39,13 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView, void SetIsDocked(bool docked, bool activate) override; void SetContentsResizingStrategy( const DevToolsContentsResizingStrategy& strategy) override; - void SetTitle(const base::string16& title) override; + void SetTitle(const std::u16string& title) override; InspectableWebContents* inspectable_web_contents() { return inspectable_web_contents_; } - const base::string16& GetTitle() const { return title_; } + const std::u16string& GetTitle() const { return title_; } private: // views::View: @@ -62,7 +62,7 @@ class InspectableWebContentsViewViews : public InspectableWebContentsView, DevToolsContentsResizingStrategy strategy_; bool devtools_visible_ = false; views::WidgetDelegate* devtools_window_delegate_ = nullptr; - base::string16 title_; + std::u16string title_; DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewViews); }; diff --git a/shell/browser/ui/views/menu_delegate.cc b/shell/browser/ui/views/menu_delegate.cc index e2988ec6f77a..435242c2a2c6 100644 --- a/shell/browser/ui/views/menu_delegate.cc +++ b/shell/browser/ui/views/menu_delegate.cc @@ -70,7 +70,7 @@ bool MenuDelegate::GetAccelerator(int id, ui::Accelerator* accelerator) const { return adapter_->GetAccelerator(id, accelerator); } -base::string16 MenuDelegate::GetLabel(int id) const { +std::u16string MenuDelegate::GetLabel(int id) const { return adapter_->GetLabel(id); } diff --git a/shell/browser/ui/views/menu_delegate.h b/shell/browser/ui/views/menu_delegate.h index d961dbb68a42..1156d45a9228 100644 --- a/shell/browser/ui/views/menu_delegate.h +++ b/shell/browser/ui/views/menu_delegate.h @@ -46,7 +46,7 @@ class MenuDelegate : public views::MenuDelegate { bool IsTriggerableEvent(views::MenuItemView* source, const ui::Event& e) override; bool GetAccelerator(int id, ui::Accelerator* accelerator) const override; - base::string16 GetLabel(int id) const override; + std::u16string GetLabel(int id) const override; void GetLabelStyle(int id, LabelStyle* style) const override; bool IsCommandEnabled(int id) const override; bool IsCommandVisible(int id) const override; diff --git a/shell/browser/ui/views/submenu_button.cc b/shell/browser/ui/views/submenu_button.cc index 89a51c8ed656..a6027e8d8bca 100644 --- a/shell/browser/ui/views/submenu_button.cc +++ b/shell/browser/ui/views/submenu_button.cc @@ -21,7 +21,7 @@ namespace electron { SubmenuButton::SubmenuButton(PressedCallback callback, - const base::string16& title, + const std::u16string& title, const SkColor& background_color) : views::MenuButton(callback, gfx::RemoveAccelerator(title)), background_color_(background_color) { @@ -89,12 +89,12 @@ void SubmenuButton::PaintButtonContents(gfx::Canvas* canvas) { } } -bool SubmenuButton::GetUnderlinePosition(const base::string16& text, +bool SubmenuButton::GetUnderlinePosition(const std::u16string& text, char16_t* accelerator, int* start, int* end) const { int pos, span; - base::string16 trimmed = + std::u16string trimmed = gfx::LocateAndRemoveAcceleratorChar(text, &pos, &span); if (pos > -1 && span != 0) { *accelerator = base::ToUpperASCII(trimmed[pos]); @@ -106,7 +106,7 @@ bool SubmenuButton::GetUnderlinePosition(const base::string16& text, return false; } -void SubmenuButton::GetCharacterPosition(const base::string16& text, +void SubmenuButton::GetCharacterPosition(const std::u16string& text, int index, int* pos) const { int height = 0; diff --git a/shell/browser/ui/views/submenu_button.h b/shell/browser/ui/views/submenu_button.h index 10344cd6842d..2a4d5cae8ad5 100644 --- a/shell/browser/ui/views/submenu_button.h +++ b/shell/browser/ui/views/submenu_button.h @@ -17,7 +17,7 @@ namespace electron { class SubmenuButton : public views::MenuButton { public: SubmenuButton(PressedCallback callback, - const base::string16& title, + const std::u16string& title, const SkColor& background_color); ~SubmenuButton() override; @@ -36,11 +36,11 @@ class SubmenuButton : public views::MenuButton { std::unique_ptr CreateInkDrop() override; private: - bool GetUnderlinePosition(const base::string16& text, + bool GetUnderlinePosition(const std::u16string& text, char16_t* accelerator, int* start, int* end) const; - void GetCharacterPosition(const base::string16& text, + void GetCharacterPosition(const std::u16string& text, int index, int* pos) const; diff --git a/shell/browser/ui/win/jump_list.cc b/shell/browser/ui/win/jump_list.cc index 310887ca4210..22d72b6e9bc1 100644 --- a/shell/browser/ui/win/jump_list.cc +++ b/shell/browser/ui/win/jump_list.cc @@ -158,7 +158,7 @@ JumpListCategory::JumpListCategory() = default; JumpListCategory::JumpListCategory(const JumpListCategory&) = default; JumpListCategory::~JumpListCategory() = default; -JumpList::JumpList(const base::string16& app_id) : app_id_(app_id) { +JumpList::JumpList(const std::u16string& app_id) : app_id_(app_id) { destinations_.CoCreateInstance(CLSID_DestinationList); } diff --git a/shell/browser/ui/win/jump_list.h b/shell/browser/ui/win/jump_list.h index 39dc118ec4f0..ae202dbc3548 100644 --- a/shell/browser/ui/win/jump_list.h +++ b/shell/browser/ui/win/jump_list.h @@ -46,9 +46,9 @@ struct JumpListItem { // For tasks this is the path to the program executable, for file links this // is the full filename. base::FilePath path; - base::string16 arguments; - base::string16 title; - base::string16 description; + std::u16string arguments; + std::u16string title; + std::u16string description; base::FilePath working_dir; base::FilePath icon_path; int icon_index = 0; @@ -73,7 +73,7 @@ struct JumpListCategory { }; Type type = Type::kTasks; - base::string16 name; + std::u16string name; std::vector items; JumpListCategory(); @@ -88,7 +88,7 @@ class JumpList { // |app_id| must be the Application User Model ID of the app for which the // custom Jump List should be created/removed, it's usually obtained by // calling GetCurrentProcessExplicitAppUserModelID(). - explicit JumpList(const base::string16& app_id); + explicit JumpList(const std::u16string& app_id); ~JumpList(); // Starts a new transaction, must be called before appending any categories, @@ -111,7 +111,7 @@ class JumpList { const std::vector& categories); private: - base::string16 app_id_; + std::u16string app_id_; CComPtr destinations_; DISALLOW_COPY_AND_ASSIGN(JumpList); diff --git a/shell/browser/web_contents_preferences.cc b/shell/browser/web_contents_preferences.cc index 8cab86df11f9..20317bfd6d8a 100644 --- a/shell/browser/web_contents_preferences.cc +++ b/shell/browser/web_contents_preferences.cc @@ -50,7 +50,7 @@ bool GetAsString(const base::Value* val, bool GetAsString(const base::Value* val, base::StringPiece path, - base::string16* out) { + std::u16string* out) { if (val) { auto* found = val->FindKeyOfType(path, base::Value::Type::STRING); if (found) { @@ -380,7 +380,7 @@ void WebContentsPreferences::OverrideWebkitPrefs( auto* fonts_dict = preference_.FindKeyOfType("defaultFontFamily", base::Value::Type::DICTIONARY); if (fonts_dict) { - base::string16 font; + std::u16string font; if (GetAsString(fonts_dict, "standard", &font)) prefs->standard_font_family_map[blink::web_pref::kCommonScript] = font; if (GetAsString(fonts_dict, "serif", &font)) diff --git a/shell/browser/web_dialog_helper.cc b/shell/browser/web_dialog_helper.cc index 47993cd4a482..976eaedeb9c8 100644 --- a/shell/browser/web_dialog_helper.cc +++ b/shell/browser/web_dialog_helper.cc @@ -35,7 +35,7 @@ using blink::mojom::NativeFileInfo; namespace { file_dialog::Filters GetFileTypesFromAcceptType( - const std::vector& accept_types) { + const std::vector& accept_types) { file_dialog::Filters filters; if (accept_types.empty()) return filters; @@ -163,7 +163,7 @@ void WebDialogHelper::EnumerateDirectory( std::vector file_info; while (!(path = file_enum.Next()).empty()) { file_info.push_back(FileChooserFileInfo::NewNativeFile( - NativeFileInfo::New(path, base::string16()))); + NativeFileInfo::New(path, std::u16string()))); } listener->FileSelected(std::move(file_info), dir, diff --git a/shell/common/api/electron_api_clipboard.cc b/shell/common/api/electron_api_clipboard.cc index 50db8a1c59ae..e67e846912e2 100644 --- a/shell/common/api/electron_api_clipboard.cc +++ b/shell/common/api/electron_api_clipboard.cc @@ -26,9 +26,9 @@ ui::ClipboardBuffer Clipboard::GetClipboardBuffer(gin_helper::Arguments* args) { return ui::ClipboardBuffer::kCopyPaste; } -std::vector Clipboard::AvailableFormats( +std::vector Clipboard::AvailableFormats( gin_helper::Arguments* args) { - std::vector format_types; + std::vector format_types; ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); clipboard->ReadAvailableTypes(GetClipboardBuffer(args), /* data_dst = */ nullptr, &format_types); @@ -80,7 +80,7 @@ void Clipboard::WriteBuffer(const std::string& format, void Clipboard::Write(const gin_helper::Dictionary& data, gin_helper::Arguments* args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); - base::string16 text, html, bookmark; + std::u16string text, html, bookmark; gfx::Image image; if (data.Get("text", &text)) { @@ -102,8 +102,8 @@ void Clipboard::Write(const gin_helper::Dictionary& data, writer.WriteImage(image.AsBitmap()); } -base::string16 Clipboard::ReadText(gin_helper::Arguments* args) { - base::string16 data; +std::u16string Clipboard::ReadText(gin_helper::Arguments* args) { + std::u16string data; ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); auto type = GetClipboardBuffer(args); if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), @@ -123,13 +123,13 @@ base::string16 Clipboard::ReadText(gin_helper::Arguments* args) { return data; } -void Clipboard::WriteText(const base::string16& text, +void Clipboard::WriteText(const std::u16string& text, gin_helper::Arguments* args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); writer.WriteText(text); } -base::string16 Clipboard::ReadRTF(gin_helper::Arguments* args) { +std::u16string Clipboard::ReadRTF(gin_helper::Arguments* args) { std::string data; ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); clipboard->ReadRTF(GetClipboardBuffer(args), /* data_dst = */ nullptr, &data); @@ -141,9 +141,9 @@ void Clipboard::WriteRTF(const std::string& text, gin_helper::Arguments* args) { writer.WriteRTF(text); } -base::string16 Clipboard::ReadHTML(gin_helper::Arguments* args) { - base::string16 data; - base::string16 html; +std::u16string Clipboard::ReadHTML(gin_helper::Arguments* args) { + std::u16string data; + std::u16string html; std::string url; uint32_t start; uint32_t end; @@ -154,14 +154,14 @@ base::string16 Clipboard::ReadHTML(gin_helper::Arguments* args) { return data; } -void Clipboard::WriteHTML(const base::string16& html, +void Clipboard::WriteHTML(const std::u16string& html, gin_helper::Arguments* args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); writer.WriteHTML(html, std::string()); } v8::Local Clipboard::ReadBookmark(gin_helper::Arguments* args) { - base::string16 title; + std::u16string title; std::string url; gin_helper::Dictionary dict = gin_helper::Dictionary::CreateEmpty(args->isolate()); @@ -172,7 +172,7 @@ v8::Local Clipboard::ReadBookmark(gin_helper::Arguments* args) { return dict.GetHandle(); } -void Clipboard::WriteBookmark(const base::string16& title, +void Clipboard::WriteBookmark(const std::u16string& title, const std::string& url, gin_helper::Arguments* args) { ui::ScopedClipboardWriter writer(GetClipboardBuffer(args)); @@ -207,9 +207,9 @@ void Clipboard::WriteImage(const gfx::Image& image, } #if !defined(OS_MAC) -void Clipboard::WriteFindText(const base::string16& text) {} -base::string16 Clipboard::ReadFindText() { - return base::string16(); +void Clipboard::WriteFindText(const std::u16string& text) {} +std::u16string Clipboard::ReadFindText() { + return std::u16string(); } #endif diff --git a/shell/common/api/electron_api_clipboard.h b/shell/common/api/electron_api_clipboard.h index 815d588281d0..7c5bdac805a4 100644 --- a/shell/common/api/electron_api_clipboard.h +++ b/shell/common/api/electron_api_clipboard.h @@ -24,7 +24,7 @@ namespace api { class Clipboard { public: static ui::ClipboardBuffer GetClipboardBuffer(gin_helper::Arguments* args); - static std::vector AvailableFormats( + static std::vector AvailableFormats( gin_helper::Arguments* args); static bool Has(const std::string& format_string, gin_helper::Arguments* args); @@ -34,27 +34,27 @@ class Clipboard { static void Write(const gin_helper::Dictionary& data, gin_helper::Arguments* args); - static base::string16 ReadText(gin_helper::Arguments* args); - static void WriteText(const base::string16& text, + static std::u16string ReadText(gin_helper::Arguments* args); + static void WriteText(const std::u16string& text, gin_helper::Arguments* args); - static base::string16 ReadRTF(gin_helper::Arguments* args); + static std::u16string ReadRTF(gin_helper::Arguments* args); static void WriteRTF(const std::string& text, gin_helper::Arguments* args); - static base::string16 ReadHTML(gin_helper::Arguments* args); - static void WriteHTML(const base::string16& html, + static std::u16string ReadHTML(gin_helper::Arguments* args); + static void WriteHTML(const std::u16string& html, gin_helper::Arguments* args); static v8::Local ReadBookmark(gin_helper::Arguments* args); - static void WriteBookmark(const base::string16& title, + static void WriteBookmark(const std::u16string& title, const std::string& url, gin_helper::Arguments* args); static gfx::Image ReadImage(gin_helper::Arguments* args); static void WriteImage(const gfx::Image& image, gin_helper::Arguments* args); - static base::string16 ReadFindText(); - static void WriteFindText(const base::string16& text); + static std::u16string ReadFindText(); + static void WriteFindText(const std::u16string& text); static v8::Local ReadBuffer(const std::string& format_string, gin_helper::Arguments* args); diff --git a/shell/common/api/electron_api_clipboard_mac.mm b/shell/common/api/electron_api_clipboard_mac.mm index aa47bab85dd3..7f101c259bd2 100644 --- a/shell/common/api/electron_api_clipboard_mac.mm +++ b/shell/common/api/electron_api_clipboard_mac.mm @@ -10,12 +10,12 @@ namespace electron { namespace api { -void Clipboard::WriteFindText(const base::string16& text) { +void Clipboard::WriteFindText(const std::u16string& text) { NSString* text_ns = base::SysUTF16ToNSString(text); [[FindPasteboard sharedInstance] setFindText:text_ns]; } -base::string16 Clipboard::ReadFindText() { +std::u16string Clipboard::ReadFindText() { return GetFindPboardText(); } diff --git a/shell/common/api/electron_api_shell.cc b/shell/common/api/electron_api_shell.cc index 9f341ac61dcc..1679afe5ecc4 100644 --- a/shell/common/api/electron_api_shell.cc +++ b/shell/common/api/electron_api_shell.cc @@ -117,7 +117,7 @@ bool WriteShortcutLink(const base::FilePath& shortcut_path, base::win::ShortcutProperties properties; base::FilePath path; - base::string16 str; + std::u16string str; UUID toastActivatorClsid; int index; if (options.Get("target", &path)) diff --git a/shell/common/application_info.h b/shell/common/application_info.h index cee9156702d9..63062c09f84e 100644 --- a/shell/common/application_info.h +++ b/shell/common/application_info.h @@ -28,7 +28,7 @@ std::string GetApplicationUserAgent(); #if defined(OS_WIN) PCWSTR GetRawAppUserModelID(); bool GetAppUserModelID(ScopedHString* app_id); -void SetAppUserModelID(const base::string16& name); +void SetAppUserModelID(const std::u16string& name); bool IsRunningInDesktopBridge(); #endif diff --git a/shell/common/application_info_win.cc b/shell/common/application_info_win.cc index e34f88d4b06c..f900a193a221 100644 --- a/shell/common/application_info_win.cc +++ b/shell/common/application_info_win.cc @@ -23,7 +23,7 @@ namespace electron { namespace { -base::string16 g_app_user_model_id; +std::u16string g_app_user_model_id; } const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1"; @@ -42,7 +42,7 @@ std::string GetApplicationVersion() { return base::UTF16ToUTF8(info->product_version()); } -void SetAppUserModelID(const base::string16& name) { +void SetAppUserModelID(const std::u16string& name) { g_app_user_model_id = name; SetCurrentProcessExplicitAppUserModelID(g_app_user_model_id.c_str()); } @@ -54,7 +54,7 @@ PCWSTR GetRawAppUserModelID() { g_app_user_model_id = current_app_id; } else { std::string name = GetApplicationName(); - base::string16 generated_app_id = base::ReplaceStringPlaceholders( + std::u16string generated_app_id = base::ReplaceStringPlaceholders( kAppUserModelIDFormat, base::UTF8ToUTF16(name), nullptr); SetAppUserModelID(generated_app_id); } diff --git a/shell/common/gin_converters/blink_converter.cc b/shell/common/gin_converters/blink_converter.cc index 490e08def209..f653f7f8eba6 100644 --- a/shell/common/gin_converters/blink_converter.cc +++ b/shell/common/gin_converters/blink_converter.cc @@ -47,7 +47,7 @@ struct Converter { static bool FromV8(v8::Isolate* isolate, v8::Handle val, char16_t* out) { - base::string16 code = base::UTF8ToUTF16(gin::V8ToString(isolate, val)); + std::u16string code = base::UTF8ToUTF16(gin::V8ToString(isolate, val)); if (code.length() != 1) return false; *out = code[0]; @@ -206,7 +206,7 @@ bool Converter::FromV8(v8::Isolate* isolate, // Make sure to not read beyond the buffer in case some bad code doesn't // NULL-terminate it (this is called from plugins). size_t text_length_cap = blink::WebKeyboardEvent::kTextLengthCap; - base::string16 text16 = base::UTF8ToUTF16(str); + std::u16string text16 = base::UTF8ToUTF16(str); std::fill_n(out->text, text_length_cap, 0); std::fill_n(out->unmodified_text, text_length_cap, 0); @@ -365,7 +365,7 @@ v8::Local EditFlagsToV8(v8::Isolate* isolate, int editFlags) { bool pasteFlag = false; if (editFlags & blink::ContextMenuDataEditFlags::kCanPaste) { - std::vector types; + std::vector types; ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes( ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr, &types); pasteFlag = !types.empty(); diff --git a/shell/common/language_util.h b/shell/common/language_util.h index 3e35073c142c..fcb61fe4a48e 100644 --- a/shell/common/language_util.h +++ b/shell/common/language_util.h @@ -18,7 +18,7 @@ std::vector GetPreferredLanguages(); #if defined(OS_WIN) bool GetPreferredLanguagesUsingGlobalization( - std::vector* languages); + std::vector* languages); #endif } // namespace electron diff --git a/shell/common/language_util_win.cc b/shell/common/language_util_win.cc index d6717b31aec2..708802c1ab02 100644 --- a/shell/common/language_util_win.cc +++ b/shell/common/language_util_win.cc @@ -17,7 +17,7 @@ namespace electron { std::vector GetPreferredLanguages() { - std::vector languages16; + std::vector languages16; // Attempt to use API available on Windows 10 or later, which // returns the full list of language preferences. @@ -33,7 +33,7 @@ std::vector GetPreferredLanguages() { } bool GetPreferredLanguagesUsingGlobalization( - std::vector* languages) { + std::vector* languages) { if (base::win::GetVersion() < base::win::Version::WIN10) return false; if (!base::win::ResolveCoreWinRTDelayload() || diff --git a/shell/common/platform_util_win.cc b/shell/common/platform_util_win.cc index dae1e8772058..90505ae27b05 100644 --- a/shell/common/platform_util_win.cc +++ b/shell/common/platform_util_win.cc @@ -241,8 +241,8 @@ std::string OpenExternalOnWorkerThread( // Quote the input scheme to be sure that the command does not have // parameters unexpected by the external program. This url should already // have been escaped. - base::string16 escaped_url = L"\"" + base::UTF8ToUTF16(url.spec()) + L"\""; - base::string16 working_dir = options.working_dir.value(); + std::u16string escaped_url = L"\"" + base::UTF8ToUTF16(url.spec()) + L"\""; + std::u16string working_dir = options.working_dir.value(); if (reinterpret_cast( ShellExecuteW(nullptr, L"open", escaped_url.c_str(), nullptr, diff --git a/shell/renderer/api/electron_api_spell_check_client.cc b/shell/renderer/api/electron_api_spell_check_client.cc index 24221be890d9..51379aecbd92 100644 --- a/shell/renderer/api/electron_api_spell_check_client.cc +++ b/shell/renderer/api/electron_api_spell_check_client.cc @@ -28,7 +28,7 @@ namespace api { namespace { -bool HasWordCharacters(const base::string16& text, int index) { +bool HasWordCharacters(const std::u16string& text, int index) { const char16_t* data = text.data(); int length = text.length(); while (index < length) { @@ -43,8 +43,8 @@ bool HasWordCharacters(const base::string16& text, int index) { struct Word { blink::WebTextCheckingResult result; - base::string16 text; - std::vector contraction_words; + std::u16string text; + std::vector contraction_words; }; } // namespace @@ -52,19 +52,19 @@ struct Word { class SpellCheckClient::SpellcheckRequest { public: SpellcheckRequest( - const base::string16& text, + const std::u16string& text, std::unique_ptr completion) : text_(text), completion_(std::move(completion)) {} SpellcheckRequest(const SpellcheckRequest&) = delete; SpellcheckRequest& operator=(const SpellcheckRequest&) = delete; ~SpellcheckRequest() = default; - const base::string16& text() const { return text_; } + const std::u16string& text() const { return text_; } blink::WebTextCheckingCompletion* completion() { return completion_.get(); } std::vector& wordlist() { return word_list_; } private: - base::string16 text_; // Text to be checked in this task. + std::u16string text_; // Text to be checked in this task. std::vector word_list_; // List of Words found in text // The interface to send the misspelled ranges to WebKit. std::unique_ptr completion_; @@ -93,7 +93,7 @@ SpellCheckClient::~SpellCheckClient() { void SpellCheckClient::RequestCheckingOfText( const blink::WebString& textToCheck, std::unique_ptr completionCallback) { - base::string16 text(textToCheck.Utf16()); + std::u16string text(textToCheck.Utf16()); // Ignore invalid requests. if (text.empty() || !HasWordCharacters(text, 0)) { completionCallback->DidCancelCheckingText(); @@ -151,10 +151,10 @@ void SpellCheckClient::SpellCheckText() { text_iterator_.SetText(text.c_str(), text.size()); SpellCheckScope scope(*this); - base::string16 word; + std::u16string word; size_t word_start; size_t word_length; - std::set words; + std::set words; auto& word_list = pending_request_param_->wordlist(); Word word_entry; for (;;) { // Run until end of text @@ -186,9 +186,9 @@ void SpellCheckClient::SpellCheckText() { } void SpellCheckClient::OnSpellCheckDone( - const std::vector& misspelled_words) { + const std::vector& misspelled_words) { std::vector results; - std::unordered_set misspelled(misspelled_words.begin(), + std::unordered_set misspelled(misspelled_words.begin(), misspelled_words.end()); auto& word_list = pending_request_param_->wordlist(); @@ -216,7 +216,7 @@ void SpellCheckClient::OnSpellCheckDone( } void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope, - const std::set& words) { + const std::set& words) { DCHECK(!scope.spell_check_.IsEmpty()); v8::Local templ = gin_helper::CreateFunctionTemplate( @@ -238,13 +238,13 @@ void SpellCheckClient::SpellCheckWords(const SpellCheckScope& scope, // words in the contraction. bool SpellCheckClient::IsContraction( const SpellCheckScope& scope, - const base::string16& contraction, - std::vector* contraction_words) { + const std::u16string& contraction, + std::vector* contraction_words) { DCHECK(contraction_iterator_.IsInitialized()); contraction_iterator_.SetText(contraction.c_str(), contraction.length()); - base::string16 word; + std::u16string word; size_t word_start; size_t word_length; for (auto status = diff --git a/shell/renderer/api/electron_api_spell_check_client.h b/shell/renderer/api/electron_api_spell_check_client.h index 1e32be9c0039..72b5572fbcb8 100644 --- a/shell/renderer/api/electron_api_spell_check_client.h +++ b/shell/renderer/api/electron_api_spell_check_client.h @@ -69,18 +69,18 @@ class SpellCheckClient : public blink::WebSpellCheckPanelHostClient, // The javascript function will callback OnSpellCheckDone // with the results of all the misspelled words. void SpellCheckWords(const SpellCheckScope& scope, - const std::set& words); + const std::set& words); // Returns whether or not the given word is a contraction of valid words // (e.g. "word:word"). // Output variable contraction_words will contain individual // words in the contraction. bool IsContraction(const SpellCheckScope& scope, - const base::string16& word, - std::vector* contraction_words); + const std::u16string& word, + std::vector* contraction_words); // Callback for the JS API which returns the list of misspelled words. - void OnSpellCheckDone(const std::vector& misspelled_words); + void OnSpellCheckDone(const std::vector& misspelled_words); // Represents character attributes used for filtering out characters which // are not supported by this SpellCheck object. diff --git a/shell/renderer/api/electron_api_web_frame.cc b/shell/renderer/api/electron_api_web_frame.cc index af814a9916dc..a5ba2e000f6f 100644 --- a/shell/renderer/api/electron_api_web_frame.cc +++ b/shell/renderer/api/electron_api_web_frame.cc @@ -114,7 +114,7 @@ content::RenderFrame* GetRenderFrame(v8::Local value) { bool SpellCheckWord(v8::Isolate* isolate, v8::Local window, const std::string& word, - std::vector* optional_suggestions) { + std::vector* optional_suggestions) { size_t start; size_t length; @@ -123,7 +123,7 @@ bool SpellCheckWord(v8::Isolate* isolate, if (!render_frame) return true; - base::string16 w = base::UTF8ToUTF16(word); + std::u16string w = base::UTF8ToUTF16(word); int id = render_frame->GetRoutingID(); return client->GetSpellCheck()->SpellCheckWord( w.c_str(), 0, word.size(), id, &start, &length, optional_suggestions); @@ -576,7 +576,7 @@ void InsertText(gin_helper::ErrorThrower thrower, } } -base::string16 InsertCSS(v8::Local window, +std::u16string InsertCSS(v8::Local window, const std::string& css, gin_helper::Arguments* args) { blink::WebDocument::CSSOrigin css_origin = @@ -591,7 +591,7 @@ base::string16 InsertCSS(v8::Local window, args->ThrowError( "Render frame was torn down before webFrame.insertCSS could be " "executed"); - return base::string16(); + return std::u16string(); } blink::WebFrame* web_frame = render_frame->GetWebFrame(); @@ -601,12 +601,12 @@ base::string16 InsertCSS(v8::Local window, .InsertStyleSheet(blink::WebString::FromUTF8(css), nullptr, css_origin) .Utf16(); } - return base::string16(); + return std::u16string(); } void RemoveInsertedCSS(gin_helper::ErrorThrower thrower, v8::Local window, - const base::string16& key) { + const std::u16string& key) { auto* render_frame = GetRenderFrame(window); if (!render_frame) { thrower.ThrowError( @@ -624,7 +624,7 @@ void RemoveInsertedCSS(gin_helper::ErrorThrower thrower, v8::Local ExecuteJavaScript(gin_helper::Arguments* args, v8::Local window, - const base::string16& code) { + const std::u16string& code) { v8::Isolate* isolate = args->isolate(); gin_helper::Promise> promise(isolate); v8::Local handle = promise.GetHandle(); @@ -685,8 +685,8 @@ v8::Local ExecuteJavaScriptInIsolatedWorld( std::vector sources; for (const auto& script : scripts) { - base::string16 code; - base::string16 url; + std::u16string code; + std::u16string url; int start_line = 1; script.Get("url", &url); script.Get("startLine", &start_line); @@ -766,10 +766,10 @@ bool IsWordMisspelled(v8::Isolate* isolate, return !SpellCheckWord(isolate, window, word, nullptr); } -std::vector GetWordSuggestions(v8::Isolate* isolate, +std::vector GetWordSuggestions(v8::Isolate* isolate, v8::Local window, const std::string& word) { - std::vector suggestions; + std::vector suggestions; SpellCheckWord(isolate, window, word, &suggestions); return suggestions; } diff --git a/shell/renderer/electron_autofill_agent.cc b/shell/renderer/electron_autofill_agent.cc index 8d060571aa53..9d8282079a41 100644 --- a/shell/renderer/electron_autofill_agent.cc +++ b/shell/renderer/electron_autofill_agent.cc @@ -25,18 +25,18 @@ const size_t kMaxDataLength = 1024; const size_t kMaxListSize = 512; void GetDataListSuggestions(const blink::WebInputElement& element, - std::vector* values, - std::vector* labels) { + std::vector* values, + std::vector* labels) { for (const auto& option : element.FilteredDataListOptions()) { values->push_back(option.Value().Utf16()); if (option.Value() != option.Label()) labels->push_back(option.Label().Utf16()); else - labels->push_back(base::string16()); + labels->push_back(std::u16string()); } } -void TrimStringVectorForIPC(std::vector* strings) { +void TrimStringVectorForIPC(std::vector* strings) { // Limit the size of the vector. if (strings->size() > kMaxListSize) strings->resize(kMaxListSize); @@ -152,8 +152,8 @@ void AutofillAgent::ShowSuggestions(const blink::WebFormControlElement& element, return; } - std::vector data_list_values; - std::vector data_list_labels; + std::vector data_list_values; + std::vector data_list_labels; if (input_element) { GetDataListSuggestions(*input_element, &data_list_values, &data_list_labels); @@ -182,13 +182,13 @@ void AutofillAgent::HidePopup() { } void AutofillAgent::ShowPopup(const blink::WebFormControlElement& element, - const std::vector& values, - const std::vector& labels) { + const std::vector& values, + const std::vector& labels) { gfx::RectF bounds = render_frame()->ElementBoundsInWindow(element); GetAutofillDriver()->ShowAutofillPopup(bounds, values, labels); } -void AutofillAgent::AcceptDataListSuggestion(const base::string16& suggestion) { +void AutofillAgent::AcceptDataListSuggestion(const std::u16string& suggestion) { auto element = render_frame()->GetWebFrame()->GetDocument().FocusedElement(); if (element.IsFormControlElement()) { ToWebInputElement(&element)->SetAutofillValue( diff --git a/shell/renderer/electron_autofill_agent.h b/shell/renderer/electron_autofill_agent.h index 91a0c8e0ff83..d9fa0640da35 100644 --- a/shell/renderer/electron_autofill_agent.h +++ b/shell/renderer/electron_autofill_agent.h @@ -58,13 +58,13 @@ class AutofillAgent : public content::RenderFrameObserver, void DataListOptionsChanged(const blink::WebInputElement&) override; // mojom::ElectronAutofillAgent - void AcceptDataListSuggestion(const base::string16& suggestion) override; + void AcceptDataListSuggestion(const std::u16string& suggestion) override; bool IsUserGesture() const; void HidePopup(); void ShowPopup(const blink::WebFormControlElement&, - const std::vector&, - const std::vector&); + const std::vector&, + const std::vector&); void ShowSuggestions(const blink::WebFormControlElement& element, const ShowSuggestionsOptions& options); diff --git a/shell/renderer/renderer_client_base.cc b/shell/renderer/renderer_client_base.cc index e1fde902b1d6..126401675ea4 100644 --- a/shell/renderer/renderer_client_base.cc +++ b/shell/renderer/renderer_client_base.cc @@ -218,7 +218,7 @@ void RendererClientBase::RenderThreadStarted() { #if defined(OS_WIN) // Set ApplicationUserModelID in renderer process. - base::string16 app_id = + std::u16string app_id = command_line->GetSwitchValueNative(switches::kAppUserModelId); if (!app_id.empty()) { SetCurrentProcessExplicitAppUserModelID(app_id.c_str()); From ec893f8322f2f984ab00cc7b9efbf17cefe77b16 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 13:58:27 -0400 Subject: [PATCH 51/85] 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" https://chromium-review.googlesource.com/c/chromium/src/+/2757472 --- chromium_src/chrome/browser/certificate_manager_model.h | 1 - shell/browser/browser.h | 1 - shell/browser/extended_web_contents_observer.h | 1 - shell/browser/login_handler.cc | 1 - shell/browser/native_window.h | 1 - shell/browser/native_window_observer.h | 1 - shell/browser/notifications/notification.h | 1 - shell/browser/notifications/win/notification_presenter_win.h | 1 - shell/browser/serial/serial_chooser_controller.h | 1 - shell/browser/ui/cocoa/electron_menu_controller.h | 1 - shell/browser/ui/gtk/gtk_status_icon.h | 1 - shell/browser/ui/inspectable_web_contents_view.h | 1 - shell/browser/ui/message_box.h | 1 - shell/browser/ui/views/global_menu_bar_x11.cc | 1 - shell/common/application_info.h | 1 - shell/common/keyboard_util.h | 1 - shell/common/language_util.h | 2 -- shell/common/platform_util.h | 4 ---- shell/renderer/electron_render_frame_observer.h | 1 - 19 files changed, 23 deletions(-) diff --git a/chromium_src/chrome/browser/certificate_manager_model.h b/chromium_src/chrome/browser/certificate_manager_model.h index 661a524aecd8..14517ee8ebc8 100644 --- a/chromium_src/chrome/browser/certificate_manager_model.h +++ b/chromium_src/chrome/browser/certificate_manager_model.h @@ -12,7 +12,6 @@ #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/strings/string16.h" #include "net/cert/nss_cert_database.h" namespace content { diff --git a/shell/browser/browser.h b/shell/browser/browser.h index 21ff40453b32..b6d143899887 100755 --- a/shell/browser/browser.h +++ b/shell/browser/browser.h @@ -12,7 +12,6 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/observer_list.h" -#include "base/strings/string16.h" #include "base/task/cancelable_task_tracker.h" #include "base/values.h" #include "gin/dictionary.h" diff --git a/shell/browser/extended_web_contents_observer.h b/shell/browser/extended_web_contents_observer.h index 49b1f30163de..20fd7b455966 100644 --- a/shell/browser/extended_web_contents_observer.h +++ b/shell/browser/extended_web_contents_observer.h @@ -8,7 +8,6 @@ #include #include "base/observer_list.h" -#include "base/strings/string16.h" #include "electron/shell/common/api/api.mojom.h" #include "ui/gfx/geometry/rect.h" diff --git a/shell/browser/login_handler.cc b/shell/browser/login_handler.cc index 1c4cc45a562f..e0ac4458ff1e 100644 --- a/shell/browser/login_handler.cc +++ b/shell/browser/login_handler.cc @@ -10,7 +10,6 @@ #include #include "base/callback.h" -#include "base/strings/string16.h" #include "base/threading/sequenced_task_runner_handle.h" #include "gin/arguments.h" #include "gin/dictionary.h" diff --git a/shell/browser/native_window.h b/shell/browser/native_window.h index e98801ef0034..e48f4d2f3d70 100644 --- a/shell/browser/native_window.h +++ b/shell/browser/native_window.h @@ -15,7 +15,6 @@ #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/optional.h" -#include "base/strings/string16.h" #include "base/supports_user_data.h" #include "base/values.h" #include "content/public/browser/desktop_media_id.h" diff --git a/shell/browser/native_window_observer.h b/shell/browser/native_window_observer.h index 32276cbdacfa..4d81276b5fb6 100644 --- a/shell/browser/native_window_observer.h +++ b/shell/browser/native_window_observer.h @@ -8,7 +8,6 @@ #include #include "base/observer_list_types.h" -#include "base/strings/string16.h" #include "base/values.h" #include "ui/base/window_open_disposition.h" #include "url/gurl.h" diff --git a/shell/browser/notifications/notification.h b/shell/browser/notifications/notification.h index 4edcc7b93fb5..927d9424ebff 100644 --- a/shell/browser/notifications/notification.h +++ b/shell/browser/notifications/notification.h @@ -9,7 +9,6 @@ #include #include "base/memory/weak_ptr.h" -#include "base/strings/string16.h" #include "third_party/skia/include/core/SkBitmap.h" #include "url/gurl.h" diff --git a/shell/browser/notifications/win/notification_presenter_win.h b/shell/browser/notifications/win/notification_presenter_win.h index 7e739ce9be03..58d9cc381974 100644 --- a/shell/browser/notifications/win/notification_presenter_win.h +++ b/shell/browser/notifications/win/notification_presenter_win.h @@ -24,7 +24,6 @@ #define SHELL_BROWSER_NOTIFICATIONS_WIN_NOTIFICATION_PRESENTER_WIN_H_ #include "base/files/scoped_temp_dir.h" -#include "base/strings/string16.h" #include "shell/browser/notifications/notification_presenter.h" class GURL; diff --git a/shell/browser/serial/serial_chooser_controller.h b/shell/browser/serial/serial_chooser_controller.h index 40bff12b7f8b..85c375908252 100644 --- a/shell/browser/serial/serial_chooser_controller.h +++ b/shell/browser/serial/serial_chooser_controller.h @@ -10,7 +10,6 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "base/strings/string16.h" #include "content/public/browser/serial_chooser.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" diff --git a/shell/browser/ui/cocoa/electron_menu_controller.h b/shell/browser/ui/cocoa/electron_menu_controller.h index af080b1071e1..42f987b3fa24 100644 --- a/shell/browser/ui/cocoa/electron_menu_controller.h +++ b/shell/browser/ui/cocoa/electron_menu_controller.h @@ -11,7 +11,6 @@ #include "base/callback.h" #include "base/mac/scoped_nsobject.h" #include "base/memory/weak_ptr.h" -#include "base/strings/string16.h" namespace electron { class ElectronMenuModel; diff --git a/shell/browser/ui/gtk/gtk_status_icon.h b/shell/browser/ui/gtk/gtk_status_icon.h index fe1454505505..eee9a21af40f 100644 --- a/shell/browser/ui/gtk/gtk_status_icon.h +++ b/shell/browser/ui/gtk/gtk_status_icon.h @@ -8,7 +8,6 @@ #include #include "base/macros.h" -#include "base/strings/string16.h" #include "ui/base/glib/glib_integers.h" #include "ui/base/glib/glib_signal.h" #include "ui/views/linux_ui/status_icon_linux.h" diff --git a/shell/browser/ui/inspectable_web_contents_view.h b/shell/browser/ui/inspectable_web_contents_view.h index 233a1276f252..1827787a519f 100644 --- a/shell/browser/ui/inspectable_web_contents_view.h +++ b/shell/browser/ui/inspectable_web_contents_view.h @@ -6,7 +6,6 @@ #ifndef SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_ #define SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_ -#include "base/strings/string16.h" #include "ui/gfx/native_widget_types.h" class DevToolsContentsResizingStrategy; diff --git a/shell/browser/ui/message_box.h b/shell/browser/ui/message_box.h index 9126b9940736..9cc2d716f546 100644 --- a/shell/browser/ui/message_box.h +++ b/shell/browser/ui/message_box.h @@ -10,7 +10,6 @@ #include #include "base/callback_forward.h" -#include "base/strings/string16.h" #include "ui/gfx/image/image_skia.h" namespace electron { diff --git a/shell/browser/ui/views/global_menu_bar_x11.cc b/shell/browser/ui/views/global_menu_bar_x11.cc index 387cc1b0f6ef..63cdffcf4e90 100644 --- a/shell/browser/ui/views/global_menu_bar_x11.cc +++ b/shell/browser/ui/views/global_menu_bar_x11.cc @@ -8,7 +8,6 @@ #include #include "base/logging.h" -#include "base/strings/string16.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h" diff --git a/shell/common/application_info.h b/shell/common/application_info.h index 63062c09f84e..fcabc81f9651 100644 --- a/shell/common/application_info.h +++ b/shell/common/application_info.h @@ -6,7 +6,6 @@ #define SHELL_COMMON_APPLICATION_INFO_H_ #if defined(OS_WIN) -#include "base/strings/string16.h" #include "shell/browser/win/scoped_hstring.h" #endif diff --git a/shell/common/keyboard_util.h b/shell/common/keyboard_util.h index 127c7bea1906..28f2a69637aa 100644 --- a/shell/common/keyboard_util.h +++ b/shell/common/keyboard_util.h @@ -7,7 +7,6 @@ #include -#include "base/strings/string16.h" #include "ui/events/keycodes/keyboard_codes.h" namespace electron { diff --git a/shell/common/language_util.h b/shell/common/language_util.h index fcb61fe4a48e..6f15cc680229 100644 --- a/shell/common/language_util.h +++ b/shell/common/language_util.h @@ -8,8 +8,6 @@ #include #include -#include "base/strings/string16.h" - namespace electron { // Return a list of user preferred languages from OS. The list doesn't include diff --git a/shell/common/platform_util.h b/shell/common/platform_util.h index 541660003b49..b9e801f055a4 100644 --- a/shell/common/platform_util.h +++ b/shell/common/platform_util.h @@ -11,10 +11,6 @@ #include "base/files/file_path.h" #include "build/build_config.h" -#if defined(OS_WIN) -#include "base/strings/string16.h" -#endif - class GURL; namespace platform_util { diff --git a/shell/renderer/electron_render_frame_observer.h b/shell/renderer/electron_render_frame_observer.h index eb59ae0cd440..03f0b82397db 100644 --- a/shell/renderer/electron_render_frame_observer.h +++ b/shell/renderer/electron_render_frame_observer.h @@ -7,7 +7,6 @@ #include -#include "base/strings/string16.h" #include "content/public/renderer/render_frame_observer.h" #include "ipc/ipc_platform_file.h" #include "shell/renderer/renderer_client_base.h" From d0989802bd460a6a3d0a067222bfdd684dbffc62 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 15:39:40 -0400 Subject: [PATCH 52/85] 2720306: [api] Remove deprecated [Shared]ArrayBuffer API https://chromium-review.googlesource.com/c/v8/v8/+/2720306 --- shell/common/v8_value_converter.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shell/common/v8_value_converter.cc b/shell/common/v8_value_converter.cc index 46674718f799..9bc691f0a1f7 100644 --- a/shell/common/v8_value_converter.cc +++ b/shell/common/v8_value_converter.cc @@ -257,7 +257,9 @@ v8::Local V8ValueConverter::ToArrayBuffer( } auto context = isolate->GetCurrentContext(); auto array_buffer = v8::ArrayBuffer::New(isolate, length); - memcpy(array_buffer->GetContents().Data(), data, length); + std::shared_ptr backing_store = + array_buffer->GetBackingStore(); + memcpy(backing_store->Data(), data, length); // From this point, if something goes wrong(can't find Buffer class for // example) we'll simply return a Uint8Array based on the created ArrayBuffer. // This can happen if no preload script was specified to the renderer. From 29dfabadfd35b77b997f6e647f48fa4cf7b41918 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 15:40:29 -0400 Subject: [PATCH 53/85] Fixup 2721718: Move HostID to extensions::mojom::HostID --- shell/browser/extensions/api/tabs/tabs_api.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/browser/extensions/api/tabs/tabs_api.cc b/shell/browser/extensions/api/tabs/tabs_api.cc index 1c464deb04c2..13f89e077d8f 100644 --- a/shell/browser/extensions/api/tabs/tabs_api.cc +++ b/shell/browser/extensions/api/tabs/tabs_api.cc @@ -86,7 +86,7 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() { execute_tab_id_ = tab_id; details_ = std::move(details); set_host_id( - mojom::HostID(mojom::HostID::HostType::kExtensions, extension->id())); + mojom::HostID(mojom::HostID::HostType::kExtensions, extension()->id())); return set_init_result(SUCCESS); } From 97b6868e9c3455292df1789294bbeb16b065dd0b Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 15:43:09 -0400 Subject: [PATCH 54/85] fixup 2651385: Moving Profile::shared_cors_origin_access_list_ into //content layer --- shell/browser/electron_browser_context.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/browser/electron_browser_context.cc b/shell/browser/electron_browser_context.cc index bc5742f9f323..f09a92e2d18a 100644 --- a/shell/browser/electron_browser_context.cc +++ b/shell/browser/electron_browser_context.cc @@ -108,7 +108,7 @@ ElectronBrowserContext::ElectronBrowserContext(const std::string& partition, : storage_policy_(new SpecialStoragePolicy), protocol_registry_(new ProtocolRegistry), in_memory_(in_memory), - ssl_config_(network::mojom::SSLConfig::New())) { + ssl_config_(network::mojom::SSLConfig::New()) { user_agent_ = ElectronBrowserClient::Get()->GetUserAgent(); // Read options. From b6d2ae04555648459d6784c6cc823ec01cf72907 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 15:43:51 -0400 Subject: [PATCH 55/85] Fixup 2752406: [LSC] Replace base::string16 with std::u16string in //ui --- shell/browser/ui/inspectable_web_contents_view.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shell/browser/ui/inspectable_web_contents_view.h b/shell/browser/ui/inspectable_web_contents_view.h index 1827787a519f..c5d2be5732e1 100644 --- a/shell/browser/ui/inspectable_web_contents_view.h +++ b/shell/browser/ui/inspectable_web_contents_view.h @@ -6,6 +6,8 @@ #ifndef SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_ #define SHELL_BROWSER_UI_INSPECTABLE_WEB_CONTENTS_VIEW_H_ +#include + #include "ui/gfx/native_widget_types.h" class DevToolsContentsResizingStrategy; From 7e961d8a374fef4c4a82da41dcb07926699eb523 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 15:44:41 -0400 Subject: [PATCH 56/85] Fixup 2725403: Add URLLoaderClient::OnReceiveEarlyHints() --- shell/browser/net/proxying_url_loader_factory.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/browser/net/proxying_url_loader_factory.cc b/shell/browser/net/proxying_url_loader_factory.cc index ca58e0a59ac2..7c8e2a3cffec 100644 --- a/shell/browser/net/proxying_url_loader_factory.cc +++ b/shell/browser/net/proxying_url_loader_factory.cc @@ -240,7 +240,8 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse( } } -void OnReceiveEarlyHints(network::mojom::EarlyHintsPtr early_hints) { +void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveEarlyHints( + network::mojom::EarlyHintsPtr early_hints) { target_client_->OnReceiveEarlyHints(std::move(early_hints)); } From c49bc282d581736e724f087eee4e3f09daa7b575 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Tue, 16 Mar 2021 16:28:20 -0400 Subject: [PATCH 57/85] update node headers --- patches/node/build_add_gn_build_files.patch | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index a62422e83ce8..97e6bcd5754a 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -846,10 +846,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636 +} diff --git a/filenames.json b/filenames.json new file mode 100644 -index 0000000000000000000000000000000000000000..2dc4680dd90f854ac965266c6f14a7196da1dba0 +index 0000000000000000000000000000000000000000..7ecda5c553fe547f79f7d9fb5dc2d71c0ef8c474 --- /dev/null +++ b/filenames.json -@@ -0,0 +1,542 @@ +@@ -0,0 +1,544 @@ +// This file is automatically generated by generate_gn_filenames_json.py +// DO NOT EDIT +{ @@ -875,9 +875,11 @@ index 0000000000000000000000000000000000000000..2dc4680dd90f854ac965266c6f14a719 + "//v8/include/cppgc/custom-space.h", + "//v8/include/cppgc/default-platform.h", + "//v8/include/cppgc/ephemeron-pair.h", ++ "//v8/include/cppgc/explicit-management.h", + "//v8/include/cppgc/garbage-collected.h", + "//v8/include/cppgc/heap-consistency.h", + "//v8/include/cppgc/heap-state.h", ++ "//v8/include/cppgc/heap-statistics.h", + "//v8/include/cppgc/heap.h", + "//v8/include/cppgc/liveness-broker.h", + "//v8/include/cppgc/macros.h", @@ -887,6 +889,7 @@ index 0000000000000000000000000000000000000000..2dc4680dd90f854ac965266c6f14a719 + "//v8/include/cppgc/persistent.h", + "//v8/include/cppgc/platform.h", + "//v8/include/cppgc/prefinalizer.h", ++ "//v8/include/cppgc/process-heap-statistics.h", + "//v8/include/cppgc/sentinel-pointer.h", + "//v8/include/cppgc/source-location.h", + "//v8/include/cppgc/testing.h", @@ -909,7 +912,6 @@ index 0000000000000000000000000000000000000000..2dc4680dd90f854ac965266c6f14a719 + "//v8/include/cppgc/internal/persistent-node.h", + "//v8/include/cppgc/internal/pointer-policies.h", + "//v8/include/cppgc/internal/prefinalizer-handler.h", -+ "//v8/include/cppgc/internal/process-heap.h", + "//v8/include/cppgc/internal/write-barrier.h" + ] + }, From bccafa02896eef24b5561e9581d853057323d548 Mon Sep 17 00:00:00 2001 From: Electron Bot Date: Wed, 17 Mar 2021 06:00:35 -0700 Subject: [PATCH 58/85] chore: bump chromium in DEPS to 91.0.4449.0 --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 63692c6f3192..0df0aebe0463 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4448.0', + '91.0.4449.0', 'node_version': 'v14.16.0', 'nan_version': From 08330cb0792b6518126146a8c1a14ce4186d197c Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Wed, 17 Mar 2021 13:48:38 -0400 Subject: [PATCH 59/85] Revert "chore: bump chromium in DEPS to 91.0.4449.0" This reverts commit bccafa02896eef24b5561e9581d853057323d548. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 0df0aebe0463..63692c6f3192 100644 --- a/DEPS +++ b/DEPS @@ -14,7 +14,7 @@ gclient_gn_args = [ vars = { 'chromium_version': - '91.0.4449.0', + '91.0.4448.0', 'node_version': 'v14.16.0', 'nan_version': From 3b183854ff094f6899a34e5c470af6eb1ceecc68 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 18 Mar 2021 15:52:54 -0400 Subject: [PATCH 60/85] 2693008: Fix loading non-system cursors on Windows on browser_tests https://chromium-review.googlesource.com/c/chromium/src/+/2693008 --- shell/browser/electron_browser_main_parts.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/shell/browser/electron_browser_main_parts.cc b/shell/browser/electron_browser_main_parts.cc index f5229da5b8a1..dde44eb23bc0 100644 --- a/shell/browser/electron_browser_main_parts.cc +++ b/shell/browser/electron_browser_main_parts.cc @@ -86,7 +86,6 @@ #endif #if defined(OS_WIN) -#include "ui/base/cursor/win/win_cursor_factory.h" #include "ui/base/l10n/l10n_util_win.h" #include "ui/display/win/dpi.h" #include "ui/gfx/system_fonts_win.h" @@ -405,10 +404,6 @@ void ElectronBrowserMainParts::ToolkitInitialized() { #if defined(OS_WIN) gfx::win::SetAdjustFontCallback(&AdjustUIFont); gfx::win::SetGetMinimumFontSizeCallback(&GetMinimumFontSize); - - wchar_t module_name[MAX_PATH] = {0}; - if (GetModuleFileName(NULL, module_name, base::size(module_name))) - ui::SetCursorResourceModule(module_name); #endif #if defined(OS_MAC) From 2d3c65becada19b7be5deb967ca94898d9afda3e Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 18 Mar 2021 15:55:51 -0400 Subject: [PATCH 61/85] 2757472: Reland "Reland "[LSC] Remove base::string16 alias"" https://chromium-review.googlesource.com/c/chromium/src/+/2757472 --- shell/app/electron_crash_reporter_client.cc | 8 +- shell/app/node_main.cc | 2 +- shell/browser/api/electron_api_base_window.cc | 6 +- .../api/electron_api_crash_reporter.cc | 2 +- .../browser/api/electron_api_web_contents.cc | 2 +- shell/browser/browser.h | 16 +-- shell/browser/browser_win.cc | 114 +++++++++--------- shell/browser/electron_browser_client.cc | 2 +- .../win/notification_presenter_win.cc | 6 +- .../win/notification_presenter_win.h | 2 +- .../notifications/win/win32_notification.cc | 7 +- .../win/windows_toast_notification.cc | 15 ++- shell/browser/ui/file_dialog_win.cc | 4 +- shell/browser/ui/message_box_win.cc | 29 ++--- shell/browser/ui/win/jump_list.cc | 2 +- shell/browser/ui/win/jump_list.h | 12 +- shell/browser/ui/win/notify_icon.cc | 8 +- shell/browser/ui/win/taskbar_host.cc | 8 +- shell/browser/web_contents_preferences.cc | 14 ++- shell/browser/web_dialog_helper.cc | 2 +- shell/common/api/electron_api_native_image.cc | 2 +- .../api/electron_api_native_image_win.cc | 2 +- shell/common/api/electron_api_shell.cc | 2 +- shell/common/application_info_win.cc | 9 +- .../gin_converters/file_path_converter.h | 1 + shell/common/gin_converters/std_converter.h | 28 +++++ shell/common/language_util.h | 5 - shell/common/language_util_win.cc | 34 +++--- shell/common/node_bindings.cc | 2 +- shell/common/platform_util_win.cc | 4 +- shell/renderer/renderer_client_base.cc | 2 +- 31 files changed, 200 insertions(+), 152 deletions(-) diff --git a/shell/app/electron_crash_reporter_client.cc b/shell/app/electron_crash_reporter_client.cc index 07fc91e30c1a..6ad5557f1394 100644 --- a/shell/app/electron_crash_reporter_client.cc +++ b/shell/app/electron_crash_reporter_client.cc @@ -33,6 +33,10 @@ #include "base/debug/dump_without_crashing.h" #endif +#if defined(OS_WIN) +#include "base/strings/string_util_win.h" +#endif + namespace { ElectronCrashReporterClient* Instance() { @@ -130,8 +134,8 @@ void ElectronCrashReporterClient::GetProductNameAndVersion( std::wstring* version, std::wstring* special_build, std::wstring* channel_name) { - *product_name = base::UTF8ToUTF16(ELECTRON_PRODUCT_NAME); - *version = base::UTF8ToUTF16(ELECTRON_VERSION_STRING); + *product_name = base::UTF8ToWide(ELECTRON_PRODUCT_NAME); + *version = base::UTF8ToWide(ELECTRON_VERSION_STRING); } #endif diff --git a/shell/app/node_main.cc b/shell/app/node_main.cc index bc0f3f7469c2..73db4f0e1811 100644 --- a/shell/app/node_main.cc +++ b/shell/app/node_main.cc @@ -66,7 +66,7 @@ void SetNodeCliFlags() { for (const auto& arg : argv) { #if defined(OS_WIN) - const auto& option = base::UTF16ToUTF8(arg); + const auto& option = base::WideToUTF8(arg); #else const auto& option = arg; #endif diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index ec3b6f7d223c..edd62803e09a 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -1101,8 +1101,10 @@ void BaseWindow::SetAppDetails(const gin_helper::Dictionary& options) { options.Get("relaunchCommand", &relaunch_command); options.Get("relaunchDisplayName", &relaunch_display_name); - ui::win::SetAppDetailsForWindow(app_id, app_icon_path, app_icon_index, - relaunch_command, relaunch_display_name, + ui::win::SetAppDetailsForWindow(base::UTF16ToWide(app_id), app_icon_path, + app_icon_index, + base::UTF16ToWide(relaunch_command), + base::UTF16ToWide(relaunch_display_name), window_->GetAcceleratedWidget()); } #endif diff --git a/shell/browser/api/electron_api_crash_reporter.cc b/shell/browser/api/electron_api_crash_reporter.cc index e0ee02960907..bb7c8d677007 100644 --- a/shell/browser/api/electron_api_crash_reporter.cc +++ b/shell/browser/api/electron_api_crash_reporter.cc @@ -175,7 +175,7 @@ void Start(const std::string& submit_url, base::PathService::Get(DIR_USER_DATA, &user_data_dir); ::crash_reporter::InitializeCrashpadWithEmbeddedHandler( process_type.empty(), process_type, - base::UTF16ToUTF8(user_data_dir.value()), base::FilePath()); + base::WideToUTF8(user_data_dir.value()), base::FilePath()); #endif #endif } diff --git a/shell/browser/api/electron_api_web_contents.cc b/shell/browser/api/electron_api_web_contents.cc index a56bf717a70e..859779fe13e8 100644 --- a/shell/browser/api/electron_api_web_contents.cc +++ b/shell/browser/api/electron_api_web_contents.cc @@ -418,7 +418,7 @@ bool IsDeviceNameValid(const std::u16string& device_name) { return printer_exists; #elif defined(OS_WIN) printing::ScopedPrinterHandle printer; - return printer.OpenPrinterWithName(device_name.c_str()); + return printer.OpenPrinterWithName(base::UTF16ToWide(device_name).c_str()); #endif return true; } diff --git a/shell/browser/browser.h b/shell/browser/browser.h index b6d143899887..4768196c0a62 100755 --- a/shell/browser/browser.h +++ b/shell/browser/browser.h @@ -112,10 +112,10 @@ class Browser : public WindowListObserver { #if defined(OS_WIN) struct LaunchItem { - std::u16string name; - std::u16string path; - std::u16string scope; - std::vector args; + std::wstring name; + std::wstring path; + std::wstring scope; + std::vector args; bool enabled = true; LaunchItem(); @@ -137,7 +137,7 @@ class Browser : public WindowListObserver { #if defined(OS_WIN) // used in browser::setLoginItemSettings bool enabled = true; - std::u16string name = std::u16string(); + std::wstring name = std::wstring(); // used in browser::getLoginItemSettings bool executable_will_launch_at_login = false; @@ -237,9 +237,9 @@ class Browser : public WindowListObserver { #if defined(OS_WIN) struct UserTask { base::FilePath program; - std::u16string arguments; - std::u16string title; - std::u16string description; + std::wstring arguments; + std::wstring title; + std::wstring description; base::FilePath working_dir; base::FilePath icon_path; int icon_index; diff --git a/shell/browser/browser_win.cc b/shell/browser/browser_win.cc index 5014bd5d7bb2..04519a20d447 100755 --- a/shell/browser/browser_win.cc +++ b/shell/browser/browser_win.cc @@ -48,7 +48,7 @@ namespace electron { namespace { -bool GetProcessExecPath(std::u16string* exe) { +bool GetProcessExecPath(std::wstring* exe) { base::FilePath path; if (!base::PathService::Get(base::FILE_EXE, &path)) { return false; @@ -57,13 +57,13 @@ bool GetProcessExecPath(std::u16string* exe) { return true; } -bool GetProtocolLaunchPath(gin::Arguments* args, std::u16string* exe) { +bool GetProtocolLaunchPath(gin::Arguments* args, std::wstring* exe) { if (!args->GetNext(exe) && !GetProcessExecPath(exe)) { return false; } // Read in optional args arg - std::vector launch_args; + std::vector launch_args; if (args->GetNext(&launch_args) && !launch_args.empty()) *exe = base::StringPrintf(L"\"%ls\" %ls \"%%1\"", exe->c_str(), base::JoinString(launch_args, L" ").c_str()); @@ -75,7 +75,7 @@ bool GetProtocolLaunchPath(gin::Arguments* args, std::u16string* exe) { // Windows treats a given scheme as an Internet scheme only if its registry // entry has a "URL Protocol" key. Check this, otherwise we allow ProgIDs to be // used as custom protocols which leads to security bugs. -bool IsValidCustomProtocol(const std::u16string& scheme) { +bool IsValidCustomProtocol(const std::wstring& scheme) { if (scheme.empty()) return false; base::win::RegKey cmd_key(HKEY_CLASSES_ROOT, scheme.c_str(), KEY_QUERY_VALUE); @@ -90,11 +90,10 @@ bool IsValidCustomProtocol(const std::u16string& scheme) { // Windows 8 introduced a new protocol->executable binding system which cannot // be retrieved in the HKCR registry subkey method implemented below. We call // AssocQueryString with the new Win8-only flag ASSOCF_IS_PROTOCOL instead. -std::u16string GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, - const GURL& url) { - const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme()); +std::wstring GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, const GURL& url) { + const std::wstring url_scheme = base::ASCIIToWide(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) - return std::u16string(); + return std::wstring(); wchar_t out_buffer[1024]; DWORD buffer_size = base::size(out_buffer); @@ -103,13 +102,13 @@ std::u16string GetAppInfoHelperForProtocol(ASSOCSTR assoc_str, out_buffer, &buffer_size); if (FAILED(hr)) { DLOG(WARNING) << "AssocQueryString failed!"; - return std::u16string(); + return std::wstring(); } - return std::u16string(out_buffer); + return std::wstring(out_buffer); } void OnIconDataAvailable(const base::FilePath& app_path, - const std::u16string& app_display_name, + const std::wstring& app_display_name, gin_helper::Promise promise, gfx::Image icon) { if (!icon.IsEmpty()) { @@ -126,21 +125,21 @@ void OnIconDataAvailable(const base::FilePath& app_path, } } -std::u16string GetAppDisplayNameForProtocol(const GURL& url) { +std::wstring GetAppDisplayNameForProtocol(const GURL& url) { return GetAppInfoHelperForProtocol(ASSOCSTR_FRIENDLYAPPNAME, url); } -std::u16string GetAppPathForProtocol(const GURL& url) { +std::wstring GetAppPathForProtocol(const GURL& url) { return GetAppInfoHelperForProtocol(ASSOCSTR_EXECUTABLE, url); } -std::u16string GetAppForProtocolUsingRegistry(const GURL& url) { - const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme()); +std::wstring GetAppForProtocolUsingRegistry(const GURL& url) { + const std::wstring url_scheme = base::ASCIIToWide(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) - return std::u16string(); + return std::wstring(); // First, try and extract the application's display name. - std::u16string command_to_launch; + std::wstring command_to_launch; base::win::RegKey cmd_key_name(HKEY_CLASSES_ROOT, url_scheme.c_str(), KEY_READ); if (cmd_key_name.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS && @@ -150,7 +149,7 @@ std::u16string GetAppForProtocolUsingRegistry(const GURL& url) { // Otherwise, parse the command line in the registry, and return the basename // of the program path if it exists. - const std::u16string cmd_key_path = url_scheme + L"\\shell\\open\\command"; + const std::wstring cmd_key_path = url_scheme + L"\\shell\\open\\command"; base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) { @@ -159,18 +158,20 @@ std::u16string GetAppForProtocolUsingRegistry(const GURL& url) { return command_line.GetProgram().BaseName().value(); } - return std::u16string(); + return std::wstring(); } -bool FormatCommandLineString(std::u16string* exe, +bool FormatCommandLineString(std::wstring* exe, const std::vector& launch_args) { if (exe->empty() && !GetProcessExecPath(exe)) { return false; } if (!launch_args.empty()) { + std::u16string joined_launch_args = + base::JoinString(launch_args, base::UTF8ToUTF16(" ")); *exe = base::StringPrintf(L"%ls %ls", exe->c_str(), - base::JoinString(launch_args, L" ").c_str()); + base::UTF16ToWide(joined_launch_args).c_str()); } return true; @@ -184,18 +185,20 @@ bool FormatCommandLineString(std::u16string* exe, std::vector GetLoginItemSettingsHelper( base::win::RegistryValueIterator* it, boolean* executable_will_launch_at_login, - std::u16string scope, + std::wstring scope, const Browser::LoginItemSettings& options) { std::vector launch_items; base::FilePath lookup_exe_path; if (options.path.empty()) { - std::u16string process_exe_path; + std::wstring process_exe_path; GetProcessExecPath(&process_exe_path); lookup_exe_path = base::CommandLine::FromString(process_exe_path).GetProgram(); } else { - lookup_exe_path = base::CommandLine::FromString(options.path).GetProgram(); + lookup_exe_path = + base::CommandLine::FromString(base::UTF16ToWide(options.path)) + .GetProgram(); } if (!lookup_exe_path.empty()) { @@ -287,7 +290,7 @@ Browser::UserTask::~UserTask() = default; void GetFileIcon(const base::FilePath& path, v8::Isolate* isolate, base::CancelableTaskTracker* cancelable_task_tracker_, - const std::u16string app_display_name, + const std::wstring app_display_name, gin_helper::Promise promise) { base::FilePath normalized_path = path.NormalizePathSeparators(); IconLoader::IconSize icon_size = IconLoader::IconSize::LARGE; @@ -316,13 +319,13 @@ void GetApplicationInfoForProtocolUsingRegistry( base::CancelableTaskTracker* cancelable_task_tracker_) { base::FilePath app_path; - const std::u16string url_scheme = base::ASCIIToUTF16(url.scheme()); + const std::wstring url_scheme = base::ASCIIToWide(url.scheme()); if (!IsValidCustomProtocol(url_scheme)) { promise.RejectWithErrorMessage("invalid url_scheme"); return; } - std::u16string command_to_launch; - const std::u16string cmd_key_path = url_scheme + L"\\shell\\open\\command"; + std::wstring command_to_launch; + const std::wstring cmd_key_path = url_scheme + L"\\shell\\open\\command"; base::win::RegKey cmd_key_exe(HKEY_CLASSES_ROOT, cmd_key_path.c_str(), KEY_READ); if (cmd_key_exe.ReadValue(NULL, &command_to_launch) == ERROR_SUCCESS) { @@ -334,7 +337,7 @@ void GetApplicationInfoForProtocolUsingRegistry( "Unable to retrieve installation path to app"); return; } - const std::u16string app_display_name = GetAppForProtocolUsingRegistry(url); + const std::wstring app_display_name = GetAppForProtocolUsingRegistry(url); if (app_display_name.empty()) { promise.RejectWithErrorMessage( @@ -354,7 +357,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery( const GURL& url, gin_helper::Promise promise, base::CancelableTaskTracker* cancelable_task_tracker_) { - std::u16string app_path = GetAppPathForProtocol(url); + std::wstring app_path = GetAppPathForProtocol(url); if (app_path.empty()) { promise.RejectWithErrorMessage( @@ -362,7 +365,7 @@ void GetApplicationInfoForProtocolUsingAssocQuery( return; } - std::u16string app_display_name = GetAppDisplayNameForProtocol(url); + std::wstring app_display_name = GetAppDisplayNameForProtocol(url); if (app_display_name.empty()) { promise.RejectWithErrorMessage("Unable to retrieve display name of app"); @@ -426,12 +429,12 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, // Main Registry Key HKEY root = HKEY_CURRENT_USER; - std::u16string keyPath = L"Software\\Classes\\"; + std::wstring keyPath = L"Software\\Classes\\"; // Command Key - std::u16string wprotocol = base::UTF8ToUTF16(protocol); - std::u16string shellPath = wprotocol + L"\\shell"; - std::u16string cmdPath = keyPath + shellPath + L"\\open\\command"; + std::wstring wprotocol = base::UTF8ToWide(protocol); + std::wstring shellPath = wprotocol + L"\\shell"; + std::wstring cmdPath = keyPath + shellPath + L"\\open\\command"; base::win::RegKey classesKey; base::win::RegKey commandKey; @@ -445,12 +448,12 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, // Key doesn't even exist, we can confirm that it is not set return true; - std::u16string keyVal; + std::wstring keyVal; if (FAILED(commandKey.ReadValue(L"", &keyVal))) // Default value not set, we can confirm that it is not set return true; - std::u16string exe; + std::wstring exe; if (!GetProtocolLaunchPath(args, &exe)) return false; @@ -461,7 +464,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol, // Let's clean up after ourselves base::win::RegKey protocolKey; - std::u16string protocolPath = keyPath + wprotocol; + std::wstring protocolPath = keyPath + wprotocol; if (SUCCEEDED( protocolKey.Open(root, protocolPath.c_str(), KEY_ALL_ACCESS))) { @@ -500,17 +503,17 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol, if (protocol.empty()) return false; - std::u16string exe; + std::wstring exe; if (!GetProtocolLaunchPath(args, &exe)) return false; // Main Registry Key HKEY root = HKEY_CURRENT_USER; - std::u16string keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); - std::u16string urlDecl = base::UTF8ToUTF16("URL:" + protocol); + std::wstring keyPath = base::UTF8ToWide("Software\\Classes\\" + protocol); + std::wstring urlDecl = base::UTF8ToWide("URL:" + protocol); // Command Key - std::u16string cmdPath = keyPath + L"\\shell\\open\\command"; + std::wstring cmdPath = keyPath + L"\\shell\\open\\command"; // Write information to registry base::win::RegKey key(root, keyPath.c_str(), KEY_ALL_ACCESS); @@ -530,16 +533,16 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, if (protocol.empty()) return false; - std::u16string exe; + std::wstring exe; if (!GetProtocolLaunchPath(args, &exe)) return false; // Main Registry Key HKEY root = HKEY_CURRENT_USER; - std::u16string keyPath = base::UTF8ToUTF16("Software\\Classes\\" + protocol); + std::wstring keyPath = base::UTF8ToWide("Software\\Classes\\" + protocol); // Command Key - std::u16string cmdPath = keyPath + L"\\shell\\open\\command"; + std::wstring cmdPath = keyPath + L"\\shell\\open\\command"; base::win::RegKey key; base::win::RegKey commandKey; @@ -551,7 +554,7 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, // Key doesn't exist, we can confirm that it is not set return false; - std::u16string keyVal; + std::wstring keyVal; if (FAILED(commandKey.ReadValue(L"", &keyVal))) // Default value not set, we can confirm that it is not set return false; @@ -563,12 +566,12 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol, std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) { // Windows 8 or above has a new protocol association query. if (base::win::GetVersion() >= base::win::Version::WIN8) { - std::u16string application_name = GetAppDisplayNameForProtocol(url); + std::wstring application_name = GetAppDisplayNameForProtocol(url); if (!application_name.empty()) - return application_name; + return base::WideToUTF16(application_name); } - return GetAppForProtocolUsingRegistry(url); + return base::WideToUTF16(GetAppForProtocolUsingRegistry(url)); } v8::Local Browser::GetApplicationInfoForProtocol( @@ -686,11 +689,10 @@ void Browser::UpdateBadgeContents( } void Browser::SetLoginItemSettings(LoginItemSettings settings) { - std::u16string key_path = - L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; + std::wstring key_path = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; base::win::RegKey key(HKEY_CURRENT_USER, key_path.c_str(), KEY_ALL_ACCESS); - std::u16string startup_approved_key_path = + std::wstring startup_approved_key_path = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved" L"\\Run"; base::win::RegKey startup_approved_key( @@ -699,7 +701,7 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) { !settings.name.empty() ? settings.name.c_str() : GetAppUserModelID(); if (settings.open_at_login) { - std::u16string exe = settings.path; + std::wstring exe = base::UTF16ToWide(settings.path); if (FormatCommandLineString(&exe, settings.args)) { key.WriteValue(key_name, exe.c_str()); @@ -732,13 +734,13 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) { Browser::LoginItemSettings Browser::GetLoginItemSettings( const LoginItemSettings& options) { LoginItemSettings settings; - std::u16string keyPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; + std::wstring keyPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; base::win::RegKey key(HKEY_CURRENT_USER, keyPath.c_str(), KEY_ALL_ACCESS); - std::u16string keyVal; + std::wstring keyVal; // keep old openAtLogin behaviour if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) { - std::u16string exe = options.path; + std::wstring exe = base::UTF16ToWide(options.path); if (FormatCommandLineString(&exe, options.args)) { settings.open_at_login = keyVal == exe; } diff --git a/shell/browser/electron_browser_client.cc b/shell/browser/electron_browser_client.cc index 7efd0359aced..95afaf080f66 100644 --- a/shell/browser/electron_browser_client.cc +++ b/shell/browser/electron_browser_client.cc @@ -920,7 +920,7 @@ ElectronBrowserClient::CreateWindowForPictureInPicture( content::PictureInPictureWindowController* controller) { auto overlay_window = content::OverlayWindow::Create(controller); #if defined(OS_WIN) - std::u16string app_user_model_id = Browser::Get()->GetAppUserModelID(); + std::wstring app_user_model_id = Browser::Get()->GetAppUserModelID(); if (!app_user_model_id.empty()) { auto* overlay_window_view = static_cast(overlay_window.get()); diff --git a/shell/browser/notifications/win/notification_presenter_win.cc b/shell/browser/notifications/win/notification_presenter_win.cc index f74a26aef592..e1f7fbdf3a6d 100644 --- a/shell/browser/notifications/win/notification_presenter_win.cc +++ b/shell/browser/notifications/win/notification_presenter_win.cc @@ -72,7 +72,7 @@ bool NotificationPresenterWin::Init() { return temp_dir_.CreateUniqueTempDir(); } -std::u16string NotificationPresenterWin::SaveIconToFilesystem( +std::wstring NotificationPresenterWin::SaveIconToFilesystem( const SkBitmap& icon, const GURL& origin) { std::string filename; @@ -85,12 +85,12 @@ std::u16string NotificationPresenterWin::SaveIconToFilesystem( } base::ThreadRestrictions::ScopedAllowIO allow_io; - base::FilePath path = temp_dir_.GetPath().Append(base::UTF8ToUTF16(filename)); + base::FilePath path = temp_dir_.GetPath().Append(base::UTF8ToWide(filename)); if (base::PathExists(path)) return path.value(); if (SaveIconToPath(icon, path)) return path.value(); - return base::UTF8ToUTF16(origin.spec()); + return base::UTF8ToWide(origin.spec()); } Notification* NotificationPresenterWin::CreateNotificationObject( diff --git a/shell/browser/notifications/win/notification_presenter_win.h b/shell/browser/notifications/win/notification_presenter_win.h index 58d9cc381974..670cfd6db2ed 100644 --- a/shell/browser/notifications/win/notification_presenter_win.h +++ b/shell/browser/notifications/win/notification_presenter_win.h @@ -38,7 +38,7 @@ class NotificationPresenterWin : public NotificationPresenter { bool Init(); - std::u16string SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin); + std::wstring SaveIconToFilesystem(const SkBitmap& icon, const GURL& origin); private: Notification* CreateNotificationObject( diff --git a/shell/browser/notifications/win/win32_notification.cc b/shell/browser/notifications/win/win32_notification.cc index 2b04f09eb701..b0cdaeb72ddf 100644 --- a/shell/browser/notifications/win/win32_notification.cc +++ b/shell/browser/notifications/win/win32_notification.cc @@ -13,6 +13,7 @@ #include #include +#include "base/strings/utf_string_conversions.h" #include "third_party/skia/include/core/SkBitmap.h" namespace electron { @@ -49,13 +50,15 @@ void Win32Notification::Show(const NotificationOptions& options) { existing->tag_.clear(); this->notification_ref_ = std::move(existing->notification_ref_); - this->notification_ref_.Set(options.title, options.msg, image); + this->notification_ref_.Set(base::UTF16ToWide(options.title), + base::UTF16ToWide(options.msg), image); // Need to remove the entry in the notifications set that // NotificationPresenter is holding existing->Destroy(); } else { this->notification_ref_ = - presenter->AddNotification(options.title, options.msg, image); + presenter->AddNotification(base::UTF16ToWide(options.title), + base::UTF16ToWide(options.msg), image); } this->tag_ = options.tag; diff --git a/shell/browser/notifications/win/windows_toast_notification.cc b/shell/browser/notifications/win/windows_toast_notification.cc index 4f0791518515..2ece87ae917b 100644 --- a/shell/browser/notifications/win/windows_toast_notification.cc +++ b/shell/browser/notifications/win/windows_toast_notification.cc @@ -21,7 +21,7 @@ #include "shell/browser/notifications/win/notification_presenter_win.h" #include "shell/browser/win/scoped_hstring.h" #include "shell/common/application_info.h" -#include "ui/base/l10n/l10n_util.h" +#include "ui/base/l10n/l10n_util_win.h" #include "ui/strings/grit/ui_strings.h" using ABI::Windows::Data::Xml::Dom::IXmlAttribute; @@ -132,15 +132,18 @@ HRESULT WindowsToastNotification::ShowInternal( // The custom xml takes priority over the preset template. if (!options.toast_xml.empty()) { REPORT_AND_RETURN_IF_FAILED( - XmlDocumentFromString(options.toast_xml.c_str(), &toast_xml), + XmlDocumentFromString(base::UTF16ToWide(options.toast_xml).c_str(), + &toast_xml), "XML: Invalid XML"); } else { auto* presenter_win = static_cast(presenter()); std::wstring icon_path = presenter_win->SaveIconToFilesystem(options.icon, options.icon_url); REPORT_AND_RETURN_IF_FAILED( - GetToastXml(toast_manager_.Get(), options.title, options.msg, icon_path, - options.timeout_type, options.silent, &toast_xml), + GetToastXml(toast_manager_.Get(), base::UTF16ToWide(options.title), + base::UTF16ToWide(options.msg), icon_path, + base::UTF16ToWide(options.timeout_type), options.silent, + &toast_xml), "XML: Failed to create XML document"); } @@ -211,7 +214,7 @@ HRESULT WindowsToastNotification::GetToastXml( } // Configure the toast's timeout settings - if (timeout_type == base::ASCIIToUTF16("never")) { + if (timeout_type == base::ASCIIToWide("never")) { REPORT_AND_RETURN_IF_FAILED( (SetXmlScenarioReminder(*toast_xml)), "XML: Setting \"scenario\" option on notification failed"); @@ -379,7 +382,7 @@ HRESULT WindowsToastNotification::SetXmlScenarioReminder(IXmlDocument* doc) { RETURN_IF_FAILED(content_attribute.As(&content_attribute_node)); // Set content attribute to Dismiss - ScopedHString content_value(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); + ScopedHString content_value(l10n_util::GetWideString(IDS_APP_CLOSE)); if (!content_value.success()) return E_FAIL; diff --git a/shell/browser/ui/file_dialog_win.cc b/shell/browser/ui/file_dialog_win.cc index 931e0346e3e3..ddf3660ba6a9 100644 --- a/shell/browser/ui/file_dialog_win.cc +++ b/shell/browser/ui/file_dialog_win.cc @@ -118,10 +118,10 @@ static void ApplySettings(IFileDialog* dialog, const DialogSettings& settings) { dialog->SetFileName(file_part.c_str()); if (!settings.title.empty()) - dialog->SetTitle(base::UTF8ToUTF16(settings.title).c_str()); + dialog->SetTitle(base::UTF8ToWide(settings.title).c_str()); if (!settings.button_label.empty()) - dialog->SetOkButtonLabel(base::UTF8ToUTF16(settings.button_label).c_str()); + dialog->SetOkButtonLabel(base::UTF8ToWide(settings.button_label).c_str()); std::vector buffer; std::vector filterspec; diff --git a/shell/browser/ui/message_box_win.cc b/shell/browser/ui/message_box_win.cc index 2e5751e72390..0fffbd8bc0ce 100644 --- a/shell/browser/ui/message_box_win.cc +++ b/shell/browser/ui/message_box_win.cc @@ -39,8 +39,8 @@ struct CommonButtonID { int button; int id; }; -CommonButtonID GetCommonID(const std::u16string& button) { - std::u16string lower = base::ToLowerASCII(button); +CommonButtonID GetCommonID(const std::wstring& button) { + std::wstring lower = base::ToLowerASCII(button); if (lower == L"ok") return {TDCBF_OK_BUTTON, IDOK}; else if (lower == L"yes") @@ -63,15 +63,15 @@ void MapToCommonID(const std::vector& buttons, TASKDIALOG_COMMON_BUTTON_FLAGS* button_flags, std::vector* dialog_buttons) { for (size_t i = 0; i < buttons.size(); ++i) { - auto common = GetCommonID(buttons[i]); + auto common = GetCommonID(base::UTF16ToWide(buttons[i])); if (common.button != -1) { // It is a common button. (*id_map)[common.id] = i; (*button_flags) |= common.button; } else { // It is a custom button. - dialog_buttons->push_back( - {static_cast(i + kIDStart), buttons[i].c_str()}); + dialog_buttons->push_back({static_cast(i + kIDStart), + base::UTF16ToWide(buttons[i]).c_str()}); } } } @@ -107,11 +107,11 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, // TaskDialogIndirect doesn't allow empty name, if we set empty title it // will show "electron.exe" in title. - std::u16string app_name = base::UTF8ToUTF16(Browser::Get()->GetName()); + std::wstring app_name = base::UTF8ToWide(Browser::Get()->GetName()); if (title.empty()) config.pszWindowTitle = app_name.c_str(); else - config.pszWindowTitle = title.c_str(); + config.pszWindowTitle = base::UTF16ToWide(title).c_str(); base::win::ScopedHICON hicon; if (!icon.isNull()) { @@ -138,14 +138,14 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, // If "detail" is empty then don't make message highlighted. if (detail.empty()) { - config.pszContent = message.c_str(); + config.pszContent = base::UTF16ToWide(message).c_str(); } else { - config.pszMainInstruction = message.c_str(); - config.pszContent = detail.c_str(); + config.pszMainInstruction = base::UTF16ToWide(message).c_str(); + config.pszContent = base::UTF16ToWide(detail).c_str(); } if (!checkbox_label.empty()) { - config.pszVerificationText = checkbox_label.c_str(); + config.pszVerificationText = base::UTF16ToWide(checkbox_label).c_str(); if (checkbox_checked) config.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED; } @@ -156,8 +156,8 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, std::vector dialog_buttons; if (no_link) { for (size_t i = 0; i < buttons.size(); ++i) - dialog_buttons.push_back( - {static_cast(i + kIDStart), buttons[i].c_str()}); + dialog_buttons.push_back({static_cast(i + kIDStart), + base::UTF16ToWide(buttons[i]).c_str()}); } else { MapToCommonID(buttons, &id_map, &config.dwCommonButtons, &dialog_buttons); } @@ -222,7 +222,8 @@ void ShowMessageBox(const MessageBoxSettings& settings, void ShowErrorBox(const std::u16string& title, const std::u16string& content) { electron::UnresponsiveSuppressor suppressor; ShowTaskDialogUTF16(nullptr, MessageBoxType::kError, {}, -1, 0, false, - L"Error", title, content, L"", false, gfx::ImageSkia()); + base::UTF8ToUTF16("Error"), title, content, + base::UTF8ToUTF16(""), false, gfx::ImageSkia()); } } // namespace electron diff --git a/shell/browser/ui/win/jump_list.cc b/shell/browser/ui/win/jump_list.cc index 22d72b6e9bc1..ecea78b1faec 100644 --- a/shell/browser/ui/win/jump_list.cc +++ b/shell/browser/ui/win/jump_list.cc @@ -158,7 +158,7 @@ JumpListCategory::JumpListCategory() = default; JumpListCategory::JumpListCategory(const JumpListCategory&) = default; JumpListCategory::~JumpListCategory() = default; -JumpList::JumpList(const std::u16string& app_id) : app_id_(app_id) { +JumpList::JumpList(const std::wstring& app_id) : app_id_(app_id) { destinations_.CoCreateInstance(CLSID_DestinationList); } diff --git a/shell/browser/ui/win/jump_list.h b/shell/browser/ui/win/jump_list.h index ae202dbc3548..9bed90477f99 100644 --- a/shell/browser/ui/win/jump_list.h +++ b/shell/browser/ui/win/jump_list.h @@ -46,9 +46,9 @@ struct JumpListItem { // For tasks this is the path to the program executable, for file links this // is the full filename. base::FilePath path; - std::u16string arguments; - std::u16string title; - std::u16string description; + std::wstring arguments; + std::wstring title; + std::wstring description; base::FilePath working_dir; base::FilePath icon_path; int icon_index = 0; @@ -73,7 +73,7 @@ struct JumpListCategory { }; Type type = Type::kTasks; - std::u16string name; + std::wstring name; std::vector items; JumpListCategory(); @@ -88,7 +88,7 @@ class JumpList { // |app_id| must be the Application User Model ID of the app for which the // custom Jump List should be created/removed, it's usually obtained by // calling GetCurrentProcessExplicitAppUserModelID(). - explicit JumpList(const std::u16string& app_id); + explicit JumpList(const std::wstring& app_id); ~JumpList(); // Starts a new transaction, must be called before appending any categories, @@ -111,7 +111,7 @@ class JumpList { const std::vector& categories); private: - std::u16string app_id_; + std::wstring app_id_; CComPtr destinations_; DISALLOW_COPY_AND_ASSIGN(JumpList); diff --git a/shell/browser/ui/win/notify_icon.cc b/shell/browser/ui/win/notify_icon.cc index 405c599481bd..aff97784f479 100644 --- a/shell/browser/ui/win/notify_icon.cc +++ b/shell/browser/ui/win/notify_icon.cc @@ -141,7 +141,7 @@ void NotifyIcon::SetToolTip(const std::string& tool_tip) { NOTIFYICONDATA icon_data; InitIconData(&icon_data); icon_data.uFlags |= NIF_TIP; - wcsncpy_s(icon_data.szTip, base::UTF8ToUTF16(tool_tip).c_str(), _TRUNCATE); + wcsncpy_s(icon_data.szTip, base::UTF8ToWide(tool_tip).c_str(), _TRUNCATE); BOOL result = Shell_NotifyIcon(NIM_MODIFY, &icon_data); if (!result) LOG(WARNING) << "Unable to set tooltip for status tray icon"; @@ -151,8 +151,10 @@ void NotifyIcon::DisplayBalloon(const BalloonOptions& options) { NOTIFYICONDATA icon_data; InitIconData(&icon_data); icon_data.uFlags |= NIF_INFO; - wcsncpy_s(icon_data.szInfoTitle, options.title.c_str(), _TRUNCATE); - wcsncpy_s(icon_data.szInfo, options.content.c_str(), _TRUNCATE); + wcsncpy_s(icon_data.szInfoTitle, base::UTF16ToWide(options.title).c_str(), + _TRUNCATE); + wcsncpy_s(icon_data.szInfo, base::UTF16ToWide(options.content).c_str(), + _TRUNCATE); icon_data.uTimeout = 0; icon_data.hBalloonIcon = options.icon; icon_data.dwInfoFlags = ConvertIconType(options.icon_type); diff --git a/shell/browser/ui/win/taskbar_host.cc b/shell/browser/ui/win/taskbar_host.cc index 272cc2fc98d1..32fd51511367 100644 --- a/shell/browser/ui/win/taskbar_host.cc +++ b/shell/browser/ui/win/taskbar_host.cc @@ -104,7 +104,7 @@ bool TaskbarHost::SetThumbarButtons(HWND window, // Set tooltip. if (!button.tooltip.empty()) { thumb_button.dwMask |= THB_TOOLTIP; - wcsncpy_s(thumb_button.szTip, base::UTF8ToUTF16(button.tooltip).c_str(), + wcsncpy_s(thumb_button.szTip, base::UTF8ToWide(button.tooltip).c_str(), _TRUNCATE); } @@ -173,7 +173,7 @@ bool TaskbarHost::SetOverlayIcon(HWND window, base::win::ScopedHICON icon(IconUtil::CreateHICONFromSkBitmap(overlay)); return SUCCEEDED(taskbar_->SetOverlayIcon(window, icon.get(), - base::UTF8ToUTF16(text).c_str())); + base::UTF8ToWide(text).c_str())); } bool TaskbarHost::SetThumbnailClip(HWND window, const gfx::Rect& region) { @@ -193,8 +193,8 @@ bool TaskbarHost::SetThumbnailToolTip(HWND window, const std::string& tooltip) { if (!InitializeTaskbar()) return false; - return SUCCEEDED(taskbar_->SetThumbnailTooltip( - window, base::UTF8ToUTF16(tooltip).c_str())); + return SUCCEEDED( + taskbar_->SetThumbnailTooltip(window, base::UTF8ToWide(tooltip).c_str())); } bool TaskbarHost::HandleThumbarButtonEvent(int button_id) { diff --git a/shell/browser/web_contents_preferences.cc b/shell/browser/web_contents_preferences.cc index 20317bfd6d8a..d609da029667 100644 --- a/shell/browser/web_contents_preferences.cc +++ b/shell/browser/web_contents_preferences.cc @@ -235,18 +235,24 @@ bool WebContentsPreferences::GetPreference(base::StringPiece name, bool WebContentsPreferences::GetPreloadPath(base::FilePath* path) const { DCHECK(path); base::FilePath::StringType preload_path; - if (GetAsString(&preference_, options::kPreloadScript, &preload_path)) { - base::FilePath preload(preload_path); + std::u16string preload_path_str; + if (GetAsString(&preference_, options::kPreloadScript, &preload_path_str)) { +#if defined(OS_WIN) + base::FilePath preload(base::UTF16ToWide(preload_path_str)); +#else + base::FilePath preload(preload_path_str); +#endif if (preload.IsAbsolute()) { *path = std::move(preload); return true; } else { LOG(ERROR) << "preload script must have absolute path."; } - } else if (GetAsString(&preference_, options::kPreloadURL, &preload_path)) { + } else if (GetAsString(&preference_, options::kPreloadURL, + &preload_path_str)) { // Translate to file path if there is "preload-url" option. base::FilePath preload; - if (net::FileURLToFilePath(GURL(preload_path), &preload)) { + if (net::FileURLToFilePath(GURL(preload_path_str), &preload)) { *path = std::move(preload); return true; } else { diff --git a/shell/browser/web_dialog_helper.cc b/shell/browser/web_dialog_helper.cc index 976eaedeb9c8..8146b7e055c2 100644 --- a/shell/browser/web_dialog_helper.cc +++ b/shell/browser/web_dialog_helper.cc @@ -86,7 +86,7 @@ file_dialog::Filters GetFileTypesFromAcceptType( for (const auto& extension : extensions) { #if defined(OS_WIN) - filters[0].second.push_back(base::UTF16ToASCII(extension)); + filters[0].second.push_back(base::WideToASCII(extension)); #else filters[0].second.push_back(extension); #endif diff --git a/shell/common/api/electron_api_native_image.cc b/shell/common/api/electron_api_native_image.cc index 98fe8d90445e..d1e7ce6c00c7 100644 --- a/shell/common/api/electron_api_native_image.cc +++ b/shell/common/api/electron_api_native_image.cc @@ -156,7 +156,7 @@ bool NativeImage::TryConvertNativeImage(v8::Isolate* isolate, *native_image = NativeImage::CreateFromPath(isolate, icon_path).get(); if ((*native_image)->image().IsEmpty()) { #if defined(OS_WIN) - const auto img_path = base::UTF16ToUTF8(icon_path.value()); + const auto img_path = base::WideToUTF8(icon_path.value()); #else const auto img_path = icon_path.value(); #endif diff --git a/shell/common/api/electron_api_native_image_win.cc b/shell/common/api/electron_api_native_image_win.cc index 23f24e30b335..455b702f2310 100644 --- a/shell/common/api/electron_api_native_image_win.cc +++ b/shell/common/api/electron_api_native_image_win.cc @@ -37,7 +37,7 @@ v8::Local NativeImage::CreateThumbnailFromPath( // create an IShellItem Microsoft::WRL::ComPtr pItem; - std::wstring image_path = path.AsUTF16Unsafe(); + std::wstring image_path = path.value(); hr = SHCreateItemFromParsingName(image_path.c_str(), nullptr, IID_PPV_ARGS(&pItem)); diff --git a/shell/common/api/electron_api_shell.cc b/shell/common/api/electron_api_shell.cc index 1679afe5ecc4..a6222f7f7e02 100644 --- a/shell/common/api/electron_api_shell.cc +++ b/shell/common/api/electron_api_shell.cc @@ -117,7 +117,7 @@ bool WriteShortcutLink(const base::FilePath& shortcut_path, base::win::ShortcutProperties properties; base::FilePath path; - std::u16string str; + std::wstring str; UUID toastActivatorClsid; int index; if (options.Get("target", &path)) diff --git a/shell/common/application_info_win.cc b/shell/common/application_info_win.cc index f900a193a221..c6af65fd19f4 100644 --- a/shell/common/application_info_win.cc +++ b/shell/common/application_info_win.cc @@ -15,6 +15,7 @@ #include "base/file_version_info.h" #include "base/notreached.h" #include "base/strings/string_util.h" +#include "base/strings/string_util_win.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "shell/browser/win/scoped_hstring.h" @@ -23,7 +24,7 @@ namespace electron { namespace { -std::u16string g_app_user_model_id; +std::wstring g_app_user_model_id; } const wchar_t kAppUserModelIDFormat[] = L"electron.app.$1"; @@ -42,7 +43,7 @@ std::string GetApplicationVersion() { return base::UTF16ToUTF8(info->product_version()); } -void SetAppUserModelID(const std::u16string& name) { +void SetAppUserModelID(const std::wstring& name) { g_app_user_model_id = name; SetCurrentProcessExplicitAppUserModelID(g_app_user_model_id.c_str()); } @@ -54,8 +55,8 @@ PCWSTR GetRawAppUserModelID() { g_app_user_model_id = current_app_id; } else { std::string name = GetApplicationName(); - std::u16string generated_app_id = base::ReplaceStringPlaceholders( - kAppUserModelIDFormat, base::UTF8ToUTF16(name), nullptr); + std::wstring generated_app_id = base::ReplaceStringPlaceholders( + kAppUserModelIDFormat, {base::UTF8ToWide(name)}, nullptr); SetAppUserModelID(generated_app_id); } CoTaskMemFree(current_app_id); diff --git a/shell/common/gin_converters/file_path_converter.h b/shell/common/gin_converters/file_path_converter.h index 313622295589..28d5c4bfda87 100644 --- a/shell/common/gin_converters/file_path_converter.h +++ b/shell/common/gin_converters/file_path_converter.h @@ -7,6 +7,7 @@ #include "base/files/file_path.h" #include "gin/converter.h" +#include "shell/common/gin_converters/std_converter.h" namespace gin { diff --git a/shell/common/gin_converters/std_converter.h b/shell/common/gin_converters/std_converter.h index 7a4240b62130..fef3cd26fa67 100644 --- a/shell/common/gin_converters/std_converter.h +++ b/shell/common/gin_converters/std_converter.h @@ -11,6 +11,10 @@ #include "gin/converter.h" +#if defined(OS_WIN) +#include "base/strings/string_util_win.h" +#endif + namespace gin { // Make it possible to convert move-only types. @@ -182,6 +186,30 @@ struct Converter> { } }; +#if defined(OS_WIN) +template <> +struct Converter { + static v8::Local ToV8(v8::Isolate* isolate, + const std::wstring& val) { + return Converter::ToV8(isolate, base::AsString16(val)); + } + static bool FromV8(v8::Isolate* isolate, + v8::Local val, + std::wstring* out) { + if (!val->IsString()) + return false; + + std::u16string str; + if (Converter::FromV8(isolate, val, &str)) { + *out = base::AsWString(str); + return true; + } else { + return false; + } + } +}; +#endif + } // namespace gin #endif // SHELL_COMMON_GIN_CONVERTERS_STD_CONVERTER_H_ diff --git a/shell/common/language_util.h b/shell/common/language_util.h index 6f15cc680229..eac23ad4ed60 100644 --- a/shell/common/language_util.h +++ b/shell/common/language_util.h @@ -14,11 +14,6 @@ namespace electron { // overrides from command line arguments. std::vector GetPreferredLanguages(); -#if defined(OS_WIN) -bool GetPreferredLanguagesUsingGlobalization( - std::vector* languages); -#endif - } // namespace electron #endif // SHELL_COMMON_LANGUAGE_UTIL_H_ diff --git a/shell/common/language_util_win.cc b/shell/common/language_util_win.cc index 708802c1ab02..e8e681aaaf74 100644 --- a/shell/common/language_util_win.cc +++ b/shell/common/language_util_win.cc @@ -16,24 +16,8 @@ namespace electron { -std::vector GetPreferredLanguages() { - std::vector languages16; - - // Attempt to use API available on Windows 10 or later, which - // returns the full list of language preferences. - if (!GetPreferredLanguagesUsingGlobalization(&languages16)) { - base::win::i18n::GetThreadPreferredUILanguageList(&languages16); - } - - std::vector languages; - for (const auto& language : languages16) { - languages.push_back(base::SysWideToUTF8(language)); - } - return languages; -} - bool GetPreferredLanguagesUsingGlobalization( - std::vector* languages) { + std::vector* languages) { if (base::win::GetVersion() < base::win::Version::WIN10) return false; if (!base::win::ResolveCoreWinRTDelayload() || @@ -73,4 +57,20 @@ bool GetPreferredLanguagesUsingGlobalization( return true; } +std::vector GetPreferredLanguages() { + std::vector languages16; + + // Attempt to use API available on Windows 10 or later, which + // returns the full list of language preferences. + if (!GetPreferredLanguagesUsingGlobalization(&languages16)) { + base::win::i18n::GetThreadPreferredUILanguageList(&languages16); + } + + std::vector languages; + for (const auto& language : languages16) { + languages.push_back(base::SysWideToUTF8(language)); + } + return languages; +} + } // namespace electron diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index 7db58675e567..b6efb9b0e244 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -214,7 +214,7 @@ void SetNodeCliFlags() { for (const auto& arg : argv) { #if defined(OS_WIN) - const auto& option = base::UTF16ToUTF8(arg); + const auto& option = base::WideToUTF8(arg); #else const auto& option = arg; #endif diff --git a/shell/common/platform_util_win.cc b/shell/common/platform_util_win.cc index 90505ae27b05..f66fc80650f2 100644 --- a/shell/common/platform_util_win.cc +++ b/shell/common/platform_util_win.cc @@ -241,8 +241,8 @@ std::string OpenExternalOnWorkerThread( // Quote the input scheme to be sure that the command does not have // parameters unexpected by the external program. This url should already // have been escaped. - std::u16string escaped_url = L"\"" + base::UTF8ToUTF16(url.spec()) + L"\""; - std::u16string working_dir = options.working_dir.value(); + std::wstring escaped_url = L"\"" + base::UTF8ToWide(url.spec()) + L"\""; + std::wstring working_dir = options.working_dir.value(); if (reinterpret_cast( ShellExecuteW(nullptr, L"open", escaped_url.c_str(), nullptr, diff --git a/shell/renderer/renderer_client_base.cc b/shell/renderer/renderer_client_base.cc index 126401675ea4..57b19b76ef21 100644 --- a/shell/renderer/renderer_client_base.cc +++ b/shell/renderer/renderer_client_base.cc @@ -218,7 +218,7 @@ void RendererClientBase::RenderThreadStarted() { #if defined(OS_WIN) // Set ApplicationUserModelID in renderer process. - std::u16string app_id = + std::wstring app_id = command_line->GetSwitchValueNative(switches::kAppUserModelId); if (!app_id.empty()) { SetCurrentProcessExplicitAppUserModelID(app_id.c_str()); From deeb2de14bfbf218494cd1e63142aee945525f32 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 22 Mar 2021 10:35:11 -0700 Subject: [PATCH 62/85] undo changes to WebContentsPreferences::GetPreloadPath to fix mac build --- shell/browser/web_contents_preferences.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/shell/browser/web_contents_preferences.cc b/shell/browser/web_contents_preferences.cc index d609da029667..20317bfd6d8a 100644 --- a/shell/browser/web_contents_preferences.cc +++ b/shell/browser/web_contents_preferences.cc @@ -235,24 +235,18 @@ bool WebContentsPreferences::GetPreference(base::StringPiece name, bool WebContentsPreferences::GetPreloadPath(base::FilePath* path) const { DCHECK(path); base::FilePath::StringType preload_path; - std::u16string preload_path_str; - if (GetAsString(&preference_, options::kPreloadScript, &preload_path_str)) { -#if defined(OS_WIN) - base::FilePath preload(base::UTF16ToWide(preload_path_str)); -#else - base::FilePath preload(preload_path_str); -#endif + if (GetAsString(&preference_, options::kPreloadScript, &preload_path)) { + base::FilePath preload(preload_path); if (preload.IsAbsolute()) { *path = std::move(preload); return true; } else { LOG(ERROR) << "preload script must have absolute path."; } - } else if (GetAsString(&preference_, options::kPreloadURL, - &preload_path_str)) { + } else if (GetAsString(&preference_, options::kPreloadURL, &preload_path)) { // Translate to file path if there is "preload-url" option. base::FilePath preload; - if (net::FileURLToFilePath(GURL(preload_path_str), &preload)) { + if (net::FileURLToFilePath(GURL(preload_path), &preload)) { *path = std::move(preload); return true; } else { From 451e0931bf28bc9cbed6e8ab944f04814232f067 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 22 Mar 2021 12:07:12 -0700 Subject: [PATCH 63/85] fix StrCat issue --- shell/browser/ui/file_dialog_win.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/browser/ui/file_dialog_win.cc b/shell/browser/ui/file_dialog_win.cc index ddf3660ba6a9..44453ed4bb8f 100644 --- a/shell/browser/ui/file_dialog_win.cc +++ b/shell/browser/ui/file_dialog_win.cc @@ -10,6 +10,7 @@ #include #include +#include "base/win/shlwapi.h" // NOLINT(build/include_order) #include "base/files/file_util.h" #include "base/i18n/case_conversion.h" From 205f5721818b2a03aafa745922ae7f2e2eae9e7a Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 22 Mar 2021 12:15:30 -0700 Subject: [PATCH 64/85] incantations for WebContentsPreferences::GetPreloadPath wide strings --- shell/browser/web_contents_preferences.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/shell/browser/web_contents_preferences.cc b/shell/browser/web_contents_preferences.cc index 20317bfd6d8a..99bd72be8cba 100644 --- a/shell/browser/web_contents_preferences.cc +++ b/shell/browser/web_contents_preferences.cc @@ -61,6 +61,21 @@ bool GetAsString(const base::Value* val, return false; } +#if defined(OS_WIN) +bool GetAsString(const base::Value* val, + base::FilePath::StringPieceType path, + std::u16string* out) { + if (val) { + auto* found = val->FindKeyOfType(path, base::Value::Type::STRING); + if (found) { + *out = base::UTF8ToWide(found->GetString()); + return true; + } + } + return false; +} +#endif + bool GetAsInteger(const base::Value* val, base::StringPiece path, int* out) { if (val) { auto* found = val->FindKey(path); @@ -246,6 +261,12 @@ bool WebContentsPreferences::GetPreloadPath(base::FilePath* path) const { } else if (GetAsString(&preference_, options::kPreloadURL, &preload_path)) { // Translate to file path if there is "preload-url" option. base::FilePath preload; + GURL preload_url; +#if defined(OS_WIN) + preload_url = GURL(base::WideToUTF8(preload_path)); +#else + preload_url = GURL(preload_path); +#endif if (net::FileURLToFilePath(GURL(preload_path), &preload)) { *path = std::move(preload); return true; From 74318705c2bde84b04b2f724521699ebdc8e9f6e Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 22 Mar 2021 13:09:41 -0700 Subject: [PATCH 65/85] bump nan --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 63692c6f3192..44430d264aac 100644 --- a/DEPS +++ b/DEPS @@ -18,7 +18,7 @@ vars = { 'node_version': 'v14.16.0', 'nan_version': - '2c4ee8a32a299eada3cd6e468bbd0a473bfea96d', + 'v2.14.2', 'squirrel.mac_version': 'cdc0729c8bf8576bfef18629186e1e9ecf1b0d9f', From ea62ecd1886ea20760f58d65ae452bd5d95614aa Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 22 Mar 2021 14:47:24 -0700 Subject: [PATCH 66/85] fix GetAsString maybe? --- shell/browser/web_contents_preferences.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/browser/web_contents_preferences.cc b/shell/browser/web_contents_preferences.cc index 99bd72be8cba..a02fadfc6a09 100644 --- a/shell/browser/web_contents_preferences.cc +++ b/shell/browser/web_contents_preferences.cc @@ -63,8 +63,8 @@ bool GetAsString(const base::Value* val, #if defined(OS_WIN) bool GetAsString(const base::Value* val, - base::FilePath::StringPieceType path, - std::u16string* out) { + base::StringPiece path, + std::wstring* out) { if (val) { auto* found = val->FindKeyOfType(path, base::Value::Type::STRING); if (found) { From 5b598037bba8ace5ab3dbb7df82555b71dba7c11 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 22 Mar 2021 15:49:43 -0700 Subject: [PATCH 67/85] windows build fixes --- shell/browser/ui/file_dialog_win.cc | 3 ++- shell/browser/web_contents_preferences.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/shell/browser/ui/file_dialog_win.cc b/shell/browser/ui/file_dialog_win.cc index 44453ed4bb8f..25d1e4d059c6 100644 --- a/shell/browser/ui/file_dialog_win.cc +++ b/shell/browser/ui/file_dialog_win.cc @@ -6,11 +6,12 @@ #include // windows.h must be included first +#include "base/win/shlwapi.h" // NOLINT(build/include_order) + #include // atlbase.h for CComPtr #include #include -#include "base/win/shlwapi.h" // NOLINT(build/include_order) #include "base/files/file_util.h" #include "base/i18n/case_conversion.h" diff --git a/shell/browser/web_contents_preferences.cc b/shell/browser/web_contents_preferences.cc index a02fadfc6a09..a34ca795a277 100644 --- a/shell/browser/web_contents_preferences.cc +++ b/shell/browser/web_contents_preferences.cc @@ -267,7 +267,7 @@ bool WebContentsPreferences::GetPreloadPath(base::FilePath* path) const { #else preload_url = GURL(preload_path); #endif - if (net::FileURLToFilePath(GURL(preload_path), &preload)) { + if (net::FileURLToFilePath(preload_url, &preload)) { *path = std::move(preload); return true; } else { From 61cf1abd4d02b87d4221c83d4cb8b2fade62b247 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 23 Mar 2021 11:12:59 -0700 Subject: [PATCH 68/85] more windows build fix --- shell/common/application_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/common/application_info.h b/shell/common/application_info.h index fcabc81f9651..a79443ec31ac 100644 --- a/shell/common/application_info.h +++ b/shell/common/application_info.h @@ -27,7 +27,7 @@ std::string GetApplicationUserAgent(); #if defined(OS_WIN) PCWSTR GetRawAppUserModelID(); bool GetAppUserModelID(ScopedHString* app_id); -void SetAppUserModelID(const std::u16string& name); +void SetAppUserModelID(const std::wstring& name); bool IsRunningInDesktopBridge(); #endif From 83d93bcbdc369b00cb146d1590c0cce1bf4f48ba Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 24 Mar 2021 10:22:04 -0700 Subject: [PATCH 69/85] SetAppUserModelID -> wstring --- shell/browser/browser.h | 2 +- shell/browser/browser_linux.cc | 2 +- shell/browser/browser_mac.mm | 2 +- shell/browser/browser_win.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/browser/browser.h b/shell/browser/browser.h index 4768196c0a62..136900881a35 100755 --- a/shell/browser/browser.h +++ b/shell/browser/browser.h @@ -84,7 +84,7 @@ class Browser : public WindowListObserver { void ClearRecentDocuments(); // Set the application user model ID. - void SetAppUserModelID(const std::u16string& name); + void SetAppUserModelID(const std::wstring& name); // Remove the default protocol handler registry key bool RemoveAsDefaultProtocolClient(const std::string& protocol, diff --git a/shell/browser/browser_linux.cc b/shell/browser/browser_linux.cc index 8c5e59e427dc..6243db893033 100644 --- a/shell/browser/browser_linux.cc +++ b/shell/browser/browser_linux.cc @@ -88,7 +88,7 @@ void Browser::AddRecentDocument(const base::FilePath& path) {} void Browser::ClearRecentDocuments() {} -void Browser::SetAppUserModelID(const std::u16string& name) {} +void Browser::SetAppUserModelID(const std::wstring& name) {} bool Browser::SetAsDefaultProtocolClient(const std::string& protocol, gin::Arguments* args) { diff --git a/shell/browser/browser_mac.mm b/shell/browser/browser_mac.mm index 97daa1ded023..86d1be74a381 100644 --- a/shell/browser/browser_mac.mm +++ b/shell/browser/browser_mac.mm @@ -218,7 +218,7 @@ std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) { return app_display_name; } -void Browser::SetAppUserModelID(const std::u16string& name) {} +void Browser::SetAppUserModelID(const std::wstring& name) {} bool Browser::SetBadgeCount(base::Optional count) { DockSetBadgeText(!count.has_value() || count.value() != 0 diff --git a/shell/browser/browser_win.cc b/shell/browser/browser_win.cc index 04519a20d447..0db6ab988d9c 100755 --- a/shell/browser/browser_win.cc +++ b/shell/browser/browser_win.cc @@ -393,7 +393,7 @@ void Browser::ClearRecentDocuments() { SHAddToRecentDocs(SHARD_APPIDINFO, nullptr); } -void Browser::SetAppUserModelID(const std::u16string& name) { +void Browser::SetAppUserModelID(const std::wstring& name) { electron::SetAppUserModelID(name); } From 4f97b9303cf59a38cd76b8786d07675f7d5e1065 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 24 Mar 2021 10:45:45 -0700 Subject: [PATCH 70/85] upgrade nan dep in tests --- spec/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/yarn.lock b/spec/yarn.lock index 7f37f3ed4d97..fb259074a4f8 100644 --- a/spec/yarn.lock +++ b/spec/yarn.lock @@ -691,9 +691,9 @@ ms@^2.1.1: integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== nan@2.x, nan@^2.12.1: - version "2.14.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" - integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== + version "2.14.2" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19" + integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ== oauth-sign@~0.9.0: version "0.9.0" From d874a5905635d809e721c557cae334e43e8c7a8a Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 24 Mar 2021 10:46:48 -0700 Subject: [PATCH 71/85] lint --- shell/common/platform_util_win.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/common/platform_util_win.cc b/shell/common/platform_util_win.cc index 8ffffa109ec1..46ff9b43b4fb 100644 --- a/shell/common/platform_util_win.cc +++ b/shell/common/platform_util_win.cc @@ -244,7 +244,7 @@ std::string OpenExternalOnWorkerThread( // have been escaped. std::wstring escaped_url = L"\"" + base::UTF8ToWide(net::EscapeExternalHandlerValue(url.spec())) + - std::wstring working_dir = options.working_dir.value(); + std::wstring working_dir = options.working_dir.value(); if (reinterpret_cast( ShellExecuteW(nullptr, L"open", escaped_url.c_str(), nullptr, From 7f7b1f6c8a8e1aec10302c4af3034507b0c6d304 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 24 Mar 2021 10:47:53 -0700 Subject: [PATCH 72/85] wstrings are cross-platform --- shell/common/gin_converters/std_converter.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/shell/common/gin_converters/std_converter.h b/shell/common/gin_converters/std_converter.h index fef3cd26fa67..977c8b3794bf 100644 --- a/shell/common/gin_converters/std_converter.h +++ b/shell/common/gin_converters/std_converter.h @@ -186,7 +186,6 @@ struct Converter> { } }; -#if defined(OS_WIN) template <> struct Converter { static v8::Local ToV8(v8::Isolate* isolate, @@ -208,7 +207,6 @@ struct Converter { } } }; -#endif } // namespace gin From aaf03765ed9da4f4d70101a5b35ffc086816ac87 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 24 Mar 2021 10:53:07 -0700 Subject: [PATCH 73/85] linter --- shell/browser/ui/file_dialog_win.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shell/browser/ui/file_dialog_win.cc b/shell/browser/ui/file_dialog_win.cc index 25d1e4d059c6..5aeaa238c210 100644 --- a/shell/browser/ui/file_dialog_win.cc +++ b/shell/browser/ui/file_dialog_win.cc @@ -8,10 +8,11 @@ #include "base/win/shlwapi.h" // NOLINT(build/include_order) -#include // atlbase.h for CComPtr +// atlbase.h for CComPtr +#include // NOLINT(build/include_order) -#include -#include +#include // NOLINT(build/include_order) +#include // NOLINT(build/include_order) #include "base/files/file_util.h" #include "base/i18n/case_conversion.h" From 640a1451126b404a6a9557c6c080cc83d51805de Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 24 Mar 2021 10:55:32 -0700 Subject: [PATCH 74/85] only bind setAppUserModelId on windows --- shell/browser/api/electron_api_app.cc | 2 ++ shell/common/gin_converters/std_converter.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/shell/browser/api/electron_api_app.cc b/shell/browser/api/electron_api_app.cc index 0bbd531f51a3..7790c5769185 100644 --- a/shell/browser/api/electron_api_app.cc +++ b/shell/browser/api/electron_api_app.cc @@ -1553,8 +1553,10 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) { base::BindRepeating(&Browser::AddRecentDocument, browser)) .SetMethod("clearRecentDocuments", base::BindRepeating(&Browser::ClearRecentDocuments, browser)) +#if defined(OS_WIN) .SetMethod("setAppUserModelId", base::BindRepeating(&Browser::SetAppUserModelID, browser)) +#endif .SetMethod( "isDefaultProtocolClient", base::BindRepeating(&Browser::IsDefaultProtocolClient, browser)) diff --git a/shell/common/gin_converters/std_converter.h b/shell/common/gin_converters/std_converter.h index 977c8b3794bf..fef3cd26fa67 100644 --- a/shell/common/gin_converters/std_converter.h +++ b/shell/common/gin_converters/std_converter.h @@ -186,6 +186,7 @@ struct Converter> { } }; +#if defined(OS_WIN) template <> struct Converter { static v8::Local ToV8(v8::Isolate* isolate, @@ -207,6 +208,7 @@ struct Converter { } } }; +#endif } // namespace gin From 6fbd84fc80f1c935579af4354fb3a2570feacce0 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Wed, 24 Mar 2021 11:48:15 -0700 Subject: [PATCH 75/85] fix a messed up merge --- shell/common/platform_util_win.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/common/platform_util_win.cc b/shell/common/platform_util_win.cc index 46ff9b43b4fb..c45093a559a6 100644 --- a/shell/common/platform_util_win.cc +++ b/shell/common/platform_util_win.cc @@ -244,7 +244,8 @@ std::string OpenExternalOnWorkerThread( // have been escaped. std::wstring escaped_url = L"\"" + base::UTF8ToWide(net::EscapeExternalHandlerValue(url.spec())) + - std::wstring working_dir = options.working_dir.value(); + L"\""; + std::wstring working_dir = options.working_dir.value(); if (reinterpret_cast( ShellExecuteW(nullptr, L"open", escaped_url.c_str(), nullptr, From dd975328a0e96d84960079613238621a08dc9056 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Thu, 25 Mar 2021 11:51:13 -0700 Subject: [PATCH 76/85] well that was an odyssey --- build/args/all.gn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/args/all.gn b/build/args/all.gn index bb5869ec9d6f..3f20f46f8ef6 100644 --- a/build/args/all.gn +++ b/build/args/all.gn @@ -19,4 +19,7 @@ enable_basic_printing = true angle_enable_vulkan_validation_layers = false dawn_enable_vulkan_validation_layers = false +# This breaks native node modules +libcxx_abi_unstable = false + is_cfi = false From 606fd87d1e074e5412e390ed9c7e20635dbb1454 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Fri, 26 Mar 2021 10:42:43 -0700 Subject: [PATCH 77/85] backport fcdf35e from v8 to fix nan crash --- patches/v8/.patches | 1 + ...of_shared_arraybuffer_backing_stores.patch | 137 ++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 patches/v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch diff --git a/patches/v8/.patches b/patches/v8/.patches index 61e50e1801db..7a3300db16c9 100644 --- a/patches/v8/.patches +++ b/patches/v8/.patches @@ -6,3 +6,4 @@ export_symbols_needed_for_windows_build.patch workaround_an_undefined_symbol_error.patch do_not_export_private_v8_symbols_on_windows.patch fix_build_deprecated_attirbute_for_older_msvc_versions.patch +skip_global_registration_of_shared_arraybuffer_backing_stores.patch diff --git a/patches/v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch b/patches/v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch new file mode 100644 index 000000000000..2fb4123e2471 --- /dev/null +++ b/patches/v8/skip_global_registration_of_shared_arraybuffer_backing_stores.patch @@ -0,0 +1,137 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ulan Degenbaev +Date: Tue, 16 Mar 2021 12:18:36 +0100 +Subject: Skip global registration of [Shared]ArrayBuffer backing stores + +Previously we needed to register the backing stores globally because +the embedder could create them from a raw pointer. This is no longer +possible after the removal of the old API. + +The global backing store registry now keeps track only of wasm memory +backing stores. + +Bug: v8:9380 +Change-Id: Iffefbf14dcafc1f9ce0dc3613335c754c9cb649a +Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2763874 +Reviewed-by: Andreas Haas +Commit-Queue: Ulan Degenbaev +Cr-Commit-Position: refs/heads/master@{#73493} + +diff --git a/src/api/api.cc b/src/api/api.cc +index 2c12f19b287cf5e3c5aaa04d339f2301e1e57c47..703720b2fea123b118a187f407e846781d62249f 100644 +--- a/src/api/api.cc ++++ b/src/api/api.cc +@@ -3786,7 +3786,6 @@ std::shared_ptr v8::ArrayBuffer::GetBackingStore() { + backing_store = + i::BackingStore::EmptyBackingStore(i::SharedFlag::kNotShared); + } +- i::GlobalBackingStoreRegistry::Register(backing_store); + std::shared_ptr bs_base = backing_store; + return std::static_pointer_cast(bs_base); + } +@@ -3797,7 +3796,6 @@ std::shared_ptr v8::SharedArrayBuffer::GetBackingStore() { + if (!backing_store) { + backing_store = i::BackingStore::EmptyBackingStore(i::SharedFlag::kShared); + } +- i::GlobalBackingStoreRegistry::Register(backing_store); + std::shared_ptr bs_base = backing_store; + return std::static_pointer_cast(bs_base); + } +diff --git a/src/objects/backing-store.cc b/src/objects/backing-store.cc +index 7931fbf13ddecc49969e23c57a51513d2e605039..08288ef62c0b930483004a154967925e2ed14d8a 100644 +--- a/src/objects/backing-store.cc ++++ b/src/objects/backing-store.cc +@@ -685,17 +685,8 @@ inline GlobalBackingStoreRegistryImpl* impl() { + void GlobalBackingStoreRegistry::Register( + std::shared_ptr backing_store) { + if (!backing_store || !backing_store->buffer_start()) return; +- +- if (!backing_store->free_on_destruct()) { +- // If the backing store buffer is managed by the embedder, +- // then we don't have to guarantee that there is single unique +- // BackingStore per buffer_start() because the destructor of +- // of the BackingStore will be a no-op in that case. +- +- // All Wasm memory has to be registered. +- CHECK(!backing_store->is_wasm_memory()); +- return; +- } ++ // Only wasm memory backing stores need to be registered globally. ++ CHECK(backing_store->is_wasm_memory()); + + base::MutexGuard scope_lock(&impl()->mutex_); + if (backing_store->globally_registered_) return; +@@ -711,6 +702,8 @@ void GlobalBackingStoreRegistry::Register( + void GlobalBackingStoreRegistry::Unregister(BackingStore* backing_store) { + if (!backing_store->globally_registered_) return; + ++ CHECK(backing_store->is_wasm_memory()); ++ + DCHECK_NOT_NULL(backing_store->buffer_start()); + + base::MutexGuard scope_lock(&impl()->mutex_); +@@ -722,26 +715,6 @@ void GlobalBackingStoreRegistry::Unregister(BackingStore* backing_store) { + backing_store->globally_registered_ = false; + } + +-std::shared_ptr GlobalBackingStoreRegistry::Lookup( +- void* buffer_start, size_t length) { +- base::MutexGuard scope_lock(&impl()->mutex_); +- TRACE_BS("BS:lookup mem=%p (%zu bytes)\n", buffer_start, length); +- const auto& result = impl()->map_.find(buffer_start); +- if (result == impl()->map_.end()) { +- return std::shared_ptr(); +- } +- auto backing_store = result->second.lock(); +- CHECK_EQ(buffer_start, backing_store->buffer_start()); +- if (backing_store->is_wasm_memory()) { +- // Grow calls to shared WebAssembly threads can be triggered from different +- // workers, length equality cannot be guaranteed here. +- CHECK_LE(length, backing_store->byte_length()); +- } else { +- CHECK_EQ(length, backing_store->byte_length()); +- } +- return backing_store; +-} +- + void GlobalBackingStoreRegistry::Purge(Isolate* isolate) { + // We need to keep a reference to all backing stores that are inspected + // in the purging loop below. Otherwise, we might get a deadlock +@@ -755,7 +728,7 @@ void GlobalBackingStoreRegistry::Purge(Isolate* isolate) { + auto backing_store = entry.second.lock(); + prevent_destruction_under_lock.emplace_back(backing_store); + if (!backing_store) continue; // skip entries where weak ptr is null +- if (!backing_store->is_wasm_memory()) continue; // skip non-wasm memory ++ CHECK(backing_store->is_wasm_memory()); + if (!backing_store->is_shared()) continue; // skip non-shared memory + SharedWasmMemoryData* shared_data = + backing_store->get_shared_wasm_memory_data(); +diff --git a/src/objects/backing-store.h b/src/objects/backing-store.h +index 4d20109676e8c955b2dfb40a882b5f27783a4ac6..eb879d5e8adf5a9a7d727dd571a77f01289f3be3 100644 +--- a/src/objects/backing-store.h ++++ b/src/objects/backing-store.h +@@ -219,21 +219,16 @@ class V8_EXPORT_PRIVATE BackingStore : public BackingStoreBase { + #endif // V8_ENABLE_WEBASSEMBLY + }; + +-// A global, per-process mapping from buffer addresses to backing stores. +-// This is generally only used for dealing with an embedder that has not +-// migrated to the new API which should use proper pointers to manage +-// backing stores. ++// A global, per-process mapping from buffer addresses to backing stores ++// of wasm memory objects. + class GlobalBackingStoreRegistry { + public: + // Register a backing store in the global registry. A mapping from the + // {buffer_start} to the backing store object will be added. The backing + // store will automatically unregister itself upon destruction. ++ // Only wasm memory backing stores are supported. + static void Register(std::shared_ptr backing_store); + +- // Look up a backing store based on the {buffer_start} pointer. +- static std::shared_ptr Lookup(void* buffer_start, +- size_t length); +- + private: + friend class BackingStore; + // Unregister a backing store in the global registry. From 01ca00ec82179f6e423e65ad6f274303963ecb77 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Fri, 26 Mar 2021 15:34:57 -0700 Subject: [PATCH 78/85] disable typedarrays-test.js --- script/nan-spec-runner.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script/nan-spec-runner.js b/script/nan-spec-runner.js index 947723e4ca7b..e4c077f3e1eb 100644 --- a/script/nan-spec-runner.js +++ b/script/nan-spec-runner.js @@ -47,7 +47,10 @@ async function main () { const onlyTests = args.only && args.only.split(','); - const DISABLED_TESTS = ['nannew-test.js']; + const DISABLED_TESTS = [ + 'nannew-test.js', + 'typedarrays-test.js' // TODO(nornagon): https://github.com/electron/electron/issues/28414 + ]; const testsToRun = fs.readdirSync(path.resolve(NAN_DIR, 'test', 'js')) .filter(test => !DISABLED_TESTS.includes(test)) .filter(test => { From 3122820e586ccab2555ced5c7a846498bd75c2b6 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Fri, 26 Mar 2021 18:14:07 -0700 Subject: [PATCH 79/85] don't defer in NSWindow creation https://chromium-review.googlesource.com/c/chromium/src/+/2707696 --- shell/browser/ui/cocoa/electron_ns_window.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/browser/ui/cocoa/electron_ns_window.mm b/shell/browser/ui/cocoa/electron_ns_window.mm index 44dff6a5803a..3ced22196e21 100644 --- a/shell/browser/ui/cocoa/electron_ns_window.mm +++ b/shell/browser/ui/cocoa/electron_ns_window.mm @@ -35,7 +35,7 @@ bool ScopedDisableResize::disable_resize_ = false; if ((self = [super initWithContentRect:ui::kWindowSizeDeterminedLater styleMask:styleMask backing:NSBackingStoreBuffered - defer:YES])) { + defer:NO])) { shell_ = shell; } return self; From 1f575ca3aff8e18508299f58f01d81da9d4398b5 Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Mon, 29 Mar 2021 12:38:55 -0700 Subject: [PATCH 80/85] use PartitionAllocator for ArrayBuffers in the main process --- shell/browser/javascript_environment.cc | 85 +++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/shell/browser/javascript_environment.cc b/shell/browser/javascript_environment.cc index 3c2cc82fb028..343e40654819 100644 --- a/shell/browser/javascript_environment.cc +++ b/shell/browser/javascript_environment.cc @@ -9,6 +9,7 @@ #include #include +#include "base/allocator/partition_allocator/partition_alloc.h" #include "base/command_line.h" #include "base/task/current_thread.h" #include "base/task/thread_pool/initialization_util.h" @@ -65,6 +66,83 @@ struct base::trace_event::TraceValue::Helper< namespace electron { +class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { + public: + enum InitializationPolicy { kZeroInitialize, kDontInitialize }; + + ArrayBufferAllocator() { + // Ref. + // https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/platform/wtf/allocator/partitions.cc;l=94;drc=062c315a858a87f834e16a144c2c8e9591af2beb + allocator_->init({base::PartitionOptions::Alignment::kRegular, + base::PartitionOptions::ThreadCache::kDisabled, + base::PartitionOptions::Quarantine::kAllowed, + base::PartitionOptions::RefCount::kDisabled}); + } + + // Allocate() methods return null to signal allocation failure to V8, which + // should respond by throwing a RangeError, per + // http://www.ecma-international.org/ecma-262/6.0/#sec-createbytedatablock. + void* Allocate(size_t size) override { + void* result = AllocateMemoryOrNull(size, kZeroInitialize); + return result; + } + + void* AllocateUninitialized(size_t size) override { + void* result = AllocateMemoryOrNull(size, kDontInitialize); + return result; + } + + void* Realloc(void* data, size_t size) override { + return allocator_->root()->Realloc(data, size, "Electron"); + } + + void Free(void* data, size_t size) override { + allocator_->root()->Free(data); + } + + private: + static void* AllocateMemoryOrNull(size_t size, InitializationPolicy policy) { + return AllocateMemoryWithFlags(size, policy, + base::PartitionAllocReturnNull); + } + + static void* AllocateMemoryWithFlags(size_t size, + InitializationPolicy policy, + int flags) { + // The array buffer contents are sometimes expected to be 16-byte aligned in + // order to get the best optimization of SSE, especially in case of audio + // and video buffers. Hence, align the given size up to 16-byte boundary. + // Technically speaking, 16-byte aligned size doesn't mean 16-byte aligned + // address, but this heuristics works with the current implementation of + // PartitionAlloc (and PartitionAlloc doesn't support a better way for now). + if (base::kAlignment < + 16) { // base::kAlignment is a compile-time constant. + size_t aligned_size = base::bits::AlignUp(size, 16); + if (size == 0) { + aligned_size = 16; + } + if (aligned_size >= size) { // Only when no overflow + size = aligned_size; + } + } + + if (policy == kZeroInitialize) { + flags |= base::PartitionAllocZeroFill; + } + void* data = allocator_->root()->AllocFlags(flags, size, "Electron"); + if (base::kAlignment < 16) { + char* ptr = reinterpret_cast(data); + DCHECK_EQ(base::bits::AlignUp(ptr, 16), ptr) + << "Pointer " << ptr << " not 16B aligned for size " << size; + } + return data; + } + + static base::NoDestructor allocator_; +}; + +base::NoDestructor ArrayBufferAllocator::allocator_{}; + JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop) : isolate_(Initialize(event_loop)), isolate_holder_(base::ThreadTaskRunnerHandle::Get(), @@ -249,10 +327,9 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) { tracing_controller, gin::V8Platform::PageAllocator()); v8::V8::InitializePlatform(platform_); - gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, - gin::ArrayBufferAllocator::SharedInstance(), - nullptr /* external_reference_table */, - false /* create_v8_platform */); + gin::IsolateHolder::Initialize( + gin::IsolateHolder::kNonStrictMode, new ArrayBufferAllocator(), + nullptr /* external_reference_table */, false /* create_v8_platform */); v8::Isolate* isolate = v8::Isolate::Allocate(); platform_->RegisterIsolate(isolate, event_loop); From 54e72fa8e34d629cc3b7661c0a89b3308d5f493b Mon Sep 17 00:00:00 2001 From: Jeremy Rose Date: Tue, 30 Mar 2021 10:17:14 -0700 Subject: [PATCH 81/85] fix patches --- ...ervice_allow_remote_certificate_verification_logic.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch index 28f5d31e9ea2..172d3f0cc427 100644 --- a/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch +++ b/patches/chromium/network_service_allow_remote_certificate_verification_logic.patch @@ -122,10 +122,10 @@ index 8e53d65ddca7b54a6effd1767257a4d8239251d8..8a00bf59c728217069000b1f1ece72e1 #endif // BUILDFLAG(IS_CHROMEOS_ASH) + auto remote_cert_verifier = std::make_unique(std::move(cert_verifier)); + remote_cert_verifier_ = remote_cert_verifier.get(); -+ cert_verifier = std::move(remote_cert_verifier); ++ cert_verifier = std::make_unique(std::move(remote_cert_verifier)); + } - // Whether the cert verifier is remote or in-process, we should wrap it in - // caching and coalescing layers to avoid extra verifications and IPCs. + builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( diff --git a/services/network/network_context.h b/services/network/network_context.h index 72885bc1d20a4da5ad4df3fb8185f05bcf6fbfba..06b1a0d550de946aa41efca2be4efde694cc24c7 100644 --- a/services/network/network_context.h From 0f3620099a3de57956370e3c463d02bd0b2dc824 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 30 Mar 2021 17:08:13 -0700 Subject: [PATCH 82/85] chore: omit some unnecessary conversions --- shell/browser/api/electron_api_base_window.cc | 12 +++++------- shell/browser/browser.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index 19f624d75afb..4a3bc35c43f5 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -1089,11 +1089,11 @@ bool BaseWindow::SetThumbnailToolTip(const std::string& tooltip) { } void BaseWindow::SetAppDetails(const gin_helper::Dictionary& options) { - std::u16string app_id; + std::wstring app_id; base::FilePath app_icon_path; int app_icon_index = 0; - std::u16string relaunch_command; - std::u16string relaunch_display_name; + std::wstring relaunch_command; + std::wstring relaunch_display_name; options.Get("appId", &app_id); options.Get("appIconPath", &app_icon_path); @@ -1101,10 +1101,8 @@ void BaseWindow::SetAppDetails(const gin_helper::Dictionary& options) { options.Get("relaunchCommand", &relaunch_command); options.Get("relaunchDisplayName", &relaunch_display_name); - ui::win::SetAppDetailsForWindow(base::UTF16ToWide(app_id), app_icon_path, - app_icon_index, - base::UTF16ToWide(relaunch_command), - base::UTF16ToWide(relaunch_display_name), + ui::win::SetAppDetailsForWindow(app_id, app_icon_path, app_icon_index, + relaunch_command, relaunch_display_name, window_->GetAcceleratedWidget()); } #endif diff --git a/shell/browser/browser.h b/shell/browser/browser.h index 136900881a35..cd96d4ea1b26 100755 --- a/shell/browser/browser.h +++ b/shell/browser/browser.h @@ -137,7 +137,7 @@ class Browser : public WindowListObserver { #if defined(OS_WIN) // used in browser::setLoginItemSettings bool enabled = true; - std::wstring name = std::wstring(); + std::wstring name; // used in browser::getLoginItemSettings bool executable_will_launch_at_login = false; From 9127cff58b6740bcf5dffff420ffeb14b24a245f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 30 Mar 2021 17:14:27 -0700 Subject: [PATCH 83/85] refactor: make LoginItemSettings::path a wstring --- shell/browser/browser.h | 2 +- shell/browser/browser_win.cc | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/shell/browser/browser.h b/shell/browser/browser.h index cd96d4ea1b26..661da80b5f11 100755 --- a/shell/browser/browser.h +++ b/shell/browser/browser.h @@ -131,7 +131,7 @@ class Browser : public WindowListObserver { bool restore_state = false; bool opened_at_login = false; bool opened_as_hidden = false; - std::u16string path; + std::wstring path; std::vector args; #if defined(OS_WIN) diff --git a/shell/browser/browser_win.cc b/shell/browser/browser_win.cc index 0db6ab988d9c..1376a32ea962 100755 --- a/shell/browser/browser_win.cc +++ b/shell/browser/browser_win.cc @@ -196,9 +196,7 @@ std::vector GetLoginItemSettingsHelper( lookup_exe_path = base::CommandLine::FromString(process_exe_path).GetProgram(); } else { - lookup_exe_path = - base::CommandLine::FromString(base::UTF16ToWide(options.path)) - .GetProgram(); + lookup_exe_path = base::CommandLine::FromString(options.path).GetProgram(); } if (!lookup_exe_path.empty()) { @@ -701,7 +699,7 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) { !settings.name.empty() ? settings.name.c_str() : GetAppUserModelID(); if (settings.open_at_login) { - std::wstring exe = base::UTF16ToWide(settings.path); + std::wstring exe = settings.path; if (FormatCommandLineString(&exe, settings.args)) { key.WriteValue(key_name, exe.c_str()); @@ -740,7 +738,7 @@ Browser::LoginItemSettings Browser::GetLoginItemSettings( // keep old openAtLogin behaviour if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) { - std::wstring exe = base::UTF16ToWide(options.path); + std::wstring exe = options.path; if (FormatCommandLineString(&exe, options.args)) { settings.open_at_login = keyVal == exe; } From 1594c549332d4245911ee0d33da3e5196f18d821 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 30 Mar 2021 18:06:00 -0700 Subject: [PATCH 84/85] refactor: make ShowTaskDialog take a wstr --- shell/browser/ui/message_box_win.cc | 81 +++++++++++++++-------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/shell/browser/ui/message_box_win.cc b/shell/browser/ui/message_box_win.cc index 0fffbd8bc0ce..1d64e2b62971 100644 --- a/shell/browser/ui/message_box_win.cc +++ b/shell/browser/ui/message_box_win.cc @@ -58,36 +58,36 @@ CommonButtonID GetCommonID(const std::wstring& button) { // Determine whether the buttons are common buttons, if so map common ID // to button ID. -void MapToCommonID(const std::vector& buttons, +void MapToCommonID(const std::vector& buttons, std::map* id_map, TASKDIALOG_COMMON_BUTTON_FLAGS* button_flags, std::vector* dialog_buttons) { for (size_t i = 0; i < buttons.size(); ++i) { - auto common = GetCommonID(base::UTF16ToWide(buttons[i])); + auto common = GetCommonID(buttons[i]); if (common.button != -1) { // It is a common button. (*id_map)[common.id] = i; (*button_flags) |= common.button; } else { // It is a custom button. - dialog_buttons->push_back({static_cast(i + kIDStart), - base::UTF16ToWide(buttons[i]).c_str()}); + dialog_buttons->push_back( + {static_cast(i + kIDStart), buttons[i].c_str()}); } } } -DialogResult ShowTaskDialogUTF16(NativeWindow* parent, - MessageBoxType type, - const std::vector& buttons, - int default_id, - int cancel_id, - bool no_link, - const std::u16string& title, - const std::u16string& message, - const std::u16string& detail, - const std::u16string& checkbox_label, - bool checkbox_checked, - const gfx::ImageSkia& icon) { +DialogResult ShowTaskDialogWstr(NativeWindow* parent, + MessageBoxType type, + const std::vector& buttons, + int default_id, + int cancel_id, + bool no_link, + const std::wstring& title, + const std::wstring& message, + const std::wstring& detail, + const std::wstring& checkbox_label, + bool checkbox_checked, + const gfx::ImageSkia& icon) { TASKDIALOG_FLAGS flags = TDF_SIZE_TO_CONTENT | // Show all content. TDF_ALLOW_DIALOG_CANCELLATION; // Allow canceling the dialog. @@ -107,11 +107,12 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, // TaskDialogIndirect doesn't allow empty name, if we set empty title it // will show "electron.exe" in title. - std::wstring app_name = base::UTF8ToWide(Browser::Get()->GetName()); - if (title.empty()) + if (title.empty()) { + std::wstring app_name = base::UTF8ToWide(Browser::Get()->GetName()); config.pszWindowTitle = app_name.c_str(); - else - config.pszWindowTitle = base::UTF16ToWide(title).c_str(); + } else { + config.pszWindowTitle = title.c_str(); + } base::win::ScopedHICON hicon; if (!icon.isNull()) { @@ -138,14 +139,14 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, // If "detail" is empty then don't make message highlighted. if (detail.empty()) { - config.pszContent = base::UTF16ToWide(message).c_str(); + config.pszContent = message.c_str(); } else { - config.pszMainInstruction = base::UTF16ToWide(message).c_str(); - config.pszContent = base::UTF16ToWide(detail).c_str(); + config.pszMainInstruction = message.c_str(); + config.pszContent = detail.c_str(); } if (!checkbox_label.empty()) { - config.pszVerificationText = base::UTF16ToWide(checkbox_label).c_str(); + config.pszVerificationText = checkbox_label.c_str(); if (checkbox_checked) config.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED; } @@ -156,8 +157,8 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, std::vector dialog_buttons; if (no_link) { for (size_t i = 0; i < buttons.size(); ++i) - dialog_buttons.push_back({static_cast(i + kIDStart), - base::UTF16ToWide(buttons[i]).c_str()}); + dialog_buttons.push_back( + {static_cast(i + kIDStart), buttons[i].c_str()}); } else { MapToCommonID(buttons, &id_map, &config.dwCommonButtons, &dialog_buttons); } @@ -185,20 +186,19 @@ DialogResult ShowTaskDialogUTF16(NativeWindow* parent, } DialogResult ShowTaskDialogUTF8(const MessageBoxSettings& settings) { - std::vector utf16_buttons; + std::vector buttons; for (const auto& button : settings.buttons) - utf16_buttons.push_back(base::UTF8ToUTF16(button)); + buttons.push_back(base::UTF8ToWide(button)); - const std::u16string title_16 = base::UTF8ToUTF16(settings.title); - const std::u16string message_16 = base::UTF8ToUTF16(settings.message); - const std::u16string detail_16 = base::UTF8ToUTF16(settings.detail); - const std::u16string checkbox_label_16 = - base::UTF8ToUTF16(settings.checkbox_label); + const std::wstring title = base::UTF8ToWide(settings.title); + const std::wstring message = base::UTF8ToWide(settings.message); + const std::wstring detail = base::UTF8ToWide(settings.detail); + const std::wstring checkbox_label = base::UTF8ToWide(settings.checkbox_label); - return ShowTaskDialogUTF16( - settings.parent_window, settings.type, utf16_buttons, settings.default_id, - settings.cancel_id, settings.no_link, title_16, message_16, detail_16, - checkbox_label_16, settings.checkbox_checked, settings.icon); + return ShowTaskDialogWstr( + settings.parent_window, settings.type, buttons, settings.default_id, + settings.cancel_id, settings.no_link, title, message, detail, + checkbox_label, settings.checkbox_checked, settings.icon); } } // namespace @@ -221,9 +221,10 @@ void ShowMessageBox(const MessageBoxSettings& settings, void ShowErrorBox(const std::u16string& title, const std::u16string& content) { electron::UnresponsiveSuppressor suppressor; - ShowTaskDialogUTF16(nullptr, MessageBoxType::kError, {}, -1, 0, false, - base::UTF8ToUTF16("Error"), title, content, - base::UTF8ToUTF16(""), false, gfx::ImageSkia()); + ShowTaskDialogWstr(nullptr, MessageBoxType::kError, {}, -1, 0, false, + base::UTF8ToWide("Error"), base::UTF16ToWide(title), + base::UTF16ToWide(content), base::UTF8ToWide(""), false, + gfx::ImageSkia()); } } // namespace electron From 9684d851015850dd7eaa3b81c8b62e9dd9372f5a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 30 Mar 2021 20:32:11 -0500 Subject: [PATCH 85/85] Revert "refactor: make LoginItemSettings::path a wstring" This reverts commit 9127cff58b6740bcf5dffff420ffeb14b24a245f. --- shell/browser/browser.h | 2 +- shell/browser/browser_win.cc | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/shell/browser/browser.h b/shell/browser/browser.h index 661da80b5f11..cd96d4ea1b26 100755 --- a/shell/browser/browser.h +++ b/shell/browser/browser.h @@ -131,7 +131,7 @@ class Browser : public WindowListObserver { bool restore_state = false; bool opened_at_login = false; bool opened_as_hidden = false; - std::wstring path; + std::u16string path; std::vector args; #if defined(OS_WIN) diff --git a/shell/browser/browser_win.cc b/shell/browser/browser_win.cc index 1376a32ea962..0db6ab988d9c 100755 --- a/shell/browser/browser_win.cc +++ b/shell/browser/browser_win.cc @@ -196,7 +196,9 @@ std::vector GetLoginItemSettingsHelper( lookup_exe_path = base::CommandLine::FromString(process_exe_path).GetProgram(); } else { - lookup_exe_path = base::CommandLine::FromString(options.path).GetProgram(); + lookup_exe_path = + base::CommandLine::FromString(base::UTF16ToWide(options.path)) + .GetProgram(); } if (!lookup_exe_path.empty()) { @@ -699,7 +701,7 @@ void Browser::SetLoginItemSettings(LoginItemSettings settings) { !settings.name.empty() ? settings.name.c_str() : GetAppUserModelID(); if (settings.open_at_login) { - std::wstring exe = settings.path; + std::wstring exe = base::UTF16ToWide(settings.path); if (FormatCommandLineString(&exe, settings.args)) { key.WriteValue(key_name, exe.c_str()); @@ -738,7 +740,7 @@ Browser::LoginItemSettings Browser::GetLoginItemSettings( // keep old openAtLogin behaviour if (!FAILED(key.ReadValue(GetAppUserModelID(), &keyVal))) { - std::wstring exe = options.path; + std::wstring exe = base::UTF16ToWide(options.path); if (FormatCommandLineString(&exe, options.args)) { settings.open_at_login = keyVal == exe; }