Changeset 228920 in webkit
- Timestamp:
- Feb 22, 2018 10:01:08 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r228919 r228920 1 2018-02-22 Matt Lewis <jlewis3@apple.com> 2 3 Unreviewed, rolling out r228902. 4 5 This broke internal builds. 6 7 Reverted changeset: 8 9 "[Cocoa] Web Automation: provide a way to ask clients the type 10 of a JavaScript dialog" 11 https://bugs.webkit.org/show_bug.cgi?id=182660 12 https://trac.webkit.org/changeset/228902 13 1 14 2018-02-22 Youenn Fablet <youenn@apple.com> 2 15 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h
r228902 r228920 1 1 /* 2 * Copyright (C) 2016 , 2018Apple Inc. All rights reserved.2 * Copyright (C) 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 @class _WKAutomationSession; 35 35 36 typedef NS_ENUM(NSInteger, _WKAutomationSessionJavaScriptDialogType) {37 _WKAutomationSessionJavaScriptDialogTypeNone = 1,38 _WKAutomationSessionJavaScriptDialogTypeAlert,39 _WKAutomationSessionJavaScriptDialogTypeConfirm,40 _WKAutomationSessionJavaScriptDialogTypePrompt,41 } WK_API_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);42 43 36 @protocol _WKAutomationSessionDelegate <NSObject> 44 37 @optional … … 52 45 - (NSString *)_automationSession:(_WKAutomationSession *)automationSession messageOfCurrentJavaScriptDialogForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.13), ios(11.0)); 53 46 - (void)_automationSession:(_WKAutomationSession *)automationSession setUserInput:(NSString *)value forCurrentJavaScriptDialogForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.13), ios(11.0)); 54 - (_WKAutomationSessionJavaScriptDialogType)_automationSession:(_WKAutomationSession *)automationSession typeOfCurrentJavaScriptDialogForWebView:(WKWebView *)webView WK_API_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);55 47 56 // FIXME 37408718: Objective-C delegate methods shouldn't use C API types like WKPageRef. We need to48 // FIXME: Objective-C delegate methods shouldn't use C API types like WKPageRef. We need to 57 49 // migrate clients to use WKWebView, or expose the same behavior via a C SPI for those clients. 58 - (WKPageRef)_automationSessionDidRequestNewWindow:(_WKAutomationSession *)automationSession WK_API_AVAILABLE(macosx(10.13), ios(11.0)); 59 - (BOOL)_automationSession:(_WKAutomationSession *)automationSession isShowingJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0)); 60 - (void)_automationSession:(_WKAutomationSession *)automationSession dismissCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0)); 61 - (void)_automationSession:(_WKAutomationSession *)automationSession acceptCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0)); 62 - (NSString *)_automationSession:(_WKAutomationSession *)automationSession messageOfCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0)); 63 - (void)_automationSession:(_WKAutomationSession *)automationSession setUserInput:(NSString *)value forCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0)); 64 - (_WKAutomationSessionJavaScriptDialogType)_automationSession:(_WKAutomationSession *)automationSession typeOfCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA); 50 - (WKPageRef)_automationSessionDidRequestNewWindow:(_WKAutomationSession *)automationSession; 51 - (BOOL)_automationSession:(_WKAutomationSession *)automationSession isShowingJavaScriptDialogOnPage:(WKPageRef)page; 52 - (void)_automationSession:(_WKAutomationSession *)automationSession dismissCurrentJavaScriptDialogOnPage:(WKPageRef)page; 53 - (void)_automationSession:(_WKAutomationSession *)automationSession acceptCurrentJavaScriptDialogOnPage:(WKPageRef)page; 54 - (NSString *)_automationSession:(_WKAutomationSession *)automationSession messageOfCurrentJavaScriptDialogOnPage:(WKPageRef)page; 55 - (void)_automationSession:(_WKAutomationSession *)automationSession setUserInput:(NSString *)value forCurrentJavaScriptDialogOnPage:(WKPageRef)page; 65 56 @end 66 57 -
trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h
r228902 r228920 65 65 bool messageOfCurrentJavaScriptDialogForWebView : 1; 66 66 bool setUserInputForCurrentJavaScriptPromptForWebView : 1; 67 bool typeOfCurrentJavaScriptDialogForWebView : 1;68 67 69 // FIXME 37408718: these delegate methods should be removed.68 // FIXME 28524687: these delegate methods should be removed. 70 69 bool didRequestNewWindow : 1; 71 70 bool isShowingJavaScriptDialogOnPage : 1; … … 74 73 bool messageOfCurrentJavaScriptDialogOnPage : 1; 75 74 bool setUserInputForCurrentJavaScriptPromptOnPage : 1; 76 bool typeOfCurrentJavaScriptDialogOnPage : 1;77 75 } m_delegateMethods; 78 76 }; -
trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm
r228902 r228920 49 49 m_delegateMethods.messageOfCurrentJavaScriptDialogForWebView = [delegate respondsToSelector:@selector(_automationSession:messageOfCurrentJavaScriptDialogForWebView:)]; 50 50 m_delegateMethods.setUserInputForCurrentJavaScriptPromptForWebView = [delegate respondsToSelector:@selector(_automationSession:setUserInput:forCurrentJavaScriptDialogForWebView:)]; 51 m_delegateMethods.typeOfCurrentJavaScriptDialogForWebView = [delegate respondsToSelector:@selector(_automationSession:typeOfCurrentJavaScriptDialogForWebView:)];52 51 53 // FIXME 37408718: these delegate methods should be removed.52 // FIXME 28524687: these delegate methods should be removed. 54 53 m_delegateMethods.didRequestNewWindow = [delegate respondsToSelector:@selector(_automationSessionDidRequestNewWindow:)]; 55 54 m_delegateMethods.isShowingJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:isShowingJavaScriptDialogOnPage:)]; … … 58 57 m_delegateMethods.messageOfCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:messageOfCurrentJavaScriptDialogOnPage:)]; 59 58 m_delegateMethods.setUserInputForCurrentJavaScriptPromptOnPage = [delegate respondsToSelector:@selector(_automationSession:setUserInput:forCurrentJavaScriptDialogOnPage:)]; 60 m_delegateMethods.typeOfCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:typeOfCurrentJavaScriptDialogOnPage:)];61 59 } 62 60 … … 67 65 } 68 66 69 // FIXME 37408718: support for WKPageRef-based delegate methods should be removed.67 // FIXME 28524687: support for WKPageRef-based delegate methods should be removed. 70 68 // Until these are removed, prefer to use the WKWebView delegate methods if implemented. 71 69 WebPageProxy* AutomationSessionClient::didRequestNewWindow(WebAutomationSession& session) … … 126 124 } 127 125 128 st atic std::optional<API::AutomationSessionClient::JavaScriptDialogType> toImpl(_WKAutomationSessionJavaScriptDialogType type)126 std::optional<API::AutomationSessionClient::JavaScriptDialogType> AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage(WebAutomationSession&, WebPageProxy&) 129 127 { 130 switch (type) { 131 case _WKAutomationSessionJavaScriptDialogTypeNone: 132 return std::nullopt; 133 case _WKAutomationSessionJavaScriptDialogTypePrompt: 134 return API::AutomationSessionClient::JavaScriptDialogType::Prompt; 135 case _WKAutomationSessionJavaScriptDialogTypeConfirm: 136 return API::AutomationSessionClient::JavaScriptDialogType::Confirm; 137 case _WKAutomationSessionJavaScriptDialogTypeAlert: 138 return API::AutomationSessionClient::JavaScriptDialogType::Alert; 139 } 140 } 141 142 std::optional<API::AutomationSessionClient::JavaScriptDialogType> AutomationSessionClient::typeOfCurrentJavaScriptDialogOnPage(WebAutomationSession& session, WebPageProxy& page) 143 { 144 if (m_delegateMethods.typeOfCurrentJavaScriptDialogForWebView) 145 return toImpl([m_delegate.get() _automationSession:wrapper(session) typeOfCurrentJavaScriptDialogForWebView:fromWebPageProxy(page)]); 146 if (m_delegateMethods.typeOfCurrentJavaScriptDialogOnPage) 147 return toImpl([m_delegate.get() _automationSession:wrapper(session) typeOfCurrentJavaScriptDialogOnPage:toAPI(&page)]); 148 128 // FIXME: Implement it. This is only used in WebAutomationSession::setUserInputForCurrentJavaScriptPrompt() so for now we return 129 // always Prompt type for compatibility. 149 130 return API::AutomationSessionClient::JavaScriptDialogType::Prompt; 150 131 }
Note: See TracChangeset
for help on using the changeset viewer.