Diff
Modified: trunk/Source/WebCore/ChangeLog (230842 => 230843)
--- trunk/Source/WebCore/ChangeLog 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebCore/ChangeLog 2018-04-20 17:45:24 UTC (rev 230843)
@@ -1,3 +1,25 @@
+2018-04-20 Youenn Fablet <you...@apple.com>
+
+ Make PluginData cache its web visible plugins
+ https://bugs.webkit.org/show_bug.cgi?id=184421
+
+ Reviewed by Chris Dumez.
+
+ Buffer visible plugins until the page URL changes.
+ For that purpose, we now cache the visible plugins and the URL it was computed from in PluginData.
+
+ Update plugin info provider API to pass the URL used to check for plugin visibility.
+
+ No observable change of behavior.
+
+ * loader/EmptyClients.cpp:
+ * plugins/PluginData.cpp:
+ (WebCore::PluginData::webVisiblePlugins const):
+ (WebCore::PluginData::publiclyVisiblePlugins const):
+ (WebCore::PluginData::supportsMimeType const):
+ * plugins/PluginData.h:
+ * plugins/PluginInfoProvider.h:
+
2018-04-20 Chris Dumez <cdu...@apple.com>
Unreviewed build fix after r230840.
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (230842 => 230843)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2018-04-20 17:45:24 UTC (rev 230843)
@@ -325,8 +325,8 @@
class EmptyPluginInfoProvider final : public PluginInfoProvider {
void refreshPlugins() final { };
- void getPluginInfo(Page&, Vector<PluginInfo>&, std::optional<Vector<SupportedPluginName>>&) final { }
- void getWebVisiblePluginInfo(Page&, Vector<PluginInfo>&) final { }
+ Vector<PluginInfo> pluginInfo(Page&, std::optional<Vector<SupportedPluginName>>&) final { return { }; }
+ Vector<PluginInfo> webVisiblePluginInfo(Page&, const URL&) final { return { }; }
};
class EmptyPopupMenu : public PopupMenu {
Modified: trunk/Source/WebCore/plugins/PluginData.cpp (230842 => 230843)
--- trunk/Source/WebCore/plugins/PluginData.cpp 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebCore/plugins/PluginData.cpp 2018-04-20 17:45:24 UTC (rev 230843)
@@ -24,6 +24,7 @@
#include "config.h"
#include "PluginData.h"
+#include "Document.h"
#include "LocalizedStrings.h"
#include "Page.h"
#include "PluginInfoProvider.h"
@@ -36,11 +37,18 @@
initPlugins();
}
-Vector<PluginInfo> PluginData::webVisiblePlugins() const
+const Vector<PluginInfo>& PluginData::webVisiblePlugins() const
{
- Vector<PluginInfo> plugins;
- m_page.pluginInfoProvider().getWebVisiblePluginInfo(m_page, plugins);
- return plugins;
+ auto documentURL = m_page.mainFrame().document() ? m_page.mainFrame().document()->url() : URL { };
+ if (!documentURL.isNull() && !protocolHostAndPortAreEqual(m_cachedVisiblePlugins.pageURL, documentURL)) {
+ m_cachedVisiblePlugins.pageURL = WTFMove(documentURL);
+ m_cachedVisiblePlugins.pluginList = std::nullopt;
+ }
+
+ if (!m_cachedVisiblePlugins.pluginList)
+ m_cachedVisiblePlugins.pluginList = m_page.pluginInfoProvider().webVisiblePluginInfo(m_page, m_cachedVisiblePlugins.pageURL);
+
+ return *m_cachedVisiblePlugins.pluginList;
}
#if PLATFORM(COCOA)
@@ -73,18 +81,15 @@
Vector<PluginInfo> PluginData::publiclyVisiblePlugins() const
{
+ auto plugins = webVisiblePlugins();
+
if (m_page.showAllPlugins())
- return webVisiblePlugins();
+ return plugins;
- Vector<PluginInfo> allPlugins;
- m_page.pluginInfoProvider().getWebVisiblePluginInfo(m_page, allPlugins);
+ plugins.removeAllMatching([](auto& plugin) {
+ return !shouldBePubliclyVisible(plugin);
+ });
- Vector<PluginInfo> plugins;
- for (auto&& plugin : allPlugins) {
- if (shouldBePubliclyVisible(plugin))
- plugins.append(WTFMove(plugin));
- }
-
std::sort(plugins.begin(), plugins.end(), [](const PluginInfo& a, const PluginInfo& b) {
return codePointCompareLessThan(a.name, b.name);
});
@@ -174,7 +179,7 @@
{
ASSERT(m_plugins.isEmpty());
- m_page.pluginInfoProvider().getPluginInfo(m_page, m_plugins, m_supportedPluginNames);
+ m_plugins = m_page.pluginInfoProvider().pluginInfo(m_page, m_supportedPluginNames);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/plugins/PluginData.h (230842 => 230843)
--- trunk/Source/WebCore/plugins/PluginData.h 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebCore/plugins/PluginData.h 2018-04-20 17:45:24 UTC (rev 230843)
@@ -102,7 +102,7 @@
static Ref<PluginData> create(Page& page) { return adoptRef(*new PluginData(page)); }
const Vector<PluginInfo>& plugins() const { return m_plugins; }
- Vector<PluginInfo> webVisiblePlugins() const;
+ const Vector<PluginInfo>& webVisiblePlugins() const;
Vector<PluginInfo> publiclyVisiblePlugins() const;
WEBCORE_EXPORT void getWebVisibleMimesAndPluginIndices(Vector<MimeClassInfo>&, Vector<size_t>&) const;
@@ -127,6 +127,12 @@
Page& m_page;
Vector<PluginInfo> m_plugins;
std::optional<Vector<SupportedPluginName>> m_supportedPluginNames;
+
+ struct CachedVisiblePlugins {
+ URL pageURL;
+ std::optional<Vector<PluginInfo>> pluginList;
+ };
+ mutable CachedVisiblePlugins m_cachedVisiblePlugins;
};
inline bool isSupportedPlugin(const Vector<SupportedPluginName>& pluginNames, const URL& pageURL, const String& pluginName)
Modified: trunk/Source/WebCore/plugins/PluginInfoProvider.h (230842 => 230843)
--- trunk/Source/WebCore/plugins/PluginInfoProvider.h 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebCore/plugins/PluginInfoProvider.h 2018-04-20 17:45:24 UTC (rev 230843)
@@ -39,8 +39,8 @@
void addPage(Page&);
void removePage(Page&);
- virtual void getPluginInfo(Page&, Vector<PluginInfo>&, std::optional<Vector<SupportedPluginName>>&) = 0;
- virtual void getWebVisiblePluginInfo(Page&, Vector<PluginInfo>&) = 0;
+ virtual Vector<PluginInfo> pluginInfo(Page&, std::optional<Vector<SupportedPluginName>>&) = 0;
+ virtual Vector<PluginInfo> webVisiblePluginInfo(Page&, const URL&) = 0;
private:
virtual void refreshPlugins() = 0;
Modified: trunk/Source/WebKit/ChangeLog (230842 => 230843)
--- trunk/Source/WebKit/ChangeLog 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebKit/ChangeLog 2018-04-20 17:45:24 UTC (rev 230843)
@@ -1,3 +1,21 @@
+2018-04-20 Youenn Fablet <you...@apple.com>
+
+ Make PluginData cache its web visible plugins
+ https://bugs.webkit.org/show_bug.cgi?id=184421
+
+ Reviewed by Chris Dumez.
+
+ Rename methods.
+ Pass an URL instead of relying on Page URL as the page URL
+ might not always be the URL we want to check against plugins.
+ In particular when navigation is on-going, we want to check the
+ plugins against the being navigated URL.
+
+ * WebProcess/Plugins/WebPluginInfoProvider.cpp:
+ (WebKit::WebPluginInfoProvider::pluginInfo):
+ (WebKit::WebPluginInfoProvider::webVisiblePluginInfo):
+ * WebProcess/Plugins/WebPluginInfoProvider.h:
+
2018-04-19 Carlos Garcia Campos <cgar...@igalia.com>
Unreviewed. Fix GTK+ build after r230830.
Modified: trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp (230842 => 230843)
--- trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp 2018-04-20 17:45:24 UTC (rev 230843)
@@ -35,6 +35,7 @@
#include <WebCore/Frame.h>
#include <WebCore/FrameLoader.h>
#include <WebCore/Page.h>
+#include <WebCore/SchemeRegistry.h>
#include <WebCore/SubframeLoader.h>
#include <wtf/text/StringHash.h>
@@ -96,7 +97,7 @@
#endif
}
-void WebPluginInfoProvider::getPluginInfo(Page& page, Vector<PluginInfo>& plugins, std::optional<Vector<SupportedPluginName>>& supportedPluginNames)
+Vector<PluginInfo> WebPluginInfoProvider::pluginInfo(Page& page, std::optional<Vector<SupportedPluginName>>& supportedPluginNames)
{
#if ENABLE(NETSCAPE_PLUGIN_API)
populatePluginCache(page);
@@ -104,37 +105,26 @@
if (m_cachedSupportedPluginNames)
supportedPluginNames = *m_cachedSupportedPluginNames;
- if (page.mainFrame().loader().subframeLoader().allowPlugins()) {
- plugins = m_cachedPlugins;
- return;
- }
-
- plugins = m_cachedApplicationPlugins;
+ return page.mainFrame().loader().subframeLoader().allowPlugins() ? m_cachedPlugins : m_cachedApplicationPlugins;
#else
UNUSED_PARAM(page);
- UNUSED_PARAM(plugins);
+ UNUSED_PARAM(supportedPluginNames);
+ return { };
#endif // ENABLE(NETSCAPE_PLUGIN_API)
}
-void WebPluginInfoProvider::getWebVisiblePluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+Vector<WebCore::PluginInfo> WebPluginInfoProvider::webVisiblePluginInfo(Page& page, const WebCore::URL& url)
{
- ASSERT_ARG(plugins, plugins.isEmpty());
-
std::optional<Vector<WebCore::SupportedPluginName>> supportedPluginNames;
- getPluginInfo(page, plugins, supportedPluginNames);
+ auto plugins = pluginInfo(page, supportedPluginNames);
- auto* document = page.mainFrame().document();
+ plugins.removeAllMatching([&] (auto& plugin) {
+ return supportedPluginNames && !isSupportedPlugin(*supportedPluginNames, url, plugin.name);
+ });
- if (document && supportedPluginNames) {
- plugins.removeAllMatching([&] (auto& plugin) {
- return !isSupportedPlugin(*supportedPluginNames, document->url(), plugin.name);
- });
- }
-
#if PLATFORM(MAC)
- auto* origin = document ? &document->securityOrigin(): nullptr;
- if (origin && origin->isLocal())
- return;
+ if (SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol().toString()))
+ return plugins;
for (int32_t i = plugins.size() - 1; i >= 0; --i) {
auto& info = plugins.at(i);
@@ -147,6 +137,7 @@
plugins.remove(i);
}
#endif
+ return plugins;
}
#if ENABLE(NETSCAPE_PLUGIN_API)
Modified: trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h (230842 => 230843)
--- trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h 2018-04-20 17:45:24 UTC (rev 230843)
@@ -45,8 +45,8 @@
private:
WebPluginInfoProvider();
- void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&, std::optional<Vector<WebCore::SupportedPluginName>>&) final;
- void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) final;
+ Vector<WebCore::PluginInfo> pluginInfo(WebCore::Page&, std::optional<Vector<WebCore::SupportedPluginName>>&) final;
+ Vector<WebCore::PluginInfo> webVisiblePluginInfo(WebCore::Page&, const WebCore::URL&) final;
void refreshPlugins() override;
#if ENABLE(NETSCAPE_PLUGIN_API)
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (230842 => 230843)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2018-04-20 17:45:24 UTC (rev 230843)
@@ -1,3 +1,15 @@
+2018-04-20 Youenn Fablet <you...@apple.com>
+
+ Make PluginData cache its web visible plugins
+ https://bugs.webkit.org/show_bug.cgi?id=184421
+
+ Reviewed by Chris Dumez.
+
+ * WebCoreSupport/WebPluginInfoProvider.h:
+ * WebCoreSupport/WebPluginInfoProvider.mm:
+ (WebPluginInfoProvider::pluginInfo):
+ (WebPluginInfoProvider::webVisiblePluginInfo):
+
2018-04-19 Chris Dumez <cdu...@apple.com>
Rename JSDOMWindowProxy to JSWindowProxy
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h (230842 => 230843)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h 2018-04-20 17:45:24 UTC (rev 230843)
@@ -34,8 +34,8 @@
private:
void refreshPlugins() override;
- void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&, std::optional<Vector<WebCore::SupportedPluginName>>&) final;
- void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) final;
+ Vector<WebCore::PluginInfo> pluginInfo(WebCore::Page&, std::optional<Vector<WebCore::SupportedPluginName>>&) final;
+ Vector<WebCore::PluginInfo> webVisiblePluginInfo(WebCore::Page&, const WebCore::URL&) final;
WebPluginInfoProvider();
};
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm (230842 => 230843)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm 2018-04-20 17:45:24 UTC (rev 230843)
@@ -55,22 +55,27 @@
[[WebPluginDatabase sharedDatabaseIfExists] refresh];
}
-void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins, std::optional<Vector<SupportedPluginName>>&)
+Vector<WebCore::PluginInfo> WebPluginInfoProvider::pluginInfo(WebCore::Page& page, std::optional<Vector<SupportedPluginName>>&)
{
+ Vector<WebCore::PluginInfo> plugins;
+
BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
// WebKit1 has no application plug-ins, so we don't need to add them here.
if (!page.mainFrame().loader().subframeLoader().allowPlugins())
- return;
+ return plugins;
for (WebPluginPackage *plugin in [WebPluginDatabase sharedDatabase].plugins)
plugins.append(plugin.pluginInfo);
END_BLOCK_OBJC_EXCEPTIONS;
+
+ return plugins;
}
-void WebPluginInfoProvider::getWebVisiblePluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+Vector<WebCore::PluginInfo> WebPluginInfoProvider::webVisiblePluginInfo(WebCore::Page& page, const WebCore::URL&)
{
std::optional<Vector<SupportedPluginName>> supportedPluginNames;
- getPluginInfo(page, plugins, supportedPluginNames);
+ return pluginInfo(page, supportedPluginNames);
}
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (230842 => 230843)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2018-04-20 17:45:24 UTC (rev 230843)
@@ -1,3 +1,15 @@
+2018-04-20 Youenn Fablet <you...@apple.com>
+
+ Make PluginData cache its web visible plugins
+ https://bugs.webkit.org/show_bug.cgi?id=184421
+
+ Reviewed by Chris Dumez.
+
+ * WebCoreSupport/WebPluginInfoProvider.cpp:
+ (WebPluginInfoProvider::pluginInfo):
+ (WebPluginInfoProvider::webVisiblePluginInfo):
+ * WebCoreSupport/WebPluginInfoProvider.h:
+
2018-04-19 Chris Dumez <cdu...@apple.com>
Rename JSDOMWindowProxy to JSWindowProxy
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp (230842 => 230843)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp 2018-04-20 17:45:24 UTC (rev 230843)
@@ -49,8 +49,9 @@
PluginDatabase::installedPlugins()->refresh();
}
-void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& outPlugins, std::optional<Vector<WebCore::SupportedPluginName>>&)
+Vector<WebCore::PluginInfo> WebPluginInfoProvider::pluginInfo(WebCore::Page& page, std::optional<Vector<WebCore::SupportedPluginName>>&)
{
+ Vector<WebCore::PluginInfo> outPlugins;
const Vector<PluginPackage*>& plugins = PluginDatabase::installedPlugins()->plugins();
outPlugins.resize(plugins.size());
@@ -80,10 +81,11 @@
outPlugins[i] = info;
}
+ return outPlugins;
}
-void WebPluginInfoProvider::getWebVisiblePluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+Vector<WebCore::PluginInfo> WebPluginInfoProvider::webVisiblePluginInfo(WebCore::Page& page, const WebCore::URL&)
{
std::optional<Vector<WebCore::SupportedPluginName>> supportedPluginNames;
- getPluginInfo(page, plugins, supportedPluginNames);
+ return pluginInfo(page, supportedPluginNames);
}
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h (230842 => 230843)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h 2018-04-20 17:03:16 UTC (rev 230842)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h 2018-04-20 17:45:24 UTC (rev 230843)
@@ -36,8 +36,8 @@
private:
void refreshPlugins() final;
- void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&, std::optional<Vector<WebCore::SupportedPluginName>>&) final;
- void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) final;
+ Vector<WebCore::PluginInfo> pluginInfo(WebCore::Page&, std::optional<Vector<WebCore::SupportedPluginName>>&) final;
+ Vector<WebCore::PluginInfo> webVisiblePluginInfo(WebCore::Page&i, const WebCore::URL&) final;
#if PLATFORM(MAC)
void setPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString) final;
void clearPluginClientPolicies() final;