Bug 217351

Summary: Use sendWithAsyncReply to evaluate JavaScript in a WebPage
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, berto, cgarcia, ews-watchlist, ggaren, gustavo, hi, joepeck, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
none
Patch none

Description Alex Christensen 2020-10-05 16:18:48 PDT
Use sendWithAsyncReply to evaluate JavaScript in a WebPage
Comment 1 Alex Christensen 2020-10-05 16:19:32 PDT
Created attachment 410581 [details]
Patch
Comment 2 Alex Christensen 2020-10-05 16:39:39 PDT
Created attachment 410587 [details]
Patch
Comment 3 EWS Watchlist 2020-10-05 16:40:25 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 https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 4 Alex Christensen 2020-10-05 16:57:02 PDT
Created attachment 410590 [details]
Patch
Comment 5 Alex Christensen 2020-10-05 18:41:42 PDT
Created attachment 410599 [details]
Patch
Comment 6 Alex Christensen 2020-10-05 21:43:54 PDT
Created attachment 410610 [details]
Patch
Comment 7 youenn fablet 2020-10-06 00:32:57 PDT
Comment on attachment 410610 [details]
Patch

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

> Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:3788
> +    getPage(webView).runJavaScriptInMainFrame(WTFMove(params), [task = WTFMove(task)](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details) {

&& and WTFMove.
Or can we use something like Expected<RefPtr<API::SerializedScriptValue>, ExceptionDetails>?

> Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:3925
>              exceptionDetails = *details;

Optional<>&& and WTFMove

> Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:3965
> +        [task](API::SerializedScriptValue* serializedScriptValue, Optional<ExceptionDetails> details) {

Optional<>&& and WTFMove

> Source/WebKit/UIProcess/Inspector/socket/RemoteInspectorProtocolHandler.cpp:124
> +        [](API::SerializedScriptValue*, Optional<WebCore::ExceptionDetails> exceptionDetails) {

&&, maybe use auto&& as well.

> Source/WebKit/UIProcess/WebPageProxy.cpp:4105
> +    sendWithAsyncReply(Messages::WebPage::RunJavaScriptInFrameInScriptWorld(parameters, frameID, world.worldData()), [activity = WTFMove(activity), callbackFunction = WTFMove(callbackFunction)] (const IPC::DataReference& dataReference, Optional<ExceptionDetails> details) mutable {

&&

> Source/WebKit/UIProcess/WebPageProxy.cpp:4113
> +        callbackFunction(API::SerializedScriptValue::adopt(WTFMove(data)).ptr(), details);

WTFMove(details)
Comment 8 Alex Christensen 2020-10-06 12:47:34 PDT
Created attachment 410680 [details]
Patch
Comment 9 Alex Christensen 2020-10-06 13:02:13 PDT
Created attachment 410683 [details]
Patch
Comment 10 Alex Christensen 2020-10-06 13:07:17 PDT
Created attachment 410686 [details]
Patch
Comment 11 Alex Christensen 2020-10-06 13:31:58 PDT
Created attachment 410688 [details]
Patch
Comment 12 Alex Christensen 2020-10-06 14:22:00 PDT
http://trac.webkit.org/r268074
Comment 13 Radar WebKit Bug Importer 2020-10-06 14:22:16 PDT
<rdar://problem/70017140>