]> git.kaiwu.me - quickjs.git/commitdiff
use CreateDataPropertyOrThrow instead of [[Set]] in array constructor (#633)
authorFabrice Bellard <fabrice@bellard.org>
Sat, 28 Nov 2026 09:44:51 +0000 (10:44 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 28 Nov 2026 09:44:51 +0000 (10:44 +0100)
quickjs.c

index 60b19378134a273067c4d20a3e7b1d82f39ebbfd..b39add08e8c947488dbffab0c18e073993676d1c 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -43182,7 +43182,7 @@ static JSValue js_array_constructor(JSContext *ctx, JSValueConst new_target,
             goto fail;
     } else {
         for(i = 0; i < argc; i++) {
-            if (JS_SetPropertyUint32(ctx, obj, i, JS_DupValue(ctx, argv[i])) < 0)
+            if (JS_CreateDataPropertyUint32(ctx, obj, i, JS_DupValue(ctx, argv[i]), JS_PROP_THROW) < 0)
                 goto fail;
         }
     }