Diff
Modified: trunk/LayoutTests/ChangeLog (242919 => 242920)
--- trunk/LayoutTests/ChangeLog 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/LayoutTests/ChangeLog 2019-03-13 23:37:32 UTC (rev 242920)
@@ -1,3 +1,22 @@
+2019-03-13 Dean Jackson <[email protected]>
+
+ Block all plugins smaller than 5x5px
+ https://bugs.webkit.org/show_bug.cgi?id=195702
+ <rdar://problem/28435204>
+
+ Reviewed by Sam Weinig.
+
+ New test for some small plugins. Updated existing tests
+ to create plugins bigger than a threshold if necessary.
+
+ * plugins/clicking-missing-plugin-fires-delegate.html:
+ * plugins/destroy-stream-twice.html:
+ * plugins/npruntime/npruntime.html:
+ * plugins/object-embed-plugin-scripting.html:
+ * plugins/small-plugin-blocked-expected.txt: Added.
+ * plugins/small-plugin-blocked.html: Added.
+ * platform/mac-wk1/TestExpectations: Skip new test on WK1.
+
2019-03-13 Zalan Bujtas <[email protected]>
Use RenderBox::previousSiblingBox/nextSiblingBox in RenderMultiColumnFlow
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (242919 => 242920)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2019-03-13 23:37:32 UTC (rev 242920)
@@ -193,6 +193,9 @@
# Disable snapshotting tests on WK1 only
plugins/snapshotting
+# Disable small plugin blocking on WK1
+plugins/small-plugin-blocked.html [ Skip ]
+
# WK1 doesn't do pending WebGL policies
fast/canvas/webgl/useWhilePending.html [ Skip ]
Modified: trunk/LayoutTests/plugins/clicking-missing-plugin-fires-delegate.html (242919 => 242920)
--- trunk/LayoutTests/plugins/clicking-missing-plugin-fires-delegate.html 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/LayoutTests/plugins/clicking-missing-plugin-fires-delegate.html 2019-03-13 23:37:32 UTC (rev 242920)
@@ -1,20 +1,21 @@
<html>
<body>
-<embed name="plg" type="application/x-non-existent" width=200 height=200></embed>
+<embed name="plg" type="application/x-non-existent" style="width:200px;height:200px;" width=200 height=200></embed>
<p>This test checks if the missing plug-in button can be clicked. This is a test for <a href="" 41721</a>.</p>
<script>
- if (!window.testRunner) {
- document.write("This test does not work in manual mode.");
- } else {
- testRunner.dumpAsText();
+if (!window.testRunner)
+ document.write("This test does not work in manual mode.");
+else {
+ testRunner.dumpAsText();
+ window._onload_ = function () {
eventSender.mouseMoveTo(0,0);
eventSender.mouseMoveTo(105, 105);
eventSender.mouseDown();
eventSender.mouseUp();
- }
-
+ };
+}
</script>
</body>
</html>
Modified: trunk/LayoutTests/plugins/destroy-stream-twice.html (242919 => 242920)
--- trunk/LayoutTests/plugins/destroy-stream-twice.html 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/LayoutTests/plugins/destroy-stream-twice.html 2019-03-13 23:37:32 UTC (rev 242920)
@@ -33,7 +33,7 @@
<embed id="plugin"
type="application/x-webkit-test-netscape"
src=""
- style="width:0; height:0"
+ style="width:10px; height:10px"
_onstreamload_="setTimeout(runTest, 0);">
</embed>
Modified: trunk/LayoutTests/plugins/npruntime/npruntime.html (242919 => 242920)
--- trunk/LayoutTests/plugins/npruntime/npruntime.html 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/LayoutTests/plugins/npruntime/npruntime.html 2019-03-13 23:37:32 UTC (rev 242920)
@@ -55,6 +55,6 @@
</script>
<embed id="plugin"
type="application/x-webkit-test-netscape"
- style="width:0; height:0"
+ style="width:10px; height:10px"
testnpruntime="1">
</embed>
Modified: trunk/LayoutTests/plugins/object-embed-plugin-scripting.html (242919 => 242920)
--- trunk/LayoutTests/plugins/object-embed-plugin-scripting.html 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/LayoutTests/plugins/object-embed-plugin-scripting.html 2019-03-13 23:37:32 UTC (rev 242920)
@@ -35,7 +35,7 @@
<OBJECT
id="myO"
type="application/x-webkit-test-netscape"
- width = 0 height = 0
+ width = 10 height = 10
>
<PARAM name="autostart" value="false">
@@ -44,7 +44,7 @@
type="application/x-webkit-test-netscape"
autostart="false"
enablejavascript="true"
- width = 0 height = 0
+ width = 10 height = 10
>
</EMBED>
</OBJECT>
@@ -55,7 +55,7 @@
type="application/x-webkit-test-netscape"
autostart="false"
enablejavascript="true"
- width = 0 height = 0
+ width = 10 height = 10
>
</object>
@@ -62,7 +62,7 @@
<object
data=""
type="image/gif"
- width = 0 height = 0
+ width = 10 height = 10
>
<embed
id="myE3"
@@ -69,7 +69,7 @@
type="application/x-webkit-test-netscape"
autostart="false"
enablejavascript="true"
- width = 0 height = 0
+ width = 10 height = 10
>
</object>
@@ -76,7 +76,7 @@
<object
data=""
type="image/gif"
- width = 0 height = 0
+ width = 10 height = 10
>
<object>
<embed
@@ -84,7 +84,7 @@
type="application/x-webkit-test-netscape"
autostart="false"
enablejavascript="true"
- width = 0 height = 0
+ width = 10 height = 10
>
</object>
</object>
@@ -94,13 +94,13 @@
type="application/x-webkit-test-netscape"
autostart="false"
enablejavascript="true"
- width = 0 height = 0
+ width = 10 height = 10
>
<object
name="Plugin"
type="application/x-webkit-test-netscape"
- width = 0 height = 0
+ width = 10 height = 10
>
<param name="autostart" value="false">
<param name="enablejavascript" value="true">
@@ -110,7 +110,7 @@
type="application/x-webkit-test-netscape"
autostart="false"
enablejavascript="true"
- width = 0 height = 0
+ width = 10 height = 10
>
</embed>
</object>
@@ -121,7 +121,7 @@
type="application/x-webkit-test-netscape"
autostart="false"
enablejavascript="true"
- width = 0 height = 0
+ width = 10 height = 10
>
</embed>
</object>
Added: trunk/LayoutTests/plugins/small-plugin-blocked-expected.txt (0 => 242920)
--- trunk/LayoutTests/plugins/small-plugin-blocked-expected.txt (rev 0)
+++ trunk/LayoutTests/plugins/small-plugin-blocked-expected.txt 2019-03-13 23:37:32 UTC (rev 242920)
@@ -0,0 +1,17 @@
+This tests that small plugins are blocked
+
+0x0 is BLOCKED
+
+1x1 is BLOCKED
+
+4x4 is BLOCKED
+
+5x5 is BLOCKED
+
+6x6 is RUNNING
+
+1x6 is RUNNING
+
+6x1 is RUNNING
+
+
Property changes on: trunk/LayoutTests/plugins/small-plugin-blocked-expected.txt
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/plain
\ No newline at end of property
Added: trunk/LayoutTests/plugins/small-plugin-blocked.html (0 => 242920)
--- trunk/LayoutTests/plugins/small-plugin-blocked.html (rev 0)
+++ trunk/LayoutTests/plugins/small-plugin-blocked.html 2019-03-13 23:37:32 UTC (rev 242920)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<p>This tests that small plugins are blocked</p>
+<div id="result"></div>
+<script>
+function log(destination, msg)
+{
+ var t = document.createTextNode(msg);
+ var p = document.createElement("p");
+ p.appendChild(t);
+ destination.appendChild(p);
+}
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ setTimeout(function () {
+ const result = document.getElementById("result");
+ for (id of ["0x0", "1x1", "4x4", "5x5", "6x6", "1x6", "6x1"]) {
+ const embed = document.getElementById(`plugin${id}`);
+ log(result, `${id} is ${internals.pluginIsBelowSizeThreshold(embed) ? "BLOCKED" : "RUNNING"}`);
+ }
+ testRunner.notifyDone();
+ }, 500);
+}
+</script>
+<embed id="plugin0x0" type="application/x-webkit-test-netscape" width="0" height="0"></embed>
+<embed id="plugin1x1" type="application/x-webkit-test-netscape" width="1" height="1"></embed>
+<embed id="plugin4x4" type="application/x-webkit-test-netscape" width="4" height="4"></embed>
+<embed id="plugin5x5" type="application/x-webkit-test-netscape" width="5" height="5"></embed>
+<embed id="plugin6x6" type="application/x-webkit-test-netscape" width="6" height="6"></embed>
+<embed id="plugin1x6" type="application/x-webkit-test-netscape" width="1" height="6"></embed>
+<embed id="plugin6x1" type="application/x-webkit-test-netscape" width="6" height="1"></embed>
Property changes on: trunk/LayoutTests/plugins/small-plugin-blocked.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Modified: trunk/Source/WebCore/ChangeLog (242919 => 242920)
--- trunk/Source/WebCore/ChangeLog 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/ChangeLog 2019-03-13 23:37:32 UTC (rev 242920)
@@ -1,3 +1,45 @@
+2019-03-13 Dean Jackson <[email protected]>
+
+ Block all plugins smaller than 5x5px
+ https://bugs.webkit.org/show_bug.cgi?id=195702
+ <rdar://problem/28435204>
+
+ Reviewed by Sam Weinig.
+
+ Block all plugins that are smaller than a threshold, in this case
+ 5px x 5px. Other browsers have implemented this for a while, and now
+ that we have Intersection Observers, small plugins are no longer
+ necessary.
+
+ Test: plugins/small-plugin-blocked.html
+
+ * en.lproj/Localizable.strings: New message for a small plugin.
+ * platform/LocalizedStrings.cpp:
+ (WebCore::pluginTooSmallText):
+ * platform/LocalizedStrings.h:
+
+ * html/HTMLPlugInElement.cpp: Helper function for Internals testing.
+ (WebCore::HTMLPlugInElement::isBelowSizeThreshold const):
+ * html/HTMLPlugInElement.h:
+
+ * loader/EmptyClients.cpp: Removed an unused function.
+ (WebCore::EmptyFrameLoaderClient::recreatePlugin): Deleted.
+ * loader/EmptyFrameLoaderClient.h:
+ * loader/FrameLoaderClient.h:
+
+ * page/Settings.yaml: Add flag for new feature.
+
+ * rendering/RenderEmbeddedObject.cpp: New unavailability reason for
+ embedded objects.
+ (WebCore::unavailablePluginReplacementText):
+ * rendering/RenderEmbeddedObject.h:
+ (WebCore::RenderEmbeddedObject::pluginUnavailabilityReason const):
+
+ * testing/Internals.cpp: Helper function for testing.
+ (WebCore::Internals::pluginIsBelowSizeThreshold):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2019-03-13 Zalan Bujtas <[email protected]>
Use RenderBox::previousSiblingBox/nextSiblingBox in RenderMultiColumnFlow
Modified: trunk/Source/WebCore/en.lproj/Localizable.strings (242919 => 242920)
--- trunk/Source/WebCore/en.lproj/Localizable.strings 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/en.lproj/Localizable.strings 2019-03-13 23:37:32 UTC (rev 242920)
@@ -559,6 +559,9 @@
/* accessibility help text for enter full screen button */
"Play movie in full screen mode" = "Play movie in full screen mode";
+/* Label text to be used when a plug-in was blocked from loading because it was too small */
+"Plug-In too small" = "Plug-In too small";
+
/* Label text to be used if plugin host process has crashed */
"Plug-in Failure" = "Plug-in Failure";
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (242919 => 242920)
--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2019-03-13 23:37:32 UTC (rev 242920)
@@ -406,6 +406,15 @@
return nullptr;
}
+bool HTMLPlugInElement::isBelowSizeThreshold() const
+{
+ auto* renderObject = renderer();
+ if (!is<RenderEmbeddedObject>(renderObject))
+ return true;
+ auto& renderEmbeddedObject = downcast<RenderEmbeddedObject>(*renderObject);
+ return renderEmbeddedObject.isPluginUnavailable() && renderEmbeddedObject.pluginUnavailabilityReason() == RenderEmbeddedObject::PluginTooSmall;
+}
+
bool HTMLPlugInElement::setReplacement(RenderEmbeddedObject::PluginUnavailabilityReason reason, const String& unavailabilityDescription)
{
if (!is<RenderEmbeddedObject>(renderer()))
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (242919 => 242920)
--- trunk/Source/WebCore/html/HTMLPlugInElement.h 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h 2019-03-13 23:37:32 UTC (rev 242920)
@@ -83,6 +83,8 @@
bool isUserObservable() const;
+ WEBCORE_EXPORT bool isBelowSizeThreshold() const;
+
// Return whether or not the replacement content for blocked plugins is accessible to the user.
WEBCORE_EXPORT bool setReplacement(RenderEmbeddedObject::PluginUnavailabilityReason, const String& unavailabilityDescription);
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (242919 => 242920)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2019-03-13 23:37:32 UTC (rev 242920)
@@ -485,10 +485,6 @@
return nullptr;
}
-void EmptyFrameLoaderClient::recreatePlugin(Widget*)
-{
-}
-
RefPtr<Widget> EmptyFrameLoaderClient::createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&)
{
return nullptr;
Modified: trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h (242919 => 242920)
--- trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/loader/EmptyFrameLoaderClient.h 2019-03-13 23:37:32 UTC (rev 242920)
@@ -173,7 +173,6 @@
void didDetectXSS(const URL&, bool) final { }
RefPtr<Frame> createFrame(const URL&, const String&, HTMLFrameOwnerElement&, const String&) final;
RefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool) final;
- void recreatePlugin(Widget*) final;
RefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL&, const Vector<String>&, const Vector<String>&) final;
ObjectContentType objectContentType(const URL&, const String&) final { return ObjectContentType::None; }
Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (242919 => 242920)
--- trunk/Source/WebCore/loader/FrameLoaderClient.h 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h 2019-03-13 23:37:32 UTC (rev 242920)
@@ -290,7 +290,6 @@
virtual RefPtr<Frame> createFrame(const URL&, const String& name, HTMLFrameOwnerElement&, const String& referrer) = 0;
virtual RefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) = 0;
- virtual void recreatePlugin(Widget*) = 0;
virtual void redirectDataToPlugin(Widget&) = 0;
virtual RefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement&, const URL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) = 0;
Modified: trunk/Source/WebCore/page/Settings.yaml (242919 => 242920)
--- trunk/Source/WebCore/page/Settings.yaml 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/page/Settings.yaml 2019-03-13 23:37:32 UTC (rev 242920)
@@ -811,6 +811,9 @@
adClickAttributionEnabled:
initial: false
+blockingOfSmallPluginsEnabled:
+ initial: true
+
# Deprecated
iceCandidateFilteringEnabled:
Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (242919 => 242920)
--- trunk/Source/WebCore/platform/LocalizedStrings.cpp 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp 2019-03-13 23:37:32 UTC (rev 242920)
@@ -678,6 +678,11 @@
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 pluginTooSmallText()
+{
+ return WEB_UI_STRING_KEY("Plug-In too small", "Plug-In too small", "Label text to be used when a plug-in was blocked from loading because it was too small");
+}
+
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 (242919 => 242920)
--- trunk/Source/WebCore/platform/LocalizedStrings.h 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h 2019-03-13 23:37:32 UTC (rev 242920)
@@ -225,6 +225,7 @@
String blockedPluginByContentSecurityPolicyText();
String insecurePluginVersionText();
String unsupportedPluginText();
+ WEBCORE_EXPORT String pluginTooSmallText();
String multipleFileUploadText(unsigned numberOfFiles);
String unknownFileSizeText();
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (242919 => 242920)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2019-03-13 23:37:32 UTC (rev 242920)
@@ -158,6 +158,8 @@
return insecurePluginVersionText();
case RenderEmbeddedObject::UnsupportedPlugin:
return unsupportedPluginText();
+ case RenderEmbeddedObject::PluginTooSmall:
+ return pluginTooSmallText();
}
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.h (242919 => 242920)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.h 2019-03-13 23:37:32 UTC (rev 242920)
@@ -45,8 +45,10 @@
PluginCrashed,
PluginBlockedByContentSecurityPolicy,
InsecurePluginVersion,
- UnsupportedPlugin
+ UnsupportedPlugin,
+ PluginTooSmall
};
+ PluginUnavailabilityReason pluginUnavailabilityReason() const { return m_pluginUnavailabilityReason; };
WEBCORE_EXPORT void setPluginUnavailabilityReason(PluginUnavailabilityReason);
WEBCORE_EXPORT void setPluginUnavailabilityReasonWithDescription(PluginUnavailabilityReason, const String& description);
Modified: trunk/Source/WebCore/testing/Internals.cpp (242919 => 242920)
--- trunk/Source/WebCore/testing/Internals.cpp 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/testing/Internals.cpp 2019-03-13 23:37:32 UTC (rev 242920)
@@ -3639,6 +3639,11 @@
return is<HTMLPlugInElement>(element) && downcast<HTMLPlugInElement>(element).displayState() <= HTMLPlugInElement::DisplayingSnapshot;
}
+bool Internals::pluginIsBelowSizeThreshold(Element& element)
+{
+ return is<HTMLPlugInElement>(element) && downcast<HTMLPlugInElement>(element).isBelowSizeThreshold();
+}
+
#if ENABLE(MEDIA_SOURCE)
void Internals::initializeMockMediaSource()
Modified: trunk/Source/WebCore/testing/Internals.h (242919 => 242920)
--- trunk/Source/WebCore/testing/Internals.h 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/testing/Internals.h 2019-03-13 23:37:32 UTC (rev 242920)
@@ -555,6 +555,7 @@
ExceptionOr<bool> isPluginUnavailabilityIndicatorObscured(Element&);
ExceptionOr<String> unavailablePluginReplacementText(Element&);
bool isPluginSnapshotted(Element&);
+ bool pluginIsBelowSizeThreshold(Element&);
#if ENABLE(MEDIA_SOURCE)
WEBCORE_TESTSUPPORT_EXPORT void initializeMockMediaSource();
Modified: trunk/Source/WebCore/testing/Internals.idl (242919 => 242920)
--- trunk/Source/WebCore/testing/Internals.idl 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebCore/testing/Internals.idl 2019-03-13 23:37:32 UTC (rev 242920)
@@ -550,6 +550,7 @@
[MayThrowException] boolean isPluginUnavailabilityIndicatorObscured(Element element);
[MayThrowException] DOMString unavailablePluginReplacementText(Element element);
boolean isPluginSnapshotted(Element element);
+ boolean pluginIsBelowSizeThreshold(Element element);
[MayThrowException] DOMRect selectionBounds();
void setSelectionWithoutValidation(Node baseNode, unsigned long baseOffset, Node? extentNode, unsigned long extentOffset);
Modified: trunk/Source/WebKit/ChangeLog (242919 => 242920)
--- trunk/Source/WebKit/ChangeLog 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKit/ChangeLog 2019-03-13 23:37:32 UTC (rev 242920)
@@ -1,3 +1,33 @@
+2019-03-13 Dean Jackson <[email protected]>
+
+ Block all plugins smaller than 5x5px
+ https://bugs.webkit.org/show_bug.cgi?id=195702
+ <rdar://problem/28435204>
+
+ Reviewed by Sam Weinig.
+
+ Block all plugins that are smaller than a threshold, in this case
+ 5x5px. Other browsers have implemented this for a while, and now
+ that we have Intersection Observers, small plugins are no longer
+ necessary.
+
+ * Shared/WebPreferences.yaml: New setting for this feature.
+
+ * UIProcess/WebPageProxy.cpp: Handle new unavailability type.
+ (WebKit::WebPageProxy::unavailablePluginButtonClicked):
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton const):
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: Removed this function
+ as it was never being called.
+ (WebKit::WebFrameLoaderClient::recreatePlugin): Deleted.
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::pluginIsSmall): Checks the size of the plugin.
+ (WebKit::WebPage::createPlugin): If the plugin is too small, stop it from
+ launching.
+
2019-03-13 Keith Rollin <[email protected]>
Add support for new StagedFrameworks layout
Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (242919 => 242920)
--- trunk/Source/WebKit/Shared/WebPreferences.yaml 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml 2019-03-13 23:37:32 UTC (rev 242920)
@@ -1247,6 +1247,13 @@
humanReadableDescription: "Implement standard behavior for scrollLeft, scrollTop, scrollWidth, scrollHeight, scrollTo, scrollBy and scrollingElement."
category: internal
+BlockingOfSmallPluginsEnabled:
+ type: bool
+ defaultValue: true
+ humanReadableName: "Block small plugins"
+ humanReadableDescription: "Stop plugins smaller than a certain threshold from loading."
+ category: internal
+
WebAnimationsEnabled:
type: bool
defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (242919 => 242920)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-03-13 23:37:32 UTC (rev 242920)
@@ -5108,6 +5108,7 @@
break;
case RenderEmbeddedObject::PluginBlockedByContentSecurityPolicy:
case RenderEmbeddedObject::UnsupportedPlugin:
+ case RenderEmbeddedObject::PluginTooSmall:
ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (242919 => 242920)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2019-03-13 23:37:32 UTC (rev 242920)
@@ -637,6 +637,7 @@
case RenderEmbeddedObject::PluginCrashed:
case RenderEmbeddedObject::PluginBlockedByContentSecurityPolicy:
case RenderEmbeddedObject::UnsupportedPlugin:
+ case RenderEmbeddedObject::PluginTooSmall:
return false;
}
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (242919 => 242920)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2019-03-13 23:37:32 UTC (rev 242920)
@@ -1561,22 +1561,6 @@
#endif
}
-void WebFrameLoaderClient::recreatePlugin(Widget* widget)
-{
-#if ENABLE(NETSCAPE_PLUGIN_API)
- ASSERT(widget);
- ASSERT(widget->isPluginViewBase());
- ASSERT(m_frame->page());
-
- auto& pluginView = static_cast<PluginView&>(*widget);
- String newMIMEType;
- auto plugin = m_frame->page()->createPlugin(m_frame, pluginView.pluginElement(), pluginView.initialParameters(), newMIMEType);
- pluginView.recreateAndInitialize(plugin.releaseNonNull());
-#else
- UNUSED_PARAM(widget);
-#endif
-}
-
void WebFrameLoaderClient::redirectDataToPlugin(Widget& pluginWidget)
{
m_pluginView = static_cast<PluginView*>(&pluginWidget);
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (242919 => 242920)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h 2019-03-13 23:37:32 UTC (rev 242920)
@@ -213,7 +213,6 @@
RefPtr<WebCore::Frame> createFrame(const URL&, const String& name, WebCore::HTMLFrameOwnerElement&, const String& referrer) final;
RefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement&, const URL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) final;
- void recreatePlugin(WebCore::Widget*) final;
void redirectDataToPlugin(WebCore::Widget&) final;
#if ENABLE(WEBGL)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (242919 => 242920)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-03-13 23:37:32 UTC (rev 242920)
@@ -181,6 +181,7 @@
#include <WebCore/JSDOMExceptionHandling.h>
#include <WebCore/JSDOMWindow.h>
#include <WebCore/KeyboardEvent.h>
+#include <WebCore/LocalizedStrings.h>
#include <WebCore/MIMETypeRegistry.h>
#include <WebCore/MouseEvent.h>
#include <WebCore/NotImplemented.h>
@@ -887,6 +888,19 @@
#endif
#if ENABLE(NETSCAPE_PLUGIN_API)
+
+constexpr int smallPluginDimensionThreshold = 5;
+
+static bool pluginIsSmall(WebCore::HTMLPlugInElement& pluginElement)
+{
+ auto* renderer = pluginElement.renderer();
+ if (!is<RenderEmbeddedObject>(*renderer))
+ return false;
+
+ auto& box = downcast<RenderBox>(*renderer);
+ return box.contentWidth() <= smallPluginDimensionThreshold && box.contentHeight() <= smallPluginDimensionThreshold;
+}
+
RefPtr<Plugin> WebPage::createPlugin(WebFrame* frame, HTMLPlugInElement* pluginElement, const Plugin::Parameters& parameters, String& newMIMEType)
{
String frameURLString = frame->coreFrame()->loader().documentLoader()->responseURL().string();
@@ -934,6 +948,12 @@
if (!pluginProcessToken)
return nullptr;
+ if (m_page->settings().blockingOfSmallPluginsEnabled() && pluginIsSmall(*pluginElement)) {
+ RELEASE_LOG(Plugins, "Blocking a plugin because it is too small");
+ pluginElement->setReplacement(RenderEmbeddedObject::PluginTooSmall, pluginTooSmallText());
+ return nullptr;
+ }
+
bool isRestartedProcess = (pluginElement->displayState() == HTMLPlugInElement::Restarting || pluginElement->displayState() == HTMLPlugInElement::RestartingWithPendingMouseClick);
return PluginProxy::create(pluginProcessToken, isRestartedProcess);
}
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (242919 => 242920)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-03-13 23:37:32 UTC (rev 242920)
@@ -1,3 +1,17 @@
+2019-03-13 Dean Jackson <[email protected]>
+
+ Block all plugins smaller than 5x5px
+ https://bugs.webkit.org/show_bug.cgi?id=195702
+ <rdar://problem/28435204>
+
+ Reviewed by Sam Weinig.
+
+ Removed a function that was never being called.
+
+ * WebCoreSupport/WebFrameLoaderClient.h:
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::recreatePlugin): Deleted.
+
2019-03-13 Keith Rollin <[email protected]>
Add support for new StagedFrameworks layout
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h (242919 => 242920)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.h 2019-03-13 23:37:32 UTC (rev 242920)
@@ -211,7 +211,6 @@
const WTF::String& referrer) final;
RefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement&, const URL&,
const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool) final;
- void recreatePlugin(WebCore::Widget*) final;
void redirectDataToPlugin(WebCore::Widget&) final;
#if ENABLE(WEBGL)
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (242919 => 242920)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2019-03-13 23:36:02 UTC (rev 242919)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm 2019-03-13 23:37:32 UTC (rev 242920)
@@ -2037,10 +2037,6 @@
return nullptr;
}
-void WebFrameLoaderClient::recreatePlugin(Widget*)
-{
-}
-
void WebFrameLoaderClient::redirectDataToPlugin(Widget& pluginWidget)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;