mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add is_main_frame argument to CefRequestContextHandler::OnBeforePluginLoad (issue #2015)
This commit is contained in:
@ -38,27 +38,3 @@ index 9895206..1f4626d 100644
|
||||
// Indicates if the Android MediaPlayer should be used instead of Chrome's
|
||||
// built in media player for the given |url|. Defaults to false.
|
||||
virtual bool ShouldUseMediaPlayerForURL(const GURL& url);
|
||||
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
|
||||
index 2d93238..95969c4 100644
|
||||
--- renderer/render_frame_impl.cc
|
||||
+++ renderer/render_frame_impl.cc
|
||||
@@ -5259,9 +5259,8 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
||||
(pending_navigation_params_ &&
|
||||
!pending_navigation_params_->request_params.redirects.empty());
|
||||
|
||||
-#ifdef OS_ANDROID
|
||||
- bool render_view_was_created_by_renderer =
|
||||
- render_view_->was_created_by_renderer_;
|
||||
+ // CEF doesn't use this value, so just pass false.
|
||||
+ bool render_view_was_created_by_renderer = false;
|
||||
// The handlenavigation API is deprecated and will be removed once
|
||||
// crbug.com/325351 is resolved.
|
||||
if (GetContentClient()->renderer()->HandleNavigation(
|
||||
@@ -5270,7 +5269,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
||||
is_redirect)) {
|
||||
return blink::WebNavigationPolicyIgnore;
|
||||
}
|
||||
-#endif
|
||||
|
||||
Referrer referrer(
|
||||
RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest));
|
||||
|
354
patch/patches/plugin_info_2015.patch
Normal file
354
patch/patches/plugin_info_2015.patch
Normal file
@ -0,0 +1,354 @@
|
||||
diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc
|
||||
index 8949f08..45a0640 100644
|
||||
--- chrome/browser/download/download_target_determiner.cc
|
||||
+++ chrome/browser/download/download_target_determiner.cc
|
||||
@@ -478,8 +478,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context,
|
||||
content::PluginService* plugin_service =
|
||||
content::PluginService::GetInstance();
|
||||
bool plugin_found = plugin_service->GetPluginInfo(
|
||||
- -1, -1, resource_context, url, url::Origin(), mime_type, false, &is_stale,
|
||||
- &plugin_info, &actual_mime_type);
|
||||
+ -1, -1, resource_context, url, true, url::Origin(), mime_type, false,
|
||||
+ &is_stale, &plugin_info, &actual_mime_type);
|
||||
if (is_stale && stale_plugin_action == RETRY_IF_STALE_PLUGIN_LIST) {
|
||||
// The GetPlugins call causes the plugin list to be refreshed. Once that's
|
||||
// done we can retry the GetPluginInfo call. We break out of this cycle
|
||||
diff --git chrome/browser/plugins/chrome_plugin_service_filter.cc chrome/browser/plugins/chrome_plugin_service_filter.cc
|
||||
index 1783a10..b380ef8 100644
|
||||
--- chrome/browser/plugins/chrome_plugin_service_filter.cc
|
||||
+++ chrome/browser/plugins/chrome_plugin_service_filter.cc
|
||||
@@ -179,6 +179,7 @@ bool ChromePluginServiceFilter::IsPluginAvailable(
|
||||
int render_frame_id,
|
||||
const void* context,
|
||||
const GURL& plugin_content_url,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
content::WebPluginInfo* plugin) {
|
||||
base::AutoLock auto_lock(lock_);
|
||||
diff --git chrome/browser/plugins/chrome_plugin_service_filter.h chrome/browser/plugins/chrome_plugin_service_filter.h
|
||||
index f8b651f..ec39f8d 100644
|
||||
--- chrome/browser/plugins/chrome_plugin_service_filter.h
|
||||
+++ chrome/browser/plugins/chrome_plugin_service_filter.h
|
||||
@@ -71,6 +71,7 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter,
|
||||
int render_frame_id,
|
||||
const void* context,
|
||||
const GURL& plugin_content_url,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
content::WebPluginInfo* plugin) override;
|
||||
|
||||
diff --git chrome/browser/plugins/plugin_info_message_filter.cc chrome/browser/plugins/plugin_info_message_filter.cc
|
||||
index 75a6fda..84cfc9f 100644
|
||||
--- chrome/browser/plugins/plugin_info_message_filter.cc
|
||||
+++ chrome/browser/plugins/plugin_info_message_filter.cc
|
||||
@@ -483,8 +483,8 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
|
||||
for (; i < matching_plugins.size(); ++i) {
|
||||
if (!filter ||
|
||||
filter->IsPluginAvailable(render_process_id_, render_frame_id,
|
||||
- resource_context_, url, main_frame_origin,
|
||||
- &matching_plugins[i])) {
|
||||
+ resource_context_, url, true,
|
||||
+ main_frame_origin, &matching_plugins[i])) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
diff --git chrome/browser/ui/cocoa/drag_util.mm chrome/browser/ui/cocoa/drag_util.mm
|
||||
index 4a3e00e..aca7f98 100644
|
||||
--- chrome/browser/ui/cocoa/drag_util.mm
|
||||
+++ chrome/browser/ui/cocoa/drag_util.mm
|
||||
@@ -52,7 +52,7 @@ BOOL IsSupportedFileURL(Profile* profile, const GURL& url) {
|
||||
return PluginService::GetInstance()->GetPluginInfo(
|
||||
-1, // process ID
|
||||
MSG_ROUTING_NONE, // routing ID
|
||||
- profile->GetResourceContext(), url, url::Origin(), mime_type,
|
||||
+ profile->GetResourceContext(), url, true, url::Origin(), mime_type,
|
||||
allow_wildcard, NULL, &plugin, NULL);
|
||||
}
|
||||
|
||||
diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
|
||||
index 59d15a7..7831a36 100644
|
||||
--- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
|
||||
+++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
|
||||
@@ -592,6 +592,6 @@ void BrowserTabStripController::OnFindURLMimeTypeCompleted(
|
||||
content::PluginService::GetInstance()->GetPluginInfo(
|
||||
-1, // process ID
|
||||
MSG_ROUTING_NONE, // routing ID
|
||||
- model_->profile()->GetResourceContext(), url, url::Origin(),
|
||||
+ model_->profile()->GetResourceContext(), url, true, url::Origin(),
|
||||
mime_type, false, NULL, &plugin, NULL));
|
||||
}
|
||||
diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc
|
||||
index 93a1da4..79ac197 100644
|
||||
--- content/browser/frame_host/render_frame_message_filter.cc
|
||||
+++ content/browser/frame_host/render_frame_message_filter.cc
|
||||
@@ -459,6 +459,7 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id,
|
||||
|
||||
void RenderFrameMessageFilter::OnGetPlugins(
|
||||
bool refresh,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
IPC::Message* reply_msg) {
|
||||
// Don't refresh if the specified threshold has not been passed. Note that
|
||||
@@ -480,18 +481,19 @@ void RenderFrameMessageFilter::OnGetPlugins(
|
||||
|
||||
PluginServiceImpl::GetInstance()->GetPlugins(
|
||||
base::Bind(&RenderFrameMessageFilter::GetPluginsCallback, this, reply_msg,
|
||||
- main_frame_origin));
|
||||
+ is_main_frame, main_frame_origin));
|
||||
}
|
||||
|
||||
void RenderFrameMessageFilter::GetPluginsCallback(
|
||||
IPC::Message* reply_msg,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::vector<WebPluginInfo>& all_plugins) {
|
||||
// Filter the plugin list.
|
||||
PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter();
|
||||
std::vector<WebPluginInfo> plugins;
|
||||
|
||||
- int child_process_id = -1;
|
||||
+ int child_process_id = render_process_id_;
|
||||
int routing_id = MSG_ROUTING_NONE;
|
||||
// In this loop, copy the WebPluginInfo (and do not use a reference) because
|
||||
// the filter might mutate it.
|
||||
@@ -500,7 +502,7 @@ void RenderFrameMessageFilter::GetPluginsCallback(
|
||||
if (!filter ||
|
||||
filter->IsPluginAvailable(child_process_id, routing_id,
|
||||
resource_context_, main_frame_origin.GetURL(),
|
||||
- main_frame_origin, &plugin)) {
|
||||
+ is_main_frame, main_frame_origin, &plugin)) {
|
||||
plugins.push_back(plugin);
|
||||
}
|
||||
}
|
||||
@@ -512,6 +514,7 @@ void RenderFrameMessageFilter::GetPluginsCallback(
|
||||
void RenderFrameMessageFilter::OnGetPluginInfo(
|
||||
int render_frame_id,
|
||||
const GURL& url,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
bool* found,
|
||||
@@ -520,8 +523,8 @@ void RenderFrameMessageFilter::OnGetPluginInfo(
|
||||
bool allow_wildcard = true;
|
||||
*found = plugin_service_->GetPluginInfo(
|
||||
render_process_id_, render_frame_id, resource_context_, url,
|
||||
- main_frame_origin, mime_type, allow_wildcard, nullptr, info,
|
||||
- actual_mime_type);
|
||||
+ is_main_frame, main_frame_origin, mime_type, allow_wildcard, nullptr,
|
||||
+ info, actual_mime_type);
|
||||
}
|
||||
|
||||
void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin(
|
||||
diff --git content/browser/frame_host/render_frame_message_filter.h content/browser/frame_host/render_frame_message_filter.h
|
||||
index 05500b4..cd00c4c 100644
|
||||
--- content/browser/frame_host/render_frame_message_filter.h
|
||||
+++ content/browser/frame_host/render_frame_message_filter.h
|
||||
@@ -125,13 +125,16 @@ class CONTENT_EXPORT RenderFrameMessageFilter
|
||||
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
void OnGetPlugins(bool refresh,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
IPC::Message* reply_msg);
|
||||
void GetPluginsCallback(IPC::Message* reply_msg,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::vector<WebPluginInfo>& plugins);
|
||||
void OnGetPluginInfo(int render_frame_id,
|
||||
const GURL& url,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
bool* found,
|
||||
diff --git content/browser/loader/mime_sniffing_resource_handler.cc content/browser/loader/mime_sniffing_resource_handler.cc
|
||||
index 6c13e04..556e43d 100644
|
||||
--- content/browser/loader/mime_sniffing_resource_handler.cc
|
||||
+++ content/browser/loader/mime_sniffing_resource_handler.cc
|
||||
@@ -426,8 +426,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler(
|
||||
WebPluginInfo plugin;
|
||||
bool has_plugin = plugin_service_->GetPluginInfo(
|
||||
info->GetChildID(), info->GetRenderFrameID(), info->GetContext(),
|
||||
- request()->url(), url::Origin(), response_->head.mime_type,
|
||||
- allow_wildcard, &stale, &plugin, NULL);
|
||||
+ request()->url(), info->IsMainFrame(), url::Origin(),
|
||||
+ response_->head.mime_type, allow_wildcard, &stale, &plugin, NULL);
|
||||
|
||||
if (stale) {
|
||||
// Refresh the plugins asynchronously.
|
||||
diff --git content/browser/plugin_service_impl.cc content/browser/plugin_service_impl.cc
|
||||
index 480c659..ec4d108 100644
|
||||
--- content/browser/plugin_service_impl.cc
|
||||
+++ content/browser/plugin_service_impl.cc
|
||||
@@ -243,6 +243,7 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id,
|
||||
int render_frame_id,
|
||||
ResourceContext* context,
|
||||
const GURL& url,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
bool allow_wildcard,
|
||||
@@ -259,7 +260,8 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id,
|
||||
for (size_t i = 0; i < plugins.size(); ++i) {
|
||||
if (!filter_ ||
|
||||
filter_->IsPluginAvailable(render_process_id, render_frame_id, context,
|
||||
- url, main_frame_origin, &plugins[i])) {
|
||||
+ url, is_main_frame, main_frame_origin,
|
||||
+ &plugins[i])) {
|
||||
*info = plugins[i];
|
||||
if (actual_mime_type)
|
||||
*actual_mime_type = mime_types[i];
|
||||
diff --git content/browser/plugin_service_impl.h content/browser/plugin_service_impl.h
|
||||
index 3e92d37..ecd8493 100644
|
||||
--- content/browser/plugin_service_impl.h
|
||||
+++ content/browser/plugin_service_impl.h
|
||||
@@ -71,6 +71,7 @@ class CONTENT_EXPORT PluginServiceImpl
|
||||
int render_frame_id,
|
||||
ResourceContext* context,
|
||||
const GURL& url,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
bool allow_wildcard,
|
||||
diff --git content/common/frame_messages.h content/common/frame_messages.h
|
||||
index 9092344..efcdb7f 100644
|
||||
--- content/common/frame_messages.h
|
||||
+++ content/common/frame_messages.h
|
||||
@@ -1187,8 +1187,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
|
||||
|
||||
// Used to get the list of plugins. |main_frame_origin| is used to handle
|
||||
// exceptions for plugin content settings.
|
||||
-IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins,
|
||||
+IPC_SYNC_MESSAGE_CONTROL3_1(FrameHostMsg_GetPlugins,
|
||||
bool /* refresh*/,
|
||||
+ bool /* is_main_frame */,
|
||||
url::Origin /* main_frame_origin */,
|
||||
std::vector<content::WebPluginInfo> /* plugins */)
|
||||
|
||||
@@ -1196,9 +1197,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins,
|
||||
// type. If there is no matching plugin, |found| is false.
|
||||
// |actual_mime_type| is the actual mime type supported by the
|
||||
// found plugin.
|
||||
-IPC_SYNC_MESSAGE_CONTROL4_3(FrameHostMsg_GetPluginInfo,
|
||||
+IPC_SYNC_MESSAGE_CONTROL5_3(FrameHostMsg_GetPluginInfo,
|
||||
int /* render_frame_id */,
|
||||
GURL /* url */,
|
||||
+ bool /* is_main_frame */,
|
||||
url::Origin /* main_frame_origin */,
|
||||
std::string /* mime_type */,
|
||||
bool /* found */,
|
||||
diff --git content/ppapi_plugin/ppapi_blink_platform_impl.cc content/ppapi_plugin/ppapi_blink_platform_impl.cc
|
||||
index c4dc0cf..4fe3e1b 100644
|
||||
--- content/ppapi_plugin/ppapi_blink_platform_impl.cc
|
||||
+++ content/ppapi_plugin/ppapi_blink_platform_impl.cc
|
||||
@@ -210,6 +210,7 @@ blink::WebURLLoader* PpapiBlinkPlatformImpl::createURLLoader() {
|
||||
|
||||
void PpapiBlinkPlatformImpl::getPluginList(
|
||||
bool refresh,
|
||||
+ bool isMainFrame,
|
||||
const blink::WebSecurityOrigin& mainFrameOrigin,
|
||||
blink::WebPluginListBuilder* builder) {
|
||||
NOTREACHED();
|
||||
diff --git content/ppapi_plugin/ppapi_blink_platform_impl.h content/ppapi_plugin/ppapi_blink_platform_impl.h
|
||||
index 9c2ba25..11a0839 100644
|
||||
--- content/ppapi_plugin/ppapi_blink_platform_impl.h
|
||||
+++ content/ppapi_plugin/ppapi_blink_platform_impl.h
|
||||
@@ -44,6 +44,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImpl {
|
||||
blink::WebThemeEngine* themeEngine() override;
|
||||
blink::WebURLLoader* createURLLoader() override;
|
||||
void getPluginList(bool refresh,
|
||||
+ bool isMainFrame,
|
||||
const blink::WebSecurityOrigin& mainFrameOrigin,
|
||||
blink::WebPluginListBuilder*) override;
|
||||
blink::WebData loadResource(const char* name) override;
|
||||
diff --git content/public/browser/plugin_service.h content/public/browser/plugin_service.h
|
||||
index c404ac8..9dd87e7 100644
|
||||
--- content/public/browser/plugin_service.h
|
||||
+++ content/public/browser/plugin_service.h
|
||||
@@ -74,6 +74,7 @@ class PluginService {
|
||||
int render_frame_id,
|
||||
ResourceContext* context,
|
||||
const GURL& url,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
bool allow_wildcard,
|
||||
diff --git content/public/browser/plugin_service_filter.h content/public/browser/plugin_service_filter.h
|
||||
index 3b610b1..7c439e0 100644
|
||||
--- content/public/browser/plugin_service_filter.h
|
||||
+++ content/public/browser/plugin_service_filter.h
|
||||
@@ -33,6 +33,7 @@ class PluginServiceFilter {
|
||||
int render_frame_id,
|
||||
const void* context,
|
||||
const GURL& url,
|
||||
+ bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
WebPluginInfo* plugin) = 0;
|
||||
|
||||
diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc
|
||||
index 2d93238..d511e99 100644
|
||||
--- content/renderer/render_frame_impl.cc
|
||||
+++ content/renderer/render_frame_impl.cc
|
||||
@@ -2749,7 +2749,8 @@ blink::WebPlugin* RenderFrameImpl::createPlugin(
|
||||
std::string mime_type;
|
||||
bool found = false;
|
||||
Send(new FrameHostMsg_GetPluginInfo(
|
||||
- routing_id_, params.url, frame->top()->getSecurityOrigin(),
|
||||
+ routing_id_, params.url, frame->parent() == nullptr,
|
||||
+ frame->top()->getSecurityOrigin(),
|
||||
params.mimeType.utf8(), &found, &info, &mime_type));
|
||||
if (!found)
|
||||
return NULL;
|
||||
@@ -5259,9 +5260,8 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
||||
(pending_navigation_params_ &&
|
||||
!pending_navigation_params_->request_params.redirects.empty());
|
||||
|
||||
-#ifdef OS_ANDROID
|
||||
- bool render_view_was_created_by_renderer =
|
||||
- render_view_->was_created_by_renderer_;
|
||||
+ // CEF doesn't use this value, so just pass false.
|
||||
+ bool render_view_was_created_by_renderer = false;
|
||||
// The handlenavigation API is deprecated and will be removed once
|
||||
// crbug.com/325351 is resolved.
|
||||
if (GetContentClient()->renderer()->HandleNavigation(
|
||||
@@ -5270,7 +5270,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
|
||||
is_redirect)) {
|
||||
return blink::WebNavigationPolicyIgnore;
|
||||
}
|
||||
-#endif
|
||||
|
||||
Referrer referrer(
|
||||
RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest));
|
||||
diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc
|
||||
index 462b144..e44983c 100644
|
||||
--- content/renderer/renderer_blink_platform_impl.cc
|
||||
+++ content/renderer/renderer_blink_platform_impl.cc
|
||||
@@ -750,6 +750,7 @@ blink::WebMIDIAccessor* RendererBlinkPlatformImpl::createMIDIAccessor(
|
||||
|
||||
void RendererBlinkPlatformImpl::getPluginList(
|
||||
bool refresh,
|
||||
+ bool isMainFrame,
|
||||
const blink::WebSecurityOrigin& mainFrameOrigin,
|
||||
blink::WebPluginListBuilder* builder) {
|
||||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
@@ -757,7 +758,8 @@ void RendererBlinkPlatformImpl::getPluginList(
|
||||
if (!plugin_refresh_allowed_)
|
||||
refresh = false;
|
||||
RenderThread::Get()->Send(
|
||||
- new FrameHostMsg_GetPlugins(refresh, mainFrameOrigin, &plugins));
|
||||
+ new FrameHostMsg_GetPlugins(refresh, isMainFrame, mainFrameOrigin,
|
||||
+ &plugins));
|
||||
for (const WebPluginInfo& plugin : plugins) {
|
||||
builder->addPlugin(
|
||||
plugin.name, plugin.desc,
|
||||
diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h
|
||||
index 6c9ac66..f53f26e 100644
|
||||
--- content/renderer/renderer_blink_platform_impl.h
|
||||
+++ content/renderer/renderer_blink_platform_impl.h
|
||||
@@ -117,6 +117,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl {
|
||||
cc::FrameSinkId generateFrameSinkId() override;
|
||||
|
||||
void getPluginList(bool refresh,
|
||||
+ bool isMainFrame,
|
||||
const blink::WebSecurityOrigin& mainFrameOrigin,
|
||||
blink::WebPluginListBuilder* builder) override;
|
||||
blink::WebPublicSuffixList* publicSuffixList() override;
|
163
patch/patches/plugin_info_webkit_2015.patch
Normal file
163
patch/patches/plugin_info_webkit_2015.patch
Normal file
@ -0,0 +1,163 @@
|
||||
diff --git Source/core/dom/DOMImplementation.cpp Source/core/dom/DOMImplementation.cpp
|
||||
index 2b04a24..85653cf 100644
|
||||
--- Source/core/dom/DOMImplementation.cpp
|
||||
+++ Source/core/dom/DOMImplementation.cpp
|
||||
@@ -240,9 +240,9 @@ Document* DOMImplementation::createDocument(const String& type,
|
||||
// For that reason, the origin must be retrieved directly from init.url().
|
||||
if (init.frame()->isMainFrame()) {
|
||||
RefPtr<SecurityOrigin> origin = SecurityOrigin::create(init.url());
|
||||
- pluginData = init.frame()->page()->pluginData(origin.get());
|
||||
+ pluginData = init.frame()->page()->pluginData(true, origin.get());
|
||||
} else {
|
||||
- pluginData = init.frame()->page()->pluginData(
|
||||
+ pluginData = init.frame()->page()->pluginData(false,
|
||||
init.frame()->tree().top()->securityContext()->getSecurityOrigin());
|
||||
}
|
||||
}
|
||||
diff --git Source/core/frame/LocalFrame.cpp Source/core/frame/LocalFrame.cpp
|
||||
index 03edc5d..b9a91db 100644
|
||||
--- Source/core/frame/LocalFrame.cpp
|
||||
+++ Source/core/frame/LocalFrame.cpp
|
||||
@@ -920,6 +920,7 @@ PluginData* LocalFrame::pluginData() const {
|
||||
if (!loader().allowPlugins(NotAboutToInstantiatePlugin))
|
||||
return nullptr;
|
||||
return page()->pluginData(
|
||||
+ isMainFrame(),
|
||||
tree().top()->securityContext()->getSecurityOrigin());
|
||||
}
|
||||
|
||||
diff --git Source/core/page/Page.cpp Source/core/page/Page.cpp
|
||||
index 671df37..27c7d6b 100644
|
||||
--- Source/core/page/Page.cpp
|
||||
+++ Source/core/page/Page.cpp
|
||||
@@ -239,16 +239,26 @@ void Page::refreshPlugins() {
|
||||
|
||||
for (const Page* page : allPages()) {
|
||||
// Clear out the page's plugin data.
|
||||
- if (page->m_pluginData)
|
||||
- page->m_pluginData = nullptr;
|
||||
+ if (page->m_pluginDataMainFrame)
|
||||
+ page->m_pluginDataMainFrame = nullptr;
|
||||
+ if (page->m_pluginDataSubFrame)
|
||||
+ page->m_pluginDataSubFrame = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
-PluginData* Page::pluginData(SecurityOrigin* mainFrameOrigin) const {
|
||||
- if (!m_pluginData ||
|
||||
- !mainFrameOrigin->isSameSchemeHostPort(m_pluginData->origin()))
|
||||
- m_pluginData = PluginData::create(mainFrameOrigin);
|
||||
- return m_pluginData.get();
|
||||
+PluginData* Page::pluginData(bool isMainFrame,
|
||||
+ SecurityOrigin* mainFrameOrigin) const {
|
||||
+ if (isMainFrame) {
|
||||
+ if (!m_pluginDataMainFrame ||
|
||||
+ !mainFrameOrigin->isSameSchemeHostPort(m_pluginDataMainFrame->origin()))
|
||||
+ m_pluginDataMainFrame = PluginData::create(true, mainFrameOrigin);
|
||||
+ } else {
|
||||
+ if (!m_pluginDataSubFrame ||
|
||||
+ !mainFrameOrigin->isSameSchemeHostPort(m_pluginDataSubFrame->origin()))
|
||||
+ m_pluginDataSubFrame = PluginData::create(false, mainFrameOrigin);
|
||||
+ }
|
||||
+
|
||||
+ return isMainFrame ? m_pluginDataMainFrame.get() : m_pluginDataSubFrame.get();
|
||||
}
|
||||
|
||||
void Page::setValidationMessageClient(ValidationMessageClient* client) {
|
||||
diff --git Source/core/page/Page.h Source/core/page/Page.h
|
||||
index 133260a..0aef9f2 100644
|
||||
--- Source/core/page/Page.h
|
||||
+++ Source/core/page/Page.h
|
||||
@@ -127,7 +127,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
|
||||
ViewportDescription viewportDescription() const;
|
||||
|
||||
static void refreshPlugins();
|
||||
- PluginData* pluginData(SecurityOrigin* mainFrameOrigin) const;
|
||||
+ PluginData* pluginData(bool isMainFrame,
|
||||
+ SecurityOrigin* mainFrameOrigin) const;
|
||||
|
||||
EditorClient& editorClient() const { return *m_editorClient; }
|
||||
SpellCheckerClient& spellCheckerClient() const {
|
||||
@@ -268,7 +269,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
|
||||
// longer needed.
|
||||
Member<Frame> m_mainFrame;
|
||||
|
||||
- mutable RefPtr<PluginData> m_pluginData;
|
||||
+ mutable RefPtr<PluginData> m_pluginDataMainFrame;
|
||||
+ mutable RefPtr<PluginData> m_pluginDataSubFrame;
|
||||
|
||||
EditorClient* const m_editorClient;
|
||||
SpellCheckerClient* const m_spellCheckerClient;
|
||||
diff --git Source/platform/plugins/PluginData.cpp Source/platform/plugins/PluginData.cpp
|
||||
index a6da275..c879e64 100644
|
||||
--- Source/platform/plugins/PluginData.cpp
|
||||
+++ Source/platform/plugins/PluginData.cpp
|
||||
@@ -30,11 +30,12 @@
|
||||
|
||||
namespace blink {
|
||||
|
||||
-PluginData::PluginData(SecurityOrigin* mainFrameOrigin)
|
||||
- : m_mainFrameOrigin(mainFrameOrigin) {
|
||||
+PluginData::PluginData(bool isMainFrame, SecurityOrigin* mainFrameOrigin)
|
||||
+ : m_isMainFrame(isMainFrame),
|
||||
+ m_mainFrameOrigin(mainFrameOrigin) {
|
||||
PluginListBuilder builder(&m_plugins);
|
||||
Platform::current()->getPluginList(
|
||||
- false, WebSecurityOrigin(m_mainFrameOrigin), &builder);
|
||||
+ false, m_isMainFrame, WebSecurityOrigin(m_mainFrameOrigin), &builder);
|
||||
|
||||
for (unsigned i = 0; i < m_plugins.size(); ++i) {
|
||||
const PluginInfo& plugin = m_plugins[i];
|
||||
@@ -73,7 +74,8 @@ String PluginData::pluginNameForMimeType(const String& mimeType) const {
|
||||
void PluginData::refreshBrowserSidePluginCache() {
|
||||
Vector<PluginInfo> plugins;
|
||||
PluginListBuilder builder(&plugins);
|
||||
- Platform::current()->getPluginList(true, WebSecurityOrigin::createUnique(),
|
||||
+ Platform::current()->getPluginList(true, true,
|
||||
+ WebSecurityOrigin::createUnique(),
|
||||
&builder);
|
||||
}
|
||||
|
||||
diff --git Source/platform/plugins/PluginData.h Source/platform/plugins/PluginData.h
|
||||
index 0edfd70..a81c128 100644
|
||||
--- Source/platform/plugins/PluginData.h
|
||||
+++ Source/platform/plugins/PluginData.h
|
||||
@@ -52,8 +52,9 @@ class PLATFORM_EXPORT PluginData : public RefCounted<PluginData> {
|
||||
WTF_MAKE_NONCOPYABLE(PluginData);
|
||||
|
||||
public:
|
||||
- static PassRefPtr<PluginData> create(SecurityOrigin* mainFrameOrigin) {
|
||||
- return adoptRef(new PluginData(mainFrameOrigin));
|
||||
+ static PassRefPtr<PluginData> create(bool isMainFrame,
|
||||
+ SecurityOrigin* mainFrameOrigin) {
|
||||
+ return adoptRef(new PluginData(isMainFrame, mainFrameOrigin));
|
||||
}
|
||||
|
||||
const Vector<PluginInfo>& plugins() const { return m_plugins; }
|
||||
@@ -71,12 +72,13 @@ class PLATFORM_EXPORT PluginData : public RefCounted<PluginData> {
|
||||
static void refreshBrowserSidePluginCache();
|
||||
|
||||
private:
|
||||
- explicit PluginData(SecurityOrigin* mainFrameOrigin);
|
||||
+ explicit PluginData(bool isMainFrame, SecurityOrigin* mainFrameOrigin);
|
||||
const PluginInfo* pluginInfoForMimeType(const String& mimeType) const;
|
||||
|
||||
Vector<PluginInfo> m_plugins;
|
||||
Vector<MimeClassInfo> m_mimes;
|
||||
Vector<size_t> m_mimePluginIndices;
|
||||
+ bool m_isMainFrame;
|
||||
RefPtr<SecurityOrigin> m_mainFrameOrigin;
|
||||
};
|
||||
|
||||
diff --git public/platform/Platform.h public/platform/Platform.h
|
||||
index d623c5a..e28e617 100644
|
||||
--- public/platform/Platform.h
|
||||
+++ public/platform/Platform.h
|
||||
@@ -357,6 +357,7 @@ class BLINK_PLATFORM_EXPORT Platform {
|
||||
// satisfy this call. mainFrameOrigin is used by the browser process to
|
||||
// filter plugins from the plugin list based on content settings.
|
||||
virtual void getPluginList(bool refresh,
|
||||
+ bool isMainFrame,
|
||||
const WebSecurityOrigin& mainFrameOrigin,
|
||||
WebPluginListBuilder*) {}
|
||||
|
Reference in New Issue
Block a user