Title: [209408] trunk
Revision
209408
Author
dba...@webkit.org
Date
2016-12-06 11:35:56 -0800 (Tue, 06 Dec 2016)

Log Message

WebKitTestRunner: Plugins are disabled in new windows
https://bugs.webkit.org/show_bug.cgi?id=165410

Reviewed by Alex Christensen.

Source/WebKit2:

Remove SPI exposed to explicitly toggle plugins from WebKitTestRunner.
Instead we will update WebKitTestRunner to make use of the SPI
WKBundleOverrideBoolPreferenceForTestRunner() to toggle plugins in
all windows.

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetPluginsEnabled): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setPluginsEnabled): Deleted.

Tools:

Currently WebKitTestRunner only enables plugins in the main window. So, a test that opens
a new window and loads a plugin will fail. We should enable plugins in all windows by
default. Moreover toggling testRunner.setPluginsEnabled() should effect all windows.

Making these changes is a step towards running plugins/open-and-close-window-with-plugin.html
in WebKitTestRunner (we still need to fix <https://bugs.webkit.org/show_bug.cgi?id=46714>) and
will make the behavior of WebKitTestRunner more closely match the behavior DumpRenderTree.

* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting): Call TestRunner::setPluginsEnabled() instead of
WKBundleSetPluginsEnabled().
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setPluginsEnabled): Take a similar approach as TestRunner::setXSSAuditorEnabled()
and make use of WKBundleOverrideBoolPreferenceForTestRunner().

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (209407 => 209408)


--- trunk/Source/WebKit2/ChangeLog	2016-12-06 19:20:19 UTC (rev 209407)
+++ trunk/Source/WebKit2/ChangeLog	2016-12-06 19:35:56 UTC (rev 209408)
@@ -1,3 +1,21 @@
+2016-12-06  Daniel Bates  <daba...@apple.com>
+
+        WebKitTestRunner: Plugins are disabled in new windows
+        https://bugs.webkit.org/show_bug.cgi?id=165410
+
+        Reviewed by Alex Christensen.
+
+        Remove SPI exposed to explicitly toggle plugins from WebKitTestRunner.
+        Instead we will update WebKitTestRunner to make use of the SPI
+        WKBundleOverrideBoolPreferenceForTestRunner() to toggle plugins in
+        all windows.
+
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleSetPluginsEnabled): Deleted.
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setPluginsEnabled): Deleted.
+
 2016-12-05  Anders Carlsson  <ander...@apple.com>
 
         Don't memcpy out of line data

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp (209407 => 209408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2016-12-06 19:20:19 UTC (rev 209407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2016-12-06 19:35:56 UTC (rev 209408)
@@ -150,11 +150,6 @@
     toImpl(bundleRef)->setFrameFlatteningEnabled(toImpl(pageGroupRef), enabled);
 }
 
-void WKBundleSetPluginsEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
-{
-    toImpl(bundleRef)->setPluginsEnabled(toImpl(pageGroupRef), enabled);
-}
-
 void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
 {
     toImpl(bundleRef)->setJavaScriptCanAccessClipboard(toImpl(pageGroupRef), enabled);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (209407 => 209408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2016-12-06 19:20:19 UTC (rev 209407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2016-12-06 19:35:56 UTC (rev 209408)
@@ -48,7 +48,6 @@
 WK_EXPORT void WKBundleSetAllowStorageAccessFromFileURLS(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool needsQuirk);
 WK_EXPORT void WKBundleSetMinimumLogicalFontSize(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, int size);
 WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
-WK_EXPORT void WKBundleSetPluginsEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetUseDashboardCompatibilityMode(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (209407 => 209408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-12-06 19:20:19 UTC (rev 209407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-12-06 19:35:56 UTC (rev 209408)
@@ -303,13 +303,6 @@
         (*iter)->settings().setFrameFlatteningEnabled(enabled);
 }
 
-void InjectedBundle::setPluginsEnabled(WebPageGroupProxy* pageGroup, bool enabled)
-{
-    const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
-    for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
-        (*iter)->settings().setPluginsEnabled(enabled);
-}
-
 void InjectedBundle::setJavaScriptCanAccessClipboard(WebPageGroupProxy* pageGroup, bool enabled)
 {
     const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();

Modified: trunk/Tools/ChangeLog (209407 => 209408)


--- trunk/Tools/ChangeLog	2016-12-06 19:20:19 UTC (rev 209407)
+++ trunk/Tools/ChangeLog	2016-12-06 19:35:56 UTC (rev 209408)
@@ -1,3 +1,25 @@
+2016-12-06  Daniel Bates  <daba...@apple.com>
+
+        WebKitTestRunner: Plugins are disabled in new windows
+        https://bugs.webkit.org/show_bug.cgi?id=165410
+
+        Reviewed by Alex Christensen.
+
+        Currently WebKitTestRunner only enables plugins in the main window. So, a test that opens
+        a new window and loads a plugin will fail. We should enable plugins in all windows by
+        default. Moreover toggling testRunner.setPluginsEnabled() should effect all windows.
+
+        Making these changes is a step towards running plugins/open-and-close-window-with-plugin.html
+        in WebKitTestRunner (we still need to fix <https://bugs.webkit.org/show_bug.cgi?id=46714>) and
+        will make the behavior of WebKitTestRunner more closely match the behavior DumpRenderTree.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting): Call TestRunner::setPluginsEnabled() instead of
+        WKBundleSetPluginsEnabled().
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setPluginsEnabled): Take a similar approach as TestRunner::setXSSAuditorEnabled()
+        and make use of WKBundleOverrideBoolPreferenceForTestRunner().
+
 2016-12-05  Dean Jackson  <d...@apple.com>
 
         pointer lock needs to be feature detectable

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (209407 => 209408)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-12-06 19:20:19 UTC (rev 209407)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-12-06 19:35:56 UTC (rev 209408)
@@ -303,7 +303,6 @@
     WKBundleSetMinimumLogicalFontSize(m_bundle, m_pageGroup, 9);
     WKBundleSetSpatialNavigationEnabled(m_bundle, m_pageGroup, false);
     WKBundleSetAllowFileAccessFromFileURLs(m_bundle, m_pageGroup, true);
-    WKBundleSetPluginsEnabled(m_bundle, m_pageGroup, true);
     WKBundleSetPopupBlockingEnabled(m_bundle, m_pageGroup, false);
     WKBundleSetAllowStorageAccessFromFileURLS(m_bundle, m_pageGroup, false);
 
@@ -311,6 +310,8 @@
     WKBundlePageSetUseTestingViewportConfiguration(page()->page(), !booleanForKey(settings, "UseFlexibleViewport"));
 #endif
 
+    m_testRunner->setPluginsEnabled(true);
+
     m_testRunner->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates"));
     m_testRunner->setUserStyleSheetEnabled(false);
     m_testRunner->setXSSAuditorEnabled(false);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (209407 => 209408)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-12-06 19:20:19 UTC (rev 209407)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-12-06 19:35:56 UTC (rev 209408)
@@ -435,8 +435,9 @@
     
 void TestRunner::setPluginsEnabled(bool enabled)
 {
+    WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitPluginsEnabled"));
     auto& injectedBundle = InjectedBundle::singleton();
-    WKBundleSetPluginsEnabled(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
+    WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
 }
 
 void TestRunner::setJavaScriptCanAccessClipboard(bool enabled)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to