Title: [236852] trunk/Source/WebKit
- Revision
- 236852
- Author
- [email protected]
- Date
- 2018-10-04 14:47:13 -0700 (Thu, 04 Oct 2018)
Log Message
Web Automation: clear pending callbacks when the session terminates
https://bugs.webkit.org/show_bug.cgi?id=190259
<rdar://problem/44958352>
Reviewed by Joseph Pecoraro.
WebAutomationSession::terminate() can be called at any time to nuke the session.
However, it's possible that the session is in the midst of simulating keyboard/mouse
events. While in that state, there are some CompletionHandler objects waiting
for key/mouse events to be flushed. We need to empty out callback maps with
CompletionHandler instances so that they do not assert because they were never called.
I was able to test this manually by running a test that erroneously hangs
while waiting for keyboard input. While the test was hung, I killed the NetworkProcess
manually to trigger WebAutomationSession::terminate(). From there, I saw that the
Perform Actions REST API call gets cancelled with the appropriate error code.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::terminate):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (236851 => 236852)
--- trunk/Source/WebKit/ChangeLog 2018-10-04 21:14:58 UTC (rev 236851)
+++ trunk/Source/WebKit/ChangeLog 2018-10-04 21:47:13 UTC (rev 236852)
@@ -1,3 +1,25 @@
+2018-10-04 Brian Burg <[email protected]>
+
+ Web Automation: clear pending callbacks when the session terminates
+ https://bugs.webkit.org/show_bug.cgi?id=190259
+ <rdar://problem/44958352>
+
+ Reviewed by Joseph Pecoraro.
+
+ WebAutomationSession::terminate() can be called at any time to nuke the session.
+ However, it's possible that the session is in the midst of simulating keyboard/mouse
+ events. While in that state, there are some CompletionHandler objects waiting
+ for key/mouse events to be flushed. We need to empty out callback maps with
+ CompletionHandler instances so that they do not assert because they were never called.
+
+ I was able to test this manually by running a test that erroneously hangs
+ while waiting for keyboard input. While the test was hung, I killed the NetworkProcess
+ manually to trigger WebAutomationSession::terminate(). From there, I saw that the
+ Perform Actions REST API call gets cancelled with the appropriate error code.
+
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::terminate):
+
2018-10-04 Jiewen Tan <[email protected]>
[WebAuthN] Move time out control from WebProcess to UIProcess
Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (236851 => 236852)
--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2018-10-04 21:14:58 UTC (rev 236851)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2018-10-04 21:47:13 UTC (rev 236852)
@@ -139,6 +139,16 @@
void WebAutomationSession::terminate()
{
+ for (auto& identifier : copyToVector(m_pendingKeyboardEventsFlushedCallbacksPerPage.keys())) {
+ auto callback = m_pendingKeyboardEventsFlushedCallbacksPerPage.take(identifier);
+ callback(AUTOMATION_COMMAND_ERROR_WITH_NAME(InternalError));
+ }
+
+ for (auto& identifier : copyToVector(m_pendingMouseEventsFlushedCallbacksPerPage.keys())) {
+ auto callback = m_pendingMouseEventsFlushedCallbacksPerPage.take(identifier);
+ callback(AUTOMATION_COMMAND_ERROR_WITH_NAME(InternalError));
+ }
+
#if ENABLE(REMOTE_INSPECTOR)
if (Inspector::FrontendChannel* channel = m_remoteChannel) {
m_remoteChannel = nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes