Changeset 244033 in webkit
- Timestamp:
- Apr 8, 2019, 12:31:45 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/Automation/WebAutomationSession.cpp (modified) (7 diffs)
-
UIProcess/Automation/WebAutomationSession.h (modified) (3 diffs)
-
UIProcess/Automation/WebAutomationSession.messages.in (modified) (2 diffs)
-
WebProcess/Automation/WebAutomationSessionProxy.cpp (modified) (29 diffs)
-
WebProcess/Automation/WebAutomationSessionProxy.h (modified) (3 diffs)
-
WebProcess/Automation/WebAutomationSessionProxy.messages.in (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r244030 r244033 1 2019-04-05 Brian Burg <bburg@apple.com> 2 3 Web Automation: clean up some WebAutomationSession methods to use modern async IPC 4 https://bugs.webkit.org/show_bug.cgi?id=196168 5 6 Reviewed by Devin Rousso. 7 8 Modern WebKit IPC is capable of providing completion handlers and can track callback IDs. 9 So, most messages between WebAutomationSession and its proxy can use this facility and stop 10 keeping track of callback IDs manually. This makes most code easier to read on both the 11 sender and receiver side. 12 13 There are two cases that could not be converted: 14 - For evaluateJavaScript, we cannot use async IPC because WebAutomationSession expects to 15 be able to cancel all pending replies when a page navigates away, the web process crashes, 16 or when handling an alert. 17 - For takeScreenshot, there is not currently support in the modern async IPC code paths for 18 sending the result back. ShareableBitmap and friends lack a modern decoder implementation. 19 20 * UIProcess/Automation/WebAutomationSession.cpp: 21 (WebKit::WebAutomationSession::resolveChildFrameHandle): 22 (WebKit::WebAutomationSession::resolveParentFrameHandle): 23 (WebKit::WebAutomationSession::computeElementLayout): 24 (WebKit::WebAutomationSession::selectOptionElement): 25 (WebKit::WebAutomationSession::getAllCookies): 26 (WebKit::WebAutomationSession::deleteSingleCookie): 27 (WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): 28 (WebKit::WebAutomationSession::didResolveChildFrame): Deleted. 29 (WebKit::WebAutomationSession::didResolveParentFrame): Deleted. 30 (WebKit::WebAutomationSession::didComputeElementLayout): Deleted. 31 (WebKit::WebAutomationSession::didSelectOptionElement): Deleted. 32 (WebKit::WebAutomationSession::didGetCookiesForFrame): Deleted. 33 (WebKit::WebAutomationSession::didDeleteCookie): Deleted. 34 * UIProcess/Automation/WebAutomationSession.h: 35 * UIProcess/Automation/WebAutomationSession.messages.in: 36 * WebProcess/Automation/WebAutomationSessionProxy.cpp: 37 (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal): 38 (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle): 39 (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName): 40 (WebKit::WebAutomationSessionProxy::resolveParentFrame): 41 (WebKit::WebAutomationSessionProxy::computeElementLayout): 42 (WebKit::WebAutomationSessionProxy::selectOptionElement): 43 (WebKit::WebAutomationSessionProxy::getCookiesForFrame): 44 (WebKit::WebAutomationSessionProxy::deleteCookie): 45 * WebProcess/Automation/WebAutomationSessionProxy.h: 46 * WebProcess/Automation/WebAutomationSessionProxy.messages.in: 47 1 48 2019-04-08 Alex Christensen <achristensen@webkit.org> 2 49 -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r243378 r244033 971 971 ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); 972 972 973 uint64_t callbackID = m_nextResolveFrameCallbackID++; 974 m_resolveChildFrameHandleCallbacks.set(callbackID, WTFMove(callback)); 973 WTF::CompletionHandler<void(Optional<String>, uint64_t)> completionHandler = [this, protectedThis = makeRef(*this), callback = callback.copyRef()](Optional<String> errorType, uint64_t frameID) mutable { 974 if (errorType) { 975 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(*errorType)); 976 return; 977 } 978 979 callback->sendSuccess(handleForWebFrameID(frameID)); 980 }; 975 981 976 982 if (optionalNodeHandle) { 977 page->process().send (Messages::WebAutomationSessionProxy::ResolveChildFrameWithNodeHandle(page->pageID(), frameID.value(), *optionalNodeHandle, callbackID), 0);983 page->process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::ResolveChildFrameWithNodeHandle(page->pageID(), frameID.value(), *optionalNodeHandle), WTFMove(completionHandler)); 978 984 return; 979 985 } 980 986 981 987 if (optionalName) { 982 page->process().send (Messages::WebAutomationSessionProxy::ResolveChildFrameWithName(page->pageID(), frameID.value(), *optionalName, callbackID), 0);988 page->process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::ResolveChildFrameWithName(page->pageID(), frameID.value(), *optionalName), WTFMove(completionHandler)); 983 989 return; 984 990 } 985 991 986 992 if (optionalOrdinal) { 987 page->process().send (Messages::WebAutomationSessionProxy::ResolveChildFrameWithOrdinal(page->pageID(), frameID.value(), *optionalOrdinal, callbackID), 0);993 page->process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::ResolveChildFrameWithOrdinal(page->pageID(), frameID.value(), *optionalOrdinal), WTFMove(completionHandler)); 988 994 return; 989 995 } 990 996 991 997 ASSERT_NOT_REACHED(); 992 }993 994 void WebAutomationSession::didResolveChildFrame(uint64_t callbackID, uint64_t frameID, const String& errorType)995 {996 auto callback = m_resolveChildFrameHandleCallbacks.take(callbackID);997 if (!callback)998 return;999 1000 if (!errorType.isEmpty())1001 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(errorType));1002 else1003 callback->sendSuccess(handleForWebFrameID(frameID));1004 998 } 1005 999 … … 1014 1008 ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); 1015 1009 1016 uint64_t callbackID = m_nextResolveParentFrameCallbackID++; 1017 m_resolveParentFrameHandleCallbacks.set(callbackID, WTFMove(callback)); 1018 1019 page->process().send(Messages::WebAutomationSessionProxy::ResolveParentFrame(page->pageID(), frameID.value(), callbackID), 0); 1020 } 1021 1022 void WebAutomationSession::didResolveParentFrame(uint64_t callbackID, uint64_t frameID, const String& errorType) 1023 { 1024 auto callback = m_resolveParentFrameHandleCallbacks.take(callbackID); 1025 if (!callback) 1026 return; 1027 1028 if (!errorType.isEmpty()) 1029 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(errorType)); 1030 else 1010 WTF::CompletionHandler<void(Optional<String>, uint64_t)> completionHandler = [this, protectedThis = makeRef(*this), callback = callback.copyRef()](Optional<String> errorType, uint64_t frameID) mutable { 1011 if (errorType) { 1012 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(*errorType)); 1013 return; 1014 } 1015 1031 1016 callback->sendSuccess(handleForWebFrameID(frameID)); 1017 }; 1018 1019 page->process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::ResolveParentFrame(page->pageID(), frameID.value()), WTFMove(completionHandler)); 1032 1020 } 1033 1021 … … 1055 1043 ASYNC_FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'coordinateSystem' is invalid."); 1056 1044 1057 // Start at 2 and use only even numbers to not conflict with m_nextViewportInViewCenterPointOfElementCallbackID. 1058 uint64_t callbackID = m_nextComputeElementLayoutCallbackID += 2; 1059 m_computeElementLayoutCallbacks.set(callbackID, WTFMove(callback)); 1045 WTF::CompletionHandler<void(Optional<String>, WebCore::IntRect, Optional<WebCore::IntPoint>, bool)> completionHandler = [callback = callback.copyRef()](Optional<String> errorType, WebCore::IntRect rect, Optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured) mutable { 1046 if (errorType) { 1047 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(*errorType)); 1048 return; 1049 } 1050 1051 auto originObject = Inspector::Protocol::Automation::Point::create() 1052 .setX(rect.x()) 1053 .setY(rect.y()) 1054 .release(); 1055 1056 auto sizeObject = Inspector::Protocol::Automation::Size::create() 1057 .setWidth(rect.width()) 1058 .setHeight(rect.height()) 1059 .release(); 1060 1061 auto rectObject = Inspector::Protocol::Automation::Rect::create() 1062 .setOrigin(WTFMove(originObject)) 1063 .setSize(WTFMove(sizeObject)) 1064 .release(); 1065 1066 if (!inViewCenterPoint) { 1067 callback->sendSuccess(WTFMove(rectObject), nullptr, isObscured); 1068 return; 1069 } 1070 1071 auto inViewCenterPointObject = Inspector::Protocol::Automation::Point::create() 1072 .setX(inViewCenterPoint.value().x()) 1073 .setY(inViewCenterPoint.value().y()) 1074 .release(); 1075 1076 callback->sendSuccess(WTFMove(rectObject), WTFMove(inViewCenterPointObject), isObscured); 1077 }; 1060 1078 1061 1079 bool scrollIntoViewIfNeeded = optionalScrollIntoViewIfNeeded ? *optionalScrollIntoViewIfNeeded : false; 1062 page->process().send(Messages::WebAutomationSessionProxy::ComputeElementLayout(page->pageID(), frameID.value(), nodeHandle, scrollIntoViewIfNeeded, coordinateSystem.value(), callbackID), 0); 1063 } 1064 1065 void WebAutomationSession::didComputeElementLayout(uint64_t callbackID, WebCore::IntRect rect, Optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured, const String& errorType) 1066 { 1067 if (callbackID % 2 == 1) { 1068 ASSERT(inViewCenterPoint); 1069 if (auto callback = m_viewportInViewCenterPointOfElementCallbacks.take(callbackID)) { 1070 Optional<AutomationCommandError> error; 1071 if (!errorType.isEmpty()) 1072 error = AUTOMATION_COMMAND_ERROR_WITH_MESSAGE(errorType); 1073 callback(inViewCenterPoint, error); 1074 } 1075 return; 1076 } 1077 1078 auto callback = m_computeElementLayoutCallbacks.take(callbackID); 1079 if (!callback) 1080 return; 1081 1082 if (!errorType.isEmpty()) { 1083 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(errorType)); 1084 return; 1085 } 1086 1087 auto originObject = Inspector::Protocol::Automation::Point::create() 1088 .setX(rect.x()) 1089 .setY(rect.y()) 1090 .release(); 1091 1092 auto sizeObject = Inspector::Protocol::Automation::Size::create() 1093 .setWidth(rect.width()) 1094 .setHeight(rect.height()) 1095 .release(); 1096 1097 auto rectObject = Inspector::Protocol::Automation::Rect::create() 1098 .setOrigin(WTFMove(originObject)) 1099 .setSize(WTFMove(sizeObject)) 1100 .release(); 1101 1102 if (!inViewCenterPoint) { 1103 callback->sendSuccess(WTFMove(rectObject), nullptr, isObscured); 1104 return; 1105 } 1106 1107 auto inViewCenterPointObject = Inspector::Protocol::Automation::Point::create() 1108 .setX(inViewCenterPoint.value().x()) 1109 .setY(inViewCenterPoint.value().y()) 1110 .release(); 1111 1112 callback->sendSuccess(WTFMove(rectObject), WTFMove(inViewCenterPointObject), isObscured); 1080 page->process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::ComputeElementLayout(page->pageID(), frameID.value(), nodeHandle, scrollIntoViewIfNeeded, coordinateSystem.value()), WTFMove(completionHandler)); 1113 1081 } 1114 1082 … … 1123 1091 ASYNC_FAIL_WITH_PREDEFINED_ERROR(FrameNotFound); 1124 1092 1125 uint64_t callbackID = m_nextSelectOptionElementCallbackID++; 1126 m_selectOptionElementCallbacks.set(callbackID, WTFMove(callback)); 1127 1128 page->process().send(Messages::WebAutomationSessionProxy::SelectOptionElement(page->pageID(), frameID.value(), nodeHandle, callbackID), 0); 1129 } 1130 1131 void WebAutomationSession::didSelectOptionElement(uint64_t callbackID, const String& errorType) 1132 { 1133 auto callback = m_selectOptionElementCallbacks.take(callbackID); 1134 if (!callback) 1135 return; 1136 1137 if (!errorType.isEmpty()) { 1138 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(errorType)); 1139 return; 1140 } 1141 1142 callback->sendSuccess(); 1143 } 1144 1093 WTF::CompletionHandler<void(Optional<String>)> completionHandler = [callback = callback.copyRef()](Optional<String> errorType) mutable { 1094 if (errorType) { 1095 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(*errorType)); 1096 return; 1097 } 1098 1099 callback->sendSuccess(); 1100 }; 1101 1102 page->process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::SelectOptionElement(page->pageID(), frameID.value(), nodeHandle), WTFMove(completionHandler)); 1103 } 1145 1104 1146 1105 void WebAutomationSession::isShowingJavaScriptDialog(Inspector::ErrorString& errorString, const String& browsingContextHandle, bool* result) … … 1271 1230 } 1272 1231 1273 void WebAutomationSession::getAllCookies(const String& browsingContextHandle, Ref<GetAllCookiesCallback>&& callback)1274 {1275 WebPageProxy* page = webPageProxyForHandle(browsingContextHandle);1276 if (!page)1277 ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);1278 1279 // Always send the main frame ID as 0 so it is resolved on the WebProcess side. This avoids a race when page->mainFrame() is null still.1280 const uint64_t mainFrameID = 0;1281 1282 uint64_t callbackID = m_nextGetCookiesCallbackID++;1283 m_getCookieCallbacks.set(callbackID, WTFMove(callback));1284 1285 page->process().send(Messages::WebAutomationSessionProxy::GetCookiesForFrame(page->pageID(), mainFrameID, callbackID), 0);1286 }1287 1288 1232 static Ref<Inspector::Protocol::Automation::Cookie> buildObjectForCookie(const WebCore::Cookie& cookie) 1289 1233 { … … 1311 1255 } 1312 1256 1313 void WebAutomationSession::didGetCookiesForFrame(uint64_t callbackID, Vector<WebCore::Cookie> cookies, const String& errorType) 1314 { 1315 auto callback = m_getCookieCallbacks.take(callbackID); 1316 if (!callback) 1317 return; 1318 1319 if (!errorType.isEmpty()) { 1320 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(errorType)); 1321 return; 1322 } 1323 1324 callback->sendSuccess(buildArrayForCookies(cookies)); 1325 } 1326 1327 void WebAutomationSession::deleteSingleCookie(const String& browsingContextHandle, const String& cookieName, Ref<DeleteSingleCookieCallback>&& callback) 1257 void WebAutomationSession::getAllCookies(const String& browsingContextHandle, Ref<GetAllCookiesCallback>&& callback) 1328 1258 { 1329 1259 WebPageProxy* page = webPageProxyForHandle(browsingContextHandle); 1330 1260 if (!page) 1331 1261 ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); 1262 1263 WTF::CompletionHandler<void(Optional<String>, Vector<WebCore::Cookie>)> completionHandler = [callback = callback.copyRef()](Optional<String> errorType, Vector<WebCore::Cookie> cookies) mutable { 1264 if (errorType) { 1265 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(*errorType)); 1266 return; 1267 } 1268 1269 callback->sendSuccess(buildArrayForCookies(cookies)); 1270 }; 1332 1271 1333 1272 // Always send the main frame ID as 0 so it is resolved on the WebProcess side. This avoids a race when page->mainFrame() is null still. 1334 1273 const uint64_t mainFrameID = 0; 1335 1336 uint64_t callbackID = m_nextDeleteCookieCallbackID++; 1337 m_deleteCookieCallbacks.set(callbackID, WTFMove(callback)); 1338 1339 page->process().send(Messages::WebAutomationSessionProxy::DeleteCookie(page->pageID(), mainFrameID, cookieName, callbackID), 0); 1340 } 1341 1342 void WebAutomationSession::didDeleteCookie(uint64_t callbackID, const String& errorType) 1343 { 1344 auto callback = m_deleteCookieCallbacks.take(callbackID); 1345 if (!callback) 1346 return; 1347 1348 if (!errorType.isEmpty()) { 1349 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(errorType)); 1350 return; 1351 } 1352 1353 callback->sendSuccess(); 1274 page->process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::GetCookiesForFrame(page->pageID(), mainFrameID), WTFMove(completionHandler)); 1275 } 1276 1277 void WebAutomationSession::deleteSingleCookie(const String& browsingContextHandle, const String& cookieName, Ref<DeleteSingleCookieCallback>&& callback) 1278 { 1279 WebPageProxy* page = webPageProxyForHandle(browsingContextHandle); 1280 if (!page) 1281 ASYNC_FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); 1282 1283 WTF::CompletionHandler<void(Optional<String>)> completionHandler = [callback = callback.copyRef()](Optional<String> errorType) mutable { 1284 if (errorType) { 1285 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_MESSAGE(*errorType)); 1286 return; 1287 } 1288 1289 callback->sendSuccess(); 1290 }; 1291 1292 // Always send the main frame ID as 0 so it is resolved on the WebProcess side. This avoids a race when page->mainFrame() is null still. 1293 const uint64_t mainFrameID = 0; 1294 page->process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::DeleteCookie(page->pageID(), mainFrameID, cookieName), WTFMove(completionHandler)); 1354 1295 } 1355 1296 … … 1519 1460 void WebAutomationSession::viewportInViewCenterPointOfElement(WebPageProxy& page, uint64_t frameID, const String& nodeHandle, Function<void (Optional<WebCore::IntPoint>, Optional<AutomationCommandError>)>&& completionHandler) 1520 1461 { 1521 // Start at 3 and use only odd numbers to not conflict with m_nextComputeElementLayoutCallbackID. 1522 uint64_t callbackID = m_nextViewportInViewCenterPointOfElementCallbackID += 2; 1523 m_viewportInViewCenterPointOfElementCallbacks.set(callbackID, WTFMove(completionHandler)); 1524 1525 page.process().send(Messages::WebAutomationSessionProxy::ComputeElementLayout(page.pageID(), frameID, nodeHandle, false, CoordinateSystem::LayoutViewport, callbackID), 0); 1462 WTF::CompletionHandler<void(Optional<String>, WebCore::IntRect, Optional<WebCore::IntPoint>, bool)> didComputeElementLayoutHandler = [completionHandler = WTFMove(completionHandler)](Optional<String> errorType, WebCore::IntRect, Optional<WebCore::IntPoint> inViewCenterPoint, bool) mutable { 1463 if (errorType) { 1464 completionHandler(WTF::nullopt, AUTOMATION_COMMAND_ERROR_WITH_MESSAGE(*errorType)); 1465 return; 1466 } 1467 1468 ASSERT(inViewCenterPoint); 1469 completionHandler(inViewCenterPoint, WTF::nullopt); 1470 }; 1471 1472 page.process().sendWithAsyncReply(Messages::WebAutomationSessionProxy::ComputeElementLayout(page.pageID(), frameID, nodeHandle, false, CoordinateSystem::LayoutViewport), WTFMove(didComputeElementLayoutHandler)); 1526 1473 } 1527 1474 -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h
r243340 r244033 30 30 #include "AutomationFrontendDispatchers.h" 31 31 #include "Connection.h" 32 #include "MessageReceiver.h" 33 #include "MessageSender.h" 32 34 #include "ShareableBitmap.h" 33 35 #include "SimulatedInputDispatcher.h" … … 233 235 void hideWindowForPage(WebPageProxy&, WTF::CompletionHandler<void()>&&); 234 236 235 // I mplemented in generated WebAutomationSessionMessageReceiver.cpp.237 // IPC::MessageReceiver (Implemented by generated code in WebAutomationSessionMessageReceiver.cpp). 236 238 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; 237 239 238 240 // Called by WebAutomationSession messages. 239 241 void didEvaluateJavaScriptFunction(uint64_t callbackID, const String& result, const String& errorType); 240 void didResolveChildFrame(uint64_t callbackID, uint64_t frameID, const String& errorType);241 void didResolveParentFrame(uint64_t callbackID, uint64_t frameID, const String& errorType);242 void didComputeElementLayout(uint64_t callbackID, WebCore::IntRect, Optional<WebCore::IntPoint>, bool isObscured, const String& errorType);243 void didSelectOptionElement(uint64_t callbackID, const String& errorType);244 242 void didTakeScreenshot(uint64_t callbackID, const ShareableBitmap::Handle&, const String& errorType); 245 void didGetCookiesForFrame(uint64_t callbackID, Vector<WebCore::Cookie>, const String& errorType);246 void didDeleteCookie(uint64_t callbackID, const String& errorType);247 243 248 244 // Platform-dependent implementations. … … 306 302 HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::EvaluateJavaScriptFunctionCallback>> m_evaluateJavaScriptFunctionCallbacks; 307 303 308 uint64_t m_nextResolveFrameCallbackID { 1 };309 HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::ResolveChildFrameHandleCallback>> m_resolveChildFrameHandleCallbacks;310 311 uint64_t m_nextResolveParentFrameCallbackID { 1 };312 HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::ResolveParentFrameHandleCallback>> m_resolveParentFrameHandleCallbacks;313 314 // Start at 2 and use only even numbers to not conflict with m_nextViewportInViewCenterPointOfElementCallbackID.315 uint64_t m_nextComputeElementLayoutCallbackID { 2 };316 HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::ComputeElementLayoutCallback>> m_computeElementLayoutCallbacks;317 318 // Start at 3 and use only odd numbers to not conflict with m_nextComputeElementLayoutCallbackID.319 uint64_t m_nextViewportInViewCenterPointOfElementCallbackID { 3 };320 HashMap<uint64_t, Function<void(Optional<WebCore::IntPoint>, Optional<AutomationCommandError>)>> m_viewportInViewCenterPointOfElementCallbacks;321 322 304 uint64_t m_nextScreenshotCallbackID { 1 }; 323 305 HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::TakeScreenshotCallback>> m_screenshotCallbacks; 324 325 uint64_t m_nextGetCookiesCallbackID { 1 };326 HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::GetAllCookiesCallback>> m_getCookieCallbacks;327 328 uint64_t m_nextDeleteCookieCallbackID { 1 };329 HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::DeleteSingleCookieCallback>> m_deleteCookieCallbacks;330 331 uint64_t m_nextSelectOptionElementCallbackID { 1 };332 HashMap<uint64_t, RefPtr<Inspector::AutomationBackendDispatcherHandler::SelectOptionElementCallback>> m_selectOptionElementCallbacks;333 306 334 307 enum class WindowTransitionedToState { -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.messages.in
r239427 r244033 1 # Copyright (C) 2016 Apple Inc. All rights reserved.1 # Copyright (C) 2016-2019 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 23 23 messages -> WebAutomationSession { 24 24 DidEvaluateJavaScriptFunction(uint64_t callbackID, String result, String errorType) 25 26 DidResolveChildFrame(uint64_t callbackID, uint64_t frameID, String errorType)27 DidResolveParentFrame(uint64_t callbackID, uint64_t frameID, String errorType)28 29 DidComputeElementLayout(uint64_t callbackID, WebCore::IntRect rect, Optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured, String errorType)30 31 DidSelectOptionElement(uint64_t callbackID, String errorType)32 33 25 DidTakeScreenshot(uint64_t callbackID, WebKit::ShareableBitmap::Handle imageDataHandle, String errorType) 34 35 DidGetCookiesForFrame(uint64_t callbackID, Vector<WebCore::Cookie> cookies, String errorType)36 DidDeleteCookie(uint64_t callbackID, String errorType)37 26 } -
trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp
r241934 r244033 313 313 } 314 314 315 void WebAutomationSessionProxy::resolveChildFrameWithOrdinal(uint64_t pageID, uint64_t frameID, uint32_t ordinal, uint64_t callbackID)316 { 317 WebPage* page = WebProcess::singleton().webPage(pageID); 318 if (!page) { 319 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 320 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, windowNotFoundErrorType), 0);315 void WebAutomationSessionProxy::resolveChildFrameWithOrdinal(uint64_t pageID, uint64_t frameID, uint32_t ordinal, CompletionHandler<void(Optional<String>, uint64_t)>&& completionHandler) 316 { 317 WebPage* page = WebProcess::singleton().webPage(pageID); 318 if (!page) { 319 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 320 completionHandler(windowNotFoundErrorType, 0); 321 321 return; 322 322 } … … 326 326 WebFrame* frame = frameID ? WebProcess::singleton().webFrame(frameID) : page->mainWebFrame(); 327 327 if (!frame) { 328 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);328 completionHandler(frameNotFoundErrorType, 0); 329 329 return; 330 330 } … … 332 332 WebCore::Frame* coreFrame = frame->coreFrame(); 333 333 if (!coreFrame) { 334 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);334 completionHandler(frameNotFoundErrorType, 0); 335 335 return; 336 336 } … … 338 338 WebCore::Frame* coreChildFrame = coreFrame->tree().scopedChild(ordinal); 339 339 if (!coreChildFrame) { 340 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);340 completionHandler(frameNotFoundErrorType, 0); 341 341 return; 342 342 } … … 344 344 WebFrame* childFrame = WebFrame::fromCoreFrame(*coreChildFrame); 345 345 if (!childFrame) { 346 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);347 return; 348 } 349 350 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, childFrame->frameID(), String()), 0);351 } 352 353 void WebAutomationSessionProxy::resolveChildFrameWithNodeHandle(uint64_t pageID, uint64_t frameID, const String& nodeHandle, uint64_t callbackID)354 { 355 WebPage* page = WebProcess::singleton().webPage(pageID); 356 if (!page) { 357 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 358 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, windowNotFoundErrorType), 0);346 completionHandler(frameNotFoundErrorType, 0); 347 return; 348 } 349 350 completionHandler(WTF::nullopt, childFrame->frameID()); 351 } 352 353 void WebAutomationSessionProxy::resolveChildFrameWithNodeHandle(uint64_t pageID, uint64_t frameID, const String& nodeHandle, CompletionHandler<void(Optional<String>, uint64_t)>&& completionHandler) 354 { 355 WebPage* page = WebProcess::singleton().webPage(pageID); 356 if (!page) { 357 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 358 completionHandler(windowNotFoundErrorType, 0); 359 359 return; 360 360 } … … 364 364 WebFrame* frame = frameID ? WebProcess::singleton().webFrame(frameID) : page->mainWebFrame(); 365 365 if (!frame) { 366 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);366 completionHandler(frameNotFoundErrorType, 0); 367 367 return; 368 368 } … … 370 370 WebCore::Element* coreElement = elementForNodeHandle(*frame, nodeHandle); 371 371 if (!coreElement || !coreElement->isFrameElementBase()) { 372 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);372 completionHandler(frameNotFoundErrorType, 0); 373 373 return; 374 374 } … … 376 376 WebCore::Frame* coreFrameFromElement = static_cast<WebCore::HTMLFrameElementBase*>(coreElement)->contentFrame(); 377 377 if (!coreFrameFromElement) { 378 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);378 completionHandler(frameNotFoundErrorType, 0); 379 379 return; 380 380 } … … 382 382 WebFrame* frameFromElement = WebFrame::fromCoreFrame(*coreFrameFromElement); 383 383 if (!frameFromElement) { 384 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);385 return; 386 } 387 388 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, frameFromElement->frameID(), String()), 0);389 } 390 391 void WebAutomationSessionProxy::resolveChildFrameWithName(uint64_t pageID, uint64_t frameID, const String& name, uint64_t callbackID)392 { 393 WebPage* page = WebProcess::singleton().webPage(pageID); 394 if (!page) { 395 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 396 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, windowNotFoundErrorType), 0);384 completionHandler(frameNotFoundErrorType, 0); 385 return; 386 } 387 388 completionHandler(WTF::nullopt, frameFromElement->frameID()); 389 } 390 391 void WebAutomationSessionProxy::resolveChildFrameWithName(uint64_t pageID, uint64_t frameID, const String& name, CompletionHandler<void(Optional<String>, uint64_t)>&& completionHandler) 392 { 393 WebPage* page = WebProcess::singleton().webPage(pageID); 394 if (!page) { 395 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 396 completionHandler(windowNotFoundErrorType, 0); 397 397 return; 398 398 } … … 402 402 WebFrame* frame = frameID ? WebProcess::singleton().webFrame(frameID) : page->mainWebFrame(); 403 403 if (!frame) { 404 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);404 completionHandler(frameNotFoundErrorType, 0); 405 405 return; 406 406 } … … 408 408 WebCore::Frame* coreFrame = frame->coreFrame(); 409 409 if (!coreFrame) { 410 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);410 completionHandler(frameNotFoundErrorType, 0); 411 411 return; 412 412 } … … 414 414 WebCore::Frame* coreChildFrame = coreFrame->tree().scopedChild(name); 415 415 if (!coreChildFrame) { 416 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);416 completionHandler(frameNotFoundErrorType, 0); 417 417 return; 418 418 } … … 420 420 WebFrame* childFrame = WebFrame::fromCoreFrame(*coreChildFrame); 421 421 if (!childFrame) { 422 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, 0, frameNotFoundErrorType), 0);423 return; 424 } 425 426 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveChildFrame(callbackID, childFrame->frameID(), String()), 0);427 } 428 429 void WebAutomationSessionProxy::resolveParentFrame(uint64_t pageID, uint64_t frameID, uint64_t callbackID)430 { 431 WebPage* page = WebProcess::singleton().webPage(pageID); 432 if (!page) { 433 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 434 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveParentFrame(callbackID, 0, windowNotFoundErrorType), 0);422 completionHandler(frameNotFoundErrorType, 0); 423 return; 424 } 425 426 completionHandler(WTF::nullopt, childFrame->frameID()); 427 } 428 429 void WebAutomationSessionProxy::resolveParentFrame(uint64_t pageID, uint64_t frameID, CompletionHandler<void(Optional<String>, uint64_t)>&& completionHandler) 430 { 431 WebPage* page = WebProcess::singleton().webPage(pageID); 432 if (!page) { 433 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 434 completionHandler(windowNotFoundErrorType, 0); 435 435 return; 436 436 } … … 440 440 WebFrame* frame = frameID ? WebProcess::singleton().webFrame(frameID) : page->mainWebFrame(); 441 441 if (!frame) { 442 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveParentFrame(callbackID, 0, frameNotFoundErrorType), 0);442 completionHandler(frameNotFoundErrorType, 0); 443 443 return; 444 444 } … … 446 446 WebFrame* parentFrame = frame->parentFrame(); 447 447 if (!parentFrame) { 448 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveParentFrame(callbackID, 0, frameNotFoundErrorType), 0);449 return; 450 } 451 452 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidResolveParentFrame(callbackID, parentFrame->frameID(), String()), 0);448 completionHandler(frameNotFoundErrorType, 0); 449 return; 450 } 451 452 completionHandler(WTF::nullopt, parentFrame->frameID()); 453 453 } 454 454 … … 535 535 } 536 536 537 void WebAutomationSessionProxy::computeElementLayout(uint64_t pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, CoordinateSystem coordinateSystem, uint64_t callbackID)538 { 539 WebPage* page = WebProcess::singleton().webPage(pageID); 540 if (!page) { 541 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 542 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, WTF::nullopt, false, windowNotFoundErrorType), 0);537 void WebAutomationSessionProxy::computeElementLayout(uint64_t pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, CoordinateSystem coordinateSystem, CompletionHandler<void(Optional<String>, WebCore::IntRect, Optional<WebCore::IntPoint>, bool)>&& completionHandler) 538 { 539 WebPage* page = WebProcess::singleton().webPage(pageID); 540 if (!page) { 541 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 542 completionHandler(windowNotFoundErrorType, { }, WTF::nullopt, false); 543 543 return; 544 544 } … … 550 550 WebFrame* frame = frameID ? WebProcess::singleton().webFrame(frameID) : page->mainWebFrame(); 551 551 if (!frame || !frame->coreFrame() || !frame->coreFrame()->view()) { 552 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, WTF::nullopt, false, frameNotFoundErrorType), 0);552 completionHandler(frameNotFoundErrorType, { }, WTF::nullopt, false); 553 553 return; 554 554 } … … 556 556 WebCore::Element* coreElement = elementForNodeHandle(*frame, nodeHandle); 557 557 if (!coreElement) { 558 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, { }, WTF::nullopt, false, nodeNotFoundErrorType), 0);558 completionHandler(nodeNotFoundErrorType, { }, WTF::nullopt, false); 559 559 return; 560 560 } … … 601 601 } 602 602 603 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidComputeElementLayout(callbackID, resultElementBounds, resultInViewCenterPoint, isObscured, String()), 0);604 } 605 606 void WebAutomationSessionProxy::selectOptionElement(uint64_t pageID, uint64_t frameID, String nodeHandle, uint64_t callbackID)607 { 608 WebPage* page = WebProcess::singleton().webPage(pageID); 609 if (!page) { 610 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 611 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidSelectOptionElement(callbackID, windowNotFoundErrorType), 0);603 completionHandler(WTF::nullopt, resultElementBounds, resultInViewCenterPoint, isObscured); 604 } 605 606 void WebAutomationSessionProxy::selectOptionElement(uint64_t pageID, uint64_t frameID, String nodeHandle, CompletionHandler<void(Optional<String>)>&& completionHandler) 607 { 608 WebPage* page = WebProcess::singleton().webPage(pageID); 609 if (!page) { 610 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 611 completionHandler(windowNotFoundErrorType); 612 612 return; 613 613 } … … 616 616 if (!frame || !frame->coreFrame() || !frame->coreFrame()->view()) { 617 617 String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound); 618 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidSelectOptionElement(callbackID, frameNotFoundErrorType), 0);618 completionHandler(frameNotFoundErrorType); 619 619 return; 620 620 } … … 623 623 if (!coreElement || (!is<WebCore::HTMLOptionElement>(coreElement) && !is<WebCore::HTMLOptGroupElement>(coreElement))) { 624 624 String nodeNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound); 625 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidSelectOptionElement(callbackID, nodeNotFoundErrorType), 0);625 completionHandler(nodeNotFoundErrorType); 626 626 return; 627 627 } … … 629 629 String elementNotInteractableErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::ElementNotInteractable); 630 630 if (is<WebCore::HTMLOptGroupElement>(coreElement)) { 631 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidSelectOptionElement(callbackID, elementNotInteractableErrorType), 0);631 completionHandler(elementNotInteractableErrorType); 632 632 return; 633 633 } … … 636 636 auto* selectElement = optionElement.ownerSelectElement(); 637 637 if (!selectElement) { 638 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidSelectOptionElement(callbackID, elementNotInteractableErrorType), 0);638 completionHandler(elementNotInteractableErrorType); 639 639 return; 640 640 } … … 645 645 selectElement->optionSelectedByUser(optionElement.index(), true, selectElement->multiple()); 646 646 } 647 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidSelectOptionElement(callbackID, { }), 0);647 completionHandler(WTF::nullopt); 648 648 } 649 649 … … 720 720 } 721 721 722 void WebAutomationSessionProxy::getCookiesForFrame(uint64_t pageID, uint64_t frameID, uint64_t callbackID)723 { 724 WebPage* page = WebProcess::singleton().webPage(pageID); 725 if (!page) { 726 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 727 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidGetCookiesForFrame(callbackID, Vector<WebCore::Cookie>(), windowNotFoundErrorType), 0);722 void WebAutomationSessionProxy::getCookiesForFrame(uint64_t pageID, uint64_t frameID, CompletionHandler<void(Optional<String>, Vector<WebCore::Cookie>)>&& completionHandler) 723 { 724 WebPage* page = WebProcess::singleton().webPage(pageID); 725 if (!page) { 726 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 727 completionHandler(windowNotFoundErrorType, Vector<WebCore::Cookie>()); 728 728 return; 729 729 } … … 732 732 if (!frame || !frame->coreFrame() || !frame->coreFrame()->document()) { 733 733 String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound); 734 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidGetCookiesForFrame(callbackID, Vector<WebCore::Cookie>(), frameNotFoundErrorType), 0);734 completionHandler(frameNotFoundErrorType, Vector<WebCore::Cookie>()); 735 735 return; 736 736 } … … 742 742 page->corePage()->cookieJar().getRawCookies(document, document.cookieURL(), foundCookies); 743 743 744 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidGetCookiesForFrame(callbackID, foundCookies, String()), 0);745 } 746 747 void WebAutomationSessionProxy::deleteCookie(uint64_t pageID, uint64_t frameID, String cookieName, uint64_t callbackID)748 { 749 WebPage* page = WebProcess::singleton().webPage(pageID); 750 if (!page) { 751 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 752 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidDeleteCookie(callbackID, windowNotFoundErrorType), 0);744 completionHandler(WTF::nullopt, foundCookies); 745 } 746 747 void WebAutomationSessionProxy::deleteCookie(uint64_t pageID, uint64_t frameID, String cookieName, CompletionHandler<void(Optional<String>)>&& completionHandler) 748 { 749 WebPage* page = WebProcess::singleton().webPage(pageID); 750 if (!page) { 751 String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound); 752 completionHandler(windowNotFoundErrorType); 753 753 return; 754 754 } … … 757 757 if (!frame || !frame->coreFrame() || !frame->coreFrame()->document()) { 758 758 String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound); 759 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidDeleteCookie(callbackID, frameNotFoundErrorType), 0);759 completionHandler(frameNotFoundErrorType); 760 760 return; 761 761 } … … 764 764 page->corePage()->cookieJar().deleteCookie(document, document.cookieURL(), cookieName); 765 765 766 WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidDeleteCookie(callbackID, String()), 0);766 completionHandler(WTF::nullopt); 767 767 } 768 768 -
trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.h
r241183 r244033 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 32 32 33 33 namespace WebCore { 34 struct Cookie; 34 35 class Element; 35 36 } … … 61 62 // Called by WebAutomationSessionProxy messages 62 63 void evaluateJavaScriptFunction(uint64_t pageID, uint64_t frameID, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, int callbackTimeout, uint64_t callbackID); 63 void resolveChildFrameWithOrdinal(uint64_t pageID, uint64_t frameID, uint32_t ordinal, uint64_t callbackID);64 void resolveChildFrameWithNodeHandle(uint64_t pageID, uint64_t frameID, const String& nodeHandle, uint64_t callbackID);65 void resolveChildFrameWithName(uint64_t pageID, uint64_t frameID, const String& name, uint64_t callbackID);66 void resolveParentFrame(uint64_t pageID, uint64_t frameID, uint64_t callbackID);64 void resolveChildFrameWithOrdinal(uint64_t pageID, uint64_t frameID, uint32_t ordinal, CompletionHandler<void(Optional<String>, uint64_t)>&&); 65 void resolveChildFrameWithNodeHandle(uint64_t pageID, uint64_t frameID, const String& nodeHandle, CompletionHandler<void(Optional<String>, uint64_t)>&&); 66 void resolveChildFrameWithName(uint64_t pageID, uint64_t frameID, const String& name, CompletionHandler<void(Optional<String>, uint64_t)>&&); 67 void resolveParentFrame(uint64_t pageID, uint64_t frameID, CompletionHandler<void(Optional<String>, uint64_t)>&&); 67 68 void focusFrame(uint64_t pageID, uint64_t frameID); 68 void computeElementLayout(uint64_t pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, CoordinateSystem, uint64_t callbackID);69 void selectOptionElement(uint64_t pageID, uint64_t frameID, String nodeHandle, uint64_t callbackID);69 void computeElementLayout(uint64_t pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, CoordinateSystem, CompletionHandler<void(Optional<String>, WebCore::IntRect, Optional<WebCore::IntPoint>, bool)>&&); 70 void selectOptionElement(uint64_t pageID, uint64_t frameID, String nodeHandle, CompletionHandler<void(Optional<String>)>&&); 70 71 void takeScreenshot(uint64_t pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, bool clipToViewport, uint64_t callbackID); 71 void getCookiesForFrame(uint64_t pageID, uint64_t frameID, uint64_t callbackID);72 void deleteCookie(uint64_t pageID, uint64_t frameID, String cookieName, uint64_t callbackID);72 void getCookiesForFrame(uint64_t pageID, uint64_t frameID, CompletionHandler<void(Optional<String>, Vector<WebCore::Cookie>)>&&); 73 void deleteCookie(uint64_t pageID, uint64_t frameID, String cookieName, CompletionHandler<void(Optional<String>)>&&); 73 74 74 75 String m_sessionIdentifier; -
trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.messages.in
r237110 r244033 1 # Copyright (C) 2016 Apple Inc. All rights reserved.1 # Copyright (C) 2016-2019 Apple Inc. All rights reserved. 2 2 # 3 3 # Redistribution and use in source and binary forms, with or without … … 24 24 EvaluateJavaScriptFunction(uint64_t pageID, uint64_t frameID, String function, Vector<String> arguments, bool expectsImplicitCallbackArgument, int callbackTimeout, uint64_t callbackID) 25 25 26 ResolveChildFrameWithOrdinal(uint64_t pageID, uint64_t frameID, uint32_t ordinal , uint64_t callbackID)27 ResolveChildFrameWithNodeHandle(uint64_t pageID, uint64_t frameID, String nodeHandle , uint64_t callbackID)28 ResolveChildFrameWithName(uint64_t pageID, uint64_t frameID, String name , uint64_t callbackID)29 ResolveParentFrame(uint64_t pageID, uint64_t frameID , uint64_t callbackID)26 ResolveChildFrameWithOrdinal(uint64_t pageID, uint64_t frameID, uint32_t ordinal) -> (Optional<String> errorType, uint64_t frameID) Async 27 ResolveChildFrameWithNodeHandle(uint64_t pageID, uint64_t frameID, String nodeHandle) -> (Optional<String> errorType, uint64_t frameID) Async 28 ResolveChildFrameWithName(uint64_t pageID, uint64_t frameID, String name) -> (Optional<String> errorType, uint64_t frameID) Async 29 ResolveParentFrame(uint64_t pageID, uint64_t frameID) -> (Optional<String> errorType, uint64_t frameID) Async 30 30 31 31 FocusFrame(uint64_t pageID, uint64_t frameID) 32 32 33 ComputeElementLayout(uint64_t pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, enum:uint8_t WebKit::CoordinateSystem coordinateSystem , uint64_t callbackID)33 ComputeElementLayout(uint64_t pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, enum:uint8_t WebKit::CoordinateSystem coordinateSystem) -> (Optional<String> errorType, WebCore::IntRect rect, Optional<WebCore::IntPoint> inViewCenterPoint, bool isObscured) Async 34 34 35 SelectOptionElement(uint64_t pageID, uint64_t frameID, String nodeHandle , uint64_t callbackID)35 SelectOptionElement(uint64_t pageID, uint64_t frameID, String nodeHandle) -> (Optional<String> errorType) Async 36 36 37 37 TakeScreenshot(uint64_t pageID, uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, bool clipToViewport, uint64_t callbackID) 38 38 39 GetCookiesForFrame(uint64_t pageID, uint64_t frameID , uint64_t callbackID)40 DeleteCookie(uint64_t pageID, uint64_t frameID, String cookieName , uint64_t callbackID)39 GetCookiesForFrame(uint64_t pageID, uint64_t frameID) -> (Optional<String> errorType, Vector<WebCore::Cookie> cookies) Async 40 DeleteCookie(uint64_t pageID, uint64_t frameID, String cookieName) -> (Optional<String> errorType) Async 41 41 }
Note:
See TracChangeset
for help on using the changeset viewer.