Title: [227637] trunk
Revision
227637
Author
[email protected]
Date
2018-01-25 15:06:51 -0800 (Thu, 25 Jan 2018)

Log Message

WebPluginInfoProvider should handle null host queries
https://bugs.webkit.org/show_bug.cgi?id=182112

Patch by Youenn Fablet <[email protected]> on 2018-01-25
Reviewed by Chris Dumez.

Source/WebCore:

No change of behavior.

Removed assertion that is not always true, as shown by API tests.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::responseReceived):

Source/WebKit:

Return early if host is null.

* WebProcess/Plugins/WebPluginInfoProvider.cpp:
(WebKit::WebPluginInfoProvider::populatePluginCache):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/PluginLoadClientPolicies.mm:
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (227636 => 227637)


--- trunk/Source/WebCore/ChangeLog	2018-01-25 22:56:57 UTC (rev 227636)
+++ trunk/Source/WebCore/ChangeLog	2018-01-25 23:06:51 UTC (rev 227637)
@@ -1,5 +1,19 @@
 2018-01-25  Youenn Fablet  <[email protected]>
 
+        WebPluginInfoProvider should handle null host queries
+        https://bugs.webkit.org/show_bug.cgi?id=182112
+
+        Reviewed by Chris Dumez.
+
+        No change of behavior.
+
+        Removed assertion that is not always true, as shown by API tests.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::responseReceived):
+
+2018-01-25  Youenn Fablet  <[email protected]>
+
         ShapeOutside should use same origin credentials mode
         https://bugs.webkit.org/show_bug.cgi?id=182141
 

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (227636 => 227637)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2018-01-25 22:56:57 UTC (rev 227636)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2018-01-25 23:06:51 UTC (rev 227637)
@@ -754,7 +754,6 @@
     } else if (response.isMultipart())
         m_isLoadingMultipartContent = true;
 
-    ASSERT(!response.url().isNull());
     m_response = response;
 
     if (m_identifierForLoadWithoutResourceLoader) {

Modified: trunk/Source/WebKit/ChangeLog (227636 => 227637)


--- trunk/Source/WebKit/ChangeLog	2018-01-25 22:56:57 UTC (rev 227636)
+++ trunk/Source/WebKit/ChangeLog	2018-01-25 23:06:51 UTC (rev 227637)
@@ -1,3 +1,15 @@
+2018-01-25  Youenn Fablet  <[email protected]>
+
+        WebPluginInfoProvider should handle null host queries
+        https://bugs.webkit.org/show_bug.cgi?id=182112
+
+        Reviewed by Chris Dumez.
+
+        Return early if host is null.
+
+        * WebProcess/Plugins/WebPluginInfoProvider.cpp:
+        (WebKit::WebPluginInfoProvider::populatePluginCache):
+
 2018-01-25  Simon Fraser  <[email protected]>
 
         ASSERT(CGSizeEqualToSize(m_resizeScrollOffset, CGSizeZero)) in WebViewImpl::setFrameAndScrollBy()

Modified: trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp (227636 => 227637)


--- trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp	2018-01-25 22:56:57 UTC (rev 227636)
+++ trunk/Source/WebKit/WebProcess/Plugins/WebPluginInfoProvider.cpp	2018-01-25 23:06:51 UTC (rev 227637)
@@ -154,6 +154,8 @@
 
 #if PLATFORM(MAC)
     String pageHost = page.mainFrame().loader().documentLoader()->responseURL().host();
+    if (pageHost.isNull())
+        return;
     for (auto& info : m_cachedPlugins) {
         if (auto clientPolicy = pluginLoadClientPolicyForHost(pageHost, info))
             info.clientLoadPolicy = *clientPolicy;

Modified: trunk/Tools/ChangeLog (227636 => 227637)


--- trunk/Tools/ChangeLog	2018-01-25 22:56:57 UTC (rev 227636)
+++ trunk/Tools/ChangeLog	2018-01-25 23:06:51 UTC (rev 227637)
@@ -1,3 +1,13 @@
+2018-01-25  Youenn Fablet  <[email protected]>
+
+        WebPluginInfoProvider should handle null host queries
+        https://bugs.webkit.org/show_bug.cgi?id=182112
+
+        Reviewed by Chris Dumez.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/PluginLoadClientPolicies.mm:
+        (TEST):
+
 2018-01-25  Basuke Suzuki  <[email protected]>
 
         [webkitpy] Stop modifying path information only when running on Cygwin

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PluginLoadClientPolicies.mm (227636 => 227637)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PluginLoadClientPolicies.mm	2018-01-25 22:56:57 UTC (rev 227636)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PluginLoadClientPolicies.mm	2018-01-25 23:06:51 UTC (rev 227637)
@@ -28,10 +28,13 @@
 #if PLATFORM(MAC)
 
 #import "PlatformUtilities.h"
+#import "PlatformWebView.h"
 #import "Test.h"
+#import "TestBrowsingContextLoadDelegate.h"
 #import <WebKit/WKContextPrivateMac.h>
 #import <WebKit/WKPluginInformation.h>
 #import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/WKViewPrivate.h>
 #import <wtf/RetainPtr.h>
 
 #if WK_API_ENABLED
@@ -103,5 +106,31 @@
     EXPECT_EQ(0U, policies.count);
 }
 
-#endif
-#endif
+#if WK_HAVE_C_SPI
+static bool testFinished = false;
+
+TEST(WebKit, PluginLoadClientPoliciesWithNullHost)
+{
+    WKRetainPtr<WKContextRef> context = adoptWK(TestWebKitAPI::Util::createContextForInjectedBundleTest("DenyWillSendRequestTest"));
+
+    auto appleHost = adoptWK(WKStringCreateWithUTF8CString("apple.com"));
+    auto flashIdentifier = adoptWK(WKStringCreateWithUTF8CString("com.macromedia.Flash Player.plugin"));
+    auto flashVersion = adoptWK(WKStringCreateWithUTF8CString("26.0.0.126"));
+    WKContextSetPluginLoadClientPolicy(context.get(), kWKPluginLoadClientPolicyAllowAlways, appleHost.get(), flashIdentifier.get(), flashVersion.get());
+
+    TestWebKitAPI::PlatformWebView webView(context.get());
+
+    webView.platformView().minimumSizeForAutoLayout = NSMakeSize(400, 300);
+    webView.platformView().browsingContextController.loadDelegate = [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
+        testFinished = true;
+    }];
+    [webView.platformView().browsingContextController loadHTMLString:@"<html><body><script>navigator.plugins.length;</script></body></html>" baseURL:[NSURL URLWithString:@"about:blank"]];
+
+    TestWebKitAPI::Util::run(&testFinished);
+}
+
+#endif // WK_HAVE_C_SPI
+
+#endif // WK_API_ENABLED
+
+#endif // PLATFORM(MAC)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to