Title: [233563] trunk
Revision
233563
Author
[email protected]
Date
2018-07-05 22:50:17 -0700 (Thu, 05 Jul 2018)

Log Message

REGRESSION (r230843): Flash doesn't work; Produces blue box on page
https://bugs.webkit.org/show_bug.cgi?id=187346
<rdar://problem/41773974>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Introduce clearPagesPluginData used by WebProcess when a plugin policy changes.
Add a new internals API to get the plugin count as navigator.plugin is filtering plugins.

Test: http/tests/plugins/plugin-allow-then-reload.html

* plugins/PluginData.h:
* plugins/PluginInfoProvider.cpp:
(WebCore::PluginInfoProvider::clearPagesPluginData):
* plugins/PluginInfoProvider.h:
* testing/Internals.cpp:
(WebCore::Internals::pluginCount):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

Reset page plugins when the load client policies are updated.
This will ensure that pages will rebuild their plugin lists based on the new policies.

* WebProcess/Plugins/WebPluginInfoProvider.cpp:
(WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
(WebKit::WebPluginInfoProvider::clearPluginClientPolicies):

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::setBlockAllPlugins):
When not blocked, set the load policy to allow once.
* WebKitTestRunner/TestController.h:

LayoutTests:

Skip new test on WK1 since it does not have the ability to block plugins.

* http/tests/plugins/plugin-allow-then-reload-expected.txt: Added.
* http/tests/plugins/plugin-allow-then-reload.html: Added.
* platform/mac-wk1/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (233562 => 233563)


--- trunk/LayoutTests/ChangeLog	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/LayoutTests/ChangeLog	2018-07-06 05:50:17 UTC (rev 233563)
@@ -1,3 +1,17 @@
+2018-07-05  Youenn Fablet  <[email protected]>
+
+        REGRESSION (r230843): Flash doesn't work; Produces blue box on page
+        https://bugs.webkit.org/show_bug.cgi?id=187346
+        <rdar://problem/41773974>
+
+        Reviewed by Ryosuke Niwa.
+
+        Skip new test on WK1 since it does not have the ability to block plugins.
+
+        * http/tests/plugins/plugin-allow-then-reload-expected.txt: Added.
+        * http/tests/plugins/plugin-allow-then-reload.html: Added.
+        * platform/mac-wk1/TestExpectations:
+
 2018-07-05  Brady Eidson  <[email protected]>
 
         IndexedDB operations in a Page fail after a StorageProcess crash.

Added: trunk/LayoutTests/http/tests/plugins/plugin-allow-then-reload-expected.txt (0 => 233563)


--- trunk/LayoutTests/http/tests/plugins/plugin-allow-then-reload-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/plugin-allow-then-reload-expected.txt	2018-07-06 05:50:17 UTC (rev 233563)
@@ -0,0 +1,3 @@
+number of plugins decreased after blocking: PASS
+number of plugins increased after allowing: PASS
+PASS

Added: trunk/LayoutTests/http/tests/plugins/plugin-allow-then-reload.html (0 => 233563)


--- trunk/LayoutTests/http/tests/plugins/plugin-allow-then-reload.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/plugins/plugin-allow-then-reload.html	2018-07-06 05:50:17 UTC (rev 233563)
@@ -0,0 +1,47 @@
+<html>
+<body>
+<script>
+function doTest()
+{
+    if (!window.testRunner || !window.internals) {
+        document.body.innerHTML = "FAIL: requires internals API";
+        return;
+    }
+    if (!window.localStorage.step) {
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+
+        window.localStorage.step = 1;
+        window.localStorage.step0Value = window.internals.pluginCount();
+
+        testRunner.setBlockAllPlugins(true);
+
+        window.location.reload();
+        return;
+    }
+    if (window.localStorage.step == 1) {
+        window.localStorage.step = 2;
+        window.localStorage.step1Value = window.internals.pluginCount();
+
+        testRunner.setBlockAllPlugins(false);
+
+        window.location.reload();
+        return;
+    }
+    window.localStorage.step2Value = window.internals.pluginCount();
+    var test1 = window.localStorage.step0Value > window.localStorage.step1Value;
+    var test2 = window.localStorage.step2Value > window.localStorage.step1Value;
+
+    var message = "number of plugins decreased after blocking: " + (test1 ? "PASS" : "FAIL");
+    message += "<br>";
+    message += "number of plugins increased after allowing: " + (test2 ? "PASS" : "FAIL");
+    message += "<br>";
+    message += test1 && test2 ? "PASS" : "FAIL";
+    document.body.innerHTML = message;
+
+    testRunner.notifyDone();
+}
+doTest();
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (233562 => 233563)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2018-07-06 05:50:17 UTC (rev 233563)
@@ -111,6 +111,7 @@
 
 # Plug-in blocking callback doesn't exist in WebKit1.
 plugins/unavailable-plugin-indicator-obscurity.html
+http/tests/plugins/plugin-allow-then-reload.html [ Skip ]
 
 http/tests/plugins/nounsupported-plugin.html [ Skip ]
 http/tests/plugins/supported-plugin-all-origin-visibility.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (233562 => 233563)


