cef/patch/patches/content_2015.patch

181 lines
9.0 KiB
Diff

diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc
index 286e99d804cd0..2f431dcab0283 100644
--- content/browser/devtools/devtools_http_handler.cc
+++ content/browser/devtools/devtools_http_handler.cc
@@ -587,7 +587,7 @@ void DevToolsHttpHandler::OnJsonRequest(
version.SetString("Protocol-Version",
DevToolsAgentHost::GetProtocolVersion());
version.SetString("WebKit-Version", GetWebKitVersion());
- version.SetString("Browser", GetContentClient()->browser()->GetProduct());
+ version.SetString("Browser", GetContentClient()->browser()->GetChromeProduct());
version.SetString("User-Agent",
GetContentClient()->browser()->GetUserAgent());
version.SetString("V8-Version", V8_VERSION_STRING);
diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc
index 95ab3cd395b8a..1a82cf112454e 100644
--- content/browser/loader/navigation_url_loader_impl.cc
+++ content/browser/loader/navigation_url_loader_impl.cc
@@ -715,6 +715,17 @@ NavigationURLLoaderImpl::PrepareForNonInterceptedRequest(
resource_request_->has_user_gesture, initiating_origin,
initiator_document_.AsRenderFrameHostIfValid(), &loader_factory);
+ if (!handled) {
+ handled = GetContentClient()->browser()->HandleExternalProtocol(
+ web_contents_getter_, frame_tree_node_id_,
+ navigation_ui_data_.get(), request_info_->is_primary_main_frame,
+ FrameTreeNode::GloballyFindByID(frame_tree_node_id_)
+ ->IsInFencedFrameTree(),
+ request_info_->sandbox_flags,
+ *resource_request_, initiating_origin,
+ initiator_document_.AsRenderFrameHostIfValid(), &loader_factory);
+ }
+
if (loader_factory) {
factory = base::MakeRefCounted<network::WrapperSharedURLLoaderFactory>(
std::move(loader_factory));
diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc
index f31156ba6ea6d..bc890c2a0319c 100644
--- content/public/browser/content_browser_client.cc
+++ content/public/browser/content_browser_client.cc
@@ -955,7 +955,7 @@ ContentBrowserClient::CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
void ContentBrowserClient::OnNetworkServiceCreated(
network::mojom::NetworkService* network_service) {}
-void ContentBrowserClient::ConfigureNetworkContextParams(
+bool ContentBrowserClient::ConfigureNetworkContextParams(
BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -964,6 +964,7 @@ void ContentBrowserClient::ConfigureNetworkContextParams(
cert_verifier_creation_params) {
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
network_context_params->accept_language = "en-us,en";
+ return true;
}
std::vector<base::FilePath>
diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h
index 9b6c2b8b249af..75ac41f88708b 100644
--- content/public/browser/content_browser_client.h
+++ content/public/browser/content_browser_client.h
@@ -34,6 +34,7 @@
#include "content/public/browser/login_delegate.h"
#include "content/public/browser/mojo_binder_policy_map.h"
#include "content/public/browser/storage_partition_config.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/common/alternative_error_page_override_info.mojom-forward.h"
#include "content/public/common/page_visibility_state.h"
#include "content/public/common/window_container_type.mojom-forward.h"
@@ -1753,7 +1754,7 @@ class CONTENT_EXPORT ContentBrowserClient {
//
// If |relative_partition_path| is the empty string, it means this needs to
// create the default NetworkContext for the BrowserContext.
- virtual void ConfigureNetworkContextParams(
+ virtual bool ConfigureNetworkContextParams(
BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -1959,6 +1960,19 @@ class CONTENT_EXPORT ContentBrowserClient {
RenderFrameHost* initiator_document,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory);
+ // Same as above, but exposing the whole ResourceRequest object.
+ virtual bool HandleExternalProtocol(
+ WebContents::Getter web_contents_getter,
+ int frame_tree_node_id,
+ NavigationUIData* navigation_data,
+ bool is_primary_main_frame,
+ bool is_in_fenced_frame_tree,
+ network::mojom::WebSandboxFlags sandbox_flags,
+ const network::ResourceRequest& request,
+ const absl::optional<url::Origin>& initiating_origin,
+ RenderFrameHost* initiator_document,
+ mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) { return false; }
+
// Creates an OverlayWindow to be used for video or document
// Picture-in-Picture respectively. This window will house the content shown
// when in Picture-in-Picture mode. This will return a new OverlayWindow.
@@ -2014,6 +2028,10 @@ class CONTENT_EXPORT ContentBrowserClient {
// Used as part of the user agent string.
virtual std::string GetProduct();
+ // Returns the Chrome-specific product string. This is used for compatibility
+ // purposes with external tools like Selenium.
+ virtual std::string GetChromeProduct() { return GetProduct(); }
+
// Returns the user agent. This can also return the reduced user agent, based
// on blink::features::kUserAgentReduction. Content may cache this value.
virtual std::string GetUserAgent();
diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h
index 69e9da01fd708..32ed3641566c2 100644
--- content/public/renderer/content_renderer_client.h
+++ content/public/renderer/content_renderer_client.h
@@ -92,6 +92,9 @@ class CONTENT_EXPORT ContentRendererClient {
// binding requests from RenderProcessHost::BindReceiver().
virtual void ExposeInterfacesToBrowser(mojo::BinderMap* binders) {}
+ // Notifies that the RenderThread can now send sync IPC messages.
+ virtual void RenderThreadConnected() {}
+
// Notifies that a new RenderFrame has been created.
virtual void RenderFrameCreated(RenderFrame* render_frame) {}
@@ -311,6 +314,10 @@ class CONTENT_EXPORT ContentRendererClient {
// This method may invalidate the frame.
virtual void RunScriptsAtDocumentIdle(RenderFrame* render_frame) {}
+ // Notifies that a DevTools agent has attached or detached.
+ virtual void DevToolsAgentAttached() {}
+ virtual void DevToolsAgentDetached() {}
+
// Allows subclasses to enable some runtime features before Blink has
// started.
virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {}
diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc
index 17b628006b06f..cea55de60c5d3 100644
--- content/renderer/render_thread_impl.cc
+++ content/renderer/render_thread_impl.cc
@@ -597,6 +597,8 @@ void RenderThreadImpl::Init() {
GetContentClient()->renderer()->CreateURLLoaderThrottleProvider(
blink::URLLoaderThrottleProviderType::kFrame);
+ GetContentClient()->renderer()->RenderThreadConnected();
+
GetAssociatedInterfaceRegistry()->AddInterface<mojom::Renderer>(
base::BindRepeating(&RenderThreadImpl::OnRendererInterfaceReceiver,
base::Unretained(this)));
diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc
index 4cedfbfaa2f7b..6d9c87b5c2247 100644
--- content/renderer/renderer_blink_platform_impl.cc
+++ content/renderer/renderer_blink_platform_impl.cc
@@ -1021,6 +1021,15 @@ SkBitmap* RendererBlinkPlatformImpl::GetSadPageBitmap() {
//------------------------------------------------------------------------------
+void RendererBlinkPlatformImpl::DevToolsAgentAttached() {
+ GetContentClient()->renderer()->DevToolsAgentAttached();
+}
+void RendererBlinkPlatformImpl::DevToolsAgentDetached() {
+ GetContentClient()->renderer()->DevToolsAgentDetached();
+}
+
+//------------------------------------------------------------------------------
+
std::unique_ptr<blink::WebV8ValueConverter>
RendererBlinkPlatformImpl::CreateWebV8ValueConverter() {
return std::make_unique<V8ValueConverterImpl>();
diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h
index 78ffa14e79f12..ca007abcacf51 100644
--- content/renderer/renderer_blink_platform_impl.h
+++ content/renderer/renderer_blink_platform_impl.h
@@ -227,6 +227,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
blink::WebVector<blink::WebContentSecurityPolicyHeader>* csp) override;
base::PlatformThreadId GetIOThreadId() const override;
+ void DevToolsAgentAttached() override;
+ void DevToolsAgentDetached() override;
+
// Tells this platform that the renderer is locked to a site (i.e., a scheme
// plus eTLD+1, such as https://google.com), or to a more specific origin.
void SetIsLockedToSite();