Title: [227813] branches/safari-605-branch

Diff

Modified: branches/safari-605-branch/Source/WebKit/ChangeLog (227812 => 227813)


--- branches/safari-605-branch/Source/WebKit/ChangeLog	2018-01-30 18:50:34 UTC (rev 227812)
+++ branches/safari-605-branch/Source/WebKit/ChangeLog	2018-01-30 18:50:39 UTC (rev 227813)
@@ -1,5 +1,26 @@
 2018-01-30  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227647. rdar://problem/37019494
+
+    2018-01-25  Alex Christensen  <[email protected]>
+
+            REGRESSION (r221899): Web Content process hangs when webpage tries to make a new window if the WKWebView doesn’t have a UI delegate
+            https://bugs.webkit.org/show_bug.cgi?id=182152
+
+            Reviewed by Joseph Pecoraro.
+
+            Call the completion handler of the default API::UIClient::createNewPage.
+
+            * UIProcess/API/APIUIClient.h:
+            (API::UIClient::createNewPage):
+            * UIProcess/API/C/WKPage.cpp:
+            (WKPageSetPageUIClient):
+            * UIProcess/Cocoa/UIDelegate.h:
+            * UIProcess/Cocoa/UIDelegate.mm:
+            (WebKit::UIDelegate::UIClient::createNewPage):
+
+2018-01-30  Jason Marcell  <[email protected]>
+
         Cherry-pick r227638. rdar://problem/37019454
 
     2018-01-25  Chris Dumez  <[email protected]>

Modified: branches/safari-605-branch/Source/WebKit/UIProcess/API/APIUIClient.h (227812 => 227813)


--- branches/safari-605-branch/Source/WebKit/UIProcess/API/APIUIClient.h	2018-01-30 18:50:34 UTC (rev 227812)
+++ branches/safari-605-branch/Source/WebKit/UIProcess/API/APIUIClient.h	2018-01-30 18:50:39 UTC (rev 227813)
@@ -30,6 +30,7 @@
 #include "WebHitTestResultData.h"
 #include "WebPageProxy.h"
 #include <WebCore/FloatRect.h>
+#include <wtf/CompletionHandler.h>
 
 #if PLATFORM(IOS)
 OBJC_CLASS NSArray;
@@ -71,7 +72,7 @@
 public:
     virtual ~UIClient() { }
 
-    virtual void createNewPage(WebKit::WebPageProxy&, Ref<FrameInfo>&&, WebCore::ResourceRequest&&, WebCore::WindowFeatures&&, WebKit::NavigationActionData&&, WTF::Function<void(RefPtr<WebKit::WebPageProxy>&&)>&&) { }
+    virtual void createNewPage(WebKit::WebPageProxy&, Ref<FrameInfo>&&, WebCore::ResourceRequest&&, WebCore::WindowFeatures&&, WebKit::NavigationActionData&&, CompletionHandler<void(RefPtr<WebKit::WebPageProxy>&&)>&& completionHandler) { completionHandler(nullptr); }
     virtual void showPage(WebKit::WebPageProxy*) { }
     virtual void fullscreenMayReturnToInline(WebKit::WebPageProxy*) { }
     virtual void didEnterFullscreen(WebKit::WebPageProxy*) { }

Modified: branches/safari-605-branch/Source/WebKit/UIProcess/API/C/WKPage.cpp (227812 => 227813)


--- branches/safari-605-branch/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-01-30 18:50:34 UTC (rev 227812)
+++ branches/safari-605-branch/Source/WebKit/UIProcess/API/C/WKPage.cpp	2018-01-30 18:50:39 UTC (rev 227813)
@@ -1567,7 +1567,7 @@
         }
 
     private:
