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

[fetch] Implement the Response.json static method #10593

Conversation

andreubotella
Copy link
Contributor

@andreubotella andreubotella commented Feb 23, 2023

206817f

[fetch] Implement the `Response.json` static method
https://bugs.webkit.org/show_bug.cgi?id=240375

Reviewed by Youenn Fablet.

This implements the `Response.json` static method, added to the fetch
spec in whatwg/fetch#1392

* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-json.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-json.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-json.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-json.any.worker-expected.txt:
* Source/WebCore/Modules/fetch/FetchBody.h:
* Source/WebCore/Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::create):
  Added this method overload to implement the spec's "initialize a
  response" algorithm. This algortihm used to be combined with the
  regular Response creation algorithm which extracts the body, but
  Response.json cannot use that directly.
(WebCore::FetchResponse::staticJson):
* Source/WebCore/Modules/fetch/FetchResponse.h:
* Source/WebCore/Modules/fetch/FetchResponse.idl:

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

5fcd50d

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🛠 gtk
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🧪 gtk-wk2
✅ 🛠 tv ✅ 🧪 mac-wk2 ✅ 🧪 api-gtk
✅ 🛠 tv-sim ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 watch ✅ 🧪 mac-wk2-stress
✅ 🛠 🧪 merge ✅ 🛠 watch-sim

@andreubotella
Copy link
Contributor Author

This PR depends on #10087.

@andreubotella andreubotella force-pushed the eng/Implement-Response-json-static-method branch from c0fcbca to 5a5f252 Compare February 27, 2023 15:37
@andreubotella andreubotella force-pushed the eng/Implement-Response-json-static-method branch from 5a5f252 to 7be7abb Compare February 28, 2023 21:13
@Ahmad-S792 Ahmad-S792 added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Mar 10, 2023
@andreubotella
Copy link
Contributor Author

@youennf PTAL

@andreubotella
Copy link
Contributor Author

@youennf @cdumez ping

Copy link
Contributor

@youennf youennf left a comment

Choose a reason for hiding this comment

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

This looks ok to me.
A few potential improvements below.

Source/WebCore/Modules/fetch/FetchResponse.cpp Outdated Show resolved Hide resolved
Source/WebCore/Modules/fetch/FetchResponse.cpp Outdated Show resolved Hide resolved
Source/WebCore/Modules/fetch/FetchResponse.idl Outdated Show resolved Hide resolved
@andreubotella andreubotella force-pushed the eng/Implement-Response-json-static-method branch from c3b304e to 89f0f0a Compare March 20, 2023 16:07
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 20, 2023
@andreubotella andreubotella force-pushed the eng/Implement-Response-json-static-method branch from 89f0f0a to 5fcd50d Compare March 21, 2023 08:53
@andreubotella andreubotella requested review from youennf and removed request for cdumez March 22, 2023 11:40
@andreubotella
Copy link
Contributor Author

@youennf Could you merge this PR?

@youennf youennf added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Mar 22, 2023
https://bugs.webkit.org/show_bug.cgi?id=240375

Reviewed by Youenn Fablet.

This implements the `Response.json` static method, added to the fetch
spec in whatwg/fetch#1392.

* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-json.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-json.any.serviceworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-json.any.sharedworker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/fetch/api/response/response-static-json.any.worker-expected.txt:
* Source/WebCore/Modules/fetch/FetchBody.h:
* Source/WebCore/Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::create):
  Added this method overload to implement the spec's "initialize a
  response" algorithm. This algortihm used to be combined with the
  regular Response creation algorithm which extracts the body, but
  Response.json cannot use that directly.
(WebCore::FetchResponse::staticJson):
* Source/WebCore/Modules/fetch/FetchResponse.h:
* Source/WebCore/Modules/fetch/FetchResponse.idl:

Canonical link: https://commits.webkit.org/261960@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Implement-Response-json-static-method branch from 5fcd50d to 206817f Compare March 22, 2023 13:10
@webkit-commit-queue
Copy link
Collaborator

Committed 261960@main (206817f): https://commits.webkit.org/261960@main

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Bugs Unclassified bugs are placed in this component until the correct component can be determined.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants