Title: [239733] trunk/Source/WebKit
Revision
239733
Author
bb...@apple.com
Date
2019-01-08 11:41:41 -0800 (Tue, 08 Jan 2019)

Log Message

Remove WKPageRef-based SPI in _WKAutomationSessionDelegate
https://bugs.webkit.org/show_bug.cgi?id=193202
<rdar://problem/37408718>

Reviewed by Alex Christensen.

This code is no longer used, it should be deleted.

* UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
* UIProcess/Cocoa/AutomationSessionClient.h:
* UIProcess/Cocoa/AutomationSessionClient.mm:
(WebKit::AutomationSessionClient::AutomationSessionClient):
(WebKit::AutomationSessionClient::requestNewPageWithOptions):
(WebKit::AutomationSessionClient::requestSwitchToPage):
(WebKit::AutomationSessionClient::requestHideWindowOfPage):
(WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
(WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
(WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
(WebKit::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage):
(WebKit::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage):
(WebKit::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage):
(WebKit::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage):
(WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
Clean up the delegate bridging methods now that only one delegate implementation is possible.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (239732 => 239733)


--- trunk/Source/WebKit/ChangeLog	2019-01-08 19:40:21 UTC (rev 239732)
+++ trunk/Source/WebKit/ChangeLog	2019-01-08 19:41:41 UTC (rev 239733)
@@ -1,3 +1,30 @@
+2019-01-08  Brian Burg  <bb...@apple.com>
+
+        Remove WKPageRef-based SPI in _WKAutomationSessionDelegate
+        https://bugs.webkit.org/show_bug.cgi?id=193202
+        <rdar://problem/37408718>
+
+        Reviewed by Alex Christensen.
+
+        This code is no longer used, it should be deleted.
+
+        * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
+        * UIProcess/Cocoa/AutomationSessionClient.h:
+        * UIProcess/Cocoa/AutomationSessionClient.mm:
+        (WebKit::AutomationSessionClient::AutomationSessionClient):
+        (WebKit::AutomationSessionClient::requestNewPageWithOptions):
+        (WebKit::AutomationSessionClient::requestSwitchToPage):
+        (WebKit::AutomationSessionClient::requestHideWindowOfPage):
+        (WebKit::AutomationSessionClient::requestRestoreWindowOfPage):
+        (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
+        (WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage):
+        (WebKit::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage):
+        (WebKit::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage):
+        (WebKit::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage):
+        (WebKit::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage):
+        (WebKit::AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage):
+        Clean up the delegate bridging methods now that only one delegate implementation is possible.
+
 2019-01-08  Patrick Griffis  <pgrif...@igalia.com>
 
         [GTK][WPE] Remove DConf permissions from sandbox

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h (239732 => 239733)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h	2019-01-08 19:40:21 UTC (rev 239732)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h	2019-01-08 19:41:41 UTC (rev 239733)
@@ -63,19 +63,6 @@
 - (void)_automationSession:(_WKAutomationSession *)automationSession setUserInput:(NSString *)value forCurrentJavaScriptDialogForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 - (_WKAutomationSessionJavaScriptDialogType)_automationSession:(_WKAutomationSession *)automationSession typeOfCurrentJavaScriptDialogForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.14), ios(12.0));
 
-// FIXME 37408718: Objective-C delegate methods shouldn't use C API types like WKPageRef. We need to
-// migrate clients to use WKWebView, or expose the same behavior via a C SPI for those clients.
-- (void)_automationSession:(_WKAutomationSession *)automationSession requestNewPageWithOptions:(_WKAutomationSessionBrowsingContextOptions)options completionHandler:(void(^)(WKPageRef))completionHandler WK_API_AVAILABLE(macosx(10.14), ios(12.0));
-- (void)_automationSession:(_WKAutomationSession *)automationSession requestHideWindowOfPage:(WKPageRef)page completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(10.14), ios(12.0));
-- (void)_automationSession:(_WKAutomationSession *)automationSession requestRestoreWindowOfPage:(WKPageRef)page completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(10.14), ios(12.0));
-- (void)_automationSession:(_WKAutomationSession *)automationSession requestMaximizeWindowOfPage:(WKPageRef)page completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(10.14), ios(12.0));
-- (void)_automationSession:(_WKAutomationSession *)automationSession requestSwitchToPage:(WKPageRef)page completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(10.14), ios(12.0));
-- (BOOL)_automationSession:(_WKAutomationSession *)automationSession isShowingJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0));
-- (void)_automationSession:(_WKAutomationSession *)automationSession dismissCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0));
-- (void)_automationSession:(_WKAutomationSession *)automationSession acceptCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0));
-- (nullable NSString *)_automationSession:(_WKAutomationSession *)automationSession messageOfCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0));
-- (void)_automationSession:(_WKAutomationSession *)automationSession setUserInput:(NSString *)value forCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0));
-- (_WKAutomationSessionJavaScriptDialogType)_automationSession:(_WKAutomationSession *)automationSession typeOfCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.14), ios(12.0));
 @end
 
 NS_ASSUME_NONNULL_END

