]> git.kaiwu.me - quickjs.git/commitdiff
Symbol.species is no longer used in TypedArray constructor from a TypedArray
authorFabrice Bellard <fabrice@bellard.org>
Sat, 9 Dec 2023 11:32:00 +0000 (12:32 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 9 Dec 2023 11:32:00 +0000 (12:32 +0100)
quickjs.c
test262_errors.txt

index 0d1cff3631523be9103bdab28cf75c223ccc932c..e0ce6349cad2a55a20afb162d9655abaaaae9e45 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -52777,7 +52777,7 @@ static JSValue js_typed_array_constructor_ta(JSContext *ctx,
 {
     JSObject *p, *src_buffer;
     JSTypedArray *ta;
-    JSValue ctor, obj, buffer;
+    JSValue obj, buffer;
     uint32_t len, i;
     int size_log2;
     JSArrayBuffer *src_abuf, *abuf;
@@ -52794,19 +52794,9 @@ static JSValue js_typed_array_constructor_ta(JSContext *ctx,
     len = p->u.array.count;
     src_buffer = ta->buffer;
     src_abuf = src_buffer->u.array_buffer;
-    if (!src_abuf->shared) {
-        ctor = JS_SpeciesConstructor(ctx, JS_MKPTR(JS_TAG_OBJECT, src_buffer),
-                                     JS_UNDEFINED);
-        if (JS_IsException(ctor))
-            goto fail;
-    } else {
-        /* force ArrayBuffer default constructor */
-        ctor = JS_UNDEFINED;
-    }
     size_log2 = typed_array_size_log2(classid);
-    buffer = js_array_buffer_constructor1(ctx, ctor,
+    buffer = js_array_buffer_constructor1(ctx, JS_UNDEFINED,
                                           (uint64_t)len << size_log2);
-    JS_FreeValue(ctx, ctor);
     if (JS_IsException(buffer))
         goto fail;
     /* necessary because it could have been detached */
index 9822b8ac813747b8aa89b35258f3cfd52b3b768d..9681190675c8981fae0d9712110d8b0f385510dd 100644 (file)
@@ -15,8 +15,6 @@ test262/test/built-ins/String/prototype/localeCompare/15.5.4.9_CE.js:62: Test262
 test262/test/built-ins/String/prototype/localeCompare/15.5.4.9_CE.js:62: strict mode: Test262Error: String.prototype.localeCompare considers ö (\u006f\u0308) ≠ ö (\u00f6).
 test262/test/built-ins/TypedArray/prototype/sort/sort-tonumber.js:30: TypeError: ArrayBuffer is detached (Testing with Float64Array.)
 test262/test/built-ins/TypedArray/prototype/sort/sort-tonumber.js:30: strict mode: TypeError: ArrayBuffer is detached (Testing with Float64Array.)
-test262/test/built-ins/TypedArrayConstructors/ctors/no-species.js:16: Test262Error: unreachable
-test262/test/built-ins/TypedArrayConstructors/ctors/no-species.js:16: strict mode: Test262Error: unreachable
 test262/test/language/expressions/assignment/target-member-computed-reference-null.js:32: Test262Error: Expected a DummyError but got a TypeError
 test262/test/language/expressions/assignment/target-member-computed-reference-null.js:32: strict mode: Test262Error: Expected a DummyError but got a TypeError
 test262/test/language/expressions/assignment/target-member-computed-reference-undefined.js:32: Test262Error: Expected a DummyError but got a TypeError