Skip to content

QuickJS support for fetch(). #908

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

Merged
merged 3 commits into from
May 8, 2025
Merged

Conversation

hongzhidao
Copy link
Contributor

No description provided.

@hongzhidao hongzhidao requested review from xeioex and Copilot May 8, 2025 03:07
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces QuickJS support for the fetch() API by adding new helper functions and modules, updating test cases, and modifying build configurations.

  • Added a new qjs_array_length helper and a fetch function (ngx_qjs_ext_fetch) in the QuickJS module.
  • Removed skip_all conditions from various fetch-related tests to enable them.
  • Updated module registration and build files to incorporate the new fetch support.

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/qjs.h / src/qjs.c Added and implemented qjs_array_length for array length retrieval.
nginx/t/*.t Removed skip_all conditions and added test cases for fetch methods.
nginx/ngx_stream_js_module.c Registered the new fetch module.
nginx/ngx_js.h / nginx/ngx_js.c Declared and defined the fetch function and a new string conversion helper.
nginx/ngx_http_js_module.c Conditionally registered the fetch module.
nginx/config Updated dependency and source lists to include fetch-related files.
nginx/ngx_js_http.h Introduced new HTTP helper definitions for JS integration.
Comments suppressed due to low confidence (2)

nginx/t/js_fetch_objects.t:273

  • Consider adding a comment explaining why both error message prefixes ('Cannot assign to read-only p' and 'no setter for property') are checked, to clarify the rationale behind this condition.
if (!e.message.startsWith('Cannot assign to read-only p') {

nginx/ngx_js.c:2288

  • [nitpick] The function name 'ngx_js_ngx_string' is somewhat ambiguous; consider renaming it to something like 'ngx_js_to_ngx_string' to clearly indicate that it converts an njs_str_t to an ngx_str_t.
ngx_int_t ngx_js_ngx_string(njs_vm_t *vm, njs_value_t *value, ngx_str_t *str)

@hongzhidao hongzhidao force-pushed the qjs-fetch branch 3 times, most recently from e61a198 to bea18db Compare May 8, 2025 04:34
Copy link
Contributor

@xeioex xeioex left a comment

Choose a reason for hiding this comment

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

Otherwise looks good.

@hongzhidao hongzhidao force-pushed the qjs-fetch branch 3 times, most recently from ce67f5d to f6e7a7b Compare May 8, 2025 16:08
@xeioex xeioex self-requested a review May 8, 2025 16:14
Copy link
Contributor

@xeioex xeioex left a comment

Choose a reason for hiding this comment

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

Looks good.

@hongzhidao hongzhidao merged commit b7f76b7 into nginx:master May 8, 2025
1 check passed
@hongzhidao
Copy link
Contributor Author

Thanks Dmitry.

@xeioex xeioex added this to the 0.9.1 milestone May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy