Bug 169487

Summary: [iOS WK2] Web Automation: implement platform methods for simulating keyboard events
Product: WebKit Reporter: BJ Burg <bburg>
Component: WebKit2Assignee: BJ Burg <bburg>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, joepeck, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch joepeck: review+

Description BJ Burg 2017-03-10 15:27:48 PST
.
Comment 1 BJ Burg 2017-03-10 15:28:21 PST
<rdar://problem/28360564>
Comment 2 BJ Burg 2017-03-13 10:06:13 PDT
Created attachment 304264 [details]
Patch
Comment 3 Alex Christensen 2017-03-14 10:39:32 PDT
Comment on attachment 304264 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=304264&action=review

> Source/WebKit2/UIProcess/Automation/WebAutomationSession.h:175
> +#if PLATFORM(MAC) || PLATFORM(IOS)

This is what PLATFORM(COCOA) is for
Comment 4 Joseph Pecoraro 2017-03-14 11:11:47 PDT
Comment on attachment 304264 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=304264&action=review

r=me

> Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp:936
> +#if !PLATFORM(MAC) && !PLATFORM(IOS)

This could be !PLATFORM(COCOA)

> Source/WebKit2/UIProcess/Automation/WebAutomationSession.h:226
> +    // We don't platform keyboard events on iOS, so we need to track it ourselves.

Grammar: "We don't platform keyboard" is missing a word somewhere.

> Source/WebKit2/UIProcess/Automation/WebAutomationSession.h:227
> +    unsigned m_currentModifiers;

Initialize this to { 0 }.

> Source/WebKit2/UIProcess/Automation/ios/WebAutomationSessionIOS.mm:111
> +        return;

This should be break, not return.

> Source/WebKit2/UIProcess/Automation/ios/WebAutomationSessionIOS.mm:270
> +        [eventsToBeSent addObject:[[::WebEvent alloc] initWithKeyEventType:WebEventKeyDown timeStamp:CFAbsoluteTimeGetCurrent() characters:characters charactersIgnoringModifiers:characters modifiers:m_currentModifiers isRepeating:NO withFlags:inputFlags withInputManagerHint:nil keyCode:keyCode isTabKey:isTabKey]];

I suspect this code is not under ARC (you are using a RetainPtr above). So all of these [::WebEvent alloc] allocated objects in this patch should be autoreleased when put into the eventsToBeSent array.
Comment 5 BJ Burg 2017-03-16 14:49:37 PDT
Committed r214070: <http://trac.webkit.org/changeset/214070>