Modified: trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h (239732 => 239733)


--- trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h	2019-01-08 19:40:21 UTC (rev 239732)
+++ trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h	2019-01-08 19:41:41 UTC (rev 239733)
@@ -74,19 +74,6 @@
         bool messageOfCurrentJavaScriptDialogForWebView : 1;
         bool setUserInputForCurrentJavaScriptPromptForWebView : 1;
         bool typeOfCurrentJavaScriptDialogForWebView : 1;
-
-        // FIXME 37408718: these delegate methods should be removed.
-        bool requestNewPageWithOptions : 1;
-        bool requestSwitchToPage : 1;
-        bool requestHideWindowOfPage : 1;
-        bool requestRestoreWindowOfPage : 1;
-        bool requestMaximizeWindowOfPage : 1;
-        bool isShowingJavaScriptDialogOnPage : 1;
-        bool dismissCurrentJavaScriptDialogOnPage : 1;
-        bool acceptCurrentJavaScriptDialogOnPage : 1;
-        bool messageOfCurrentJavaScriptDialogOnPage : 1;
-        bool setUserInputForCurrentJavaScriptPromptOnPage : 1;
-        bool typeOfCurrentJavaScriptDialogOnPage : 1;
     } m_delegateMethods;
 };
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm (239732 => 239733)


--- trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm	2019-01-08 19:40:21 UTC (rev 239732)
+++ trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm	2019-01-08 19:41:41 UTC (rev 239733)
@@ -54,19 +54,6 @@
     m_delegateMethods.messageOfCurrentJavaScriptDialogForWebView = [delegate respondsToSelector:@selector(_automationSession:messageOfCurrentJavaScriptDialogForWebView:)];
     m_delegateMethods.setUserInputForCurrentJavaScriptPromptForWebView = [delegate respondsToSelector:@selector(_automationSession:setUserInput:forCurrentJavaScriptDialogForWebView:)];
     m_delegateMethods.typeOfCurrentJavaScriptDialogForWebView = [delegate respondsToSelector:@selector(_automationSession:typeOfCurrentJavaScriptDialogForWebView:)];
-
-    // FIXME 37408718: these delegate methods should be removed.
-    m_delegateMethods.requestNewPageWithOptions = [delegate respondsToSelector:@selector(_automationSession:requestNewPageWithOptions:completionHandler:)];
-    m_delegateMethods.requestSwitchToPage = [delegate respondsToSelector:@selector(_automationSession:requestSwitchToPage:completionHandler:)];
-    m_delegateMethods.requestHideWindowOfPage = [delegate respondsToSelector:@selector(_automationSession:requestHideWindowOfPage:completionHandler:)];
-    m_delegateMethods.requestRestoreWindowOfPage = [delegate respondsToSelector:@selector(_automationSession:requestRestoreWindowOfPage:completionHandler:)];
-    m_delegateMethods.requestMaximizeWindowOfPage = [delegate respondsToSelector:@selector(_automationSession:requestMaximizeWindowOfPage:completionHandler:)];
-    m_delegateMethods.isShowingJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:isShowingJavaScriptDialogOnPage:)];
-    m_delegateMethods.dismissCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:dismissCurrentJavaScriptDialogOnPage:)];
-    m_delegateMethods.acceptCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:acceptCurrentJavaScriptDialogOnPage:)];
-    m_delegateMethods.messageOfCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:messageOfCurrentJavaScriptDialogOnPage:)];
-    m_delegateMethods.setUserInputForCurrentJavaScriptPromptOnPage = [delegate respondsToSelector:@selector(_automationSession:setUserInput:forCurrentJavaScriptDialogOnPage:)];
-    m_delegateMethods.typeOfCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:typeOfCurrentJavaScriptDialogOnPage:)];
 }
 
 void AutomationSessionClient::didDisconnectFromRemote(WebAutomationSession& session)
@@ -85,8 +72,6 @@
     return static_cast<_WKAutomationSessionBrowsingContextOptions>(wkOptions);
 }
 
