228 lines
10 KiB
Diff
228 lines
10 KiB
Diff
diff --git third_party/blink/public/mojom/plugins/plugin_registry.mojom third_party/blink/public/mojom/plugins/plugin_registry.mojom
|
|
index ff7a8ed89e94a..77f44956ff22f 100644
|
|
--- third_party/blink/public/mojom/plugins/plugin_registry.mojom
|
|
+++ third_party/blink/public/mojom/plugins/plugin_registry.mojom
|
|
@@ -36,5 +36,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);
|
|
};
|
|
diff --git third_party/blink/public/platform/platform.h third_party/blink/public/platform/platform.h
|
|
index f9be3480ae7c9..913d327af7a85 100644
|
|
--- third_party/blink/public/platform/platform.h
|
|
+++ third_party/blink/public/platform/platform.h
|
|
@@ -872,6 +872,11 @@ class BLINK_PLATFORM_EXPORT Platform {
|
|
const WebURL& url,
|
|
blink::WebVector<blink::WebContentSecurityPolicyHeader>* csp) {}
|
|
|
|
+ // DevTools ------------------------------------------------------------
|
|
+
|
|
+ virtual void DevToolsAgentAttached() {}
|
|
+ virtual void DevToolsAgentDetached() {}
|
|
+
|
|
private:
|
|
static void InitializeMainThreadCommon(Platform* platform,
|
|
std::unique_ptr<Thread> main_thread);
|
|
diff --git third_party/blink/renderer/core/dom/document_init.cc third_party/blink/renderer/core/dom/document_init.cc
|
|
index 463e3e5e73419..97aaf0da2b9a5 100644
|
|
--- third_party/blink/renderer/core/dom/document_init.cc
|
|
+++ third_party/blink/renderer/core/dom/document_init.cc
|
|
@@ -177,11 +177,11 @@ PluginData* DocumentInit::GetPluginData(LocalFrame* frame, const KURL& url) {
|
|
// frame()->tree().top()->securityContext() returns nullptr.
|
|
// For that reason, the origin must be retrieved directly from |url|.
|
|
if (frame->IsMainFrame())
|
|
- return frame->GetPage()->GetPluginData(SecurityOrigin::Create(url).get());
|
|
+ return frame->GetPage()->GetPluginData(true, SecurityOrigin::Create(url).get());
|
|
|
|
const SecurityOrigin* main_frame_origin =
|
|
frame->Tree().Top().GetSecurityContext()->GetSecurityOrigin();
|
|
- return frame->GetPage()->GetPluginData(main_frame_origin);
|
|
+ return frame->GetPage()->GetPluginData(false, main_frame_origin);
|
|
}
|
|
|
|
DocumentInit& DocumentInit::WithTypeFrom(const String& mime_type) {
|
|
diff --git third_party/blink/renderer/core/frame/local_frame.cc third_party/blink/renderer/core/frame/local_frame.cc
|
|
index cf505929c9f6e..ad6d5b603223f 100644
|
|
--- third_party/blink/renderer/core/frame/local_frame.cc
|
|
+++ third_party/blink/renderer/core/frame/local_frame.cc
|
|
@@ -1853,7 +1853,7 @@ WebContentSettingsClient* LocalFrame::GetContentSettingsClient() {
|
|
PluginData* LocalFrame::GetPluginData() const {
|
|
if (!Loader().AllowPlugins())
|
|
return nullptr;
|
|
- return GetPage()->GetPluginData(
|
|
+ return GetPage()->GetPluginData(IsMainFrame(),
|
|
Tree().Top().GetSecurityContext()->GetSecurityOrigin());
|
|
}
|
|
|
|
diff --git third_party/blink/renderer/core/inspector/devtools_session.cc third_party/blink/renderer/core/inspector/devtools_session.cc
|
|
index b28a69f901a56..7a04bd07b6b16 100644
|
|
--- third_party/blink/renderer/core/inspector/devtools_session.cc
|
|
+++ third_party/blink/renderer/core/inspector/devtools_session.cc
|
|
@@ -8,6 +8,7 @@
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
+#include "third_party/blink/public/platform/platform.h"
|
|
#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/inspector/devtools_agent.h"
|
|
@@ -146,6 +147,7 @@ DevToolsSession::DevToolsSession(
|
|
for (wtf_size_t i = 0; i < agents_.size(); i++)
|
|
agents_[i]->Restore();
|
|
}
|
|
+ Platform::Current()->DevToolsAgentAttached();
|
|
}
|
|
|
|
DevToolsSession::~DevToolsSession() {
|
|
@@ -186,6 +188,7 @@ void DevToolsSession::Detach() {
|
|
agents_.clear();
|
|
v8_session_.reset();
|
|
agent_->client_->DebuggerTaskFinished();
|
|
+ Platform::Current()->DevToolsAgentDetached();
|
|
}
|
|
|
|
void DevToolsSession::DispatchProtocolCommand(
|
|
diff --git third_party/blink/renderer/core/page/page.cc third_party/blink/renderer/core/page/page.cc
|
|
index 3afca2407df4b..6127652fb5f42 100644
|
|
--- third_party/blink/renderer/core/page/page.cc
|
|
+++ third_party/blink/renderer/core/page/page.cc
|
|
@@ -212,7 +212,8 @@ Page::Page(base::PassKey<Page>,
|
|
MakeGarbageCollected<OverscrollController>(GetVisualViewport(),
|
|
GetChromeClient())),
|
|
link_highlight_(MakeGarbageCollected<LinkHighlight>(*this)),
|
|
- plugin_data_(nullptr),
|
|
+ plugin_data_main_frame_(nullptr),
|
|
+ plugin_data_sub_frame_(nullptr),
|
|
// TODO(pdr): Initialize |validation_message_client_| lazily.
|
|
validation_message_client_(
|
|
MakeGarbageCollected<ValidationMessageClientImpl>(*this)),
|
|
@@ -404,21 +405,41 @@ void Page::InitialStyleChanged() {
|
|
}
|
|
}
|
|
|
|
-PluginData* Page::GetPluginData(const SecurityOrigin* main_frame_origin) {
|
|
- if (!plugin_data_)
|
|
- plugin_data_ = MakeGarbageCollected<PluginData>();
|
|
+PluginData* Page::GetPluginData(bool is_main_frame,
|
|
+ const SecurityOrigin* main_frame_origin) {
|
|
+ if (is_main_frame) {
|
|
+ if (!plugin_data_main_frame_)
|
|
+ plugin_data_main_frame_ = MakeGarbageCollected<PluginData>();
|
|
|
|
- if (!plugin_data_->Origin() ||
|
|
- !main_frame_origin->IsSameOriginWith(plugin_data_->Origin()))
|
|
- plugin_data_->UpdatePluginList(main_frame_origin);
|
|
|
|
- return plugin_data_.Get();
|
|
+ if (!plugin_data_main_frame_->Origin() ||
|
|
+ !main_frame_origin->IsSameOriginWith(
|
|
+ plugin_data_main_frame_->Origin())) {
|
|
+ plugin_data_main_frame_->UpdatePluginList(true, main_frame_origin);
|
|
+ }
|
|
+
|
|
+ return plugin_data_main_frame_.Get();
|
|
+ } else {
|
|
+ if (!plugin_data_sub_frame_)
|
|
+ plugin_data_sub_frame_ = MakeGarbageCollected<PluginData>();
|
|
+
|
|
+ if (!plugin_data_sub_frame_->Origin() ||
|
|
+ !main_frame_origin->IsSameOriginWith(
|
|
+ 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();
|
|
}
|
|
}
|
|
@@ -929,7 +950,8 @@ void Page::Trace(Visitor* visitor) const {
|
|
visitor->Trace(link_highlight_);
|
|
visitor->Trace(spatial_navigation_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(plugins_changed_observers_);
|
|
visitor->Trace(next_related_page_);
|
|
diff --git third_party/blink/renderer/core/page/page.h third_party/blink/renderer/core/page/page.h
|
|
index 72e214c315acf..c89b578f7d6d5 100644
|
|
--- third_party/blink/renderer/core/page/page.h
|
|
+++ third_party/blink/renderer/core/page/page.h
|
|
@@ -148,7 +148,8 @@ class CORE_EXPORT Page final : public GarbageCollected<Page>,
|
|
ViewportDescription GetViewportDescription() const;
|
|
|
|
// Returns the plugin data associated with |main_frame_origin|.
|
|
- PluginData* GetPluginData(const SecurityOrigin* main_frame_origin);
|
|
+ PluginData* GetPluginData(bool is_main_frame,
|
|
+ const SecurityOrigin* main_frame_origin);
|
|
|
|
// Resets the plugin data for all pages in the renderer process and notifies
|
|
// PluginsChangedObservers.
|
|
@@ -433,7 +434,8 @@ class CORE_EXPORT Page final : public GarbageCollected<Page>,
|
|
const Member<LinkHighlight> link_highlight_;
|
|
Member<SpatialNavigationController> spatial_navigation_controller_;
|
|
|
|
- Member<PluginData> plugin_data_;
|
|
+ Member<PluginData> plugin_data_main_frame_;
|
|
+ Member<PluginData> plugin_data_sub_frame_;
|
|
|
|
Member<ValidationMessageClient> validation_message_client_;
|
|
|
|
diff --git third_party/blink/renderer/core/page/plugin_data.cc third_party/blink/renderer/core/page/plugin_data.cc
|
|
index c5f0d9c55c56b..83949238bd4dd 100644
|
|
--- third_party/blink/renderer/core/page/plugin_data.cc
|
|
+++ third_party/blink/renderer/core/page/plugin_data.cc
|
|
@@ -96,10 +96,12 @@ void PluginData::RefreshBrowserSidePluginCache() {
|
|
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
|
|
registry.BindNewPipeAndPassReceiver());
|
|
Vector<mojom::blink::PluginInfoPtr> plugins;
|
|
- registry->GetPlugins(true, SecurityOrigin::CreateUniqueOpaque(), &plugins);
|
|
+ registry->GetPlugins(true, true, SecurityOrigin::CreateUniqueOpaque(),
|
|
+ &plugins);
|
|
}
|
|
|
|
-void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) {
|
|
+void PluginData::UpdatePluginList(bool is_main_frame,
|
|
+ const SecurityOrigin* main_frame_origin) {
|
|
SCOPED_UMA_HISTOGRAM_TIMER("Blink.Plugin.UpdateTime");
|
|
ResetPluginData();
|
|
main_frame_origin_ = main_frame_origin;
|
|
@@ -108,7 +110,7 @@ void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) {
|
|
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
|
|
registry.BindNewPipeAndPassReceiver());
|
|
Vector<mojom::blink::PluginInfoPtr> plugins;
|
|
- registry->GetPlugins(false, main_frame_origin_, &plugins);
|
|
+ registry->GetPlugins(false, is_main_frame, main_frame_origin_, &plugins);
|
|
for (const auto& plugin : plugins) {
|
|
auto* plugin_info = MakeGarbageCollected<PluginInfo>(
|
|
std::move(plugin->name), FilePathToWebString(plugin->filename),
|
|
diff --git third_party/blink/renderer/core/page/plugin_data.h third_party/blink/renderer/core/page/plugin_data.h
|
|
index 0d5439e9238aa..89478997bd808 100644
|
|
--- third_party/blink/renderer/core/page/plugin_data.h
|
|
+++ third_party/blink/renderer/core/page/plugin_data.h
|
|
@@ -101,7 +101,8 @@ class CORE_EXPORT PluginData final : public GarbageCollected<PluginData> {
|
|
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(const SecurityOrigin* main_frame_origin);
|
|
+ void UpdatePluginList(bool is_main_frame,
|
|
+ const SecurityOrigin* main_frame_origin);
|
|
void ResetPluginData();
|
|
|
|
bool SupportsMimeType(const String& mime_type) const;
|