Fix crashes when loading Flash plugins with extensions disabled (issue #2359)

This commit is contained in:
Marshall Greenblatt 2018-02-02 19:01:36 -05:00
parent a2f430c6f3
commit d7e1312e9d
6 changed files with 37 additions and 6 deletions

View File

@ -680,11 +680,17 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
// Propagate the following switches to the renderer command line (along with
// any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
switches::kDisableExtensions, switches::kDisablePdfExtension,
switches::kDisableScrollBounce, switches::kDisableSpellChecking,
switches::kEnableSpeechInput, switches::kEnableSystemFlash,
switches::kPpapiFlashArgs, switches::kPpapiFlashPath,
switches::kPpapiFlashVersion, switches::kUncaughtExceptionStackSize,
switches::kDisableExtensions,
switches::kDisablePdfExtension,
switches::kDisablePlugins,
switches::kDisableScrollBounce,
switches::kDisableSpellChecking,
switches::kEnableSpeechInput,
switches::kEnableSystemFlash,
switches::kPpapiFlashArgs,
switches::kPpapiFlashPath,
switches::kPpapiFlashVersion,
switches::kUncaughtExceptionStackSize,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
arraysize(kSwitchNames));

View File

@ -288,6 +288,8 @@ void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs) {
SetBool(prefs, prefs::kWebKitLoadsImagesAutomatically, false);
if (command_line->HasSwitch(switches::kDisableTabToLinks))
SetBool(prefs, prefs::kWebkitTabsToLinks, false);
if (command_line->HasSwitch(switches::kDisablePlugins))
SetBool(prefs, prefs::kWebKitPluginsEnabled, false);
}
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {

View File

@ -57,6 +57,9 @@ const char kDisableTextAreaResize[] = "disable-text-area-resize";
// Disable using the tab key to advance focus to links.
const char kDisableTabToLinks[] = "disable-tab-to-links";
// Disable plugins.
const char kDisablePlugins[] = "disable-plugins";
// Persist session cookies.
const char kPersistSessionCookies[] = "persist-session-cookies";

View File

@ -31,6 +31,7 @@ extern const char kDisableImageLoading[];
extern const char kImageShrinkStandaloneToFit[];
extern const char kDisableTextAreaResize[];
extern const char kDisableTabToLinks[];
extern const char kDisablePlugins[];
extern const char kPersistSessionCookies[];
extern const char kPersistUserPreferences[];
extern const char kEnableMediaStream[];

View File

@ -717,7 +717,8 @@ void CefMainDelegate::InitializeResourceBundle() {
}
}
if (extensions::ExtensionsEnabled()) {
if (extensions::ExtensionsEnabled() ||
!command_line->HasSwitch(switches::kDisablePlugins)) {
if (base::PathExists(cef_extensions_pak_file)) {
resource_bundle.AddDataPackFromPath(cef_extensions_pak_file,
ui::SCALE_FACTOR_NONE);

View File

@ -187,3 +187,21 @@ index 5dc888bfb2df..297737be682e 100644
break;
}
case chrome::mojom::PluginStatus::kComponentUpdateRequired: {
diff --git chrome/renderer/plugins/chrome_plugin_placeholder.cc chrome/renderer/plugins/chrome_plugin_placeholder.cc
index 7a814bb072dc..79c7d65118cb 100644
--- chrome/renderer/plugins/chrome_plugin_placeholder.cc
+++ chrome/renderer/plugins/chrome_plugin_placeholder.cc
@@ -349,8 +349,11 @@ void ChromePluginPlaceholder::OnBlockedContent(
if (status ==
content::RenderFrame::PeripheralContentStatus::CONTENT_STATUS_TINY) {
- ContentSettingsObserver::Get(render_frame())
- ->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, title_);
+ ContentSettingsObserver* observer =
+ ContentSettingsObserver::Get(render_frame());
+ if (observer) {
+ observer->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, title_);
+ }
}
std::string message = base::StringPrintf(