-// FIXME 37408718: support for WKPageRef-based delegate methods should be removed.
-// Until these are removed, prefer to use the WKWebView delegate methods if implemented.
 void AutomationSessionClient::requestNewPageWithOptions(WebAutomationSession& session, API::AutomationSessionBrowsingContextOptions options, CompletionHandler<void(WebKit::WebPageProxy*)>&& completionHandler)
 {
     if (m_delegateMethods.requestNewWebViewWithOptions) {
@@ -93,67 +78,31 @@
         [m_delegate.get() _automationSession:wrapper(session) requestNewWebViewWithOptions:toAPI(options) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler)](WKWebView *webView) mutable {
             completionHandler(webView->_page.get());
         }).get()];
-    } else if (m_delegateMethods.requestNewPageWithOptions) {
-        [m_delegate.get() _automationSession:wrapper(session) requestNewPageWithOptions:toAPI(options) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler)](WKPageRef page) mutable {
-            completionHandler(toImpl(page));
-        }).get()];
     }
 }
 
 void AutomationSessionClient::requestSwitchToPage(WebAutomationSession& session, WebPageProxy& page, CompletionHandler<void()>&& completionHandler)
 {
-    if (!m_delegateMethods.requestSwitchToWebView && !m_delegateMethods.requestSwitchToPage) {
-        completionHandler();
-        return;
-    }
-
-    auto completionBlock = makeBlockPtr(WTFMove(completionHandler));
     if (m_delegateMethods.requestSwitchToWebView)
-        [m_delegate.get() _automationSession:wrapper(session) requestSwitchToWebView:fromWebPageProxy(page) completionHandler:completionBlock.get()];
-    else if (m_delegateMethods.requestSwitchToPage)
-        [m_delegate.get() _automationSession:wrapper(session) requestSwitchToPage:toAPI(&page) completionHandler:completionBlock.get()];
+        [m_delegate.get() _automationSession:wrapper(session) requestSwitchToWebView:fromWebPageProxy(page) completionHandler:makeBlockPtr(WTFMove(completionHandler)).get()];
 }
 
 void AutomationSessionClient::requestHideWindowOfPage(WebAutomationSession& session, WebPageProxy& page, CompletionHandler<void()>&& completionHandler)
 {
-    if (!m_delegateMethods.requestHideWindowOfWebView && !m_delegateMethods.requestHideWindowOfPage) {
-        completionHandler();
-        return;
-    }
-
-    auto completionBlock = makeBlockPtr(WTFMove(completionHandler));
     if (m_delegateMethods.requestHideWindowOfWebView)
-        [m_delegate.get() _automationSession:wrapper(session) requestHideWindowOfWebView:fromWebPageProxy(page) completionHandler:completionBlock.get()];
-    else if (m_delegateMethods.requestHideWindowOfPage)
-        [m_delegate.get() _automationSession:wrapper(session) requestHideWindowOfPage:toAPI(&page) completionHandler:completionBlock.get()];
+        [m_delegate.get() _automationSession:wrapper(session) requestHideWindowOfWebView:fromWebPageProxy(page) completionHandler:makeBlockPtr(WTFMove(completionHandler)).get()];
 }
 
 void AutomationSessionClient::requestRestoreWindowOfPage(WebAutomationSession& session, WebPageProxy& page, CompletionHandler<void()>&& completionHandler)
 {
-    if (!m_delegateMethods.requestRestoreWindowOfWebView && !m_delegateMethods.requestRestoreWindowOfPage) {
-        completionHandler();
-        return;
-    }
-
-    auto completionBlock = makeBlockPtr(WTFMove(completionHandler));
     if (m_delegateMethods.requestRestoreWindowOfWebView)
-        [m_delegate.get() _automationSession:wrapper(session) requestRestoreWindowOfWebView:fromWebPageProxy(page) completionHandler:completionBlock.get()];
-    else if (m_delegateMethods.requestRestoreWindowOfPage)
-        [m_delegate.get() _automationSession:wrapper(session) requestRestoreWindowOfPage:toAPI(&page) completionHandler:completionBlock.get()];
+        [m_delegate.get() _automationSession:wrapper(session) requestRestoreWindowOfWebView:fromWebPageProxy(page) completionHandler:makeBlockPtr(WTFMove(completionHandler)).get()];
 }
 
 void AutomationSessionClient::requestMaximizeWindowOfPage(WebAutomationSession& session, WebPageProxy& page, CompletionHandler<void()>&& completionHandler)
 {
-    if (!m_delegateMethods.requestMaximizeWindowOfWebView && !m_delegateMethods.requestMaximizeWindowOfPage) {
-        completionHandler();
-        return;
-    }
-
-    auto completionBlock = makeBlockPtr(WTFMove(completionHandler));
     if (m_delegateMethods.requestMaximizeWindowOfWebView)
-        [m_delegate.get() _automationSession:wrapper(session) requestMaximizeWindowOfWebView:fromWebPageProxy(page) completionHandler:completionBlock.get()];
-    else if (m_delegateMethods.requestMaximizeWindowOfPage)
-        [m_delegate.get() _automationSession:wrapper(session) requestMaximizeWindowOfPage:toAPI(&page) completionHandler:completionBlock.get()];
+        [m_delegate.get() _automationSession:wrapper(session) requestMaximizeWindowOfWebView:fromWebPageProxy(page) completionHandler:makeBlockPtr(WTFMove(completionHandler)).get()];
 }
 
 bool AutomationSessionClient::isShowingJavaScriptDialogOnPage(WebAutomationSession& session, WebPageProxy& page)
