ca75bca667
* chore: bump chromium in DEPS to 520c02b46668fc608927e0fcd79b6a90885a48bf * chore: bump chromium in DEPS to 90.0.4414.0 * resolve chromium conflicts * resolve v8 conflicts * fix node gn files * 2673502: Remove RenderViewCreated use from ExtensionHost. https://chromium-review.googlesource.com/c/chromium/src/+/2673502 * 2676903: [mojo] Remove most legacy Binding classes. https://chromium-review.googlesource.com/c/chromium/src/+/2676903 * 2644847: Move self-deleting URLLoaderFactory base into //services/network. https://chromium-review.googlesource.com/c/chromium/src/+/2644847 * 2664006: Remove from mojo::DataPipe. https://chromium-review.googlesource.com/c/chromium/src/+/2664006 * 2674530: Remove CertVerifierService feature https://chromium-review.googlesource.com/c/chromium/src/+/2674530 * 2668748: Move OnSSLCertificateError to a new interface. https://chromium-review.googlesource.com/c/chromium/src/+/2668748 * 2672923: Remove RAPPOR reporting infrastructure. https://chromium-review.googlesource.com/c/chromium/src/+/2672923 * 2673502: Remove RenderViewCreated use from ExtensionHost. https://chromium-review.googlesource.com/c/chromium/src/+/2673502 * 2655126: Convert FrameHostMsg_ContextMenu and FrameMsg_ContextMenuClosed|CustomContextMenuAction to Mojo https://chromium-review.googlesource.com/c/chromium/src/+/2655126 * 2628705: Window Placement: Implement screen.isExtended and change event https://chromium-review.googlesource.com/c/chromium/src/+/2628705 * 2643161: Refactor storage::kFileSystem*Native* https://chromium-review.googlesource.com/c/chromium/src/+/2643161 * fix build * only remove the biggest subdir of //ios * chore: bump chromium in DEPS to 90.0.4415.0 * update patches * update sysroots * 2686147: Remove WebContentsObserver::RenderViewCreated(). https://chromium-review.googlesource.com/c/chromium/src/+/2686147 * 2596429: Fixing how extension's split and spanning modes affect OriginAccessList. https://chromium-review.googlesource.com/c/chromium/src/+/2596429 * 2686026: [mojo] Delete AssociatedInterfacePtr (replaced by AssociatedRemote) https://chromium-review.googlesource.com/c/chromium/src/+/2686026 * 2651705: Move ui/base/dragdrop/file_info to ui/base/clipboard https://chromium-review.googlesource.com/c/chromium/src/+/2651705 * 358217: drawBitmap is deprecated https://skia-review.googlesource.com/c/skia/+/358217 * fix gn check * 2678098: Use gen/front_end as input to generate_devtools_grd https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2678098 * 2674530: Remove CertVerifierService feature https://chromium-review.googlesource.com/c/chromium/src/+/2674530 * fixup 2664006: Remove from mojo::DataPipe. https://chromium-review.googlesource.com/c/chromium/src/+/2664006 * fixup build_add_electron_tracing_category.patch * 2673415: [base] Prepare CrashReporterClient for string16 switch https://chromium-review.googlesource.com/c/chromium/src/+/2673415 * 2673413: Add CursorFactoryWin to handle Cursors on Windows https://chromium-review.googlesource.com/c/chromium/src/+/2673413 * 2668748: Move OnSSLCertificateError to a new interface. https://chromium-review.googlesource.com/c/chromium/src/+/2668748 * fix mas gn check * update patch after merge * Update node for .mjs files * build: load v8_prof_processor dependencies as ESM * chore: add patch to fix linux 32bit Co-authored-by: Jeremy Rose <nornagon@nornagon.net> Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
121 lines
5.9 KiB
Diff
121 lines
5.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shelley Vohr <shelley.vohr@gmail.com>
|
|
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 092cb7aa6b5d1e2b516569eae8b9dabed6661dfc..963196951c0dce346220c11287ceeab32fec2e32 100644
|
|
--- a/chrome/renderer/chrome_content_renderer_client.cc
|
|
+++ b/chrome/renderer/chrome_content_renderer_client.cc
|
|
@@ -1266,6 +1266,25 @@ ChromeContentRendererClient::GetProtocolHandlerSecurityLevel() {
|
|
#endif
|
|
}
|
|
|
|
+bool ChromeContentRendererClient::ShouldFork(WebLocalFrame* frame,
|
|
+ const GURL& url,
|
|
+ const std::string& http_method,
|
|
+ bool is_initial_navigation,
|
|
+ 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 30718f6b057fcca8eef7516cb48720c4137c3cb4..7a1f4ad8e73cf141ac7c60a9aced2b81cbc61812 100644
|
|
--- a/chrome/renderer/chrome_content_renderer_client.h
|
|
+++ b/chrome/renderer/chrome_content_renderer_client.h
|
|
@@ -122,6 +122,11 @@ 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_initial_navigation,
|
|
+ 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 18e13633bc5f2be2830f6c10f4a46783c57720d4..e9123e07996f511e66ce23e28bcfc2f8ecedd6c5 100644
|
|
--- a/content/public/renderer/content_renderer_client.cc
|
|
+++ b/content/public/renderer/content_renderer_client.cc
|
|
@@ -117,6 +117,14 @@ bool ContentRendererClient::HandleNavigation(
|
|
}
|
|
#endif
|
|
|
|
+bool ContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
|
+ const GURL& url,
|
|
+ const std::string& http_method,
|
|
+ bool is_initial_navigation,
|
|
+ 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 357df68c64071ef7dca98ce4aab885dd936b1c49..f501a2ab0bd6d4664dad13913671c4d7d5a96c1e 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 {
|
|
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_initial_navigation,
|
|
+ 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 49b0d9012c43661a4fb4b9b8b8a68c156c7a76b6..db038990188455fc645c3c769a71e01af1ad3f0b 100644
|
|
--- a/content/renderer/render_frame_impl.cc
|
|
+++ b/content/renderer/render_frame_impl.cc
|
|
@@ -5313,6 +5313,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);
|
|
+
|
|
+ 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.
|
|
+ bool is_initial_navigation = render_view_->history_list_length_ == 0;
|
|
+ should_fork = GetContentClient()->renderer()->ShouldFork(
|
|
+ frame_, url, info->url_request.HttpMethod().Utf8(),
|
|
+ is_initial_navigation, false /* is_redirect */);
|
|
+ }
|
|
+
|
|
if (should_fork) {
|
|
OpenURL(std::move(info));
|
|
return; // Suppress the load here.
|