--- trunk/Source/WebCore/ChangeLog	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Source/WebCore/ChangeLog	2018-07-06 05:50:17 UTC (rev 233563)
@@ -1,3 +1,25 @@
+2018-07-05  Youenn Fablet  <[email protected]>
+
+        REGRESSION (r230843): Flash doesn't work; Produces blue box on page
+        https://bugs.webkit.org/show_bug.cgi?id=187346
+        <rdar://problem/41773974>
+
+        Reviewed by Ryosuke Niwa.
+
+        Introduce clearPagesPluginData used by WebProcess when a plugin policy changes.
+        Add a new internals API to get the plugin count as navigator.plugin is filtering plugins.
+
+        Test: http/tests/plugins/plugin-allow-then-reload.html
+
+        * plugins/PluginData.h:
+        * plugins/PluginInfoProvider.cpp:
+        (WebCore::PluginInfoProvider::clearPagesPluginData):
+        * plugins/PluginInfoProvider.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::pluginCount):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2018-07-05  Brady Eidson  <[email protected]>
 
         IndexedDB operations in a Page fail after a StorageProcess crash.

Modified: trunk/Source/WebCore/plugins/PluginData.h (233562 => 233563)


--- trunk/Source/WebCore/plugins/PluginData.h	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Source/WebCore/plugins/PluginData.h	2018-07-06 05:50:17 UTC (rev 233563)
@@ -102,7 +102,7 @@
     static Ref<PluginData> create(Page& page) { return adoptRef(*new PluginData(page)); }
 
     const Vector<PluginInfo>& plugins() const { return m_plugins; }
-    const Vector<PluginInfo>& webVisiblePlugins() const;
+    WEBCORE_EXPORT const Vector<PluginInfo>& webVisiblePlugins() const;
     Vector<PluginInfo> publiclyVisiblePlugins() const;
     WEBCORE_EXPORT void getWebVisibleMimesAndPluginIndices(Vector<MimeClassInfo>&, Vector<size_t>&) const;
 

Modified: trunk/Source/WebCore/plugins/PluginInfoProvider.cpp (233562 => 233563)


--- trunk/Source/WebCore/plugins/PluginInfoProvider.cpp	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Source/WebCore/plugins/PluginInfoProvider.cpp	2018-07-06 05:50:17 UTC (rev 233563)
@@ -38,6 +38,12 @@
     ASSERT(m_pages.isEmpty());
 }
 
+void PluginInfoProvider::clearPagesPluginData()
+{
+    for (auto& page : m_pages)
+        page->clearPluginData();
+}
+
 void PluginInfoProvider::refresh(bool reloadPages)
 {
     refreshPlugins();

Modified: trunk/Source/WebCore/plugins/PluginInfoProvider.h (233562 => 233563)


--- trunk/Source/WebCore/plugins/PluginInfoProvider.h	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Source/WebCore/plugins/PluginInfoProvider.h	2018-07-06 05:50:17 UTC (rev 233563)
@@ -38,6 +38,7 @@
 
     void addPage(Page&);
     void removePage(Page&);
+    void clearPagesPluginData();
 
     virtual Vector<PluginInfo> pluginInfo(Page&, std::optional<Vector<SupportedPluginIdentifier>>&) = 0;
     virtual Vector<PluginInfo> webVisiblePluginInfo(Page&, const URL&) = 0;

Modified: trunk/Source/WebCore/testing/Internals.cpp (233562 => 233563)


--- trunk/Source/WebCore/testing/Internals.cpp	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Source/WebCore/testing/Internals.cpp	2018-07-06 05:50:17 UTC (rev 233563)
@@ -119,6 +119,7 @@
 #include "PathUtilities.h"
 #include "PlatformMediaSessionManager.h"
 #include "PlatformStrategies.h"
+#include "PluginData.h"
 #include "PrintContext.h"
 #include "PseudoElement.h"
 #include "Range.h"
@@ -4637,4 +4638,12 @@
     contextDocument()->page()->setUseSystemAppearance(value);
 }
 
+size_t Internals::pluginCount()
+{
+    if (!contextDocument() || !contextDocument()->page())
+        return 0;
+
+    return contextDocument()->page()->pluginData().webVisiblePlugins().size();
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/testing/Internals.h (233562 => 233563)


--- trunk/Source/WebCore/testing/Internals.h	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Source/WebCore/testing/Internals.h	2018-07-06 05:50:17 UTC (rev 233563)
@@ -717,6 +717,8 @@
 
     void setUseSystemAppearance(bool);
 
+    size_t pluginCount();
+
 private:
     explicit Internals(Document&);
     Document* contextDocument() const;

Modified: trunk/Source/WebCore/testing/Internals.idl (233562 => 233563)


--- trunk/Source/WebCore/testing/Internals.idl	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Source/WebCore/testing/Internals.idl	2018-07-06 05:50:17 UTC (rev 233563)
@@ -654,4 +654,6 @@
     void reloadWithoutContentExtensions();
 
     void setUseSystemAppearance(boolean value);
+
+    unsigned long pluginCount();
 };

