Title: [241285] trunk/Source/WebKit
Revision
241285
Author
[email protected]
Date
2019-02-11 17:15:49 -0800 (Mon, 11 Feb 2019)

Log Message

[Cocoa] Web Automation: client callbacks are not called if delegate does not override
https://bugs.webkit.org/show_bug.cgi?id=194519
<rdar://problem/47981961>

Reviewed by Joseph Pecoraro.

Call the completion handler directly if the delegate does not implement the relevant method.

* UIProcess/Cocoa/AutomationSessionClient.mm:
(WebKit::AutomationSessionClient::requestNewPageWithOptions):
(WebKit::AutomationSessionClient::requestSwitchToPage):
(WebKit::AutomationSessionClient::requestHideWindowOfPage):
(WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
(WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (241284 => 241285)


--- trunk/Source/WebKit/ChangeLog	2019-02-12 01:04:16 UTC (rev 241284)
+++ trunk/Source/WebKit/ChangeLog	2019-02-12 01:15:49 UTC (rev 241285)
@@ -1,3 +1,20 @@
+2019-02-11  Brian Burg  <[email protected]>
+
+        [Cocoa] Web Automation: client callbacks are not called if delegate does not override
+        https://bugs.webkit.org/show_bug.cgi?id=194519
+        <rdar://problem/47981961>
+
+        Reviewed by Joseph Pecoraro.
+
+        Call the completion handler directly if the delegate does not implement the relevant method.
+
+        * UIProcess/Cocoa/AutomationSessionClient.mm:
+        (WebKit::AutomationSessionClient::requestNewPageWithOptions):
+        (WebKit::AutomationSessionClient::requestSwitchToPage):
+        (WebKit::AutomationSessionClient::requestHideWindowOfPage):
+        (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
+        (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
+
 2019-02-11  Daniel Bates  <[email protected]>
 
         [iOS] Adopt SPI to support Emacs bindings: transpose and delete to end of paragraph

Modified: trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm (241284 => 241285)


--- trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm	2019-02-12 01:04:16 UTC (rev 241284)
+++ trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm	2019-02-12 01:15:49 UTC (rev 241285)
@@ -79,7 +79,8 @@
         [m_delegate.get() _automationSession:wrapper(session) requestNewWebViewWithOptions:toAPI(options) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler)](WKWebView *webView) mutable {
             completionHandler(webView->_page.get());
         }).get()];
-    }
+    } else
+        completionHandler(nullptr);
 }
 
 void AutomationSessionClient::requestSwitchToPage(WebAutomationSession& session, WebPageProxy& page, CompletionHandler<void()>&& completionHandler)
@@ -86,6 +87,8 @@
 {
     if (m_delegateMethods.requestSwitchToWebView)
         [m_delegate.get() _automationSession:wrapper(session) requestSwitchToWebView:fromWebPageProxy(page) completionHandler:makeBlockPtr(WTFMove(completionHandler)).get()];
+    else
+        completionHandler();
 }
 
 void AutomationSessionClient::requestHideWindowOfPage(WebAutomationSession& session, WebPageProxy& page, CompletionHandler<void()>&& completionHandler)
@@ -92,6 +95,8 @@
 {
     if (m_delegateMethods.requestHideWindowOfWebView)
         [m_delegate.get() _automationSession:wrapper(session) requestHideWindowOfWebView:fromWebPageProxy(page) completionHandler:makeBlockPtr(WTFMove(completionHandler)).get()];
+    else
+        completionHandler();
 }
 
 void AutomationSessionClient::requestRestoreWindowOfPage(WebAutomationSession& session, WebPageProxy& page, CompletionHandler<void()>&& completionHandler)
@@ -98,6 +103,8 @@
 {
     if (m_delegateMethods.requestRestoreWindowOfWebView)
         [m_delegate.get() _automationSession:wrapper(session) requestRestoreWindowOfWebView:fromWebPageProxy(page) completionHandler:makeBlockPtr(WTFMove(completionHandler)).get()];
+    else
+        completionHandler();
 }
 
 void AutomationSessionClient::requestMaximizeWindowOfPage(WebAutomationSession& session, WebPageProxy& page, CompletionHandler<void()>&& completionHandler)
@@ -104,6 +111,8 @@
 {
     if (m_delegateMethods.requestMaximizeWindowOfWebView)
         [m_delegate.get() _automationSession:wrapper(session) requestMaximizeWindowOfWebView:fromWebPageProxy(page) completionHandler:makeBlockPtr(WTFMove(completionHandler)).get()];
+    else
+        completionHandler();
 }
 
 bool AutomationSessionClient::isShowingJavaScriptDialogOnPage(WebAutomationSession& session, WebPageProxy& page)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to