Bug 217351 - Use sendWithAsyncReply to evaluate JavaScript in a WebPage
Summary: Use sendWithAsyncReply to evaluate JavaScript in a WebPage
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-05 16:18 PDT by Alex Christensen
Modified: 2020-10-06 14:39 PDT (History)
10 users (show)

See Also:


Attachments
Patch (21.35 KB, patch)
2020-10-05 16:19 PDT, Alex Christensen
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (22.63 KB, patch)
2020-10-05 16:39 PDT, Alex Christensen
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (23.93 KB, patch)
2020-10-05 16:57 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (24.48 KB, patch)
2020-10-05 18:41 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (25.72 KB, patch)
2020-10-05 21:43 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (26.06 KB, patch)
2020-10-06 12:47 PDT, Alex Christensen
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (27.55 KB, patch)
2020-10-06 13:02 PDT, Alex Christensen
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (27.55 KB, patch)
2020-10-06 13:07 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (26.54 KB, patch)
2020-10-06 13:31 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>