Diff
Modified: trunk/LayoutTests/ChangeLog (228586 => 228587)
--- trunk/LayoutTests/ChangeLog 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/LayoutTests/ChangeLog 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1,3 +1,25 @@
+2018-02-16 Youenn Fablet <[email protected]>
+
+ Allow specifying which plug-ins are supported
+ https://bugs.webkit.org/show_bug.cgi?id=182748
+
+ Reviewed by Chris Dumez.
+
+ * http/tests/plugins/nounsupported-plugin-expected.txt: Added.
+ * http/tests/plugins/nounsupported-plugin.html: Added.
+ * http/tests/plugins/supported-plugin-all-origin-visibility-expected.txt: Added.
+ * http/tests/plugins/supported-plugin-all-origin-visibility.html: Added.
+ * http/tests/plugins/supported-plugin-on-specific-origin-expected.txt: Added.
+ * http/tests/plugins/supported-plugin-on-specific-origin.html: Added.
+ * http/tests/plugins/supported-plugin-origin-specific-visibility-expected.txt: Added.
+ * http/tests/plugins/supported-plugin-origin-specific-visibility.html: Added.
+ * http/tests/plugins/unsupported-plugin-on-specific-origin-expected.txt: Added.
+ * http/tests/plugins/unsupported-plugin-on-specific-origin.html: Added.
+ * plugins/unsupported-plugin-expected.txt: Added.
+ * plugins/unsupported-plugin.html: Added.
+ * platform/ios-wk1/TestExpectations:
+ * platform/mac-wk1/TestExpectations:
+
2018-02-16 Ryan Haddad <[email protected]>
Mark fast/block/positioning/fixed-container-with-relative-parent.html as flaky.
Added: trunk/LayoutTests/http/tests/plugins/nounsupported-plugin-expected.txt (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/nounsupported-plugin-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/nounsupported-plugin-expected.txt 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,3 @@
+
+PASS Test plugins
+
Added: trunk/LayoutTests/http/tests/plugins/nounsupported-plugin.html (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/nounsupported-plugin.html (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/nounsupported-plugin.html 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,16 @@
+<html>
+<body>
+<script src= ""
+<script src= ""
+<script>
+function checkPlugins()
+{
+ return !!(navigator.plugins["WebKit Test PlugIn"] || navigator.plugins["WebKit built-in PDF"]);
+}
+
+test(() => {
+ assert_true(checkPlugins());
+}, "Test plugins");
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/plugins/supported-plugin-all-origin-visibility-expected.txt (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/supported-plugin-all-origin-visibility-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/supported-plugin-all-origin-visibility-expected.txt 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,3 @@
+
+PASS Ensure plugins visibility for supported plug-in for all origins
+
Added: trunk/LayoutTests/http/tests/plugins/supported-plugin-all-origin-visibility.html (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/supported-plugin-all-origin-visibility.html (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/supported-plugin-all-origin-visibility.html 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,19 @@
+<html>
+<body>
+<script src= ""
+<script src= ""
+<script>
+function checkPlugins()
+{
+ return !!(navigator.plugins["WebKit Test PlugIn"] || navigator.plugins["WebKit built-in PDF"]);
+}
+
+test(() => {
+ assert_true(!!window.testRunner);
+ testRunner.setPluginSupportedMode("allOrigins");
+ var plugins = navigator.plugins;
+ assert_true(checkPlugins());
+}, "Ensure plugins visibility for supported plug-in for all origins");
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/plugins/supported-plugin-on-specific-origin-expected.txt (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/supported-plugin-on-specific-origin-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/supported-plugin-on-specific-origin-expected.txt 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,6 @@
+On WebKitTestRunner, no console log message should appear stating the plugin is unsupported.
+
+
+
+PASS Testing unsupported plug-in
+
Added: trunk/LayoutTests/http/tests/plugins/supported-plugin-on-specific-origin.html (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/supported-plugin-on-specific-origin.html (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/supported-plugin-on-specific-origin.html 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src= ""
+<script src= ""
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+</script>
+<p>On WebKitTestRunner, no console log message should appear stating the plugin is unsupported.</p>
+<div id="pluginPlaceholder"></div>
+
+<script>
+function doTest()
+{
+ if (window.location.origin !== "http://localhost:8080") {
+ if (!window.testRunner) {
+ assert_not_reached("Needs test runnner");
+ return;
+ }
+ testRunner.setPluginSupportedMode("specificOrigin");
+ window.location = "http://localhost:8080/plugins/supported-plugin-on-specific-origin.html";
+ return;
+ }
+ pluginPlaceholder.innerHTML = '<embed id="plugin" type="application/x-webkit-test-netscape"></embed>';
+ var test = async_test("Testing unsupported plug-in");
+ test.step(() => {
+ if (!window.internals) {
+ test.done();
+ return;
+ }
+ var counter = 0;
+ setInterval(test.step_func(() => {
+ let text = internals.unavailablePluginReplacementText(plugin);
+ assert_equals(text, "");
+ if (++counter > 5)
+ test.done();
+ }), 50);
+ });
+}
+doTest();
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/plugins/supported-plugin-origin-specific-visibility-expected.txt (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/supported-plugin-origin-specific-visibility-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/supported-plugin-origin-specific-visibility-expected.txt 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,3 @@
+
+PASS Ensure per-origin supported plugins origin
+
Added: trunk/LayoutTests/http/tests/plugins/supported-plugin-origin-specific-visibility.html (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/supported-plugin-origin-specific-visibility.html (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/supported-plugin-origin-specific-visibility.html 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,35 @@
+<html>
+<body>
+<script src= ""
+<script src= ""
+<script>
+function checkPlugins()
+{
+ return !!(navigator.plugins["WebKit Test PlugIn"] || navigator.plugins["WebKit built-in PDF"]);
+}
+
+function doTest()
+{
+ if (window.location.origin !== "http://localhost:8080") {
+ test(() => {
+ if (!window.testRunner) {
+ assert_not_reached("Needs test runnner");
+ return;
+ }
+ testRunner.setPluginSupportedMode("specificOrigin");
+
+ assert_false(checkPlugins());
+ window.location = "http://localhost:8080/plugins/supported-plugin-origin-specific-visibility.html";
+ }, "Ensure per-origin supported plugins origin - first");
+ return;
+ }
+ test(() => {
+ assert_true(checkPlugins());
+ }, "Ensure per-origin supported plugins origin");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+doTest();
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/plugins/unsupported-plugin-on-specific-origin-expected.txt (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/unsupported-plugin-on-specific-origin-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/unsupported-plugin-on-specific-origin-expected.txt 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: Tried to use an unsupported plug-in.
+A console log message should appear stating the plugin is unsupported.
+
+
+
+PASS Testing unsupported plug-in
+
Added: trunk/LayoutTests/http/tests/plugins/unsupported-plugin-on-specific-origin.html (0 => 228587)
--- trunk/LayoutTests/http/tests/plugins/unsupported-plugin-on-specific-origin.html (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/unsupported-plugin-on-specific-origin.html 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src= ""
+<script src= ""
+<script>
+if (window.testRunner)
+ testRunner.setPluginSupportedMode("specificOrigin");
+</script>
+<p>A console log message should appear stating the plugin is unsupported.</p>
+<embed id="plugin" type="application/x-webkit-test-netscape"></embed>
+
+<script>
+var test = async_test("Testing unsupported plug-in");
+test.step(() => {
+ if (!window.internals) {
+ test.done();
+ return;
+ }
+ var counter = 0;
+ setInterval(test.step_func(() => {
+ assert_true(++counter < 20, "Test timed out");
+ let text = internals.unavailablePluginReplacementText(plugin);
+ if (!text)
+ return;
+ assert_equals(text, "Unsupported Plug-in");
+ test.done();
+ }), 50);
+});
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios-wk1/TestExpectations (228586 => 228587)
--- trunk/LayoutTests/platform/ios-wk1/TestExpectations 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/LayoutTests/platform/ios-wk1/TestExpectations 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1094,6 +1094,13 @@
http/tests/security/video-cross-origin-readback.html [ Failure ]
http/tests/security/xssAuditor/link-opens-new-window.html [ Failure ]
+http/tests/plugins/nounsupported-plugin.html [ Skip ]
+http/tests/plugins/supported-plugin-all-origin-visibility.html [ Skip ]
+http/tests/plugins/supported-plugin-origin-specific-visibility.html [ Skip ]
+http/tests/plugins/supported-plugin-on-specific-origin.html [ Skip ]
+http/tests/plugins/unsupported-plugin-on-specific-origin.html [ Skip ]
+plugins/unsupported-plugin.html [ Skip ]
+
# HTTP tests that assert:
http/tests/navigation/metaredirect-basic.html
http/tests/navigation/metaredirect-goback.html
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (228586 => 228587)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2018-02-16 23:31:31 UTC (rev 228587)
@@ -102,6 +102,13 @@
# Plug-in blocking callback doesn't exist in WebKit1.
plugins/unavailable-plugin-indicator-obscurity.html
+http/tests/plugins/nounsupported-plugin.html [ Skip ]
+http/tests/plugins/supported-plugin-all-origin-visibility.html [ Skip ]
+http/tests/plugins/supported-plugin-origin-specific-visibility.html [ Skip ]
+http/tests/plugins/supported-plugin-on-specific-origin.html [ Skip ]
+http/tests/plugins/unsupported-plugin-on-specific-origin.html [ Skip ]
+plugins/unsupported-plugin.html [ Skip ]
+
# Color input is not yet implemented on Mac WK1. Currently, using it erroneously triggers an ASSERT_NOT_REACHED.
webkit.org/b/119094 fast/forms/color/input-color-onchange-event.html [ Skip ]
webkit.org/b/119094 fast/forms/color/color-suggestion-picker-crash-on-set-value.html [ Skip ]
Added: trunk/LayoutTests/plugins/unsupported-plugin-expected.txt (0 => 228587)
--- trunk/LayoutTests/plugins/unsupported-plugin-expected.txt (rev 0)
+++ trunk/LayoutTests/plugins/unsupported-plugin-expected.txt 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: Tried to use an unsupported plug-in.
+A console log message should appear stating the plugin is unsupported.
+
+
+
+PASS Testing unsupported plug-in
+
Added: trunk/LayoutTests/plugins/unsupported-plugin.html (0 => 228587)
--- trunk/LayoutTests/plugins/unsupported-plugin.html (rev 0)
+++ trunk/LayoutTests/plugins/unsupported-plugin.html 2018-02-16 23:31:31 UTC (rev 228587)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src= ""
+<script src= ""
+<script>
+if (window.testRunner)
+ testRunner.setPluginSupportedMode("none");
+</script>
+<p>A console log message should appear stating the plugin is unsupported.</p>
+<embed id="plugin" type="application/x-webkit-test-netscape"></embed>
+
+<script>
+var test = async_test("Testing unsupported plug-in");
+test.step(() => {
+ if (!window.internals) {
+ test.done();
+ return;
+ }
+ var counter = 0;
+ setInterval(test.step_func(() => {
+ assert_true(++counter < 20, "Test timed out");
+ let text = internals.unavailablePluginReplacementText(plugin);
+ if (!text)
+ return;
+ assert_equals(text, "Unsupported Plug-in");
+ test.done();
+ }), 50);
+});
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (228586 => 228587)
--- trunk/Source/WebCore/ChangeLog 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/ChangeLog 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1,3 +1,49 @@
+2018-02-16 Youenn Fablet <[email protected]>
+
+ Allow specifying which plug-ins are supported
+ https://bugs.webkit.org/show_bug.cgi?id=182748
+
+ Reviewed by Chris Dumez.
+
+ Tests: http/tests/plugins/nounsupported-plugin.html
+ http/tests/plugins/supported-plugin-all-origin-visibility.html
+ http/tests/plugins/supported-plugin-on-specific-origin.html
+ http/tests/plugins/supported-plugin-origin-specific-visibility.html
+ http/tests/plugins/unsupported-plugin-on-specific-origin.html
+ plugins/unsupported-plugin.html
+
+ Added support for computing plugin web visibility with the added knowledge of supported plugins.
+ In case of a plugin failing to be created due to being unsupported, update the UI
+ to use mark the plugin as "Unexpected plug in".
+
+ Added internal API to retrieve the plug-in error description message.
+
+ * English.lproj/Localizable.strings:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/HTMLPlugInElement.cpp:
+ (WebCore::HTMLPlugInElement::setReplacement):
+ * html/HTMLPlugInElement.h:
+ * loader/EmptyClients.cpp:
+ * platform/LocalizedStrings.cpp:
+ (WebCore::unsupportedPluginText):
+ * platform/LocalizedStrings.h:
+ * plugins/PluginData.cpp:
+ (WebCore::PluginData::initPlugins):
+ * plugins/PluginData.h:
+ (WebCore::decodePluginNames):
+ (WebCore::encodePluginNames):
+ (WebCore::SupportedPluginNames::decode):
+ (WebCore::SupportedPluginNames::encode const):
+ * plugins/PluginInfoProvider.h:
+ * rendering/RenderEmbeddedObject.cpp:
+ (WebCore::unavailablePluginReplacementText):
+ * rendering/RenderEmbeddedObject.h:
+ (WebCore::RenderEmbeddedObject::pluginReplacementTextIfUnavailable const):
+ * testing/Internals.cpp:
+ (WebCore::Internals::unavailablePluginReplacementText):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2018-02-16 Chris Dumez <[email protected]>
http/tests/security/http-0.9/xhr-blocked.html is flaky
Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (228586 => 228587)
--- trunk/Source/WebCore/English.lproj/Localizable.strings 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings 2018-02-16 23:31:31 UTC (rev 228587)
@@ -115,6 +115,9 @@
/* Label text to be used when an insecure plug-in version was blocked from loading */
"Blocked Plug-In (Insecure plug-in)" = "Blocked Plug-in";
+/* Label text to be used when an insecure plug-in version was blocked from loading */
+"Unsupported Plug-In" = "Unsupported Plug-in";
+
/* Bold context menu item */
"Bold" = "Bold";
Modified: trunk/Source/WebCore/PAL/pal/SessionID.h (228586 => 228587)
--- trunk/Source/WebCore/PAL/pal/SessionID.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/PAL/pal/SessionID.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -64,6 +64,7 @@
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static bool decode(Decoder&, SessionID&);
+ template<class Decoder> static std::optional<SessionID> decode(Decoder&);
SessionID isolatedCopy() const;
@@ -86,13 +87,27 @@
template<class Decoder>
bool SessionID::decode(Decoder& decoder, SessionID& sessionID)
{
- if (!decoder.decode(sessionID.m_sessionID))
+ std::optional<SessionID> decodedSessionID;
+ decoder >> decodedSessionID;
+ if (!decodedSessionID)
return false;
- // FIXME: Eliminate places that encode invalid SessionIDs, then fail to decode an invalid sessionID.
+ sessionID = decodedSessionID.value();
return true;
}
+template<class Decoder>
+std::optional<SessionID> SessionID::decode(Decoder& decoder)
+{
+ std::optional<uint64_t> sessionID;
+ decoder >> sessionID;
+ if (!sessionID)
+ return std::nullopt;
+
+ // FIXME: Eliminate places that encode invalid SessionIDs, then fail to decode an invalid sessionID.
+ return SessionID { *sessionID };
+}
+
} // namespace PAL
namespace WTF {
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (228586 => 228587)
--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -403,13 +403,16 @@
return nullptr;
}
-// Return whether or not the replacement content for blocked plugins is accessible to the user.
-bool HTMLPlugInElement::isReplacementObscured(const String& unavailabilityDescription)
+bool HTMLPlugInElement::setReplacement(RenderEmbeddedObject::PluginUnavailabilityReason reason, const String& unavailabilityDescription)
{
if (!is<RenderEmbeddedObject>(renderer()))
return false;
+
+ if (reason == RenderEmbeddedObject::UnsupportedPlugin)
+ document().addConsoleMessage(MessageSource::JS, MessageLevel::Warning, ASCIILiteral("Tried to use an unsupported plug-in."));
+
Ref<HTMLPlugInElement> protectedThis(*this);
- downcast<RenderEmbeddedObject>(*renderer()).setPluginUnavailabilityReasonWithDescription(RenderEmbeddedObject::InsecurePluginVersion, unavailabilityDescription);
+ downcast<RenderEmbeddedObject>(*renderer()).setPluginUnavailabilityReasonWithDescription(reason, unavailabilityDescription);
bool replacementIsObscured = isReplacementObscured();
// hittest in isReplacementObscured() method could destroy the renderer. Let's refetch it.
if (is<RenderEmbeddedObject>(renderer()))
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (228586 => 228587)
--- trunk/Source/WebCore/html/HTMLPlugInElement.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -24,6 +24,7 @@
#include "HTMLFrameOwnerElement.h"
#include "Image.h"
+#include "RenderEmbeddedObject.h"
namespace JSC {
namespace Bindings {
@@ -34,7 +35,6 @@
namespace WebCore {
class PluginReplacement;
-class RenderEmbeddedObject;
class RenderWidget;
class Widget;
@@ -82,7 +82,9 @@
bool isUserObservable() const;
- WEBCORE_EXPORT bool isReplacementObscured(const String& unavailabilityDescription);
+ // Return whether or not the replacement content for blocked plugins is accessible to the user.
+ WEBCORE_EXPORT bool setReplacement(RenderEmbeddedObject::PluginUnavailabilityReason, const String& unavailabilityDescription);
+
WEBCORE_EXPORT bool isReplacementObscured();
protected:
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (228586 => 228587)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -325,7 +325,7 @@
class EmptyPluginInfoProvider final : public PluginInfoProvider {
void refreshPlugins() final { };
- void getPluginInfo(Page&, Vector<PluginInfo>&) final { }
+ void getPluginInfo(Page&, Vector<PluginInfo>&, std::optional<SupportedPluginNames>&) final { }
void getWebVisiblePluginInfo(Page&, Vector<PluginInfo>&) final { }
};
Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (228586 => 228587)
--- trunk/Source/WebCore/platform/LocalizedStrings.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -660,6 +660,11 @@
return WEB_UI_STRING_KEY("Blocked Plug-in", "Blocked Plug-In (Insecure plug-in)", "Label text to be used when an insecure plug-in version was blocked from loading");
}
+String unsupportedPluginText()
+{
+ return WEB_UI_STRING_KEY("Unsupported Plug-in", "Unsupported Plug-In", "Label text to be used when an unsupported plug-in was blocked from loading");
+}
+
String multipleFileUploadText(unsigned numberOfFiles)
{
return formatLocalizedString(WEB_UI_STRING("%d files", "Label to describe the number of files selected in a file upload control that allows multiple files"), numberOfFiles);
Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (228586 => 228587)
--- trunk/Source/WebCore/platform/LocalizedStrings.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -223,6 +223,7 @@
String crashedPluginText();
String blockedPluginByContentSecurityPolicyText();
String insecurePluginVersionText();
+ String unsupportedPluginText();
String multipleFileUploadText(unsigned numberOfFiles);
String unknownFileSizeText();
Modified: trunk/Source/WebCore/plugins/PluginData.cpp (228586 => 228587)
--- trunk/Source/WebCore/plugins/PluginData.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/plugins/PluginData.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -174,7 +174,7 @@
{
ASSERT(m_plugins.isEmpty());
- m_page.pluginInfoProvider().getPluginInfo(m_page, m_plugins);
+ m_page.pluginInfoProvider().getPluginInfo(m_page, m_plugins, m_supportedPluginNames);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/plugins/PluginData.h (228586 => 228587)
--- trunk/Source/WebCore/plugins/PluginData.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/plugins/PluginData.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -20,8 +20,12 @@
#pragma once
+#include "SecurityOriginData.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
+#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -84,6 +88,14 @@
return result;
}
+struct SupportedPluginNames {
+ HashSet<String> allOriginPlugins;
+ HashMap<SecurityOriginData, HashSet<String>> originSpecificPlugins;
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static std::optional<SupportedPluginNames> decode(Decoder&);
+};
+
// FIXME: merge with PluginDatabase in the future
class PluginData : public RefCounted<PluginData> {
public:
@@ -114,6 +126,39 @@
protected:
Page& m_page;
Vector<PluginInfo> m_plugins;
+ std::optional<SupportedPluginNames> m_supportedPluginNames;
};
+inline bool isSupportedPlugin(SupportedPluginNames& pluginNames, SecurityOriginData& origin, const String& pluginName)
+{
+ auto iterator = pluginNames.originSpecificPlugins.find(origin);
+ if (iterator != pluginNames.originSpecificPlugins.end()) {
+ if (iterator->value.contains(pluginName))
+ return true;
+ }
+
+ return pluginNames.allOriginPlugins.contains(pluginName);
+}
+
+template<class Decoder> inline std::optional<SupportedPluginNames> SupportedPluginNames::decode(Decoder& decoder)
+{
+ std::optional<HashSet<String>> allOriginPlugins;
+ decoder >> allOriginPlugins;
+ if (!allOriginPlugins)
+ return std::nullopt;
+
+ std::optional<HashMap<SecurityOriginData, HashSet<String>>> originSpecificPlugins;
+ decoder >> originSpecificPlugins;
+ if (!originSpecificPlugins)
+ return std::nullopt;
+
+ return SupportedPluginNames { WTFMove(allOriginPlugins.value()), WTFMove(originSpecificPlugins.value()) };
+}
+
+template<class Encoder> inline void SupportedPluginNames::encode(Encoder& encoder) const
+{
+ encoder << allOriginPlugins;
+ encoder << originSpecificPlugins;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/plugins/PluginInfoProvider.h (228586 => 228587)
--- trunk/Source/WebCore/plugins/PluginInfoProvider.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/plugins/PluginInfoProvider.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -39,7 +39,7 @@
void addPage(Page&);
void removePage(Page&);
- virtual void getPluginInfo(Page&, Vector<PluginInfo>&) = 0;
+ virtual void getPluginInfo(Page&, Vector<PluginInfo>&, std::optional<SupportedPluginNames>&) = 0;
virtual void getWebVisiblePluginInfo(Page&, Vector<PluginInfo>&) = 0;
private:
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (228586 => 228587)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -156,6 +156,8 @@
return blockedPluginByContentSecurityPolicyText();
case RenderEmbeddedObject::InsecurePluginVersion:
return insecurePluginVersionText();
+ case RenderEmbeddedObject::UnsupportedPlugin:
+ return unsupportedPluginText();
}
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.h (228586 => 228587)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -45,6 +45,7 @@
PluginCrashed,
PluginBlockedByContentSecurityPolicy,
InsecurePluginVersion,
+ UnsupportedPlugin
};
WEBCORE_EXPORT void setPluginUnavailabilityReason(PluginUnavailabilityReason);
WEBCORE_EXPORT void setPluginUnavailabilityReasonWithDescription(PluginUnavailabilityReason, const String& description);
@@ -58,6 +59,9 @@
bool allowsAcceleratedCompositing() const;
LayoutRect unavailablePluginIndicatorBounds(const LayoutPoint& accumulatedOffset) const;
+
+ const String& pluginReplacementTextIfUnavailable() const { return m_unavailablePluginReplacementText; }
+
protected:
void paintReplaced(PaintInfo&, const LayoutPoint&) final;
void paint(PaintInfo&, const LayoutPoint&) override;
Modified: trunk/Source/WebCore/testing/Internals.cpp (228586 => 228587)
--- trunk/Source/WebCore/testing/Internals.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/testing/Internals.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -3278,6 +3278,18 @@
return downcast<HTMLPlugInElement>(element).isReplacementObscured();
}
+ExceptionOr<String> Internals::unavailablePluginReplacementText(Element& element)
+{
+ if (!is<HTMLPlugInElement>(element))
+ return Exception { InvalidAccessError };
+
+ auto* renderer = element.renderer();
+ if (!is<RenderEmbeddedObject>(renderer))
+ return String { };
+
+ return String { downcast<RenderEmbeddedObject>(*renderer).pluginReplacementTextIfUnavailable() };
+}
+
bool Internals::isPluginSnapshotted(Element& element)
{
return is<HTMLPlugInElement>(element) && downcast<HTMLPlugInElement>(element).displayState() <= HTMLPlugInElement::DisplayingSnapshot;
Modified: trunk/Source/WebCore/testing/Internals.h (228586 => 228587)
--- trunk/Source/WebCore/testing/Internals.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/testing/Internals.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -480,6 +480,7 @@
ExceptionOr<Ref<DOMRect>> selectionBounds();
ExceptionOr<bool> isPluginUnavailabilityIndicatorObscured(Element&);
+ ExceptionOr<String> unavailablePluginReplacementText(Element&);
bool isPluginSnapshotted(Element&);
#if ENABLE(MEDIA_SOURCE)
Modified: trunk/Source/WebCore/testing/Internals.idl (228586 => 228587)
--- trunk/Source/WebCore/testing/Internals.idl 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebCore/testing/Internals.idl 2018-02-16 23:31:31 UTC (rev 228587)
@@ -440,6 +440,7 @@
boolean isSelectPopupVisible(HTMLSelectElement element);
[MayThrowException] boolean isPluginUnavailabilityIndicatorObscured(Element element);
+ [MayThrowException] DOMString unavailablePluginReplacementText(Element element);
boolean isPluginSnapshotted(Element element);
[MayThrowException] DOMRect selectionBounds();
Modified: trunk/Source/WebKit/ChangeLog (228586 => 228587)
--- trunk/Source/WebKit/ChangeLog 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/ChangeLog 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1,3 +1,65 @@
+2018-02-16 Youenn Fablet <[email protected]>
+
+ Allow specifying which plug-ins are supported
+ https://bugs.webkit.org/show_bug.cgi?id=182748
+
+ Reviewed by Chris Dumez.
+
+ Add a C and ObjC API to set which plug-ins are specified.
+ Plug-ins may be allowed by origin of the main page or for all origins.
+
+ If the API to set a supported plug-in is called, WebKit enters a mode
+ where it will block any plug-in that is not on the list.
+
+ The list of supported plug-ins is stored in UIProcess and sent to WebProcess.
+ This allows to compute the list of visible plug-ins according supported plugins.
+
+ PluginInfoStore is storing the list of supported plugins and can
+ answer whether a plug-in creation request is to be made unsupported or not.
+ It also creates the structure sent to WebProcess for computing plugin visibility.
+
+ Updated ArgumentCoders to accept modern HashSet decoders.
+
+ * Platform/IPC/ArgumentCoders.h:
+ * UIProcess/API/C/WKContext.cpp:
+ (WKContextAddSupportedPlugin):
+ (WKContextClearSupportedPlugins):
+ * UIProcess/API/C/WKContextPrivate.h:
+ * UIProcess/API/Cocoa/WKProcessPool.mm:
+ (-[WKProcessPool _addSupportedPlugin:named:withMimeTypes:withExtensions:]):
+ * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+ * UIProcess/Plugins/PluginInfoStore.cpp:
+ (WebKit::PluginInfoStore::isSupportedPlugin):
+ (WebKit::PluginInfoStore::SupportedPlugins::isSupported):
+ (WebKit::PluginInfoStore::SupportedPlugin::isSupported):
+ (WebKit::PluginInfoStore::supportedPluginNames):
+ (WebKit::PluginInfoStore::addSupportedPlugin):
+ * UIProcess/Plugins/PluginInfoStore.h:
+ (WebKit::PluginInfoStore::clearSupportedPlugins):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::findPlugin):
+ (WebKit::WebPageProxy::unavailablePluginButtonClicked):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::addSupportedPlugin):
+ (WebKit::WebProcessPool::clearSupportedPlugins):
+ * UIProcess/WebProcessPool.h:
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::getPlugins):
+ * UIProcess/WebProcessProxy.h:
+ * UIProcess/WebProcessProxy.messages.in:
+ * WebProcess/Plugins/WebPluginInfoProvider.cpp:
+ (WebKit::WebPluginInfoProvider::getPluginInfo):
+ (WebKit::WebPluginInfoProvider::getWebVisiblePluginInfo):
+ (WebKit::WebPluginInfoProvider::populatePluginCache):
+ * WebProcess/Plugins/WebPluginInfoProvider.h:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton const):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::createPlugin):
+ (WebKit::WebPage::canPluginHandleResponse):
+
2018-02-16 Jiewen Tan <[email protected]>
[WebAuthN] Implement PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
Modified: trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h (228586 => 228587)
--- trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/Platform/IPC/ArgumentCoders.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -368,23 +368,26 @@
uint64_t hashMapSize;
if (!decoder.decode(hashMapSize))
return std::nullopt;
-
+
HashMapType hashMap;
for (uint64_t i = 0; i < hashMapSize; ++i) {
- KeyArg key;
- MappedArg value;
- if (!decoder.decode(key))
+ std::optional<KeyArg> key;
+ decoder >> key;
+ if (!key)
return std::nullopt;
- if (!decoder.decode(value))
+
+ std::optional<MappedArg> value;
+ decoder >> value;
+ if (!value)
return std::nullopt;
-
- if (!hashMap.add(key, value).isNewEntry) {
+
+ if (!hashMap.add(WTFMove(key.value()), WTFMove(value.value())).isNewEntry) {
// The hash map already has the specified key, bail.
decoder.markInvalid();
return std::nullopt;
}
}
-
+
return WTFMove(hashMap);
}
};
@@ -401,26 +404,36 @@
static bool decode(Decoder& decoder, HashSetType& hashSet)
{
+ std::optional<HashSetType> tempHashSet;
+ decoder >> tempHashSet;
+ if (!tempHashSet)
+ return false;
+
+ hashSet.swap(tempHashSet.value());
+ return true;
+ }
+
+ static std::optional<HashSetType> decode(Decoder& decoder)
+ {
uint64_t hashSetSize;
if (!decoder.decode(hashSetSize))
- return false;
+ return std::nullopt;
- HashSetType tempHashSet;
+ HashSetType hashSet;
for (uint64_t i = 0; i < hashSetSize; ++i) {
std::optional<KeyArg> key;
decoder >> key;
if (!key)
- return false;
+ return std::nullopt;
- if (!tempHashSet.add(*key).isNewEntry) {
- // The hash map already has the specified key, bail.
+ if (!hashSet.add(WTFMove(key.value())).isNewEntry) {
+ // The hash set already has the specified key, bail.
decoder.markInvalid();
- return false;
+ return std::nullopt;
}
}
- hashSet.swap(tempHashSet);
- return true;
+ return WTFMove(hashSet);
}
};
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (228586 => 228587)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2018-02-16 23:31:31 UTC (rev 228587)
@@ -398,6 +398,7 @@
'WebCore::ShippingMethodUpdate': ['<WebCore/ApplePaySessionPaymentRequest.h>'],
'WebCore::ShouldNotifyWhenResolved': ['<WebCore/ServiceWorkerTypes.h>'],
'WebCore::ShouldSample': ['<WebCore/DiagnosticLoggingClient.h>'],
+ 'WebCore::SupportedPluginNames': ['<WebCore/PluginData.h>'],
'WebCore::TextCheckingRequestData': ['<WebCore/TextChecking.h>'],
'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'],
'WebCore::TextIndicatorData': ['<WebCore/TextIndicator.h>'],
Modified: trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -36,8 +36,10 @@
#include "AuthenticationChallengeProxy.h"
#include "DownloadProxy.h"
#include "WKAPICast.h"
+#include "WKArray.h"
#include "WKContextConfigurationRef.h"
#include "WKRetainPtr.h"
+#include "WKString.h"
#include "WebCertificateInfo.h"
#include "WebContextInjectedBundleClient.h"
#include "WebProcessPool.h"
@@ -618,3 +620,30 @@
{
return toImpl(contextRef)->storageProcessIdentifier();
}
+
+void WKContextAddSupportedPlugin(WKContextRef contextRef, WKStringRef originRef, WKStringRef nameRef, WKArrayRef mimeTypesRef, WKArrayRef extensionsRef)
+{
+#if ENABLE(NETSCAPE_PLUGIN_API)
+ HashSet<String> mimeTypes;
+ HashSet<String> extensions;
+
+ size_t count = WKArrayGetSize(mimeTypesRef);
+ for (size_t i = 0; i < count; ++i)
+ mimeTypes.add(toWTFString(static_cast<WKStringRef>(WKArrayGetItemAtIndex(mimeTypesRef, i))));
+ count = WKArrayGetSize(extensionsRef);
+ for (size_t i = 0; i < count; ++i)
+ extensions.add(toWTFString(static_cast<WKStringRef>(WKArrayGetItemAtIndex(extensionsRef, i))));
+
+ RefPtr<SecurityOrigin> origin;
+ if (!WKStringIsEmpty(originRef))
+ origin = SecurityOrigin::createFromString(toWTFString(originRef));
+ toImpl(contextRef)->addSupportedPlugin(origin.get(), toWTFString(nameRef), WTFMove(mimeTypes), WTFMove(extensions));
+#endif
+}
+
+void WKContextClearSupportedPlugins(WKContextRef contextRef)
+{
+#if ENABLE(NETSCAPE_PLUGIN_API)
+ toImpl(contextRef)->clearSupportedPlugins();
+#endif
+}
Modified: trunk/Source/WebKit/UIProcess/API/C/WKContextPrivate.h (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/API/C/WKContextPrivate.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/API/C/WKContextPrivate.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -112,6 +112,9 @@
WK_EXPORT WKProcessID WKContextGetNetworkProcessIdentifier(WKContextRef context);
WK_EXPORT WKProcessID WKContextGetDatabaseProcessIdentifier(WKContextRef context);
+WK_EXPORT void WKContextAddSupportedPlugin(WKContextRef context, WKStringRef origin, WKStringRef name, WKArrayRef mimeTypes, WKArrayRef extensions);
+WK_EXPORT void WKContextClearSupportedPlugins(WKContextRef context);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2018-02-16 23:31:31 UTC (rev 228587)
@@ -397,6 +397,23 @@
_processPool->setAutomationSession(automationSession ? automationSession->_session.get() : nullptr);
}
+- (void)_addSupportedPlugin:(NSString *) origin named:(NSString *) name withMimeTypes: (NSSet<NSString *> *) nsMimeTypes withExtensions: (NSSet<NSString *> *) nsExtensions
+{
+ HashSet<String> mimeTypes;
+ for (NSString *mimeType in nsMimeTypes)
+ mimeTypes.add(mimeType);
+ HashSet<String> extensions;
+ for (NSString *extension in nsExtensions)
+ extensions.add(extension);
+
+ _processPool->addSupportedPlugin([origin length] ? WebCore::SecurityOrigin::createFromString(origin).ptr() : nullptr, name, WTFMove(mimeTypes), WTFMove(extensions));
+}
+
+- (void)_clearSupportedPlugins
+{
+ _processPool->clearSupportedPlugins();
+}
+
- (void)_terminateStorageProcess
{
_processPool->terminateStorageProcess();
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -24,6 +24,7 @@
*/
#import <WebKit/WKProcessPool.h>
+#import <WebKit/WKSecurityOrigin.h>
#if WK_API_ENABLED
@@ -71,6 +72,9 @@
- (void)_automationCapabilitiesDidChange WK_API_AVAILABLE(macosx(10.12), ios(10.0));
- (void)_setAutomationSession:(_WKAutomationSession *)automationSession WK_API_AVAILABLE(macosx(10.12), ios(10.0));
+- (void)_addSupportedPlugin:(NSString *) origin named:(NSString *) name withMimeTypes: (NSSet<NSString *> *) mimeTypes withExtensions: (NSSet<NSString *> *) extensions WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_clearSupportedPlugins WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
// Test only. Should be called only while no web content processes are running.
- (void)_terminateStorageProcess;
- (void)_terminateNetworkProcess;
Modified: trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -204,6 +204,65 @@
return PluginModuleInfo();
}
+bool PluginInfoStore::isSupportedPlugin(const PluginInfoStore::SupportedPlugin& plugin, const String& mimeType, const URL& pluginURL)
+{
+ if (plugin.mimeTypes.contains(mimeType))
+ return true;
+ auto extension = pathExtension(pluginURL);
+ return extension.isEmpty() ? false : plugin.extensions.contains(extension);
+}
+
+bool PluginInfoStore::isSupportedPlugin(const String& mimeType, const URL& pluginURL, const String&, const URL& pageURL)
+{
+ // We check only pageURLString for consistency with WebProcess visible plugins.
+ if (!m_supportedPlugins)
+ return true;
+
+ for (auto& plugin : m_supportedPlugins->originSpecificPlugins.get(SecurityOriginData { pageURL.protocol().toString(), pageURL.host(), pageURL.port() })) {
+ if (isSupportedPlugin(plugin, mimeType, pluginURL))
+ return true;
+ }
+ for (auto& plugin : m_supportedPlugins->allOriginPlugins) {
+ if (isSupportedPlugin(plugin, mimeType, pluginURL))
+ return true;
+ }
+ return false;
+}
+
+std::optional<SupportedPluginNames> PluginInfoStore::supportedPluginNames()
+{
+ if (!m_supportedPlugins)
+ return std::nullopt;
+
+ HashSet<String> allOriginPlugins;
+ for (auto& plugin : m_supportedPlugins->allOriginPlugins)
+ allOriginPlugins.add(plugin.name);
+
+ HashMap<SecurityOriginData, HashSet<String>> originSpecificPlugins;
+ for (auto& keyValue : m_supportedPlugins->originSpecificPlugins) {
+ HashSet<String> names;
+ for (auto& plugin : keyValue.value)
+ names.add(plugin.name);
+ originSpecificPlugins.add(keyValue.key, WTFMove(names));
+ }
+ return SupportedPluginNames { WTFMove(allOriginPlugins), WTFMove(originSpecificPlugins) };
+}
+
+void PluginInfoStore::addSupportedPlugin(const SecurityOrigin* origin, String&& name, HashSet<String>&& mimeTypes, HashSet<String> extensions)
+{
+ if (!m_supportedPlugins)
+ m_supportedPlugins = SupportedPlugins { };
+
+ SupportedPlugin plugin { WTFMove(name), WTFMove(mimeTypes), WTFMove(extensions) };
+ if (!origin) {
+ m_supportedPlugins->allOriginPlugins.append(WTFMove(plugin));
+ return;
+ }
+ m_supportedPlugins->originSpecificPlugins.ensure(SecurityOriginData::fromSecurityOrigin(*origin), [] {
+ return Vector<SupportedPlugin> { };
+ }).iterator->value.append(WTFMove(plugin));
+}
+
PluginModuleInfo PluginInfoStore::infoForPluginWithPath(const String& pluginPath) const
{
for (const auto& plugin : m_plugins) {
Modified: trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.h (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/Plugins/PluginInfoStore.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PluginInfoStore_h
-#define PluginInfoStore_h
+#pragma once
#if ENABLE(NETSCAPE_PLUGIN_API)
@@ -33,7 +32,7 @@
#include <WebCore/PluginData.h>
namespace WebCore {
- class URL;
+class URL;
}
namespace WebKit {
@@ -64,6 +63,11 @@
static PluginModuleLoadPolicy defaultLoadPolicyForPlugin(const PluginModuleInfo&);
+ bool isSupportedPlugin(const String& mimeType, const WebCore::URL& pluginURL, const String& frameURLString, const WebCore::URL& pageURL);
+ std::optional<WebCore::SupportedPluginNames> supportedPluginNames();
+ void addSupportedPlugin(const WebCore::SecurityOrigin*, String&& name, HashSet<String>&& mimeTypes, HashSet<String> extensions);
+ void clearSupportedPlugins() { m_supportedPlugins = std::nullopt; }
+
private:
PluginModuleInfo findPluginForMIMEType(const String& mimeType, WebCore::PluginData::AllowedPluginTypes) const;
PluginModuleInfo findPluginForExtension(const String& extension, String& mimeType, WebCore::PluginData::AllowedPluginTypes) const;
@@ -91,10 +95,21 @@
Vector<String> m_additionalPluginsDirectories;
Vector<PluginModuleInfo> m_plugins;
bool m_pluginListIsUpToDate;
+
+ struct SupportedPlugin {
+ String name;
+ HashSet<String> mimeTypes;
+ HashSet<String> extensions;
+ };
+ struct SupportedPlugins {
+ Vector<SupportedPlugin> allOriginPlugins;
+ HashMap<WebCore::SecurityOriginData, Vector<SupportedPlugin>> originSpecificPlugins;
+ };
+ static bool isSupportedPlugin(const SupportedPlugin&, const String& mimeType, const WebCore::URL& pluginURL);
+
+ std::optional<SupportedPlugins> m_supportedPlugins;
};
} // namespace WebKit
#endif // ENABLE(NETSCAPE_PLUGIN_API)
-
-#endif // PluginInfoStore_h
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -2055,17 +2055,27 @@
}
#if ENABLE(NETSCAPE_PLUGIN_API)
-void WebPageProxy::findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMimeType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription)
+void WebPageProxy::findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMimeType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription, bool& isUnsupported)
{
PageClientProtector protector(m_pageClient);
MESSAGE_CHECK_URL(urlString);
+ URL pluginURL = URL { URL(), urlString };
newMimeType = mimeType.convertToASCIILowercase();
- pluginLoadPolicy = PluginModuleLoadNormally;
PluginData::AllowedPluginTypes allowedPluginTypes = allowOnlyApplicationPlugins ? PluginData::OnlyApplicationPlugins : PluginData::AllPlugins;
- PluginModuleInfo plugin = m_process->processPool().pluginInfoStore().findPlugin(newMimeType, URL(URL(), urlString), allowedPluginTypes);
+
+ URL pageURL = URL { URL(), pageURLString };
+ if (!m_process->processPool().pluginInfoStore().isSupportedPlugin(mimeType, pluginURL, frameURLString, pageURL)) {
+ isUnsupported = true;
+ pluginProcessToken = 0;
+ return;
+ }
+
+ isUnsupported = false;
+ pluginLoadPolicy = PluginModuleLoadNormally;
+ PluginModuleInfo plugin = m_process->processPool().pluginInfoStore().findPlugin(newMimeType, pluginURL, allowedPluginTypes);
if (!plugin.path) {
pluginProcessToken = 0;
return;
@@ -4143,6 +4153,7 @@
pluginUnavailabilityReason = kWKPluginUnavailabilityReasonPluginCrashed;
break;
case RenderEmbeddedObject::PluginBlockedByContentSecurityPolicy:
+ case RenderEmbeddedObject::UnsupportedPlugin:
ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1655,7 +1655,7 @@
#endif
#if ENABLE(NETSCAPE_PLUGIN_API)
- void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMIMEType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription);
+ void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMIMEType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription, bool& isUnsupported);
#endif
#if USE(QUICK_LOOK)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2018-02-16 23:31:31 UTC (rev 228587)
@@ -420,7 +420,7 @@
#endif
#if ENABLE(NETSCAPE_PLUGIN_API)
- FindPlugin(String mimeType, uint32_t processType, String urlString, String frameURLString, String pageURLString, bool allowOnlyApplicationPlugins) -> (uint64_t pluginProcessToken, String newMIMEType, uint32_t pluginLoadPolicy, String unavailabilityDescription)
+ FindPlugin(String mimeType, uint32_t processType, String urlString, String frameURLString, String pageURLString, bool allowOnlyApplicationPlugins) -> (uint64_t pluginProcessToken, String newMIMEType, uint32_t pluginLoadPolicy, String unavailabilityDescription, bool isUnsupported)
#endif
DidUpdateActivityState()
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1760,6 +1760,25 @@
}
#endif
+void WebProcessPool::addSupportedPlugin(SecurityOrigin* origin, String&& name, HashSet<String>&& mimeTypes, HashSet<String> extensions)
+{
+#if ENABLE(NETSCAPE_PLUGIN_API)
+ m_pluginInfoStore.addSupportedPlugin(origin, WTFMove(name), WTFMove(mimeTypes), WTFMove(extensions));
+#else
+ UNUSED_PARAM(origin);
+ UNUSED_PARAM(name);
+ UNUSED_PARAM(mimeTypes);
+ UNUSED_PARAM(extensions);
+#endif
+}
+
+void WebProcessPool::clearSupportedPlugins()
+{
+#if ENABLE(NETSCAPE_PLUGIN_API)
+ m_pluginInfoStore.clearSupportedPlugins();
+#endif
+}
+
void WebProcessPool::setMemoryCacheDisabled(bool disabled)
{
m_memoryCacheDisabled = disabled;
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -202,6 +202,9 @@
const HashMap<String, HashMap<String, HashMap<String, uint8_t>>>& pluginLoadClientPolicies() const { return m_pluginLoadClientPolicies; }
#endif
+ void addSupportedPlugin(WebCore::SecurityOrigin*, String&& name, HashSet<String>&& mimeTypes, HashSet<String> extensions);
+ void clearSupportedPlugins();
+
ProcessID networkProcessIdentifier();
ProcessID storageProcessIdentifier();
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -567,11 +567,13 @@
}
#if ENABLE(NETSCAPE_PLUGIN_API)
-void WebProcessProxy::getPlugins(bool refresh, Vector<PluginInfo>& plugins, Vector<PluginInfo>& applicationPlugins)
+void WebProcessProxy::getPlugins(bool refresh, Vector<PluginInfo>& plugins, Vector<PluginInfo>& applicationPlugins, std::optional<WebCore::SupportedPluginNames>& supportedPluginNames)
{
if (refresh)
m_processPool->pluginInfoStore().refresh();
+ supportedPluginNames = m_processPool->pluginInfoStore().supportedPluginNames();
+
Vector<PluginModuleInfo> pluginModules = m_processPool->pluginInfoStore().plugins();
for (size_t i = 0; i < pluginModules.size(); ++i)
plugins.append(pluginModules[i].info);
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -238,7 +238,7 @@
// Plugins
#if ENABLE(NETSCAPE_PLUGIN_API)
- void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins, Vector<WebCore::PluginInfo>& applicationPlugins);
+ void getPlugins(bool refresh, Vector<WebCore::PluginInfo>& plugins, Vector<WebCore::PluginInfo>& applicationPlugins, std::optional<WebCore::SupportedPluginNames>&);
#endif // ENABLE(NETSCAPE_PLUGIN_API)
#if ENABLE(NETSCAPE_PLUGIN_API)
void getPluginProcessConnection(uint64_t pluginProcessToken, Ref<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply>&&);
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in (228586 => 228587)
--- trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in 2018-02-16 23:31:31 UTC (rev 228587)
@@ -33,7 +33,7 @@
# Plugin messages.
#if ENABLE(NETSCAPE_PLUGIN_API)
- GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins, Vector<WebCore::PluginInfo> applicationPlugins)
+ GetPlugins(bool refresh) -> (Vector<WebCore::PluginInfo> plugins, Vector<WebCore::PluginInfo> applicationPlugins, struct std::optional<WebCore::SupportedPluginNames> supportedPluginNames)
GetPluginProcessConnection(uint64_t pluginProcessToken) -> (IPC::Attachment connectionHandle, bool supportsAsynchronousInitialization) Delayed
#endif
GetNetworkProcessConnection() -> (IPC::Attachment connectionHandle) Delayed
Modified: trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp (228586 => 228587)
--- trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -35,15 +35,15 @@
#include <WebCore/FrameLoader.h>
#include <WebCore/MainFrame.h>
#include <WebCore/Page.h>
-#include <WebCore/SecurityOrigin.h>
+#include <WebCore/SecurityOriginData.h>
#include <WebCore/SubframeLoader.h>
#include <wtf/text/StringHash.h>
#if PLATFORM(MAC)
#include <WebCore/StringUtilities.h>
+#endif
using namespace WebCore;
-#endif
namespace WebKit {
@@ -97,11 +97,14 @@
#endif
}
-void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+void WebPluginInfoProvider::getPluginInfo(Page& page, Vector<PluginInfo>& plugins, std::optional<SupportedPluginNames>& supportedPluginNames)
{
#if ENABLE(NETSCAPE_PLUGIN_API)
populatePluginCache(page);
+ if (m_cachedSupportedPluginNames)
+ supportedPluginNames = *m_cachedSupportedPluginNames;
+
if (page.mainFrame().loader().subframeLoader().allowPlugins()) {
plugins = m_cachedPlugins;
return;
@@ -118,14 +121,23 @@
{
ASSERT_ARG(plugins, plugins.isEmpty());
- getPluginInfo(page, plugins);
+ std::optional<WebCore::SupportedPluginNames> supportedPluginNames;
+ getPluginInfo(page, plugins, supportedPluginNames);
-#if PLATFORM(MAC)
- if (auto* document = page.mainFrame().document()) {
- if (document->securityOrigin().isLocal())
- return;
+ auto* document = page.mainFrame().document();
+ auto* origin = document ? &document->securityOrigin(): nullptr;
+
+ if (origin && supportedPluginNames) {
+ auto originData = SecurityOriginData::fromSecurityOrigin(*origin);
+ plugins.removeAllMatching([&] (auto& plugin) {
+ return !isSupportedPlugin(*supportedPluginNames, originData, plugin.name);
+ });
}
+#if PLATFORM(MAC)
+ if (origin && origin->isLocal())
+ return;
+
for (int32_t i = plugins.size() - 1; i >= 0; --i) {
auto& info = plugins.at(i);
@@ -146,7 +158,7 @@
HangDetectionDisabler hangDetectionDisabler;
if (!WebProcess::singleton().parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetPlugins(m_shouldRefreshPlugins),
- Messages::WebProcessProxy::GetPlugins::Reply(m_cachedPlugins, m_cachedApplicationPlugins), 0,
+ Messages::WebProcessProxy::GetPlugins::Reply(m_cachedPlugins, m_cachedApplicationPlugins, m_cachedSupportedPluginNames), 0,
Seconds::infinity(), IPC::SendSyncOption::DoNotProcessIncomingMessagesWhenWaitingForSyncReply))
return;
Modified: trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h (228586 => 228587)
--- trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -45,8 +45,8 @@
private:
WebPluginInfoProvider();
- void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
- void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
+ void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&, std::optional<WebCore::SupportedPluginNames>&) final;
+ void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) final;
void refreshPlugins() override;
#if ENABLE(NETSCAPE_PLUGIN_API)
@@ -68,6 +68,7 @@
bool m_shouldRefreshPlugins { false };
Vector<WebCore::PluginInfo> m_cachedPlugins;
Vector<WebCore::PluginInfo> m_cachedApplicationPlugins;
+ std::optional<WebCore::SupportedPluginNames> m_cachedSupportedPluginNames;
#endif
};
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (228586 => 228587)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -633,6 +633,7 @@
case RenderEmbeddedObject::PluginCrashed:
case RenderEmbeddedObject::PluginBlockedByContentSecurityPolicy:
+ case RenderEmbeddedObject::UnsupportedPlugin:
return false;
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (228586 => 228587)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -828,13 +828,14 @@
uint64_t pluginProcessToken;
uint32_t pluginLoadPolicy;
String unavailabilityDescription;
- if (!sendSync(Messages::WebPageProxy::FindPlugin(parameters.mimeType, static_cast<uint32_t>(processType), parameters.url.string(), frameURLString, pageURLString, allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy, unavailabilityDescription)))
+ bool isUnsupported;
+ if (!sendSync(Messages::WebPageProxy::FindPlugin(parameters.mimeType, static_cast<uint32_t>(processType), parameters.url.string(), frameURLString, pageURLString, allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy, unavailabilityDescription, isUnsupported)))
return nullptr;
PluginModuleLoadPolicy loadPolicy = static_cast<PluginModuleLoadPolicy>(pluginLoadPolicy);
bool isBlockedPlugin = (loadPolicy == PluginModuleBlockedForSecurity) || (loadPolicy == PluginModuleBlockedForCompatibility);
- if (isBlockedPlugin || !pluginProcessToken) {
+ if (isUnsupported || isBlockedPlugin || !pluginProcessToken) {
#if ENABLE(PDFKIT_PLUGIN)
String path = parameters.url.path();
if (shouldUsePDFPlugin() && (MIMETypeRegistry::isPDFOrPostScriptMIMEType(parameters.mimeType) || (parameters.mimeType.isEmpty() && (path.endsWithIgnoringASCIICase(".pdf") || path.endsWithIgnoringASCIICase(".ps")))))
@@ -842,8 +843,14 @@
#endif
}
+ if (isUnsupported) {
+ pluginElement->setReplacement(RenderEmbeddedObject::UnsupportedPlugin, unavailabilityDescription);
+ return nullptr;
+ }
+
if (isBlockedPlugin) {
- send(Messages::WebPageProxy::DidBlockInsecurePluginVersion(parameters.mimeType, parameters.url.string(), frameURLString, pageURLString, pluginElement->isReplacementObscured(unavailabilityDescription)));
+ bool isReplacementObscured = pluginElement->setReplacement(RenderEmbeddedObject::InsecurePluginVersion, unavailabilityDescription);
+ send(Messages::WebPageProxy::DidBlockInsecurePluginVersion(parameters.mimeType, parameters.url.string(), frameURLString, pageURLString, isReplacementObscured));
return nullptr;
}
@@ -4547,11 +4554,13 @@
uint64_t pluginProcessToken;
String newMIMEType;
String unavailabilityDescription;
- if (!sendSync(Messages::WebPageProxy::FindPlugin(response.mimeType(), PluginProcessTypeNormal, response.url().string(), response.url().string(), response.url().string(), allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy, unavailabilityDescription)))
+ bool isUnsupported = false;
+ if (!sendSync(Messages::WebPageProxy::FindPlugin(response.mimeType(), PluginProcessTypeNormal, response.url().string(), response.url().string(), response.url().string(), allowOnlyApplicationPlugins), Messages::WebPageProxy::FindPlugin::Reply(pluginProcessToken, newMIMEType, pluginLoadPolicy, unavailabilityDescription, isUnsupported)))
return false;
+ ASSERT(!isUnsupported);
bool isBlockedPlugin = (pluginLoadPolicy == PluginModuleBlockedForSecurity) || (pluginLoadPolicy == PluginModuleBlockedForCompatibility);
- return !isBlockedPlugin && pluginProcessToken;
+ return !isUnsupported && !isBlockedPlugin && pluginProcessToken;
#else
UNUSED_PARAM(response);
return false;
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (228586 => 228587)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1,3 +1,15 @@
+2018-02-16 Youenn Fablet <[email protected]>
+
+ Allow specifying which plug-ins are supported
+ https://bugs.webkit.org/show_bug.cgi?id=182748
+
+ Reviewed by Chris Dumez.
+
+ * WebCoreSupport/WebPluginInfoProvider.h:
+ * WebCoreSupport/WebPluginInfoProvider.mm:
+ (WebPluginInfoProvider::getPluginInfo):
+ (WebPluginInfoProvider::getWebVisiblePluginInfo):
+
2018-02-16 Brent Fulgham <[email protected]>
[Cocoa][WebKitLegacy] REGRESSION(r221559): Coda 2 crashes when switching views
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h (228586 => 228587)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -34,8 +34,8 @@
private:
void refreshPlugins() override;
- void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
- void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
+ void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&, std::optional<WebCore::SupportedPluginNames>&) final;
+ void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) final;
WebPluginInfoProvider();
};
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm (228586 => 228587)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebPluginInfoProvider.mm 2018-02-16 23:31:31 UTC (rev 228587)
@@ -55,7 +55,7 @@
[[WebPluginDatabase sharedDatabaseIfExists] refresh];
}
-void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
+void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins, std::optional<SupportedPluginNames>&)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -71,5 +71,6 @@
void WebPluginInfoProvider::getWebVisiblePluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
{
- getPluginInfo(page, plugins);
+ std::optional<SupportedPluginNames> supportedPluginNames;
+ getPluginInfo(page, plugins, supportedPluginNames);
}
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (228586 => 228587)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1,3 +1,14 @@
+2018-02-16 Youenn Fablet <[email protected]>
+
+ Allow specifying which plug-ins are supported
+ https://bugs.webkit.org/show_bug.cgi?id=182748
+
+ Reviewed by Chris Dumez.
+
+ * WebCoreSupport/WebPluginInfoProvider.cpp:
+ (WebPluginInfoProvider::getPluginInfo):
+ * WebCoreSupport/WebPluginInfoProvider.h:
+
2018-02-15 Don Olmstead <[email protected]>
WebCore headers should not be included relatively within dependent projects
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp (228586 => 228587)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -49,7 +49,7 @@
PluginDatabase::installedPlugins()->refresh();
}
-void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& outPlugins)
+void WebPluginInfoProvider::getPluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& outPlugins, std::optional<WebCore::SupportedPluginNames>&)
{
const Vector<PluginPackage*>& plugins = PluginDatabase::installedPlugins()->plugins();
@@ -84,5 +84,6 @@
void WebPluginInfoProvider::getWebVisiblePluginInfo(WebCore::Page& page, Vector<WebCore::PluginInfo>& plugins)
{
- getPluginInfo(page, plugins);
+ std::optional<WebCore::SupportedPluginNames> supportedPluginNames;
+ getPluginInfo(page, plugins, supportedPluginNames);
}
Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h (228586 => 228587)
--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebPluginInfoProvider.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -35,12 +35,12 @@
virtual ~WebPluginInfoProvider();
private:
- void refreshPlugins() override;
- void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
- void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) override;
+ void refreshPlugins() final;
+ void getPluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&, std::optional<WebCore::SupportedPluginNames>&) final;
+ void getWebVisiblePluginInfo(WebCore::Page&, Vector<WebCore::PluginInfo>&) final;
#if PLATFORM(MAC)
- void setPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString) override;
- void clearPluginClientPolicies() override;
+ void setPluginLoadClientPolicy(WebCore::PluginLoadClientPolicy, const String& host, const String& bundleIdentifier, const String& versionString) final;
+ void clearPluginClientPolicies() final;
#endif
WebPluginInfoProvider();
Modified: trunk/Tools/ChangeLog (228586 => 228587)
--- trunk/Tools/ChangeLog 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Tools/ChangeLog 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1,3 +1,23 @@
+2018-02-16 Youenn Fablet <[email protected]>
+
+ Allow specifying which plug-ins are supported
+ https://bugs.webkit.org/show_bug.cgi?id=182748
+
+ Reviewed by Chris Dumez.
+
+ Add support for a test runner API to specificy supported plug-ins.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setPluginsAsUnsupported):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::resetStateToConsistentValues):
+ (WTR::TestController::setPluginsAsUnsupported):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+
2018-02-16 Per Arne Vollan <[email protected]>
Implement stopping of run loop in the WebContent process when using NSRunLoop.
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (228586 => 228587)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-02-16 23:31:31 UTC (rev 228587)
@@ -233,7 +233,8 @@
// Override plugin load policy.
void setBlockAllPlugins(boolean shouldBlock);
-
+ void setPluginSupportedMode(DOMString mode);
+
// Hooks to the JSC compiler.
object failNextNewCodeBlock();
object numberOfDFGCompiles(object function);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (228586 => 228587)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -1075,6 +1075,13 @@
WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
}
+void TestRunner::setPluginSupportedMode(JSStringRef mode)
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetPluginSupportedMode"));
+ WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(mode));
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
+}
+
JSValueRef TestRunner::failNextNewCodeBlock()
{
WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(InjectedBundle::singleton().page()->page());
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (228586 => 228587)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -188,7 +188,8 @@
// Audio testing.
void setAudioResult(JSContextRef, JSValueRef data);
- void setBlockAllPlugins(bool shouldBlock);
+ void setBlockAllPlugins(bool);
+ void setPluginSupportedMode(JSStringRef);
enum WhatToDump { RenderTree, MainFrameText, AllFramesText, Audio, DOMAsWebArchive };
WhatToDump whatToDump() const { return m_whatToDump; }
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (228586 => 228587)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -843,6 +843,7 @@
m_authenticationPassword = String();
m_shouldBlockAllPlugins = false;
+ setPluginSupportedMode({ });
m_shouldLogDownloadCallbacks = false;
m_shouldLogHistoryClientCallbacks = false;
@@ -1669,6 +1670,44 @@
#endif
}
+void TestController::setPluginSupportedMode(const String& mode)
+{
+ if (m_unsupportedPluginMode == mode)
+ return;
+
+ m_unsupportedPluginMode = mode;
+ if (m_unsupportedPluginMode.isEmpty()) {
+ WKContextClearSupportedPlugins(m_context.get());
+ return;
+ }
+
+ WKRetainPtr<WKMutableArrayRef> emptyArray = adoptWK(WKMutableArrayCreate());
+ WKRetainPtr<WKStringRef> allOrigins = adoptWK(WKStringCreateWithUTF8CString(""));
+ WKRetainPtr<WKStringRef> specificOrigin = adoptWK(WKStringCreateWithUTF8CString("http://localhost:8080"));
+
+ WKRetainPtr<WKStringRef> pdfName = adoptWK(WKStringCreateWithUTF8CString("My personal PDF"));
+ WKContextAddSupportedPlugin(m_context.get(), allOrigins.get(), pdfName.get(), emptyArray.get(), emptyArray.get());
+
+ WKRetainPtr<WKStringRef> nameNetscape = adoptWK(WKStringCreateWithUTF8CString("com.apple.testnetscapeplugin"));
+ WKRetainPtr<WKStringRef> mimeTypeNetscape = adoptWK(WKStringCreateWithUTF8CString("application/x-webkit-test-netscape"));
+ WKRetainPtr<WKMutableArrayRef> mimeTypesNetscape = adoptWK(WKMutableArrayCreate());
+ WKArrayAppendItem(mimeTypesNetscape.get(), mimeTypeNetscape.get());
+
+ WKRetainPtr<WKStringRef> namePdf = adoptWK(WKStringCreateWithUTF8CString("WebKit built-in PDF"));
+
+ if (m_unsupportedPluginMode == "allOrigins") {
+ WKContextAddSupportedPlugin(m_context.get(), allOrigins.get(), nameNetscape.get(), mimeTypesNetscape.get(), emptyArray.get());
+ WKContextAddSupportedPlugin(m_context.get(), allOrigins.get(), namePdf.get(), emptyArray.get(), emptyArray.get());
+ return;
+ }
+
+ if (m_unsupportedPluginMode == "specificOrigin") {
+ WKContextAddSupportedPlugin(m_context.get(), specificOrigin.get(), nameNetscape.get(), mimeTypesNetscape.get(), emptyArray.get());
+ WKContextAddSupportedPlugin(m_context.get(), specificOrigin.get(), namePdf.get(), emptyArray.get(), emptyArray.get());
+ return;
+ }
+}
+
void TestController::didCommitNavigation(WKPageRef page, WKNavigationRef navigation)
{
mainWebView()->focus();
Modified: trunk/Tools/WebKitTestRunner/TestController.h (228586 => 228587)
--- trunk/Tools/WebKitTestRunner/TestController.h 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2018-02-16 23:31:31 UTC (rev 228587)
@@ -139,6 +139,7 @@
void setAllowsAnySSLCertificate(bool);
void setBlockAllPlugins(bool shouldBlock) { m_shouldBlockAllPlugins = shouldBlock; }
+ void setPluginSupportedMode(const String&);
void setShouldLogHistoryClientCallbacks(bool shouldLog) { m_shouldLogHistoryClientCallbacks = shouldLog; }
void setShouldLogCanAuthenticateAgainstProtectionSpace(bool shouldLog) { m_shouldLogCanAuthenticateAgainstProtectionSpace = shouldLog; }
@@ -398,6 +399,7 @@
String m_authenticationPassword;
bool m_shouldBlockAllPlugins { false };
+ String m_unsupportedPluginMode;
bool m_forceComplexText { false };
bool m_shouldUseAcceleratedDrawing { false };
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (228586 => 228587)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2018-02-16 23:18:00 UTC (rev 228586)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2018-02-16 23:31:31 UTC (rev 228587)
@@ -710,6 +710,13 @@
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetPluginSupportedMode")) {
+ ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
+ WKStringRef mode = static_cast<WKStringRef>(messageBody);
+ TestController::singleton().setPluginSupportedMode(toWTFString(mode));
+ return;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "SetShouldDecideNavigationPolicyAfterDelay")) {
ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);