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
|
2021-04-21 00:52:34 +02:00
|
|
|
index ff7a8ed89e94a..77f44956ff22f 100644
|
2018-07-02 19:11:49 +02:00
|
|
|
--- third_party/blink/public/mojom/plugins/plugin_registry.mojom
|
|
|
|
+++ third_party/blink/public/mojom/plugins/plugin_registry.mojom
|
2019-07-16 19:59:21 +02:00
|
|
|
@@ -36,5 +36,5 @@ interface PluginRegistry {
|
2018-07-02 19:11:49 +02:00
|
|
|
//
|
|
|
|
// 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
|
2021-04-21 00:52:34 +02:00
|
|
|
index b5904a748f70b..a936bd95229b7 100644
|
2018-04-19 17:44:42 +02:00
|
|
|
--- third_party/blink/public/platform/platform.h
|
|
|
|
+++ third_party/blink/public/platform/platform.h
|
2021-04-21 00:52:34 +02:00
|
|
|
@@ -774,6 +774,11 @@ class BLINK_PLATFORM_EXPORT Platform {
|
|
|
|
// Returns a sad page bitmap used when the child frame has crashed.
|
|
|
|
virtual SkBitmap* GetSadPageBitmap() { return nullptr; }
|
2018-04-19 17:44:42 +02:00
|
|
|
|
|
|
|
+ // DevTools ------------------------------------------------------------
|
|
|
|
+
|
|
|
|
+ virtual void DevToolsAgentAttached() {}
|
|
|
|
+ virtual void DevToolsAgentDetached() {}
|
|
|
|
+
|
2018-11-03 02:15:09 +01:00
|
|
|
private:
|
2020-06-09 19:48:00 +02:00
|
|
|
static void InitializeMainThreadCommon(Platform* platform,
|
|
|
|
std::unique_ptr<Thread> main_thread);
|
2020-03-04 01:29:39 +01:00
|
|
|
diff --git third_party/blink/renderer/core/dom/document_init.cc third_party/blink/renderer/core/dom/document_init.cc
|
2021-04-21 00:52:34 +02:00
|
|
|
index a43dcce78e486..46bbd086516f8 100644
|
2020-03-04 01:29:39 +01:00
|
|
|
--- third_party/blink/renderer/core/dom/document_init.cc
|
|
|
|
+++ third_party/blink/renderer/core/dom/document_init.cc
|
2021-03-04 23:36:57 +01:00
|
|
|
@@ -185,11 +185,11 @@ PluginData* DocumentInit::GetPluginData(LocalFrame* frame, const KURL& url) {
|
2020-06-09 19:48:00 +02:00
|
|
|
// 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);
|
|
|
|
}
|
2020-03-04 01:29:39 +01:00
|
|
|
|
2020-06-09 19:48:00 +02:00
|
|
|
DocumentInit& DocumentInit::WithTypeFrom(const String& mime_type) {
|
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
|
2021-04-21 00:52:34 +02:00
|
|
|
index 4da1c9cbfdbf6..acd69b393cfc0 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
|
2021-04-21 00:52:34 +02:00
|
|
|
@@ -1967,7 +1967,7 @@ WebContentSettingsClient* LocalFrame::GetContentSettingsClient() {
|
2017-04-20 21:28:17 +02:00
|
|
|
PluginData* LocalFrame::GetPluginData() const {
|
2021-01-28 00:13:12 +01:00
|
|
|
if (!Loader().AllowPlugins())
|
2017-04-20 21:28:17 +02:00
|
|
|
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
|
2021-04-21 00:52:34 +02:00
|
|
|
index 242653b4e7237..385e4b4d3f075 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
|
2020-02-10 18:10:17 +01:00
|
|
|
@@ -8,6 +8,7 @@
|
|
|
|
#include <utility>
|
2019-10-01 15:55:16 +02:00
|
|
|
#include <vector>
|
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"
|
2019-09-04 17:13:32 +02:00
|
|
|
#include "third_party/blink/renderer/core/inspector/devtools_agent.h"
|
2020-07-08 19:23:29 +02:00
|
|
|
@@ -144,6 +145,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() {
|
2020-07-08 19:23:29 +02: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();
|
|
|
|
}
|
|
|
|
|
2020-04-14 21:31:00 +02:00
|
|
|
void DevToolsSession::DispatchProtocolCommand(
|
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
|
2021-04-21 00:52:34 +02:00
|
|
|
index 415b29342170a..5aebc6d6379a5 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
|
2021-03-04 23:36:57 +01:00
|
|
|
@@ -210,7 +210,8 @@ Page::Page(PageClients& page_clients,
|
2019-06-05 16:15:45 +02:00
|
|
|
MakeGarbageCollected<OverscrollController>(GetVisualViewport(),
|
|
|
|
GetChromeClient())),
|
2019-11-12 17:11:44 +01:00
|
|
|
link_highlight_(MakeGarbageCollected<LinkHighlight>(*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.
|
2019-06-05 16:15:45 +02:00
|
|
|
validation_message_client_(
|
|
|
|
MakeGarbageCollected<ValidationMessageClientImpl>(*this)),
|
2021-03-04 23:36:57 +01:00
|
|
|
@@ -402,21 +403,41 @@ 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_)
|
2019-06-05 16:15:45 +02:00
|
|
|
- plugin_data_ = MakeGarbageCollected<PluginData>();
|
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_)
|
2019-06-05 16:15:45 +02:00
|
|
|
+ plugin_data_main_frame_ = MakeGarbageCollected<PluginData>();
|
2017-07-27 01:19:27 +02:00
|
|
|
|
|
|
|
- if (!plugin_data_->Origin() ||
|
2020-02-10 18:10:17 +01:00
|
|
|
- !main_frame_origin->IsSameOriginWith(plugin_data_->Origin()))
|
2017-07-27 01:19:27 +02:00
|
|
|
- plugin_data_->UpdatePluginList(main_frame_origin);
|
2020-02-10 18:10:17 +01:00
|
|
|
|
|
|
|
- return plugin_data_.Get();
|
2017-07-27 01:19:27 +02:00
|
|
|
+ if (!plugin_data_main_frame_->Origin() ||
|
2020-02-10 18:10:17 +01:00
|
|
|
+ !main_frame_origin->IsSameOriginWith(
|
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_)
|
2019-06-05 16:15:45 +02:00
|
|
|
+ plugin_data_sub_frame_ = MakeGarbageCollected<PluginData>();
|
2020-02-10 18:10:17 +01:00
|
|
|
+
|
2017-07-27 01:19:27 +02:00
|
|
|
+ if (!plugin_data_sub_frame_->Origin() ||
|
2020-02-10 18:10:17 +01:00
|
|
|
+ !main_frame_origin->IsSameOriginWith(
|
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();
|
|
|
|
}
|
|
|
|
}
|
2021-03-04 23:36:57 +01:00
|
|
|
@@ -928,7 +949,8 @@ void Page::Trace(Visitor* visitor) const {
|
2019-11-12 17:11:44 +01:00
|
|
|
visitor->Trace(link_highlight_);
|
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_);
|
2021-01-28 00:13:12 +01: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
|
2021-04-21 00:52:34 +02:00
|
|
|
index d2efc89d1305e..4934e23c3b085 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
|
2021-03-04 23:36:57 +01:00
|
|
|
@@ -156,7 +156,8 @@ class CORE_EXPORT Page final : public GarbageCollected<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.
|
2021-03-04 23:36:57 +01:00
|
|
|
@@ -435,7 +436,8 @@ class CORE_EXPORT Page final : public GarbageCollected<Page>,
|
2019-11-12 17:11:44 +01:00
|
|
|
const Member<LinkHighlight> link_highlight_;
|
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_;
|
|
|
|
|
2019-03-13 22:27:37 +01:00
|
|
|
diff --git third_party/blink/renderer/core/page/plugin_data.cc third_party/blink/renderer/core/page/plugin_data.cc
|
2021-04-21 00:52:34 +02:00
|
|
|
index 89beb74dae8a9..63bfa84b45b72 100644
|
2019-03-13 22:27:37 +01:00
|
|
|
--- third_party/blink/renderer/core/page/plugin_data.cc
|
|
|
|
+++ third_party/blink/renderer/core/page/plugin_data.cc
|
2019-10-01 15:55:16 +02:00
|
|
|
@@ -91,10 +91,12 @@ void PluginData::RefreshBrowserSidePluginCache() {
|
2020-03-04 01:29:39 +01:00
|
|
|
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
|
2019-10-01 15:55:16 +02:00
|
|
|
registry.BindNewPipeAndPassReceiver());
|
2018-07-02 19:11:49 +02:00
|
|
|
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;
|
|
|
|
|
2019-10-01 15:55:16 +02:00
|
|
|
@@ -102,7 +104,7 @@ void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) {
|
2020-03-04 01:29:39 +01:00
|
|
|
Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
|
2019-10-01 15:55:16 +02:00
|
|
|
registry.BindNewPipeAndPassReceiver());
|
2018-07-02 19:11:49 +02:00
|
|
|
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),
|
2019-03-13 22:27:37 +01:00
|
|
|
diff --git third_party/blink/renderer/core/page/plugin_data.h third_party/blink/renderer/core/page/plugin_data.h
|
2021-04-21 00:52:34 +02:00
|
|
|
index fe5aa20243d89..c2b3540d3bb54 100644
|
2019-03-13 22:27:37 +01:00
|
|
|
--- third_party/blink/renderer/core/page/plugin_data.h
|
|
|
|
+++ third_party/blink/renderer/core/page/plugin_data.h
|
2019-11-12 17:11:44 +01:00
|
|
|
@@ -97,7 +97,8 @@ class CORE_EXPORT PluginData final : public GarbageCollected<PluginData> {
|
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;
|