@@ -160,8 +109,6 @@
 {
     if (m_delegateMethods.isShowingJavaScriptDialogForWebView)
         return [m_delegate.get() _automationSession:wrapper(session) isShowingJavaScriptDialogForWebView:fromWebPageProxy(page)];
-    else if (m_delegateMethods.isShowingJavaScriptDialogOnPage)
-        return [m_delegate.get() _automationSession:wrapper(session) isShowingJavaScriptDialogOnPage:toAPI(&page)];
     
     return false;
 }
@@ -170,8 +117,6 @@
 {
     if (m_delegateMethods.dismissCurrentJavaScriptDialogForWebView)
         [m_delegate.get() _automationSession:wrapper(session) dismissCurrentJavaScriptDialogForWebView:fromWebPageProxy(page)];
-    else if (m_delegateMethods.dismissCurrentJavaScriptDialogOnPage)
-        [m_delegate.get() _automationSession:wrapper(session) dismissCurrentJavaScriptDialogOnPage:toAPI(&page)];
 }
 
 void AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage(WebAutomationSession& session, WebPageProxy& page)
@@ -178,8 +123,6 @@
 {
     if (m_delegateMethods.acceptCurrentJavaScriptDialogForWebView)
         [m_delegate.get() _automationSession:wrapper(session) acceptCurrentJavaScriptDialogForWebView:fromWebPageProxy(page)];
-    else if (m_delegateMethods.acceptCurrentJavaScriptDialogOnPage)
-        [m_delegate.get() _automationSession:wrapper(session) acceptCurrentJavaScriptDialogOnPage:toAPI(&page)];
 }
 
 String AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage(WebAutomationSession& session, WebPageProxy& page)
@@ -187,9 +130,6 @@
     if (m_delegateMethods.messageOfCurrentJavaScriptDialogForWebView)
         return [m_delegate.get() _automationSession:wrapper(session) messageOfCurrentJavaScriptDialogForWebView:fromWebPageProxy(page)];
 
-    if (m_delegateMethods.messageOfCurrentJavaScriptDialogOnPage)
-        return [m_delegate.get() _automationSession:wrapper(session) messageOfCurrentJavaScriptDialogOnPage:toAPI(&page)];
-
     return String();
 }
 
@@ -197,8 +137,6 @@
 {
     if (m_delegateMethods.setUserInputForCurrentJavaScriptPromptForWebView)
         [m_delegate.get() _automationSession:wrapper(session) setUserInput:value forCurrentJavaScriptDialogForWebView:fromWebPageProxy(page)];
-    else if (m_delegateMethods.setUserInputForCurrentJavaScriptPromptOnPage)
-        [m_delegate.get() _automationSession:wrapper(session) setUserInput:value forCurrentJavaScriptDialogOnPage:toAPI(&page)];
 }
 
 static Optional<API::AutomationSessionClient::_javascript_DialogType> toImpl(_WKAutomationSessionJavaScriptDialogType type)
@@ -219,8 +157,6 @@
 {
     if (m_delegateMethods.typeOfCurrentJavaScriptDialogForWebView)
         return toImpl([m_delegate.get() _automationSession:wrapper(session) typeOfCurrentJavaScriptDialogForWebView:fromWebPageProxy(page)]);
-    if (m_delegateMethods.typeOfCurrentJavaScriptDialogOnPage)
-        return toImpl([m_delegate.get() _automationSession:wrapper(session) typeOfCurrentJavaScriptDialogOnPage:toAPI(&page)]);
 
     return API::AutomationSessionClient::_javascript_DialogType::Prompt;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to