diff --git a/patches/chromium/.patches b/patches/chromium/.patches index 1847e5e50731..20d3efd486dd 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -57,7 +57,6 @@ allow_new_privileges_in_unsandboxed_child_processes.patch expose_setuseragent_on_networkcontext.patch feat_add_set_theme_source_to_allow_apps_to.patch add_webmessageportconverter_entangleandinjectmessageportchannel.patch -revert_remove_contentrendererclient_shouldfork.patch ignore_rc_check.patch remove_usage_of_incognito_apis_in_the_spellchecker.patch chore_use_electron_resources_not_chrome_for_spellchecker.patch 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 d1b071a8a053..59fc03437815 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 260551dbdbbe8b2f2366365397ebc619d941e5ec..ec98fdd1a62c6fb9d934caa6aed4fba0cd3aed38 100644 +index 8818e803bc10c3032ecbf582df49dd37487f137d..86ed3fc858d83268dba9fb2bfd0492149433129a 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc @@ -2325,7 +2325,7 @@ const blink::WebView* RenderFrameImpl::GetWebView() const { diff --git a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch b/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch deleted file mode 100644 index 281c52c05d84..000000000000 --- a/patches/chromium/revert_remove_contentrendererclient_shouldfork.patch +++ /dev/null @@ -1,116 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Tue, 4 Feb 2020 08:59:32 -0700 -Subject: Revert "Remove ContentRendererClient::ShouldFork." - -This reverts the CL at https://chromium-review.googlesource.com/c/chromium/src/+/1812128. -We use it to force a new renderer process for navigations, and need to start a new renderer process -for every navigation to keep Node.js working properly. Once Native Modules in the renderer process -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 89f15b443f97a98c6472aef2f2c8062ab70b3a9f..b9a4ce636692813de2a3dd34f0e749bb94a4729f 100644 ---- a/chrome/renderer/chrome_content_renderer_client.cc -+++ b/chrome/renderer/chrome_content_renderer_client.cc -@@ -1329,6 +1329,24 @@ ChromeContentRendererClient::GetProtocolHandlerSecurityLevel() { - #endif - } - -+bool ChromeContentRendererClient::ShouldFork(WebLocalFrame* frame, -+ const GURL& url, -+ const std::string& http_method, -+ bool is_server_redirect) { -+ DCHECK(!frame->Parent()); -+ -+ // If |url| matches one of the prerendered URLs, stop this navigation and try -+ // to swap in the prerendered page on the browser process. If the prerendered -+ // page no longer exists by the time the OpenURL IPC is handled, a normal -+ // navigation is attempted. -+ if (prerender_dispatcher_.get() && -+ prerender_dispatcher_->IsPrerenderURL(url)) { -+ return true; -+ } -+ -+ return false; -+} -+ - void ChromeContentRendererClient::WillSendRequest( - 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 0b9f4e64d09774b1a249eac0b17a6519effd156c..eb25f5e7b54dddb07fefeaeca5448df2cd41753d 100644 ---- a/chrome/renderer/chrome_content_renderer_client.h -+++ b/chrome/renderer/chrome_content_renderer_client.h -@@ -122,6 +122,10 @@ class ChromeContentRendererClient - base::SingleThreadTaskRunner* compositor_thread_task_runner) override; - bool RunIdleHandlerWhenWidgetsHidden() override; - bool AllowPopup() override; -+ bool ShouldFork(blink::WebLocalFrame* frame, -+ const GURL& url, -+ const std::string& http_method, -+ bool is_server_redirect) override; - blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel() - 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 32dbc4de0813795043e8e33840ff04540329d5e7..5f5593eb266189e06e23109d72adbeb145c23199 100644 ---- a/content/public/renderer/content_renderer_client.cc -+++ b/content/public/renderer/content_renderer_client.cc -@@ -112,6 +112,13 @@ bool ContentRendererClient::HandleNavigation( - } - #endif - -+bool ContentRendererClient::ShouldFork(blink::WebLocalFrame* frame, -+ const GURL& url, -+ const std::string& http_method, -+ bool is_server_redirect) { -+ return false; -+} -+ - void ContentRendererClient::WillSendRequest( - 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 d8c7a1954d5acc0eb4bb675795038eae0e16bc05..bfc7b531b3d0958d8638330eb155e85c75ae6f8b 100644 ---- a/content/public/renderer/content_renderer_client.h -+++ b/content/public/renderer/content_renderer_client.h -@@ -202,6 +202,12 @@ class CONTENT_EXPORT ContentRendererClient { - bool is_redirect); - #endif - -+ // Returns true if we should fork a new process for the given navigation. -+ virtual bool ShouldFork(blink::WebLocalFrame* frame, -+ const GURL& url, -+ const std::string& http_method, -+ bool is_server_redirect); -+ - // Notifies the embedder that the given frame is requesting the resource at - // |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 8818e803bc10c3032ecbf582df49dd37487f137d..260551dbdbbe8b2f2366365397ebc619d941e5ec 100644 ---- a/content/renderer/render_frame_impl.cc -+++ b/content/renderer/render_frame_impl.cc -@@ -5040,6 +5040,22 @@ 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); -+ -+ if (!should_fork && url.SchemeIs(url::kFileScheme)) { -+ // Fork non-file to file opens (see https://crbug.com/1031119). Note that -+ // this may fork unnecessarily if another tab (hosting a file or not) -+ // targeted this one before its initial navigation, but that shouldn't -+ // cause a problem. -+ should_fork = !old_url.SchemeIs(url::kFileScheme); -+ } -+ -+ if (!should_fork) { -+ // Give the embedder a chance. -+ should_fork = GetContentClient()->renderer()->ShouldFork( -+ frame_, url, info->url_request.HttpMethod().Utf8(), -+ false /* is_redirect */); -+ } -+ - if (should_fork) { - OpenURL(std::move(info)); - return; // Suppress the load here. 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 13cbf818035a..7ffd551c8d9b 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 bfc7b531b3d0958d8638330eb155e85c75ae6f8b..bfa3948abb30f59148e149a6386ac090a440e1b4 100644 +index d8c7a1954d5acc0eb4bb675795038eae0e16bc05..0eee88a106abdc6f232b384265da03e85075fb00 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 { +@@ -366,6 +366,11 @@ class CONTENT_EXPORT ContentRendererClient { virtual void DidInitializeWorkerContextOnWorkerThread( v8::Local context) {} diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index ce91ed1c6fc6..78c95a895494 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -165,17 +165,6 @@ void ElectronRendererClient::WillReleaseScriptContext( electron_bindings_->EnvironmentDestroyed(env); } -bool ElectronRendererClient::ShouldFork(blink::WebLocalFrame* frame, - const GURL& url, - const std::string& http_method, - bool is_server_redirect) { - // Handle all the navigations and reloads in browser. - // FIXME We only support GET here because http method will be ignored when - // the OpenURLFromTab is triggered, which means form posting would not work, - // we should solve this by patching Chromium in future. - return http_method == net::HttpRequestHeaders::kGetMethod; -} - void ElectronRendererClient::WorkerScriptReadyForEvaluationOnWorkerThread( v8::Local context) { // TODO(loc): Note that this will not be correct for in-process child windows diff --git a/shell/renderer/electron_renderer_client.h b/shell/renderer/electron_renderer_client.h index dd1e0bd4826c..2ecee5ba4c0c 100644 --- a/shell/renderer/electron_renderer_client.h +++ b/shell/renderer/electron_renderer_client.h @@ -36,10 +36,6 @@ class ElectronRendererClient : public RendererClientBase { void RenderFrameCreated(content::RenderFrame*) override; void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override; void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override; - bool ShouldFork(blink::WebLocalFrame* frame, - const GURL& url, - const std::string& http_method, - bool is_server_redirect) override; void WorkerScriptReadyForEvaluationOnWorkerThread( v8::Local context) override; void WillDestroyWorkerContextOnWorkerThread( diff --git a/shell/renderer/electron_sandboxed_renderer_client.cc b/shell/renderer/electron_sandboxed_renderer_client.cc index 84cd6817cedc..e31221f3b3c7 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.cc +++ b/shell/renderer/electron_sandboxed_renderer_client.cc @@ -254,11 +254,4 @@ void ElectronSandboxedRendererClient::WillReleaseScriptContext( InvokeHiddenCallback(context, kLifecycleKey, "onExit"); } -bool ElectronSandboxedRendererClient::ShouldFork(blink::WebLocalFrame* frame, - const GURL& url, - const std::string& http_method, - bool is_server_redirect) { - return true; -} - } // namespace electron diff --git a/shell/renderer/electron_sandboxed_renderer_client.h b/shell/renderer/electron_sandboxed_renderer_client.h index efbe3cbaf823..fe739eb29e73 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.h +++ b/shell/renderer/electron_sandboxed_renderer_client.h @@ -30,10 +30,6 @@ class ElectronSandboxedRendererClient : public RendererClientBase { void RenderFrameCreated(content::RenderFrame*) override; void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override; void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override; - bool ShouldFork(blink::WebLocalFrame* frame, - const GURL& url, - const std::string& http_method, - bool is_server_redirect) override; private: std::unique_ptr metrics_;