Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: chrome/browser/plugins/plugin_info_message_filter.cc

Issue 1088323002: Fix crash when a webview tries to load a plugin resource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/plugins/plugin_info_message_filter.cc
diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc
index 657357c71703c311a8b9f877ce86c486f5581c44..a8fd6b78f772cf5f3bfc3630d133e9b6959c2cd8 100644
--- a/chrome/browser/plugins/plugin_info_message_filter.cc
+++ b/chrome/browser/plugins/plugin_info_message_filter.cc
@@ -37,6 +37,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/guest_view/guest_view_base.h"
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
+#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/webview_info.h"
@@ -157,6 +158,8 @@ bool IsPluginLoadingAccessibleResourceInWebView(
const extensions::Extension* extension =
extension_registry->GetExtensionById(extension_id,
extensions::ExtensionRegistry::ENABLED);
+ if (!extension)
+ return false;
const extensions::WebviewInfo* webview_info =
static_cast<const extensions::WebviewInfo*>(extension->GetManifestData(
extensions::manifest_keys::kWebviewAccessibleResources));
@@ -417,7 +420,8 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
// If an app has explicitly made internal resources available by listing them
// in |accessible_resources| in the manifest, then allow them to be loaded by
// plugins inside a guest-view.
- if (!is_managed && plugin_setting == CONTENT_SETTING_BLOCK &&
+ if (params.url.SchemeIs(extensions::kExtensionScheme) && !is_managed &&
+ plugin_setting == CONTENT_SETTING_BLOCK &&
IsPluginLoadingAccessibleResourceInWebView(
extension_registry_, render_process_id_, params.url)) {
plugin_setting = CONTENT_SETTING_ALLOW;

Powered by Google App Engine
This is Rietveld 408576698