-        void createNewPage(WebPageProxy& page, Ref<API::FrameInfo>&& sourceFrameInfo, WebCore::ResourceRequest&& resourceRequest, WebCore::WindowFeatures&& windowFeatures, NavigationActionData&& navigationActionData, WTF::Function<void(RefPtr<WebPageProxy>&&)>&& completionHandler) final
+        void createNewPage(WebPageProxy& page, Ref<API::FrameInfo>&& sourceFrameInfo, WebCore::ResourceRequest&& resourceRequest, WebCore::WindowFeatures&& windowFeatures, NavigationActionData&& navigationActionData, CompletionHandler<void(RefPtr<WebPageProxy>&&)>&& completionHandler) final
         {
             if (m_client.createNewPage) {
                 auto configuration = page.configuration().copy();

Modified: branches/safari-605-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (227812 => 227813)


--- branches/safari-605-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.h	2018-01-30 18:50:34 UTC (rev 227812)
+++ branches/safari-605-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.h	2018-01-30 18:50:39 UTC (rev 227813)
@@ -80,7 +80,7 @@
 
     private:
         // API::UIClient
-        void createNewPage(WebPageProxy&, Ref<API::FrameInfo>&&, WebCore::ResourceRequest&&, WebCore::WindowFeatures&&, NavigationActionData&&, WTF::Function<void(RefPtr<WebPageProxy>&&)>&&) final;
+        void createNewPage(WebPageProxy&, Ref<API::FrameInfo>&&, WebCore::ResourceRequest&&, WebCore::WindowFeatures&&, NavigationActionData&&, CompletionHandler<void(RefPtr<WebPageProxy>&&)>&&) final;
         void close(WebPageProxy*) final;
         void fullscreenMayReturnToInline(WebPageProxy*) final;
         void didEnterFullscreen(WebPageProxy*) final;

Modified: branches/safari-605-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (227812 => 227813)


--- branches/safari-605-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2018-01-30 18:50:34 UTC (rev 227812)
+++ branches/safari-605-branch/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2018-01-30 18:50:39 UTC (rev 227813)
@@ -201,7 +201,7 @@
 {
 }
 
-void UIDelegate::UIClient::createNewPage(WebPageProxy& page, Ref<API::FrameInfo>&& sourceFrameInfo, WebCore::ResourceRequest&& request, WebCore::WindowFeatures&& windowFeatures, NavigationActionData&& navigationActionData, WTF::Function<void(RefPtr<WebPageProxy>&&)>&& completionHandler)
+void UIDelegate::UIClient::createNewPage(WebPageProxy& page, Ref<API::FrameInfo>&& sourceFrameInfo, WebCore::ResourceRequest&& request, WebCore::WindowFeatures&& windowFeatures, NavigationActionData&& navigationActionData, CompletionHandler<void(RefPtr<WebPageProxy>&&)>&& completionHandler)
 {
     auto delegate = m_uiDelegate.m_delegate.get();
     ASSERT(delegate);
@@ -216,7 +216,7 @@
     auto apiWindowFeatures = API::WindowFeatures::create(windowFeatures);
 
     if (m_uiDelegate.m_delegateMethods.webViewCreateWebViewWithConfigurationForNavigationActionWindowFeaturesAsync) {
-        RefPtr<CompletionHandlerCallChecker> checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:completionHandler:));
+        auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:completionHandler:));
 
         [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:wrapper(apiNavigationAction) windowFeatures:wrapper(apiWindowFeatures) completionHandler:BlockPtr<void (WKWebView *)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker), relatedWebView = RetainPtr<WKWebView>(m_uiDelegate.m_webView)](WKWebView *webView) {
             if (checker->completionHandlerHasBeenCalled())

Modified: branches/safari-605-branch/Tools/ChangeLog (227812 => 227813)


--- branches/safari-605-branch/Tools/ChangeLog	2018-01-30 18:50:34 UTC (rev 227812)
+++ branches/safari-605-branch/Tools/ChangeLog	2018-01-30 18:50:39 UTC (rev 227813)
@@ -1,5 +1,20 @@
 2018-01-30  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227647. rdar://problem/37019494
+
+    2018-01-25  Alex Christensen  <[email protected]>
+
+            REGRESSION (r221899): Web Content process hangs when webpage tries to make a new window if the WKWebView doesn’t have a UI delegate
+            https://bugs.webkit.org/show_bug.cgi?id=182152
+
+            Reviewed by Joseph Pecoraro.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+            (-[NoUIDelegate webView:decidePolicyForNavigationAction:decisionHandler:]):
+            (TEST):
+
+2018-01-30  Jason Marcell  <[email protected]>
+
         Cherry-pick r227637. rdar://problem/37019468
 
     2018-01-25  Youenn Fablet  <[email protected]>

Modified: branches/safari-605-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (227812 => 227813)


--- branches/safari-605-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm	2018-01-30 18:50:34 UTC (rev 227812)
+++ branches/safari-605-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm	2018-01-30 18:50:39 UTC (rev 227813)
@@ -77,6 +77,30 @@
     TestWebKitAPI::Util::run(&done);
 }
 
+@interface NoUIDelegate : NSObject <WKNavigationDelegate>
+@end
+
+@implementation NoUIDelegate
+
+- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
+{
+    if ([navigationAction.request.URL.absoluteString isEqualToString:[[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"] absoluteString]])
+        done = true;
+    decisionHandler(WKNavigationActionPolicyAllow);
+}
+
+@end
+
+TEST(WebKit, WindowOpenWithoutUIDelegate)
+{
+    done = false;
+    auto webView = adoptNS([[WKWebView alloc] init]);
+    auto delegate = adoptNS([[NoUIDelegate alloc] init]);
+    [webView setNavigationDelegate:delegate.get()];
+    [webView loadHTMLString:@"<script>window.open('simple2.html');window.location='simple.html'</script>" baseURL:[[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+    TestWebKitAPI::Util::run(&done);
+}
+
 @interface GeolocationDelegate : NSObject <WKUIDelegatePrivate> {
     bool _allowGeolocation;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to