2018-07-02 19:11:49 +02:00
|
|
|
diff --git third_party/blink/public/mojom/plugins/plugin_registry.mojom third_party/blink/public/mojom/plugins/plugin_registry.mojom
|
|
|
|
index 92e9cb865204..4628c56882b4 100644
|
|
|
|
--- third_party/blink/public/mojom/plugins/plugin_registry.mojom
|
|
|
|
+++ third_party/blink/public/mojom/plugins/plugin_registry.mojom
|
|
|
|
@@ -34,5 +34,5 @@ interface PluginRegistry {
|
|
|
|
//
|
|
|
|
// TODO(crbug.com/850278): We shouldn't rely on the renderer to tell us the main frame origin.
|
|
|
|
[Sync]
|
|
|
|
- GetPlugins(bool refresh, url.mojom.Origin main_frame_origin) => (array<PluginInfo> plugins);
|
|
|
|
+ GetPlugins(bool refresh, bool is_main_frame, url.mojom.Origin main_frame_origin) => (array<PluginInfo> plugins);
|
|
|
|
};
|
2018-04-19 17:44:42 +02:00
|
|
|
diff --git third_party/blink/public/platform/platform.h third_party/blink/public/platform/platform.h
|
2019-02-21 01:42:36 +01:00
|
|
|
index 55bd97c5ddae..5d69388be783 100644
|
2018-04-19 17:44:42 +02:00
|
|
|
--- third_party/blink/public/platform/platform.h
|
|
|
|
+++ third_party/blink/public/platform/platform.h
|
2019-02-21 01:42:36 +01:00
|
|
|
@@ -732,6 +732,11 @@ class BLINK_PLATFORM_EXPORT Platform {
|
2018-04-19 17:44:42 +02:00
|
|
|
// runs during Chromium's build step).
|
|
|
|
virtual bool IsTakingV8ContextSnapshot() { return false; }
|
|
|
|
|
|
|
|
+ // DevTools ------------------------------------------------------------
|
|
|
|
+
|
|
|
|
+ virtual void DevToolsAgentAttached() {}
|
|
|
|
+ virtual void DevToolsAgentDetached() {}
|
|
|
|
+
|
2018-11-03 02:15:09 +01:00
|
|
|
private:
|
|
|
|
static void InitializeCommon(Platform* platform,
|
|
|
|
std::unique_ptr<Thread> main_thread);
|
2018-04-19 17:44:42 +02:00
|
|
|
diff --git third_party/blink/renderer/core/dom/dom_implementation.cc third_party/blink/renderer/core/dom/dom_implementation.cc
|
2019-02-01 20:40:18 +01:00
|
|
|
index 31d7915a56b1..3867128de143 100644
|
2018-04-19 17:44:42 +02:00
|
|
|
--- third_party/blink/renderer/core/dom/dom_implementation.cc
|
|
|
|
+++ third_party/blink/renderer/core/dom/dom_implementation.cc
|
2018-02-15 01:12:09 +01:00
|
|
|
@@ -243,10 +243,11 @@ Document* DOMImplementation::createDocument(const String& type,
|
2017-04-20 21:28:17 +02:00
|
|
|
if (init.GetFrame()->IsMainFrame()) {
|
2018-02-15 01:12:09 +01:00
|
|
|
scoped_refptr<const SecurityOrigin> origin =
|
|
|
|
SecurityOrigin::Create(init.Url());
|
2017-10-20 19:45:20 +02:00
|
|
|
- plugin_data = init.GetFrame()->GetPage()->GetPluginData(origin.get());
|
2017-04-20 21:28:17 +02:00
|
|
|
+ plugin_data = init.GetFrame()->GetPage()->GetPluginData(true,
|
2017-10-20 19:45:20 +02:00
|
|
|
+ origin.get());
|
2017-04-20 21:28:17 +02:00
|
|
|
} else {
|
|
|
|
plugin_data =
|
|
|
|
- init.GetFrame()->GetPage()->GetPluginData(init.GetFrame()
|
|
|
|
+ init.GetFrame()->GetPage()->GetPluginData(false, init.GetFrame()
|
|
|
|
->Tree()
|
|
|
|
.Top()
|
2017-05-31 17:33:30 +02:00
|
|
|
.GetSecurityContext()
|
2018-04-19 17:44:42 +02:00
|
|
|
diff --git third_party/blink/renderer/core/frame/local_frame.cc third_party/blink/renderer/core/frame/local_frame.cc
|
2019-02-21 01:42:36 +01:00
|
|
|
index daf6c8f000dd..ca2ac98edf8a 100644
|
2018-04-19 17:44:42 +02:00
|
|
|
--- third_party/blink/renderer/core/frame/local_frame.cc
|
|
|
|
+++ third_party/blink/renderer/core/frame/local_frame.cc
|
2019-02-21 01:42:36 +01:00
|
|
|
@@ -1322,7 +1322,7 @@ FrameResourceCoordinator* LocalFrame::GetFrameResourceCoordinator() {
|
2017-04-20 21:28:17 +02:00
|
|
|
PluginData* LocalFrame::GetPluginData() const {
|
|
|
|
if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin))
|
|
|
|
return nullptr;
|
|
|
|
- return GetPage()->GetPluginData(
|
|
|
|
+ return GetPage()->GetPluginData(IsMainFrame(),
|
2017-05-31 17:33:30 +02:00
|
|
|
Tree().Top().GetSecurityContext()->GetSecurityOrigin());
|
2017-04-20 21:28:17 +02:00
|
|
|
}
|
|
|
|
|
2018-11-03 02:15:09 +01:00
|
|
|
diff --git third_party/blink/renderer/core/inspector/devtools_session.cc third_party/blink/renderer/core/inspector/devtools_session.cc
|
2019-02-21 01:42:36 +01:00
|
|
|
index 3eb429271b95..3ebd2ac75f4d 100644
|
2018-11-03 02:15:09 +01:00
|
|
|
--- third_party/blink/renderer/core/inspector/devtools_session.cc
|
|
|
|
+++ third_party/blink/renderer/core/inspector/devtools_session.cc
|
|
|
|
@@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
#include "third_party/blink/renderer/core/inspector/devtools_session.h"
|
2018-10-24 22:37:39 +02:00
|
|
|
|
|
|
|
+#include "third_party/blink/public/platform/platform.h"
|
2018-11-03 02:15:09 +01:00
|
|
|
#include "third_party/blink/renderer/bindings/core/v8/script_controller.h"
|
|
|
|
#include "third_party/blink/renderer/core/frame/local_frame.h"
|
|
|
|
#include "third_party/blink/renderer/core/frame/use_counter.h"
|
2019-02-21 01:42:36 +01:00
|
|
|
@@ -146,6 +147,7 @@ DevToolsSession::DevToolsSession(
|
2018-11-03 02:15:09 +01:00
|
|
|
for (wtf_size_t i = 0; i < agents_.size(); i++)
|
|
|
|
agents_[i]->Restore();
|
|
|
|
}
|
2018-10-24 22:37:39 +02:00
|
|
|
+ Platform::Current()->DevToolsAgentAttached();
|
|
|
|
}
|
|
|
|
|
2018-11-03 02:15:09 +01:00
|
|
|
DevToolsSession::~DevToolsSession() {
|
2019-02-21 01:42:36 +01:00
|
|
|
@@ -184,6 +186,7 @@ void DevToolsSession::Detach() {
|
2018-11-03 02:15:09 +01:00
|
|
|
agents_.clear();
|
|
|
|
v8_session_.reset();
|
|
|
|
agent_->client_->DebuggerTaskFinished();
|
2018-10-24 22:37:39 +02:00
|
|
|
+ Platform::Current()->DevToolsAgentDetached();
|
|
|
|
}
|
|
|
|
|
2018-11-03 02:15:09 +01:00
|
|
|
void DevToolsSession::FlushProtocolNotifications() {
|
2018-04-19 17:44:42 +02:00
|
|
|
diff --git third_party/blink/renderer/core/page/page.cc third_party/blink/renderer/core/page/page.cc
|
2019-02-21 01:42:36 +01:00
|
|
|
index b1533fe6db9a..6c006296ef9e 100644
|
2018-04-19 17:44:42 +02:00
|
|
|
--- third_party/blink/renderer/core/page/page.cc
|
|
|
|
+++ third_party/blink/renderer/core/page/page.cc
|
2019-02-21 01:42:36 +01:00
|
|
|
@@ -171,7 +171,8 @@ Page::Page(PageClients& page_clients)
|
2018-07-13 21:29:20 +02:00
|
|
|
overscroll_controller_(
|
2017-07-27 01:19:27 +02:00
|
|
|
OverscrollController::Create(GetVisualViewport(), GetChromeClient())),
|
2018-07-24 00:32:02 +02:00
|
|
|
link_highlights_(LinkHighlights::Create(*this)),
|
2017-07-27 01:19:27 +02:00
|
|
|
- plugin_data_(nullptr),
|
|
|
|
+ plugin_data_main_frame_(nullptr),
|
|
|
|
+ plugin_data_sub_frame_(nullptr),
|
2018-09-04 11:43:21 +02:00
|
|
|
// TODO(pdr): Initialize |validation_message_client_| lazily.
|
|
|
|
validation_message_client_(ValidationMessageClientImpl::Create(*this)),
|
2018-07-13 21:29:20 +02:00
|
|
|
opened_by_dom_(false),
|
2019-02-21 01:42:36 +01:00
|
|
|
@@ -326,21 +327,40 @@ void Page::InitialStyleChanged() {
|
2018-06-08 18:53:10 +02:00
|
|
|
}
|
2017-04-20 21:28:17 +02:00
|
|
|
}
|
|
|
|
|
2018-02-15 01:12:09 +01:00
|
|
|
-PluginData* Page::GetPluginData(const SecurityOrigin* main_frame_origin) {
|
2017-07-27 01:19:27 +02:00
|
|
|
- if (!plugin_data_)
|
|
|
|
- plugin_data_ = PluginData::Create();
|
2017-04-20 21:28:17 +02:00
|
|
|
+PluginData* Page::GetPluginData(bool is_main_frame,
|
2018-02-15 01:12:09 +01:00
|
|
|
+ const SecurityOrigin* main_frame_origin) {
|
2017-04-20 21:28:17 +02:00
|
|
|
+ if (is_main_frame) {
|
2017-07-27 01:19:27 +02:00
|
|
|
+ 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() ||
|
2017-04-20 21:28:17 +02:00
|
|
|
+ !main_frame_origin->IsSameSchemeHostPort(
|
2018-02-15 01:12:09 +01:00
|
|
|
+ plugin_data_main_frame_->Origin())) {
|
2017-07-27 01:19:27 +02:00
|
|
|
+ plugin_data_main_frame_->UpdatePluginList(true, main_frame_origin);
|
2018-02-15 01:12:09 +01:00
|
|
|
+ }
|
|
|
|
+
|
2017-04-20 21:28:17 +02:00
|
|
|
+ return plugin_data_main_frame_.Get();
|
|
|
|
+ } else {
|
2017-07-27 01:19:27 +02:00
|
|
|
+ if (!plugin_data_sub_frame_)
|
|
|
|
+ plugin_data_sub_frame_ = PluginData::Create();
|
2018-02-15 01:12:09 +01:00
|
|
|
|
|
|
|
- return plugin_data_.Get();
|
2017-07-27 01:19:27 +02:00
|
|
|
+ if (!plugin_data_sub_frame_->Origin() ||
|
2017-04-20 21:28:17 +02:00
|
|
|
+ !main_frame_origin->IsSameSchemeHostPort(
|
2018-02-15 01:12:09 +01:00
|
|
|
+ plugin_data_sub_frame_->Origin())) {
|
2017-07-27 01:19:27 +02:00
|
|
|
+ plugin_data_sub_frame_->UpdatePluginList(false, main_frame_origin);
|
2018-02-15 01:12:09 +01:00
|
|
|
+ }
|
2017-07-27 01:19:27 +02:00
|
|
|
+
|
2017-04-20 21:28:17 +02:00
|
|
|
+ return plugin_data_sub_frame_.Get();
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
2017-07-27 01:19:27 +02:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
2019-02-21 01:42:36 +01:00
|
|
|
@@ -745,7 +765,8 @@ void Page::Trace(blink::Visitor* visitor) {
|
2018-07-24 00:32:02 +02:00
|
|
|
visitor->Trace(link_highlights_);
|
2019-02-01 17:42:40 +01:00
|
|
|
visitor->Trace(spatial_navigation_controller_);
|
2017-07-27 01:19:27 +02:00
|
|
|
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(plugins_changed_observers_);
|
2018-07-13 21:29:20 +02:00
|
|
|
visitor->Trace(next_related_page_);
|
2018-04-19 17:44:42 +02:00
|
|
|
diff --git third_party/blink/renderer/core/page/page.h third_party/blink/renderer/core/page/page.h
|
2019-02-21 01:42:36 +01:00
|
|
|
index 38e73455007f..cae4a0c51d55 100644
|
2018-04-19 17:44:42 +02:00
|
|
|
--- third_party/blink/renderer/core/page/page.h
|
|
|
|
+++ third_party/blink/renderer/core/page/page.h
|
2019-02-21 01:42:36 +01:00
|
|
|
@@ -139,7 +139,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
|
2017-04-20 21:28:17 +02:00
|
|
|
ViewportDescription GetViewportDescription() const;
|
|
|
|
|
2017-07-27 01:19:27 +02:00
|
|
|
// Returns the plugin data associated with |main_frame_origin|.
|
2018-02-15 01:12:09 +01:00
|
|
|
- PluginData* GetPluginData(const SecurityOrigin* main_frame_origin);
|
2017-04-20 21:28:17 +02:00
|
|
|
+ PluginData* GetPluginData(bool is_main_frame,
|
2018-02-15 01:12:09 +01:00
|
|
|
+ const SecurityOrigin* main_frame_origin);
|
2017-04-20 21:28:17 +02:00
|
|
|
|
2018-06-08 18:53:10 +02:00
|
|
|
// Resets the plugin data for all pages in the renderer process and notifies
|
|
|
|
// PluginsChangedObservers.
|
2019-02-21 01:42:36 +01:00
|
|
|
@@ -361,7 +362,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
|
2018-07-24 00:32:02 +02:00
|
|
|
const Member<LinkHighlights> link_highlights_;
|
2019-02-01 17:42:40 +01:00
|
|
|
Member<SpatialNavigationController> spatial_navigation_controller_;
|
2017-04-20 21:28:17 +02:00
|
|
|
|
2017-07-27 01:19:27 +02:00
|
|
|
- Member<PluginData> plugin_data_;
|
|
|
|
+ Member<PluginData> plugin_data_main_frame_;
|
|
|
|
+ Member<PluginData> plugin_data_sub_frame_;
|
2017-04-20 21:28:17 +02:00
|
|
|
|
2018-02-15 01:12:09 +01:00
|
|
|
Member<ValidationMessageClient> validation_message_client_;
|
|
|
|
|
2018-04-19 17:44:42 +02:00
|
|
|
diff --git third_party/blink/renderer/platform/plugins/plugin_data.cc third_party/blink/renderer/platform/plugins/plugin_data.cc
|
2018-12-26 16:12:11 +01:00
|
|
|
index 29721cbbc167..bfb0086206a4 100644
|
2018-04-19 17:44:42 +02:00
|
|
|
--- third_party/blink/renderer/platform/plugins/plugin_data.cc
|
|
|
|
+++ third_party/blink/renderer/platform/plugins/plugin_data.cc
|
2018-07-02 19:11:49 +02:00
|
|
|
@@ -88,10 +88,12 @@ void PluginData::RefreshBrowserSidePluginCache() {
|
|
|
|
Platform::Current()->GetInterfaceProvider()->GetInterface(
|
|
|
|
mojo::MakeRequest(®istry));
|
|
|
|
Vector<mojom::blink::PluginInfoPtr> plugins;
|
|
|
|
- registry->GetPlugins(true, SecurityOrigin::CreateUniqueOpaque(), &plugins);
|
|
|
|
+ registry->GetPlugins(true, true, SecurityOrigin::CreateUniqueOpaque(),
|
|
|
|
+ &plugins);
|
2017-04-20 21:28:17 +02:00
|
|
|
}
|
|
|
|
|
2018-02-15 01:12:09 +01:00
|
|
|
-void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) {
|
2017-07-27 01:19:27 +02:00
|
|
|
+void PluginData::UpdatePluginList(bool is_main_frame,
|
2018-02-15 01:12:09 +01:00
|
|
|
+ const SecurityOrigin* main_frame_origin) {
|
2017-07-27 01:19:27 +02:00
|
|
|
ResetPluginData();
|
|
|
|
main_frame_origin_ = main_frame_origin;
|
|
|
|
|
2018-10-02 14:14:11 +02:00
|
|
|
@@ -99,7 +101,7 @@ void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) {
|
2018-07-02 19:11:49 +02:00
|
|
|
Platform::Current()->GetInterfaceProvider()->GetInterface(
|
|
|
|
mojo::MakeRequest(®istry));
|
|
|
|
Vector<mojom::blink::PluginInfoPtr> plugins;
|
2018-10-02 14:14:11 +02:00
|
|
|
- registry->GetPlugins(false, main_frame_origin_, &plugins);
|
|
|
|
+ registry->GetPlugins(false, is_main_frame, main_frame_origin_, &plugins);
|
2018-07-02 19:11:49 +02:00
|
|
|
for (const auto& plugin : plugins) {
|
2018-12-26 16:12:11 +01:00
|
|
|
auto* plugin_info = MakeGarbageCollected<PluginInfo>(
|
|
|
|
plugin->name, FilePathToWebString(plugin->filename),
|
2018-04-19 17:44:42 +02:00
|
|
|
diff --git third_party/blink/renderer/platform/plugins/plugin_data.h third_party/blink/renderer/platform/plugins/plugin_data.h
|
2018-12-26 16:12:11 +01:00
|
|
|
index bb48e3956f52..18fc136fd971 100644
|
2018-04-19 17:44:42 +02:00
|
|
|
--- third_party/blink/renderer/platform/plugins/plugin_data.h
|
|
|
|
+++ third_party/blink/renderer/platform/plugins/plugin_data.h
|
2018-12-26 16:12:11 +01:00
|
|
|
@@ -103,7 +103,8 @@ class PLATFORM_EXPORT PluginData final
|
2017-07-27 01:19:27 +02:00
|
|
|
const HeapVector<Member<PluginInfo>>& Plugins() const { return plugins_; }
|
|
|
|
const HeapVector<Member<MimeClassInfo>>& Mimes() const { return mimes_; }
|
2017-10-20 19:45:20 +02:00
|
|
|
const SecurityOrigin* Origin() const { return main_frame_origin_.get(); }
|
2018-02-15 01:12:09 +01:00
|
|
|
- void UpdatePluginList(const SecurityOrigin* main_frame_origin);
|
|
|
|
+ void UpdatePluginList(bool is_main_frame,
|
|
|
|
+ const SecurityOrigin* main_frame_origin);
|
2017-07-27 01:19:27 +02:00
|
|
|
void ResetPluginData();
|
|
|
|
|
|
|
|
bool SupportsMimeType(const String& mime_type) const;
|