Modified: trunk/Source/WebKit/ChangeLog (233562 => 233563)


--- trunk/Source/WebKit/ChangeLog	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Source/WebKit/ChangeLog	2018-07-06 05:50:17 UTC (rev 233563)
@@ -1,3 +1,18 @@
+2018-07-05  Youenn Fablet  <[email protected]>
+
+        REGRESSION (r230843): Flash doesn't work; Produces blue box on page
+        https://bugs.webkit.org/show_bug.cgi?id=187346
+        <rdar://problem/41773974>
+
+        Reviewed by Ryosuke Niwa.
+
+        Reset page plugins when the load client policies are updated.
+        This will ensure that pages will rebuild their plugin lists based on the new policies.
+
+        * WebProcess/Plugins/WebPluginInfoProvider.cpp:
+        (WebKit::WebPluginInfoProvider::setPluginLoadClientPolicy):
+        (WebKit::WebPluginInfoProvider::clearPluginClientPolicies):
+
 2018-07-05  Brady Eidson  <[email protected]>
 
         IndexedDB operations in a Page fail after a StorageProcess crash.

Modified: trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp (233562 => 233563)


--- trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp	2018-07-06 05:50:17 UTC (rev 233563)
@@ -80,11 +80,14 @@
     versionsToPolicies.set(versionStringToSet, clientPolicy);
     policiesByIdentifier.set(bundleIdentifierToSet, versionsToPolicies);
     m_hostsToPluginIdentifierData.set(hostToSet, policiesByIdentifier);
+
+    clearPagesPluginData();
 }
 
 void WebPluginInfoProvider::clearPluginClientPolicies()
 {
     m_hostsToPluginIdentifierData.clear();
+    clearPagesPluginData();
 }
 #endif
 

Modified: trunk/Tools/ChangeLog (233562 => 233563)


--- trunk/Tools/ChangeLog	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Tools/ChangeLog	2018-07-06 05:50:17 UTC (rev 233563)
@@ -1,3 +1,17 @@
+2018-07-05  Youenn Fablet  <[email protected]>
+
+        REGRESSION (r230843): Flash doesn't work; Produces blue box on page
+        https://bugs.webkit.org/show_bug.cgi?id=187346
+        <rdar://problem/41773974>
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetStateToConsistentValues):
+        (WTR::TestController::setBlockAllPlugins):
+        When not blocked, set the load policy to allow once.
+        * WebKitTestRunner/TestController.h:
+
 2018-07-05  Aakash Jain  <[email protected]>
 
         [ews-build] Bindings-tests-EWS should output result in json

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (233562 => 233563)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2018-07-06 05:50:17 UTC (rev 233563)
@@ -879,7 +879,7 @@
     m_authenticationUsername = String();
     m_authenticationPassword = String();
 
-    m_shouldBlockAllPlugins = false;
+    setBlockAllPlugins(false);
     setPluginSupportedMode({ });
 
     m_shouldLogDownloadCallbacks = false;
@@ -1740,6 +1740,21 @@
 #endif
 }
 
+void TestController::setBlockAllPlugins(bool shouldBlock)
+{
+    m_shouldBlockAllPlugins = shouldBlock;
+
+#if PLATFORM(MAC)
+    auto policy = shouldBlock ? kWKPluginLoadClientPolicyBlock : kWKPluginLoadClientPolicyAllow;
+
+    WKRetainPtr<WKStringRef> nameNetscape = adoptWK(WKStringCreateWithUTF8CString("com.apple.testnetscapeplugin"));
+    WKRetainPtr<WKStringRef> nameFlash = adoptWK(WKStringCreateWithUTF8CString("com.macromedia.Flash Player.plugin"));
+    WKRetainPtr<WKStringRef> emptyString = adoptWK(WKStringCreateWithUTF8CString(""));
+    WKContextSetPluginLoadClientPolicy(m_context.get(), policy, emptyString.get(), nameNetscape.get(), emptyString.get());
+    WKContextSetPluginLoadClientPolicy(m_context.get(), policy, emptyString.get(), nameFlash.get(), emptyString.get());
+#endif
+}
+
 void TestController::setPluginSupportedMode(const String& mode)
 {
     if (m_unsupportedPluginMode == mode)

Modified: trunk/Tools/WebKitTestRunner/TestController.h (233562 => 233563)


--- trunk/Tools/WebKitTestRunner/TestController.h	2018-07-06 05:48:35 UTC (rev 233562)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2018-07-06 05:50:17 UTC (rev 233563)
@@ -139,7 +139,7 @@
     void setAuthenticationPassword(String password) { m_authenticationPassword = password; }
     void setAllowsAnySSLCertificate(bool);
 
-    void setBlockAllPlugins(bool shouldBlock) { m_shouldBlockAllPlugins = shouldBlock; }
+    void setBlockAllPlugins(bool shouldBlock);
     void setPluginSupportedMode(const String&);
 
     void setShouldLogHistoryClientCallbacks(bool shouldLog) { m_shouldLogHistoryClientCallbacks = shouldLog; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to