This is an automated email from the ASF dual-hosted git repository. vatamane pushed a commit to branch fix-recent-quickjs-regressions in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 0cfbe4298e70e70d6c401dcc6cd0fee4d51d4e82 Author: Nick Vatamaniuc <[email protected]> AuthorDate: Wed Nov 5 13:22:55 2025 -0500 Fix a few regressions recent updates * Fix exception handling in `put_var` operation https://github.com/bellard/quickjs/commit/d10613f8f93c6d8f7eefbeb955ea75eb4a51ef95 * Fix `JS_PROP_AUTOINIT` handling in `js_closure_define_global_var()` https://github.com/bellard/quickjs/commit/b07ad11c313225b74bcc121068325b0bd28b7736 * Restore a mistakenly removed goto on error in `js_build_module_ns()` https://github.com/bellard/quickjs/commit/9688007ccbba2024b339ddcd52044b23e2a4d982 --- src/couch_quickjs/patches/01-spidermonkey-185-mode.patch | 6 +++--- src/couch_quickjs/patches/02-test262-errors.patch | 4 ++-- src/couch_quickjs/quickjs/quickjs.c | 11 +++++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/couch_quickjs/patches/01-spidermonkey-185-mode.patch b/src/couch_quickjs/patches/01-spidermonkey-185-mode.patch index 46f6cd831..f50c02bf9 100644 --- a/src/couch_quickjs/patches/01-spidermonkey-185-mode.patch +++ b/src/couch_quickjs/patches/01-spidermonkey-185-mode.patch @@ -1,6 +1,6 @@ ---- quickjs-master/quickjs.c 2025-11-03 12:53:32 -+++ quickjs/quickjs.c 2025-11-03 16:58:35 -@@ -31279,10 +31279,24 @@ +--- quickjs-master/quickjs.c 2025-11-05 05:46:20 ++++ quickjs/quickjs.c 2025-11-05 09:54:50 +@@ -31286,10 +31286,24 @@ if (s->token.val == TOK_FUNCTION || (token_is_pseudo_keyword(s, JS_ATOM_async) && peek_token(s, TRUE) == TOK_FUNCTION)) { diff --git a/src/couch_quickjs/patches/02-test262-errors.patch b/src/couch_quickjs/patches/02-test262-errors.patch index ac8106bda..267bcb6c8 100644 --- a/src/couch_quickjs/patches/02-test262-errors.patch +++ b/src/couch_quickjs/patches/02-test262-errors.patch @@ -1,5 +1,5 @@ ---- quickjs-master/test262_errors.txt 2025-11-03 12:53:32 -+++ quickjs/test262_errors.txt 2025-11-03 16:58:35 +--- quickjs-master/test262_errors.txt 2025-11-05 05:46:20 ++++ quickjs/test262_errors.txt 2025-11-05 09:54:50 @@ -19,6 +19,8 @@ test262/test/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js:24: Test262Error: #1: innerX === 2. Actual: 5 test262/test/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js:24: Test262Error: #1: innerX === 2. Actual: 5 diff --git a/src/couch_quickjs/quickjs/quickjs.c b/src/couch_quickjs/quickjs/quickjs.c index c7657971d..07ddb6aa1 100644 --- a/src/couch_quickjs/quickjs/quickjs.c +++ b/src/couch_quickjs/quickjs/quickjs.c @@ -16673,9 +16673,14 @@ static JSVarRef *js_closure_define_global_var(JSContext *ctx, JSClosureVar *cv, if (is_direct_or_indirect_eval) flags |= JS_PROP_CONFIGURABLE; + retry: prs = find_own_property(&pr, p, cv->var_name); if (prs) { - if ((prs->flags & JS_PROP_TMASK) != JS_PROP_VARREF) { + if (unlikely((prs->flags & JS_PROP_TMASK) == JS_PROP_AUTOINIT)) { + if (JS_AutoInitProperty(ctx, p, cv->var_name, pr, prs)) + return NULL; + goto retry; + } else if ((prs->flags & JS_PROP_TMASK) != JS_PROP_VARREF) { var_ref = js_global_object_get_uninitialized_var(ctx, p, cv->var_name); if (!var_ref) return NULL; @@ -18011,14 +18016,15 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj, } ret = JS_SetPropertyInternal(ctx, ctx->global_obj, cv->var_name, sp[-1], ctx->global_obj, JS_PROP_THROW_STRICT); + sp--; if (ret < 0) goto exception; } } else { put_var_ok: set_value(ctx, var_ref->pvalue, sp[-1]); + sp--; } - sp--; } BREAK; CASE(OP_get_loc): @@ -29729,6 +29735,7 @@ static JSValue js_build_module_ns(JSContext *ctx, JSModuleDef *m) en->export_name, JS_AUTOINIT_ID_MODULE_NS, m, JS_PROP_ENUMERABLE | JS_PROP_WRITABLE) < 0) + goto fail; break; default: break;
