Title: [262815] trunk/Source/WebKit
Revision
262815
Author
[email protected]
Date
2020-06-09 15:06:04 -0700 (Tue, 09 Jun 2020)

Log Message

[Cocoa] Element Send Keys can hang when an automation window becomes unfocused
https://bugs.webkit.org/show_bug.cgi?id=212985
<rdar://problem/56354471>

Reviewed by Devin Rousso.

* UIProcess/Automation/mac/WebAutomationSessionMac.mm:
(WebKit::WebAutomationSession::sendSynthesizedEventsToPage):
Make sure to focus the window and set first responder so sending keys doesn't hang.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (262814 => 262815)


--- trunk/Source/WebKit/ChangeLog	2020-06-09 22:04:49 UTC (rev 262814)
+++ trunk/Source/WebKit/ChangeLog	2020-06-09 22:06:04 UTC (rev 262815)
@@ -1,3 +1,16 @@
+2020-06-09  Brian Burg  <[email protected]>
+
+        [Cocoa] Element Send Keys can hang when an automation window becomes unfocused
+        https://bugs.webkit.org/show_bug.cgi?id=212985
+        <rdar://problem/56354471>
+
+        Reviewed by Devin Rousso.
+
+        * UIProcess/Automation/mac/WebAutomationSessionMac.mm:
+        (WebKit::WebAutomationSession::sendSynthesizedEventsToPage):
+        Make sure to focus the window and set first responder so sending keys doesn't hang.
+
+
 2020-06-09  Jonathan Bedard  <[email protected]>
 
         WebKit: Import NSURLConnectionSPI.h instead of CFNSURLConnection.h

Modified: trunk/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm (262814 => 262815)


--- trunk/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm	2020-06-09 22:04:49 UTC (rev 262814)
+++ trunk/Source/WebKit/UIProcess/Automation/mac/WebAutomationSessionMac.mm	2020-06-09 22:06:04 UTC (rev 262815)
@@ -73,6 +73,8 @@
 void WebAutomationSession::sendSynthesizedEventsToPage(WebPageProxy& page, NSArray *eventsToSend)
 {
     NSWindow *window = page.platformWindow();
+    [window makeKeyAndOrderFront:nil];
+    page.makeFirstResponder();
 
     for (NSEvent *event in eventsToSend) {
         LOG(Automation, "Sending event[%p] to window[%p]: %@", event, window, event);
@@ -79,7 +81,8 @@
 
         // Take focus back in case the Inspector became focused while the prior command or
         // NSEvent was delivered to the window.
-        [window becomeKeyWindow];
+        [window makeKeyAndOrderFront:nil];
+        page.makeFirstResponder();
 
         markEventAsSynthesizedForAutomation(event);
         [window sendEvent:event];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to