Fix crashes with --disable-extensions (fixes issue #2777)

This commit is contained in:
Marshall Greenblatt
2019-10-07 11:59:16 +03:00
parent 1687a637a8
commit c63c001142

View File

@@ -125,7 +125,7 @@ index f2223e24ec7c..8374b7f0d56d 100644
// If we broke out of the loop, we have found an enabled plugin.
bool enabled = i < matching_plugins.size();
diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc
index 73d60aa7f77c..89bff0de7186 100644
index 73d60aa7f77c..ab21e5adc28e 100644
--- chrome/browser/plugins/plugin_utils.cc
+++ chrome/browser/plugins/plugin_utils.cc
@@ -5,6 +5,7 @@
@@ -148,7 +148,19 @@ index 73d60aa7f77c..89bff0de7186 100644
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
@@ -251,12 +257,29 @@ base::flat_map<std::string, std::string>
@@ -221,6 +227,11 @@ std::string PluginUtils::GetExtensionIdForMimeType(
std::string PluginUtils::GetExtensionIdForMimeType(
content::BrowserContext* browser_context,
const std::string& mime_type) {
+#if BUILDFLAG(ENABLE_CEF)
+ if (!extensions::ExtensionsEnabled())
+ return std::string();
+#endif
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
Profile* profile = Profile::FromBrowserContext(browser_context);
auto map = GetMimeTypeToExtensionIdMapInternal(
@@ -251,12 +262,29 @@ base::flat_map<std::string, std::string>
PluginUtils::GetMimeTypeToExtensionIdMap(
content::ResourceContext* resource_context) {
#if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -180,6 +192,37 @@ index 73d60aa7f77c..89bff0de7186 100644
base::BindRepeating(
[](const scoped_refptr<extensions::InfoMap>& info_map,
const std::string& extension_id) {
diff --git chrome/common/google_url_loader_throttle.cc chrome/common/google_url_loader_throttle.cc
index 64219ce72232..97c673d7a074 100644
--- chrome/common/google_url_loader_throttle.cc
+++ chrome/common/google_url_loader_throttle.cc
@@ -4,9 +4,14 @@
#include "chrome/common/google_url_loader_throttle.h"
+#include "cef/libcef/features/features.h"
#include "chrome/common/net/safe_search_util.h"
#include "components/variations/net/variations_http_headers.h"
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/common/extensions/extensions_util.h"
+#endif
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "extensions/common/extension_urls.h"
#endif
@@ -95,6 +100,11 @@ void GoogleURLLoaderThrottle::WillProcessResponse(
const GURL& response_url,
network::ResourceResponseHead* response_head,
bool* defer) {
+#if BUILDFLAG(ENABLE_CEF)
+ if (!extensions::ExtensionsEnabled())
+ return;
+#endif
+
// Built-in additional protection for the chrome web store origin.
GURL webstore_url(extension_urls::GetWebstoreLaunchURL());
if (response_url.SchemeIsHTTPOrHTTPS() &&
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
index ae7e07340ea4..f193040e8bca 100644
--- chrome/renderer/chrome_content_renderer_client.cc