179 lines
8.4 KiB
Diff
179 lines
8.4 KiB
Diff
diff --git third_party/WebKit/Source/core/dom/DOMImplementation.cpp third_party/WebKit/Source/core/dom/DOMImplementation.cpp
|
|
index 9a7f30516021..22f1214abbe2 100644
|
|
--- third_party/WebKit/Source/core/dom/DOMImplementation.cpp
|
|
+++ third_party/WebKit/Source/core/dom/DOMImplementation.cpp
|
|
@@ -242,10 +242,11 @@ Document* DOMImplementation::createDocument(const String& type,
|
|
// For that reason, the origin must be retrieved directly from init.url().
|
|
if (init.GetFrame()->IsMainFrame()) {
|
|
RefPtr<SecurityOrigin> origin = SecurityOrigin::Create(init.Url());
|
|
- plugin_data = init.GetFrame()->GetPage()->GetPluginData(origin.Get());
|
|
+ plugin_data = init.GetFrame()->GetPage()->GetPluginData(true,
|
|
+ origin.Get());
|
|
} else {
|
|
plugin_data =
|
|
- init.GetFrame()->GetPage()->GetPluginData(init.GetFrame()
|
|
+ init.GetFrame()->GetPage()->GetPluginData(false, init.GetFrame()
|
|
->Tree()
|
|
.Top()
|
|
.GetSecurityContext()
|
|
diff --git third_party/WebKit/Source/core/frame/LocalFrame.cpp third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
|
index a06acdcd51ff..90ba2c860542 100644
|
|
--- third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
|
+++ third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
|
@@ -1016,7 +1016,7 @@ FrameResourceCoordinator* LocalFrame::GetFrameResourceCoordinator() {
|
|
PluginData* LocalFrame::GetPluginData() const {
|
|
if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin))
|
|
return nullptr;
|
|
- return GetPage()->GetPluginData(
|
|
+ return GetPage()->GetPluginData(IsMainFrame(),
|
|
Tree().Top().GetSecurityContext()->GetSecurityOrigin());
|
|
}
|
|
|
|
diff --git third_party/WebKit/Source/core/page/Page.cpp third_party/WebKit/Source/core/page/Page.cpp
|
|
index bdc85924f2b3..8105be8f4e5d 100644
|
|
--- third_party/WebKit/Source/core/page/Page.cpp
|
|
+++ third_party/WebKit/Source/core/page/Page.cpp
|
|
@@ -126,7 +126,8 @@ Page::Page(PageClients& page_clients)
|
|
overscroll_controller_(
|
|
OverscrollController::Create(GetVisualViewport(), GetChromeClient())),
|
|
main_frame_(nullptr),
|
|
- plugin_data_(nullptr),
|
|
+ plugin_data_main_frame_(nullptr),
|
|
+ plugin_data_sub_frame_(nullptr),
|
|
editor_client_(page_clients.editor_client),
|
|
spell_checker_client_(page_clients.spell_checker_client),
|
|
use_counter_(page_clients.chrome_client &&
|
|
@@ -300,21 +301,38 @@ void Page::RefreshPlugins() {
|
|
PluginData::RefreshBrowserSidePluginCache();
|
|
}
|
|
|
|
-PluginData* Page::GetPluginData(SecurityOrigin* main_frame_origin) {
|
|
- if (!plugin_data_)
|
|
- plugin_data_ = PluginData::Create();
|
|
+PluginData* Page::GetPluginData(bool is_main_frame,
|
|
+ SecurityOrigin* main_frame_origin) {
|
|
+ if (is_main_frame) {
|
|
+ if (!plugin_data_main_frame_)
|
|
+ plugin_data_main_frame_ = PluginData::Create();
|
|
|
|
- if (!plugin_data_->Origin() ||
|
|
- !main_frame_origin->IsSameSchemeHostPort(plugin_data_->Origin()))
|
|
- plugin_data_->UpdatePluginList(main_frame_origin);
|
|
+ if (!plugin_data_main_frame_->Origin() ||
|
|
+ !main_frame_origin->IsSameSchemeHostPort(
|
|
+ plugin_data_main_frame_->Origin()))
|
|
+ plugin_data_main_frame_->UpdatePluginList(true, main_frame_origin);
|
|
|
|
- return plugin_data_.Get();
|
|
+ return plugin_data_main_frame_.Get();
|
|
+ } else {
|
|
+ if (!plugin_data_sub_frame_)
|
|
+ plugin_data_sub_frame_ = PluginData::Create();
|
|
+
|
|
+ if (!plugin_data_sub_frame_->Origin() ||
|
|
+ !main_frame_origin->IsSameSchemeHostPort(
|
|
+ plugin_data_sub_frame_->Origin()))
|
|
+ plugin_data_sub_frame_->UpdatePluginList(false, main_frame_origin);
|
|
+
|
|
+ return plugin_data_sub_frame_.Get();
|
|
+ }
|
|
}
|
|
|
|
void Page::ResetPluginData() {
|
|
for (Page* page : AllPages()) {
|
|
- if (page->plugin_data_) {
|
|
- page->plugin_data_->ResetPluginData();
|
|
+ if (page->plugin_data_main_frame_ || page->plugin_data_sub_frame_) {
|
|
+ if (page->plugin_data_main_frame_)
|
|
+ page->plugin_data_main_frame_->ResetPluginData();
|
|
+ if (page->plugin_data_sub_frame_)
|
|
+ page->plugin_data_sub_frame_->ResetPluginData();
|
|
page->NotifyPluginsChanged();
|
|
}
|
|
}
|
|
@@ -661,7 +679,8 @@ DEFINE_TRACE(Page) {
|
|
visitor->Trace(visual_viewport_);
|
|
visitor->Trace(overscroll_controller_);
|
|
visitor->Trace(main_frame_);
|
|
- visitor->Trace(plugin_data_);
|
|
+ visitor->Trace(plugin_data_main_frame_);
|
|
+ visitor->Trace(plugin_data_sub_frame_);
|
|
visitor->Trace(validation_message_client_);
|
|
visitor->Trace(use_counter_);
|
|
visitor->Trace(plugins_changed_observers_);
|
|
diff --git third_party/WebKit/Source/core/page/Page.h third_party/WebKit/Source/core/page/Page.h
|
|
index 0ba364b0a934..e9b79de58841 100644
|
|
--- third_party/WebKit/Source/core/page/Page.h
|
|
+++ third_party/WebKit/Source/core/page/Page.h
|
|
@@ -135,7 +135,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
|
|
ViewportDescription GetViewportDescription() const;
|
|
|
|
// Returns the plugin data associated with |main_frame_origin|.
|
|
- PluginData* GetPluginData(SecurityOrigin* main_frame_origin);
|
|
+ PluginData* GetPluginData(bool is_main_frame,
|
|
+ SecurityOrigin* main_frame_origin);
|
|
|
|
// Refreshes the browser-side plugin cache.
|
|
static void RefreshPlugins();
|
|
@@ -351,7 +352,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
|
|
// longer needed.
|
|
Member<Frame> main_frame_;
|
|
|
|
- Member<PluginData> plugin_data_;
|
|
+ Member<PluginData> plugin_data_main_frame_;
|
|
+ Member<PluginData> plugin_data_sub_frame_;
|
|
|
|
EditorClient* const editor_client_;
|
|
SpellCheckerClient* const spell_checker_client_;
|
|
diff --git third_party/WebKit/Source/platform/plugins/PluginData.cpp third_party/WebKit/Source/platform/plugins/PluginData.cpp
|
|
index 5eb6af5fbdd5..eac85461c7de 100644
|
|
--- third_party/WebKit/Source/platform/plugins/PluginData.cpp
|
|
+++ third_party/WebKit/Source/platform/plugins/PluginData.cpp
|
|
@@ -79,16 +79,18 @@ DEFINE_TRACE(PluginData) {
|
|
// static
|
|
void PluginData::RefreshBrowserSidePluginCache() {
|
|
PluginListBuilder builder(nullptr);
|
|
- Platform::Current()->GetPluginList(true, WebSecurityOrigin::CreateUnique(),
|
|
+ Platform::Current()->GetPluginList(true, true,
|
|
+ WebSecurityOrigin::CreateUnique(),
|
|
&builder);
|
|
}
|
|
|
|
-void PluginData::UpdatePluginList(SecurityOrigin* main_frame_origin) {
|
|
+void PluginData::UpdatePluginList(bool is_main_frame,
|
|
+ SecurityOrigin* main_frame_origin) {
|
|
ResetPluginData();
|
|
main_frame_origin_ = main_frame_origin;
|
|
PluginListBuilder builder(&plugins_);
|
|
Platform::Current()->GetPluginList(
|
|
- false, WebSecurityOrigin(main_frame_origin_), &builder);
|
|
+ false, is_main_frame, WebSecurityOrigin(main_frame_origin_), &builder);
|
|
|
|
for (PluginInfo* plugin_info : plugins_) {
|
|
for (MimeClassInfo* mime_class_info : plugin_info->mimes_)
|
|
diff --git third_party/WebKit/Source/platform/plugins/PluginData.h third_party/WebKit/Source/platform/plugins/PluginData.h
|
|
index 6cb520cd5810..fdcaf938b28a 100644
|
|
--- third_party/WebKit/Source/platform/plugins/PluginData.h
|
|
+++ third_party/WebKit/Source/platform/plugins/PluginData.h
|
|
@@ -93,7 +93,7 @@ class PLATFORM_EXPORT PluginData final
|
|
const HeapVector<Member<PluginInfo>>& Plugins() const { return plugins_; }
|
|
const HeapVector<Member<MimeClassInfo>>& Mimes() const { return mimes_; }
|
|
const SecurityOrigin* Origin() const { return main_frame_origin_.Get(); }
|
|
- void UpdatePluginList(SecurityOrigin* main_frame_origin);
|
|
+ void UpdatePluginList(bool is_main_frame, SecurityOrigin* main_frame_origin);
|
|
void ResetPluginData();
|
|
|
|
bool SupportsMimeType(const String& mime_type) const;
|
|
diff --git third_party/WebKit/public/platform/Platform.h third_party/WebKit/public/platform/Platform.h
|
|
index de906059109c..baaeb09ec8f5 100644
|
|
--- third_party/WebKit/public/platform/Platform.h
|
|
+++ third_party/WebKit/public/platform/Platform.h
|
|
@@ -384,6 +384,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 is_main_frame,
|
|
const WebSecurityOrigin& main_frame_origin,
|
|
WebPluginListBuilder*) {}
|
|
|