summaryrefslogtreecommitdiffstats
path: root/chromium/content
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content')
-rw-r--r--chromium/content/browser/download/download_manager_impl.cc66
-rw-r--r--chromium/content/browser/frame_host/render_frame_host_impl.cc6
-rw-r--r--chromium/content/browser/loader/navigation_url_loader_impl.cc26
-rw-r--r--chromium/content/browser/media/hardware_key_media_controller.cc12
-rw-r--r--chromium/content/browser/media/hardware_key_media_controller.h13
-rw-r--r--chromium/content/browser/network_service_instance.cc25
-rw-r--r--chromium/content/browser/notifications/platform_notification_context_impl.cc2
-rw-r--r--chromium/content/browser/renderer_host/render_process_host_impl.cc4
-rw-r--r--chromium/content/browser/renderer_host/render_process_host_impl.h1
-rw-r--r--chromium/content/browser/service_worker/embedded_worker_instance.cc5
-rw-r--r--chromium/content/browser/tracing/tracing_controller_impl.cc5
-rw-r--r--chromium/content/browser/webrtc/webrtc_video_capture_browsertest.cc19
-rw-r--r--chromium/content/common/child.mojom6
-rw-r--r--chromium/content/common/service_manager/child_connection.cc13
-rw-r--r--chromium/content/common/service_manager/child_connection.h3
-rw-r--r--chromium/content/common/service_manager/service_manager_connection_impl.cc3
-rw-r--r--chromium/content/common/throttling_url_loader.cc8
-rw-r--r--chromium/content/public/browser/content_browser_client.cc1
-rw-r--r--chromium/content/public/browser/content_browser_client.h12
-rw-r--r--chromium/content/public/browser/render_process_host.h3
-rw-r--r--chromium/content/public/common/content_features.cc13
-rw-r--r--chromium/content/public/common/url_utils.cc3
-rw-r--r--chromium/content/renderer/media/stream/media_stream_constraints_util_audio.cc3
-rw-r--r--chromium/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc26
24 files changed, 197 insertions, 81 deletions
diff --git a/chromium/content/browser/download/download_manager_impl.cc b/chromium/content/browser/download/download_manager_impl.cc
index 2d45e9e41f4..a2cd3267d01 100644
--- a/chromium/content/browser/download/download_manager_impl.cc
+++ b/chromium/content/browser/download/download_manager_impl.cc
@@ -70,6 +70,8 @@
#include "content/public/common/origin_util.h"
#include "content/public/common/previews_state.h"
#include "content/public/common/referrer.h"
+#include "content/public/common/url_utils.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
#include "net/base/elements_upload_data_stream.h"
#include "net/base/load_flags.h"
#include "net/base/request_priority.h"
@@ -77,6 +79,7 @@
#include "net/url_request/url_request_context.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/network/public/cpp/features.h"
+#include "services/network/public/cpp/wrapper_shared_url_loader_factory.h"
#include "storage/browser/blob/blob_url_loader_factory.h"
#include "storage/browser/blob/blob_url_request_job_factory.h"
#include "url/origin.h"
@@ -276,16 +279,34 @@ CreateDownloadURLLoaderFactoryGetter(StoragePartitionImpl* storage_partition,
network::mojom::URLLoaderFactoryPtrInfo proxy_factory_ptr_info;
network::mojom::URLLoaderFactoryRequest proxy_factory_request;
if (rfh) {
- network::mojom::URLLoaderFactoryPtrInfo devtools_factory_ptr_info;
- network::mojom::URLLoaderFactoryRequest devtools_factory_request =
- MakeRequest(&devtools_factory_ptr_info);
- if (devtools_instrumentation::WillCreateURLLoaderFactory(
- static_cast<RenderFrameHostImpl*>(rfh), true, is_download,
- &devtools_factory_request)) {
- proxy_factory_ptr_info = std::move(devtools_factory_ptr_info);
- proxy_factory_request = std::move(devtools_factory_request);
+ bool should_proxy = false;
+
+ // Create an intermediate pipe that can be used to proxy the download's
+ // URLLoaderFactory.
+ network::mojom::URLLoaderFactoryPtrInfo maybe_proxy_factory_ptr_info;
+ network::mojom::URLLoaderFactoryRequest maybe_proxy_factory_request =
+ MakeRequest(&maybe_proxy_factory_ptr_info);
+
+ // Allow DevTools to potentially inject itself into the proxy pipe.
+ should_proxy = devtools_instrumentation::WillCreateURLLoaderFactory(
+ static_cast<RenderFrameHostImpl*>(rfh), true, is_download,
+ &maybe_proxy_factory_request);
+
+ // Also allow the Content embedder to inject itself if it wants to.
+ should_proxy |= GetContentClient()->browser()->WillCreateURLLoaderFactory(
+ rfh->GetSiteInstance()->GetBrowserContext(), rfh,
+ rfh->GetProcess()->GetID(), false /* is_navigation */,
+ true /* is_download/ */, url::Origin(), &maybe_proxy_factory_request,
+ nullptr /* header_client */, nullptr /* bypass_redirect_checks */);
+
+ // If anyone above indicated that they care about proxying, pass the
+ // intermediate pipe along to the NetworkDownloadURLLoaderFactoryGetter.
+ if (should_proxy) {
+ proxy_factory_ptr_info = std::move(maybe_proxy_factory_ptr_info);
+ proxy_factory_request = std::move(maybe_proxy_factory_request);
}
}
+
return base::MakeRefCounted<NetworkDownloadURLLoaderFactoryGetter>(
storage_partition->url_loader_factory_getter(),
std::move(proxy_factory_ptr_info), std::move(proxy_factory_request));
@@ -1266,6 +1287,35 @@ void DownloadManagerImpl::BeginResourceDownloadOnChecksComplete(
base::MakeRefCounted<FileSystemDownloadURLLoaderFactoryGetter>(
params->url(), rfh, /*is_navigation=*/false,
storage_partition->GetFileSystemContext(), storage_domain);
+ } else if (!IsURLHandledByNetworkService(params->url())) {
+ ContentBrowserClient::NonNetworkURLLoaderFactoryMap
+ non_network_url_loader_factories;
+ GetContentClient()
+ ->browser()
+ ->RegisterNonNetworkSubresourceURLLoaderFactories(
+ params->render_process_host_id(),
+ params->render_frame_host_routing_id(),
+ &non_network_url_loader_factories);
+ auto it = non_network_url_loader_factories.find(params->url().scheme());
+ if (it == non_network_url_loader_factories.end()) {
+ DLOG(ERROR) << "No URLLoaderFactory found to download " << params->url();
+ return;
+ } else {
+ std::unique_ptr<network::mojom::URLLoaderFactory> factory =
+ std::move(it->second);
+ network::mojom::URLLoaderFactoryPtr factory_ptr;
+ mojo::MakeStrongBinding(std::move(factory),
+ mojo::MakeRequest(&factory_ptr));
+ network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info =
+ factory_ptr.PassInterface();
+
+ auto wrapper_factory =
+ std::make_unique<network::WrapperSharedURLLoaderFactoryInfo>(
+ std::move(factory_ptr_info));
+ url_loader_factory_getter =
+ base::MakeRefCounted<download::DownloadURLLoaderFactoryGetterImpl>(
+ std::move(wrapper_factory));
+ }
} else {
StoragePartitionImpl* storage_partition =
static_cast<StoragePartitionImpl*>(
diff --git a/chromium/content/browser/frame_host/render_frame_host_impl.cc b/chromium/content/browser/frame_host/render_frame_host_impl.cc
index fcda9392b8a..9727a15ac2b 100644
--- a/chromium/content/browser/frame_host/render_frame_host_impl.cc
+++ b/chromium/content/browser/frame_host/render_frame_host_impl.cc
@@ -4803,7 +4803,7 @@ void RenderFrameHostImpl::CommitNavigation(
auto factory_request = mojo::MakeRequest(&factory_proxy_info);
GetContentClient()->browser()->WillCreateURLLoaderFactory(
browser_context, this, GetProcess()->GetID(),
- false /* is_navigation */,
+ false /* is_navigation */, false /* is_download */,
GetOriginForURLLoaderFactory(common_params.url, GetSiteInstance())
.value_or(url::Origin()),
&factory_request, nullptr /* header_client */,
@@ -5549,8 +5549,8 @@ bool RenderFrameHostImpl::CreateNetworkServiceDefaultFactoryInternal(
if (base::FeatureList::IsEnabled(network::features::kNetworkService)) {
GetContentClient()->browser()->WillCreateURLLoaderFactory(
context, this, GetProcess()->GetID(), false /* is_navigation */,
- origin.value_or(url::Origin()), &default_factory_request,
- &header_client, &bypass_redirect_checks);
+ false /* is_download */, origin.value_or(url::Origin()),
+ &default_factory_request, &header_client, &bypass_redirect_checks);
}
// Keep DevTools proxy last, i.e. closest to the network.
diff --git a/chromium/content/browser/loader/navigation_url_loader_impl.cc b/chromium/content/browser/loader/navigation_url_loader_impl.cc
index eb08165b270..47c7fb628bb 100644
--- a/chromium/content/browser/loader/navigation_url_loader_impl.cc
+++ b/chromium/content/browser/loader/navigation_url_loader_impl.cc
@@ -323,17 +323,6 @@ void UnknownSchemeCallback(
handled_externally ? net::ERR_ABORTED : net::ERR_UNKNOWN_URL_SCHEME));
}
-// Returns whether this URL can be handled by the default network service
-// URLLoader.
-bool IsURLHandledByDefaultLoader(const GURL& url) {
- // Data URLs are only handled by the network service if
- // |enable_data_url_support| is set in NetworkContextParams. This is set to
- // true for the context used by NavigationURLLoaderImpl, so in addition to
- // checking whether the URL is handled by the network service, we also need to
- // check for the data scheme.
- return IsURLHandledByNetworkService(url) || url.SchemeIs(url::kDataScheme);
-}
-
// Determines whether it is safe to redirect from |from_url| to |to_url|.
bool IsRedirectSafe(const GURL& from_url,
const GURL& to_url,
@@ -801,8 +790,8 @@ class NavigationURLLoaderImpl::URLLoaderRequestController
if (!default_loader_used_ ||
(base::FeatureList::IsEnabled(network::features::kNetworkService) &&
url_chain_.size() > 1 &&
- IsURLHandledByDefaultLoader(url_chain_[url_chain_.size() - 1]) !=
- IsURLHandledByDefaultLoader(url_chain_[url_chain_.size() - 2]))) {
+ IsURLHandledByNetworkService(url_chain_[url_chain_.size() - 1]) !=
+ IsURLHandledByNetworkService(url_chain_[url_chain_.size() - 2]))) {
url_loader_.reset();
}
interceptor_index_ = 0;
@@ -985,7 +974,7 @@ class NavigationURLLoaderImpl::URLLoaderRequestController
// further refactor the factory getters to avoid this.
scoped_refptr<network::SharedURLLoaderFactory> factory;
- if (!IsURLHandledByDefaultLoader(resource_request_->url)) {
+ if (!IsURLHandledByNetworkService(resource_request_->url)) {
if (known_schemes_.find(resource_request_->url.scheme()) ==
known_schemes_.end()) {
bool handled = GetContentClient()->browser()->HandleExternalProtocol(
@@ -1675,8 +1664,9 @@ NavigationURLLoaderImpl::NavigationURLLoaderImpl(
bool use_proxy = GetContentClient()->browser()->WillCreateURLLoaderFactory(
partition->browser_context(), frame_tree_node->current_frame_host(),
frame_tree_node->current_frame_host()->GetProcess()->GetID(),
- true /* is_navigation */, navigation_request_initiator,
- &factory_request, &header_client, &bypass_redirect_checks);
+ true /* is_navigation */, false /* is_download */,
+ navigation_request_initiator, &factory_request, &header_client,
+ &bypass_redirect_checks);
if (devtools_instrumentation::WillCreateURLLoaderFactory(
frame_tree_node->current_frame_host(), true /* is_navigation */,
false /* is_download */, &factory_request)) {
@@ -1854,8 +1844,8 @@ void NavigationURLLoaderImpl::BindNonNetworkURLLoaderFactoryRequest(
GetContentClient()->browser()->WillCreateURLLoaderFactory(
frame->GetSiteInstance()->GetBrowserContext(), frame,
frame->GetProcess()->GetID(), true /* is_navigation */,
- navigation_request_initiator, &factory, nullptr /* header_client */,
- nullptr /* bypass_redirect_checks */);
+ false /* is_download */, navigation_request_initiator, &factory,
+ nullptr /* header_client */, nullptr /* bypass_redirect_checks */);
it->second->Clone(std::move(factory));
}
diff --git a/chromium/content/browser/media/hardware_key_media_controller.cc b/chromium/content/browser/media/hardware_key_media_controller.cc
index f7cf052573f..84b57a948c5 100644
--- a/chromium/content/browser/media/hardware_key_media_controller.cc
+++ b/chromium/content/browser/media/hardware_key_media_controller.cc
@@ -32,12 +32,12 @@ HardwareKeyMediaController::HardwareKeyMediaController(
controller_manager_ptr->CreateActiveMediaController(
mojo::MakeRequest(&media_controller_ptr_));
- // Observe the active media session for changes to playback state and
+ // Observe the active media controller for changes to playback state and
// supported actions.
- media_session::mojom::MediaSessionObserverPtr media_session_observer;
- media_session_observer_binding_.Bind(
- mojo::MakeRequest(&media_session_observer));
- media_controller_ptr_->AddObserver(std::move(media_session_observer));
+ media_session::mojom::MediaControllerObserverPtr media_controller_observer;
+ media_controller_observer_binding_.Bind(
+ mojo::MakeRequest(&media_controller_observer));
+ media_controller_ptr_->AddObserver(std::move(media_controller_observer));
}
HardwareKeyMediaController::~HardwareKeyMediaController() = default;
@@ -185,4 +185,4 @@ HardwareKeyMediaController::MediaSessionActionToKeyCode(
}
}
-} // namespace content \ No newline at end of file
+} // namespace content
diff --git a/chromium/content/browser/media/hardware_key_media_controller.h b/chromium/content/browser/media/hardware_key_media_controller.h
index b9ecba2d0c8..94dbb0fe7bb 100644
--- a/chromium/content/browser/media/hardware_key_media_controller.h
+++ b/chromium/content/browser/media/hardware_key_media_controller.h
@@ -13,7 +13,6 @@
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/media_session/public/mojom/media_controller.mojom.h"
-#include "services/media_session/public/mojom/media_session.mojom.h"
#include "ui/base/accelerators/media_keys_listener.h"
#include "ui/events/keycodes/keyboard_codes.h"
@@ -25,13 +24,13 @@ namespace content {
// HardwareKeyMediaController controls media sessions via hardware media keys.
class CONTENT_EXPORT HardwareKeyMediaController
- : public media_session::mojom::MediaSessionObserver,
+ : public media_session::mojom::MediaControllerObserver,
public ui::MediaKeysListener::Delegate {
public:
explicit HardwareKeyMediaController(service_manager::Connector* connector);
~HardwareKeyMediaController() override;
- // media_session::mojom::MediaSessionObserver:
+ // media_session::mojom::MediaControllerObserver:
void MediaSessionInfoChanged(
media_session::mojom::MediaSessionInfoPtr session_info) override;
void MediaSessionMetadataChanged(
@@ -84,13 +83,13 @@ class CONTENT_EXPORT HardwareKeyMediaController
// Used to check which actions are currently supported.
base::flat_set<media_session::mojom::MediaSessionAction> actions_;
- // Used to receive updates to the active MediaSession.
- mojo::Binding<media_session::mojom::MediaSessionObserver>
- media_session_observer_binding_{this};
+ // Used to receive updates to the active media controller.
+ mojo::Binding<media_session::mojom::MediaControllerObserver>
+ media_controller_observer_binding_{this};
DISALLOW_COPY_AND_ASSIGN(HardwareKeyMediaController);
};
} // namespace content
-#endif // CONTENT_BROWSER_MEDIA_HARDWARE_KEY_MEDIA_CONTROLLER_H_ \ No newline at end of file
+#endif // CONTENT_BROWSER_MEDIA_HARDWARE_KEY_MEDIA_CONTROLLER_H_
diff --git a/chromium/content/browser/network_service_instance.cc b/chromium/content/browser/network_service_instance.cc
index f45d1d89974..e4d01d908f0 100644
--- a/chromium/content/browser/network_service_instance.cc
+++ b/chromium/content/browser/network_service_instance.cc
@@ -37,6 +37,13 @@ namespace content {
namespace {
+#if defined(OS_POSIX)
+// Environment variable pointing to credential cache file.
+constexpr char kKrb5CCEnvName[] = "KRB5CCNAME";
+// Environment variable pointing to Kerberos config file.
+constexpr char kKrb5ConfEnvName[] = "KRB5_CONFIG";
+#endif
+
network::mojom::NetworkServicePtr* g_network_service_ptr = nullptr;
network::NetworkConnectionTracker* g_network_connection_tracker;
network::NetworkService* g_network_service;
@@ -50,6 +57,24 @@ network::mojom::NetworkServiceParamsPtr CreateNetworkServiceParams() {
network_service_params->initial_connection_subtype =
network::mojom::ConnectionSubtype(
net::NetworkChangeNotifier::GetConnectionSubtype());
+
+#if defined(OS_POSIX)
+ // Send Kerberos environment variables to the network service.
+ if (IsOutOfProcessNetworkService()) {
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ std::string value;
+ if (env->HasVar(kKrb5CCEnvName)) {
+ env->GetVar(kKrb5CCEnvName, &value);
+ network_service_params->environment.push_back(
+ network::mojom::EnvironmentVariable::New(kKrb5CCEnvName, value));
+ }
+ if (env->HasVar(kKrb5ConfEnvName)) {
+ env->GetVar(kKrb5ConfEnvName, &value);
+ network_service_params->environment.push_back(
+ network::mojom::EnvironmentVariable::New(kKrb5ConfEnvName, value));
+ }
+ }
+#endif
return network_service_params;
}
diff --git a/chromium/content/browser/notifications/platform_notification_context_impl.cc b/chromium/content/browser/notifications/platform_notification_context_impl.cc
index 9b31e66db71..d2b2c16756f 100644
--- a/chromium/content/browser/notifications/platform_notification_context_impl.cc
+++ b/chromium/content/browser/notifications/platform_notification_context_impl.cc
@@ -479,7 +479,7 @@ void PlatformNotificationContextImpl::LazyInitialize(
if (!task_runner_) {
task_runner_ = base::CreateSequencedTaskRunnerWithTraits(
- {base::MayBlock(), base::TaskPriority::BEST_EFFORT});
+ {base::MayBlock(), base::TaskPriority::USER_VISIBLE});
}
task_runner_->PostTask(
diff --git a/chromium/content/browser/renderer_host/render_process_host_impl.cc b/chromium/content/browser/renderer_host/render_process_host_impl.cc
index 04f816a43b8..94d88268d6f 100644
--- a/chromium/content/browser/renderer_host/render_process_host_impl.cc
+++ b/chromium/content/browser/renderer_host/render_process_host_impl.cc
@@ -2094,6 +2094,10 @@ void RenderProcessHostImpl::BindIndexedDB(
std::move(request), origin));
}
+void RenderProcessHostImpl::ForceCrash() {
+ child_connection_->ForceCrash();
+}
+
void RenderProcessHostImpl::BindFileSystemManager(
blink::mojom::FileSystemManagerRequest request) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
diff --git a/chromium/content/browser/renderer_host/render_process_host_impl.h b/chromium/content/browser/renderer_host/render_process_host_impl.h
index 1d6fb2e6592..1e8f777be2e 100644
--- a/chromium/content/browser/renderer_host/render_process_host_impl.h
+++ b/chromium/content/browser/renderer_host/render_process_host_impl.h
@@ -239,6 +239,7 @@ class CONTENT_EXPORT RenderProcessHostImpl
const url::Origin& origin) override;
void BindIndexedDB(blink::mojom::IDBFactoryRequest request,
const url::Origin& origin) override;
+ void ForceCrash() override;
void CleanupCorbExceptionForPluginUponDestruction() override;
mojom::RouteProvider* GetRemoteRouteProvider();
diff --git a/chromium/content/browser/service_worker/embedded_worker_instance.cc b/chromium/content/browser/service_worker/embedded_worker_instance.cc
index 033853b765d..fa97725073e 100644
--- a/chromium/content/browser/service_worker/embedded_worker_instance.cc
+++ b/chromium/content/browser/service_worker/embedded_worker_instance.cc
@@ -113,8 +113,9 @@ std::unique_ptr<blink::URLLoaderFactoryBundleInfo> CreateFactoryBundle(
// See if the default factory needs to be tweaked by the embedder.
GetContentClient()->browser()->WillCreateURLLoaderFactory(
rph->GetBrowserContext(), nullptr /* frame_host */, rph->GetID(),
- false /* is_navigation */, origin, &default_factory_request,
- &default_header_client, &bypass_redirect_checks);
+ false /* is_navigation */, false /* is_download */, origin,
+ &default_factory_request, &default_header_client,
+ &bypass_redirect_checks);
}
if (!GetNetworkFactoryCallbackForTest()) {
diff --git a/chromium/content/browser/tracing/tracing_controller_impl.cc b/chromium/content/browser/tracing/tracing_controller_impl.cc
index beed93a8031..758526f49f0 100644
--- a/chromium/content/browser/tracing/tracing_controller_impl.cc
+++ b/chromium/content/browser/tracing/tracing_controller_impl.cc
@@ -298,10 +298,7 @@ TracingControllerImpl* TracingControllerImpl::GetInstance() {
bool TracingControllerImpl::GetCategories(GetCategoriesDoneCallback callback) {
std::set<std::string> category_set;
-
- tracing::TraceEventAgent::GetInstance()->GetCategories(&category_set);
- for (auto& agent : agents_)
- agent->GetCategories(&category_set);
+ tracing::TracedProcessImpl::GetInstance()->GetCategories(&category_set);
std::move(callback).Run(category_set);
return true;
diff --git a/chromium/content/browser/webrtc/webrtc_video_capture_browsertest.cc b/chromium/content/browser/webrtc/webrtc_video_capture_browsertest.cc
index 9e38210316a..a9eb78c74fa 100644
--- a/chromium/content/browser/webrtc/webrtc_video_capture_browsertest.cc
+++ b/chromium/content/browser/webrtc/webrtc_video_capture_browsertest.cc
@@ -22,16 +22,6 @@
namespace content {
-#if defined(OS_ANDROID)
-// Mojo video capture is currently not supported on Android
-// TODO(chfremer): Enable as soon as https://crbug.com/720500 is resolved.
-#define MAYBE_RecoverFromCrashInVideoCaptureProcess \
- DISABLED_RecoverFromCrashInVideoCaptureProcess
-#else
-#define MAYBE_RecoverFromCrashInVideoCaptureProcess \
- RecoverFromCrashInVideoCaptureProcess
-#endif // defined(OS_ANDROID)
-
namespace {
static const char kVideoCaptureHtmlFile[] = "/media/video_capture_test.html";
@@ -63,6 +53,7 @@ class WebRtcVideoCaptureBrowserTest : public ContentBrowserTest {
void SetUp() override {
ASSERT_TRUE(embedded_test_server()->InitializeAndListen());
EnablePixelOutput();
+ embedded_test_server()->StartAcceptingConnections();
ContentBrowserTest::SetUp();
}
@@ -73,8 +64,12 @@ class WebRtcVideoCaptureBrowserTest : public ContentBrowserTest {
};
IN_PROC_BROWSER_TEST_F(WebRtcVideoCaptureBrowserTest,
- MAYBE_RecoverFromCrashInVideoCaptureProcess) {
- embedded_test_server()->StartAcceptingConnections();
+ RecoverFromCrashInVideoCaptureProcess) {
+ // This test only makes sense if the video capture service runs in a
+ // separate process.
+ if (!features::IsVideoCaptureServiceEnabledForOutOfProcess())
+ return;
+
GURL url(embedded_test_server()->GetURL(kVideoCaptureHtmlFile));
NavigateToURL(shell(), url);
diff --git a/chromium/content/common/child.mojom b/chromium/content/common/child.mojom
index 15524dded27..af7d60f9d66 100644
--- a/chromium/content/common/child.mojom
+++ b/chromium/content/common/child.mojom
@@ -6,4 +6,8 @@ module content.mojom;
// This interface encapsulates a pipe between a child and browser processes
// that each side uses to monitor the lifetime of the connection.
-interface Child {};
+interface Child {
+ // Force the child process to crash immediately (i.e. a hard crash, no
+ // cleanup, generating a crash report).
+ Crash();
+};
diff --git a/chromium/content/common/service_manager/child_connection.cc b/chromium/content/common/service_manager/child_connection.cc
index 58f8c26fba9..7cd197ddff8 100644
--- a/chromium/content/common/service_manager/child_connection.cc
+++ b/chromium/content/common/service_manager/child_connection.cc
@@ -70,6 +70,13 @@ class ChildConnection::IOThreadContext
this, handle));
}
+ void ForceCrash() {
+ DCHECK(io_task_runner_);
+ io_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(&IOThreadContext::ForceCrashOnIOThread, this));
+ }
+
private:
friend class base::RefCountedThreadSafe<IOThreadContext>;
@@ -101,6 +108,8 @@ class ChildConnection::IOThreadContext
pid_receiver_.reset();
}
+ void ForceCrashOnIOThread() { child_->Crash(); }
+
scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
// Usable from the IO thread only.
std::unique_ptr<service_manager::Connector> connector_;
@@ -141,4 +150,8 @@ void ChildConnection::SetProcessHandle(base::ProcessHandle handle) {
context_->SetProcessHandle(handle);
}
+void ChildConnection::ForceCrash() {
+ context_->ForceCrash();
+}
+
} // namespace content
diff --git a/chromium/content/common/service_manager/child_connection.h b/chromium/content/common/service_manager/child_connection.h
index 96aca647373..067945049cd 100644
--- a/chromium/content/common/service_manager/child_connection.h
+++ b/chromium/content/common/service_manager/child_connection.h
@@ -59,6 +59,9 @@ class CONTENT_EXPORT ChildConnection {
// functional until this is called.
void SetProcessHandle(base::ProcessHandle handle);
+ // Instructs the child process to crash immediately.
+ void ForceCrash();
+
private:
class IOThreadContext;
diff --git a/chromium/content/common/service_manager/service_manager_connection_impl.cc b/chromium/content/common/service_manager/service_manager_connection_impl.cc
index 1226556dd8c..8a44c4ebe6f 100644
--- a/chromium/content/common/service_manager/service_manager_connection_impl.cc
+++ b/chromium/content/common/service_manager/service_manager_connection_impl.cc
@@ -301,6 +301,9 @@ class ServiceManagerConnectionImpl::IOThreadContext
}
}
+ // mojom::Child:
+ void Crash() override { IMMEDIATE_CRASH(); }
+
base::ThreadChecker io_thread_checker_;
bool started_ = false;
diff --git a/chromium/content/common/throttling_url_loader.cc b/chromium/content/common/throttling_url_loader.cc
index 6303159af21..b38fdad1530 100644
--- a/chromium/content/common/throttling_url_loader.cc
+++ b/chromium/content/common/throttling_url_loader.cc
@@ -552,7 +552,9 @@ void ThrottlingURLLoader::OnReceiveRedirect(
deferred_stage_ = DEFERRED_REDIRECT;
redirect_info_ =
std::make_unique<RedirectInfo>(redirect_info, response_head);
- client_binding_.PauseIncomingMethodCallProcessing();
+ // |client_binding_| can be unbound if the redirect came from a throttle.
+ if (client_binding_.is_bound())
+ client_binding_.PauseIncomingMethodCallProcessing();
return;
}
}
@@ -677,7 +679,9 @@ void ThrottlingURLLoader::Resume() {
break;
}
case DEFERRED_REDIRECT: {
- client_binding_.ResumeIncomingMethodCallProcessing();
+ // |client_binding_| can be unbound if the redirect came from a throttle.
+ if (client_binding_.is_bound())
+ client_binding_.ResumeIncomingMethodCallProcessing();
// TODO(dhausknecht) at this point we do not actually know if we commit to
// the redirect or if it will be cancelled. FollowRedirect would be a more
// suitable place to set this URL but there we do not have the data.
diff --git a/chromium/content/public/browser/content_browser_client.cc b/chromium/content/public/browser/content_browser_client.cc
index 07d71b3a06f..10de4bf0974 100644
--- a/chromium/content/public/browser/content_browser_client.cc
+++ b/chromium/content/public/browser/content_browser_client.cc
@@ -722,6 +722,7 @@ bool ContentBrowserClient::WillCreateURLLoaderFactory(
RenderFrameHost* frame,
int render_process_id,
bool is_navigation,
+ bool is_download,
const url::Origin& request_initiator,
network::mojom::URLLoaderFactoryRequest* factory_request,
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
diff --git a/chromium/content/public/browser/content_browser_client.h b/chromium/content/public/browser/content_browser_client.h
index eaa7d8b2514..b40ca1e3be8 100644
--- a/chromium/content/public/browser/content_browser_client.h
+++ b/chromium/content/public/browser/content_browser_client.h
@@ -1171,9 +1171,10 @@ class CONTENT_EXPORT ContentBrowserClient {
// Allows the embedder to register per-scheme URLLoaderFactory implementations
// to handle subresource URL requests for schemes not handled by the Network
// Service. This function can also be used to make a factory for other
- // non-subresource requests, such as for the service worker script when
- // starting a service worker. In that case, the frame id will be
- // MSG_ROUTING_NONE.
+ // non-subresource requests, such as:
+ // -downloads
+ // -service worker script when starting a service worker. In that case, the
+ // frame id will be MSG_ROUTING_NONE
virtual void RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
@@ -1217,6 +1218,7 @@ class CONTENT_EXPORT ContentBrowserClient {
RenderFrameHost* frame,
int render_process_id,
bool is_navigation,
+ bool is_download,
const url::Origin& request_initiator,
network::mojom::URLLoaderFactoryRequest* factory_request,
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
@@ -1265,6 +1267,10 @@ class CONTENT_EXPORT ContentBrowserClient {
//
// If |relative_partition_path| is the empty string, it means this needs to
// create the default NetworkContext for the BrowserContext.
+ //
+ // For NetworkContexts returned from the Network Service, some requirements:
+ // -enable data URL support (or else data URLs will fail)
+ // -disable file URL support (for security)
virtual network::mojom::NetworkContextPtr CreateNetworkContext(
BrowserContext* context,
bool in_memory,
diff --git a/chromium/content/public/browser/render_process_host.h b/chromium/content/public/browser/render_process_host.h
index 771fadd4135..56d7c5c8cdc 100644
--- a/chromium/content/public/browser/render_process_host.h
+++ b/chromium/content/public/browser/render_process_host.h
@@ -490,6 +490,9 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender,
// be posted back on the UI thread).
void PostTaskWhenProcessIsReady(base::OnceClosure task);
+ // Forces the renderer process to crash ASAP.
+ virtual void ForceCrash() {}
+
// Controls whether the destructor of RenderProcessHost*Impl* will end up
// cleaning the memory used by the exception added via
// RenderProcessHostImpl::AddCorbExceptionForPlugin.
diff --git a/chromium/content/public/common/content_features.cc b/chromium/content/public/common/content_features.cc
index 163f4055afb..628f91622bf 100644
--- a/chromium/content/public/common/content_features.cc
+++ b/chromium/content/public/common/content_features.cc
@@ -5,10 +5,6 @@
#include "content/public/common/content_features.h"
#include "build/build_config.h"
-#if defined(OS_CHROMEOS)
-#include "media/capture/video/chromeos/public/cros_features.h"
-#endif
-
namespace features {
// All features in alphabetical order.
@@ -723,12 +719,11 @@ VideoCaptureServiceConfiguration GetVideoCaptureServiceConfiguration() {
if (!ShouldEnableVideoCaptureService())
return VideoCaptureServiceConfiguration::kDisabled;
-#if defined(OS_ANDROID)
+// On ChromeOS the service must run in the browser process, because parts of the
+// code depend on global objects that are only available in the Browser process.
+// See https://crbug.com/891961.
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
return VideoCaptureServiceConfiguration::kEnabledForBrowserProcess;
-#elif defined(OS_CHROMEOS)
- return media::ShouldUseCrosCameraService()
- ? VideoCaptureServiceConfiguration::kEnabledForBrowserProcess
- : VideoCaptureServiceConfiguration::kEnabledForOutOfProcess;
#else
return base::FeatureList::IsEnabled(
features::kRunVideoCaptureServiceInBrowserProcess)
diff --git a/chromium/content/public/common/url_utils.cc b/chromium/content/public/common/url_utils.cc
index 5fcc9b77371..43da363b974 100644
--- a/chromium/content/public/common/url_utils.cc
+++ b/chromium/content/public/common/url_utils.cc
@@ -64,7 +64,8 @@ bool IsURLHandledByNetworkStack(const GURL& url) {
bool IsURLHandledByNetworkService(const GURL& url) {
return url.SchemeIsHTTPOrHTTPS() || url.SchemeIsWSOrWSS() ||
- url.SchemeIs(url::kFtpScheme) || url.SchemeIs(url::kGopherScheme);
+ url.SchemeIs(url::kFtpScheme) || url.SchemeIs(url::kGopherScheme) ||
+ url.SchemeIs(url::kDataScheme);
}
bool IsRendererDebugURL(const GURL& url) {
diff --git a/chromium/content/renderer/media/stream/media_stream_constraints_util_audio.cc b/chromium/content/renderer/media/stream/media_stream_constraints_util_audio.cc
index 0d7a924a2b4..ef3ee22659c 100644
--- a/chromium/content/renderer/media/stream/media_stream_constraints_util_audio.cc
+++ b/chromium/content/renderer/media/stream/media_stream_constraints_util_audio.cc
@@ -1255,8 +1255,7 @@ class DeviceContainer {
// It is possible, however, that the HW echo canceller is enabled. In
// such case the property for echo cancellation type should be updated
// accordingly.
- if (effects & media::AudioParameters::ECHO_CANCELLER ||
- effects & media::AudioParameters::EXPERIMENTAL_ECHO_CANCELLER) {
+ if (effects & media::AudioParameters::ECHO_CANCELLER) {
properties.echo_cancellation_type =
EchoCancellationType::kEchoCancellationSystem;
}
diff --git a/chromium/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc b/chromium/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc
index 49149a27d46..ac1ec05e744 100644
--- a/chromium/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc
+++ b/chromium/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc
@@ -190,11 +190,18 @@ class MediaStreamConstraintsUtilAudioTest
bool enable_system_echo_canceller,
bool hotword_enabled,
bool disable_local_echo,
- bool render_to_associated_sink) {
+ bool render_to_associated_sink,
+ bool enable_experimental_echo_canceller = false) {
blink::MediaStreamDevice device;
device.type = GetMediaStreamType();
+
+ int effects = 0;
if (enable_system_echo_canceller)
- device.input.set_effects(media::AudioParameters::ECHO_CANCELLER);
+ effects |= media::AudioParameters::ECHO_CANCELLER;
+ if (enable_experimental_echo_canceller)
+ effects |= media::AudioParameters::EXPERIMENTAL_ECHO_CANCELLER;
+ device.input.set_effects(effects);
+
if (render_to_associated_sink)
device.matched_output_device_id = std::string("some_device_id");
@@ -2146,6 +2153,21 @@ TEST_P(MediaStreamConstraintsUtilAudioTest, UsedAndUnusedSources) {
}
}
+TEST_P(MediaStreamConstraintsUtilAudioTest, ExperimetanlEcWithSource) {
+ std::unique_ptr<LocalMediaStreamAudioSource> source =
+ GetLocalMediaStreamAudioSource(
+ false /* enable_system_echo_canceller */,
+ false /* disable_local_echo */, false /* render_to_associated_sink */,
+ true /* enable_experimental_echo_canceller */);
+
+ constraint_factory_.Reset();
+ constraint_factory_.basic().echo_cancellation.SetExact(false);
+
+ auto result = SelectSettingsAudioCapture(
+ source.get(), constraint_factory_.CreateWebMediaConstraints());
+ EXPECT_TRUE(result.HasValue());
+}
+
INSTANTIATE_TEST_CASE_P(,
MediaStreamConstraintsUtilAudioTest,
testing::Values("",