Bug 176583

Summary: Modernize and make API::UIClient more asynchronous
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, berto, buildbot, cgarcia, gustavo, mcatanzaro, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Alex Christensen 2017-09-07 21:32:21 PDT
Modernize and make API::UIClient more asynchronous
Comment 1 Alex Christensen 2017-09-07 21:38:09 PDT
Created attachment 320235 [details]
Patch
Comment 2 Alex Christensen 2017-09-07 21:51:57 PDT
Created attachment 320236 [details]
Patch
Comment 3 Build Bot 2017-09-07 21:54:42 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 4 Alex Christensen 2017-09-07 21:58:12 PDT
Created attachment 320237 [details]
Patch
Comment 5 Alex Christensen 2017-09-07 22:45:22 PDT
Created attachment 320242 [details]
Patch
Comment 6 Alex Christensen 2017-09-08 10:06:28 PDT
Created attachment 320271 [details]
Patch
Comment 7 BJ Burg 2017-09-08 11:03:38 PDT
Comment on attachment 320271 [details]
Patch

Automation changes look OK in principle, but I would like to read this more deeply and run test suite.
Comment 8 BJ Burg 2017-09-08 11:04:10 PDT
(In reply to Brian Burg from comment #7)
> Comment on attachment 320271 [details]
> Patch
> 
> Automation changes look OK in principle, but I would like to read this more
> deeply and run test suite.

Or Carlos could do the same. I don't have time to review until Monday.
Comment 9 BJ Burg 2017-09-11 14:09:41 PDT
Comment on attachment 320271 [details]
Patch

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

r=me with small request

> Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:212
> +    page.getWindowFrameWithCompletionHandler([this, protectedThis = WTFMove(protectedThis), activeURL = page.pageLoadState().activeURL(), handle = handleForWebPageProxy(page), completionHandler = WTFMove(completionHandler)](WebCore::FloatRect windowFrame) mutable {

Err, this is weird. The async part should not be in the factory method, which just translates WK types to JSON payloads. So the new signature for this builder should be adjusted to take the page and its windowFrame, and stay synchronous.

> Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:235
> +void WebAutomationSession::getNextContext(Ref<WebAutomationSession>&& protectedThis, Vector<Ref<WebPageProxy>>&& pages, Ref<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>> contexts, Ref<WebAutomationSession::GetBrowsingContextsCallback>&& callback)

This diff is hard to read.

> Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:242
> +    buildBrowsingContextForPage(WTFMove(protectedThis), page.get(), [this, pages = WTFMove(pages), contexts = WTFMove(contexts), callback = WTFMove(callback)](Ref<WebAutomationSession>&& protectedThis, Ref<Inspector::Protocol::Automation::BrowsingContext>&& context) mutable {

... so the windowFrame async call would be here, and call the builder inside the completion handler.

> Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:1288
> +

parsedButton and parsedInteraction don't need to be in the completion handler.
Comment 10 Alex Christensen 2017-09-11 15:24:04 PDT
Created attachment 320486 [details]
Patch
Comment 11 Alex Christensen 2017-09-11 15:51:30 PDT
http://trac.webkit.org/r221887
Comment 12 Radar WebKit Bug Importer 2017-09-27 13:02:19 PDT
<rdar://problem/34694523>