256 lines
12 KiB
Diff
256 lines
12 KiB
Diff
diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc
|
|
index 11c9cd82d0392..9c700bc625cd5 100644
|
|
--- content/browser/devtools/devtools_http_handler.cc
|
|
+++ content/browser/devtools/devtools_http_handler.cc
|
|
@@ -598,7 +598,7 @@ void DevToolsHttpHandler::OnJsonRequest(
|
|
base::Value::Dict version;
|
|
version.Set("Protocol-Version", DevToolsAgentHost::GetProtocolVersion());
|
|
version.Set("WebKit-Version", GetWebKitVersion());
|
|
- version.Set("Browser", GetContentClient()->browser()->GetProduct());
|
|
+ version.Set("Browser", GetContentClient()->browser()->GetChromeProduct());
|
|
version.Set("User-Agent", GetContentClient()->browser()->GetUserAgent());
|
|
version.Set("V8-Version", V8_VERSION_STRING);
|
|
std::string host = info.GetHeaderValue("host");
|
|
diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc
|
|
index aea31f655d929..5a6633fd581e2 100644
|
|
--- content/browser/loader/navigation_url_loader_impl.cc
|
|
+++ content/browser/loader/navigation_url_loader_impl.cc
|
|
@@ -860,7 +860,7 @@ NavigationURLLoaderImpl::CreateNonNetworkLoaderFactory(
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
|
terminal_external_protocol;
|
|
bool handled = GetContentClient()->browser()->HandleExternalProtocol(
|
|
- resource_request.url, std::move(web_contents_getter),
|
|
+ resource_request.url, web_contents_getter,
|
|
frame_tree_node->frame_tree_node_id(), navigation_ui_data,
|
|
request_info.is_primary_main_frame,
|
|
frame_tree_node->IsInFencedFrameTree(), request_info.sandbox_flags,
|
|
@@ -872,6 +872,21 @@ NavigationURLLoaderImpl::CreateNonNetworkLoaderFactory(
|
|
*request_info.initiator_document_token)
|
|
: nullptr,
|
|
&terminal_external_protocol);
|
|
+
|
|
+ if (!handled) {
|
|
+ handled = GetContentClient()->browser()->HandleExternalProtocol(
|
|
+ web_contents_getter, frame_tree_node->frame_tree_node_id(),
|
|
+ navigation_ui_data, request_info.is_primary_main_frame,
|
|
+ frame_tree_node->IsInFencedFrameTree(), request_info.sandbox_flags,
|
|
+ resource_request, initiating_origin,
|
|
+ request_info.initiator_document_token
|
|
+ ? RenderFrameHostImpl::FromDocumentToken(
|
|
+ request_info.initiator_process_id,
|
|
+ *request_info.initiator_document_token)
|
|
+ : nullptr,
|
|
+ &terminal_external_protocol);
|
|
+ }
|
|
+
|
|
if (terminal_external_protocol) {
|
|
return std::make_pair(
|
|
/*is_cacheable=*/false,
|
|
diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc
|
|
index 49ae7aa8bb754..b82b455749128 100644
|
|
--- content/public/browser/content_browser_client.cc
|
|
+++ content/public/browser/content_browser_client.cc
|
|
@@ -1127,7 +1127,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,
|
|
@@ -1136,6 +1136,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 d99cccb1f99a8..fb11c0ee286bc 100644
|
|
--- content/public/browser/content_browser_client.h
|
|
+++ content/public/browser/content_browser_client.h
|
|
@@ -2164,7 +2164,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,
|
|
@@ -2383,6 +2383,21 @@ 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(
|
|
+ base::RepeatingCallback<WebContents*()> web_contents_getter,
|
|
+ FrameTreeNodeId 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 std::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 Picture-in-Picture.
|
|
// This window will house the content shown when in Picture-in-Picture mode.
|
|
// This will return a new OverlayWindow.
|
|
@@ -2443,6 +2458,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 784e0a5166d6b..1fd1e9ee107f3 100644
|
|
--- content/public/renderer/content_renderer_client.h
|
|
+++ content/public/renderer/content_renderer_client.h
|
|
@@ -109,6 +109,9 @@ class CONTENT_EXPORT ContentRendererClient {
|
|
// a crash handler (such as crashpad) is already in use.
|
|
virtual void SetUpWebAssemblyTrapHandler();
|
|
|
|
+ // 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) {}
|
|
|
|
@@ -355,6 +358,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 8fbed3f73560e..909a4d3e1eae5 100644
|
|
--- content/renderer/render_thread_impl.cc
|
|
+++ content/renderer/render_thread_impl.cc
|
|
@@ -573,6 +573,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 da2515e0067a9..e792751f278b4 100644
|
|
--- content/renderer/renderer_blink_platform_impl.cc
|
|
+++ content/renderer/renderer_blink_platform_impl.cc
|
|
@@ -1037,6 +1037,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 69c52cb8333fc..ac2bbc7459864 100644
|
|
--- content/renderer/renderer_blink_platform_impl.h
|
|
+++ content/renderer/renderer_blink_platform_impl.h
|
|
@@ -245,6 +245,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
|
InertAndMinimumIntervalOfUserLevelMemoryPressureSignal() override;
|
|
#endif // BUILDFLAG(IS_ANDROID)
|
|
|
|
+ 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();
|
|
diff --git content/shell/browser/shell_content_browser_client.cc content/shell/browser/shell_content_browser_client.cc
|
|
index 1d4bd5b055c1d..83f19e3ab19d1 100644
|
|
--- content/shell/browser/shell_content_browser_client.cc
|
|
+++ content/shell/browser/shell_content_browser_client.cc
|
|
@@ -742,7 +742,7 @@ void ShellContentBrowserClient::OnNetworkServiceCreated(
|
|
#endif
|
|
}
|
|
|
|
-void ShellContentBrowserClient::ConfigureNetworkContextParams(
|
|
+bool ShellContentBrowserClient::ConfigureNetworkContextParams(
|
|
BrowserContext* context,
|
|
bool in_memory,
|
|
const base::FilePath& relative_partition_path,
|
|
@@ -751,6 +751,7 @@ void ShellContentBrowserClient::ConfigureNetworkContextParams(
|
|
cert_verifier_creation_params) {
|
|
ConfigureNetworkContextParamsForShell(context, network_context_params,
|
|
cert_verifier_creation_params);
|
|
+ return true;
|
|
}
|
|
|
|
std::vector<base::FilePath>
|
|
diff --git content/shell/browser/shell_content_browser_client.h content/shell/browser/shell_content_browser_client.h
|
|
index f41d94c62a1aa..5b1090046265e 100644
|
|
--- content/shell/browser/shell_content_browser_client.h
|
|
+++ content/shell/browser/shell_content_browser_client.h
|
|
@@ -149,7 +149,7 @@ class ShellContentBrowserClient : public ContentBrowserClient {
|
|
GetGeolocationSystemPermissionManager() override;
|
|
void OnNetworkServiceCreated(
|
|
network::mojom::NetworkService* network_service) override;
|
|
- void ConfigureNetworkContextParams(
|
|
+ bool ConfigureNetworkContextParams(
|
|
BrowserContext* context,
|
|
bool in_memory,
|
|
const base::FilePath& relative_partition_path,
|
|
diff --git headless/lib/browser/headless_content_browser_client.cc headless/lib/browser/headless_content_browser_client.cc
|
|
index c877347bdde3a..ceca828f491b1 100644
|
|
--- headless/lib/browser/headless_content_browser_client.cc
|
|
+++ headless/lib/browser/headless_content_browser_client.cc
|
|
@@ -358,7 +358,7 @@ bool HeadlessContentBrowserClient::IsSharedStorageSelectURLAllowed(
|
|
return true;
|
|
}
|
|
|
|
-void HeadlessContentBrowserClient::ConfigureNetworkContextParams(
|
|
+bool HeadlessContentBrowserClient::ConfigureNetworkContextParams(
|
|
content::BrowserContext* context,
|
|
bool in_memory,
|
|
const base::FilePath& relative_partition_path,
|
|
@@ -368,6 +368,7 @@ void HeadlessContentBrowserClient::ConfigureNetworkContextParams(
|
|
HeadlessBrowserContextImpl::From(context)->ConfigureNetworkContextParams(
|
|
in_memory, relative_partition_path, network_context_params,
|
|
cert_verifier_creation_params);
|
|
+ return true;
|
|
}
|
|
|
|
std::string HeadlessContentBrowserClient::GetProduct() {
|
|
diff --git headless/lib/browser/headless_content_browser_client.h headless/lib/browser/headless_content_browser_client.h
|
|
index f26634ec9ce1f..ba3bfcbe0c45e 100644
|
|
--- headless/lib/browser/headless_content_browser_client.h
|
|
+++ headless/lib/browser/headless_content_browser_client.h
|
|
@@ -102,7 +102,7 @@ class HeadlessContentBrowserClient : public content::ContentBrowserClient {
|
|
std::string* out_debug_message,
|
|
bool* out_block_is_site_setting_specific) override;
|
|
|
|
- void ConfigureNetworkContextParams(
|
|
+ bool ConfigureNetworkContextParams(
|
|
content::BrowserContext* context,
|
|
bool in_memory,
|
|
const base::FilePath& relative_partition_path,
|