Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLib] New API to get the request body of WebKitURISchemeRequest #10714

Merged
merged 1 commit into from Feb 28, 2023

Conversation

wusyong
Copy link

@wusyong wusyong commented Feb 27, 2023

5fe923a

[GLib] New API to get the request body of WebKitURISchemeRequest
https://bugs.webkit.org/show_bug.cgi?id=252564

Reviewed by Carlos Garcia Campos, Michael Catanzaro and Adrian Perez de Castro.

* Source/WebCore/platform/network/soup/ResourceRequest.h:
* Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::createInputStream const): Added new function
API
* Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.h.in:
* Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp:
(webkit_uri_scheme_request_get_http_body): Added new function API
* Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp:
(testWebContextURIScheme): Expanded 'post' URI scheme to test
webkit_uri_scheme_request_get_http_body

Canonical link: https://commits.webkit.org/260949@main

1d216ea

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ›  gtk
βœ… πŸ§ͺ webkitperl   πŸ§ͺ ios-wk2   πŸ§ͺ api-mac   πŸ§ͺ gtk-wk2
  πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk1   πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  tv-sim   πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-wk2-stress
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch-sim

@wusyong wusyong requested a review from a team as a code owner February 27, 2023 06:52
Copy link
Contributor

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch @wusyong, this looks neat πŸ—οΈ

We have just branched for 2.40 recently, but IMO this is quite nice to have and should be fine to add into the release branch if @carlosgcampos or @mcatanzaro agreeβ€”the patch is self-contained, only adds one public method, and comes with a test. WDYT?

(As with any API change, we need a second approval before landing, so let's wait and see what the other reviewers think.)

@aperezdc
Copy link
Contributor

@wusyong I have changed the Bugzilla issue title to β€œ[GLib] New API to get the request body of WebKitURISchemeRequest” because to better reflect what the feature is about, and also because it also bring the new API to the WPE port (GLib = GTK + WPE). Could you change the first line of the commit log accordingly? Thanks! πŸ™πŸΌ

@wusyong wusyong changed the title [GTK] Get the HTTP body of WebKitURISchemeRequest [GLib] Get the HTTP body of WebKitURISchemeRequest Feb 27, 2023
@wusyong wusyong changed the title [GLib] Get the HTTP body of WebKitURISchemeRequest [GLib] New API to get the request body of WebKitURISchemeRequest Feb 27, 2023
@aperezdc aperezdc added WebKit API For issues and bugs in the Web Kit public embedding APIs WebKitGTK Bugs related to the Gtk API layer. WPE WebKit WebKit WPE component labels Feb 27, 2023
@carlosgcampos
Copy link
Contributor

Looks good to me, but I wonder if it would be easier to expose the body as a GBytes instead. In this case, the body is always serialized over IPC, so it fits in memory, and it's not expected to be processed as a stream, I guess.

Copy link
Contributor

@mcatanzaro mcatanzaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

@mcatanzaro
Copy link
Contributor

Looks good to me, but I wonder if it would be easier to expose the body as a GBytes instead. In this case, the body is always serialized over IPC, so it fits in memory, and it's not expected to be processed as a stream, I guess.

GBytes is fine. Or simply unsigned char * or uint8_t *.

@wusyong
Copy link
Author

wusyong commented Feb 27, 2023

I'll stick to GBytes since many APIs also return this type for bytes. I've updated the return type to GBytes. Please let me know if I missed anything.

Copy link
Contributor

@mcatanzaro mcatanzaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way: it's very unusual for your first contribution to be new public API, so congrats on that. This is simple, adequately tested, and looks good.

@mcatanzaro
Copy link
Contributor

One last thing: please squash your two commits into one. We can't land pull requests with multiple commits for WebKit-specific reasons. So please fix that, and make the one-line change that I proposed above, and then this is good to go. And we'll backport to 2.40 as well so you can use it sooner rather than later.

@aperezdc aperezdc added the merge-queue Applied to send a pull request to merge-queue label Feb 28, 2023
@mcatanzaro mcatanzaro removed the merge-queue Applied to send a pull request to merge-queue label Feb 28, 2023
@mcatanzaro mcatanzaro added the merge-queue Applied to send a pull request to merge-queue label Feb 28, 2023
https://bugs.webkit.org/show_bug.cgi?id=252564

Reviewed by Carlos Garcia Campos, Michael Catanzaro and Adrian Perez de Castro.

* Source/WebCore/platform/network/soup/ResourceRequest.h:
* Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::createInputStream const): Added new function
API
* Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.h.in:
* Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp:
(webkit_uri_scheme_request_get_http_body): Added new function API
* Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp:
(testWebContextURIScheme): Expanded 'post' URI scheme to test
webkit_uri_scheme_request_get_http_body

Canonical link: https://commits.webkit.org/260949@main
@webkit-commit-queue
Copy link
Collaborator

Committed 260949@main (5fe923a): https://commits.webkit.org/260949@main

Reviewed commits have been landed. Closing PR #10714 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 5fe923a into WebKit:main Feb 28, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 28, 2023
@wusyong wusyong deleted the request branch March 1, 2023 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit API For issues and bugs in the Web Kit public embedding APIs WebKitGTK Bugs related to the Gtk API layer. WPE WebKit WebKit WPE component
Projects
None yet
6 participants