WebKit Bugzilla
Attachment 358534 Details for
Bug 193202
: Remove WKPageRef-based SPI in _WKAutomationSessionDelegate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193202-20190107150429.patch (text/plain), 17.50 KB, created by
BJ Burg
on 2019-01-07 15:04:29 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
BJ Burg
Created:
2019-01-07 15:04:29 PST
Size:
17.50 KB
patch
obsolete
>Subversion Revision: 239686 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 47f682b48f9a5130d731b00f8e16a4e403a3e7a2..f0831662235af1e3adaeef95fa280c86b2366b60 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,30 @@ >+2019-01-07 Brian Burg <bburg@apple.com> >+ >+ Remove WKPageRef-based SPI in _WKAutomationSessionDelegate >+ https://bugs.webkit.org/show_bug.cgi?id=193202 >+ <rdar://problem/37408718> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-07 Brian Burg <bburg@apple.com> > > Unwanted page navigation after showing & dismissing contextual menu with control-click >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h b/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h >index 37a63b746a92e1148476068c458bbc7d7504670f..293865cc8645120bee505d93e1822e2de5e93379 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h >@@ -63,19 +63,6 @@ typedef NS_ENUM(NSUInteger, _WKAutomationSessionBrowsingContextOptions) { > - (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 >diff --git a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h >index db88499429c44593591d9a5624247b7a4fddafbe..b0b46c6e3529099c49549652f01467b6655502d0 100644 >--- a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h >+++ b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h >@@ -74,19 +74,6 @@ private: > 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; > }; > >diff --git a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >index 38b6a17fe4d57079e49a03af51a98a9520dcef86..b2f7d25c26ca9a062088ac4899fe087045173a7c 100644 >--- a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >+++ b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >@@ -54,19 +54,6 @@ AutomationSessionClient::AutomationSessionClient(id <_WKAutomationSessionDelegat > 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,83 +72,43 @@ static inline _WKAutomationSessionBrowsingContextOptions toAPI(API::AutomationSe > 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) { > [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) > { > 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,16 +117,12 @@ void AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage(WebAutomation > { > 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) > { > 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 @@ String AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage(WebAutoma > 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 @@ void AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage(WebAu > { > 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::JavaScriptDialogType> toImpl(_WKAutomationSessionJavaScriptDialogType type) >@@ -219,8 +157,6 @@ Optional<API::AutomationSessionClient::JavaScriptDialogType> AutomationSessionCl > { > 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::JavaScriptDialogType::Prompt; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193202
: 358534