diff --git a/quickjs.c b/quickjs.c index 5e9e1a1d0..2458fb7e4 100644 --- a/quickjs.c +++ b/quickjs.c @@ -54814,7 +54814,6 @@ static JSValue js_typed_array_indexOf(JSContext *ctx, JSValueConst this_val, double d; float f; uint16_t hf; - bool oob; p = get_typed_array(ctx, this_val); if (!p) @@ -54826,7 +54825,6 @@ static JSValue js_typed_array_indexOf(JSContext *ctx, JSValueConst this_val, if (len == 0) goto done; - oob = false; if (special == special_lastIndexOf) { k = len - 1; if (argc > 1) { @@ -54860,7 +54858,6 @@ static JSValue js_typed_array_indexOf(JSContext *ctx, JSValueConst this_val, k = 0; } else if (k > len) { k = len; - oob = true; } } stop = len; @@ -54871,8 +54868,10 @@ static JSValue js_typed_array_indexOf(JSContext *ctx, JSValueConst this_val, exception is raised) */ if (typed_array_is_oob(p) || len > p->u.array.count) { /* "includes" scans all the properties, so "undefined" can match */ - if (special == special_includes && JS_IsUndefined(argv[0]) && len > 0) - res = oob ? -1 : 0; + if (special == special_includes) + if (JS_IsUndefined(argv[0])) + if (k < typed_array_get_length(ctx, p)) + res = 0; goto done; } diff --git a/test262_errors.txt b/test262_errors.txt index 51bb177a9..c7b42098c 100644 --- a/test262_errors.txt +++ b/test262_errors.txt @@ -40,8 +40,6 @@ test262/test/built-ins/String/prototype/search/regexp-prototype-search-v-flag.js test262/test/built-ins/String/prototype/search/regexp-prototype-search-v-flag.js:9: strict mode: Test262Error: Unicode property escapes with v flag Expected SameValue(«-1», «0») to be true test262/test/built-ins/String/prototype/search/regexp-prototype-search-v-u-flag.js:9: Test262Error: Unicode property escapes with v flag Expected SameValue(«-1», «0») to be true test262/test/built-ins/String/prototype/search/regexp-prototype-search-v-u-flag.js:9: strict mode: Test262Error: Unicode property escapes with v flag Expected SameValue(«-1», «0») to be true -test262/test/built-ins/TypedArray/prototype/includes/search-undefined-after-shrinking-buffer-index-is-oob.js:23: Test262Error: Expected SameValue(«true», «false») to be true (Testing with Float64Array.) -test262/test/built-ins/TypedArray/prototype/includes/search-undefined-after-shrinking-buffer-index-is-oob.js:23: strict mode: Test262Error: Expected SameValue(«true», «false») to be true (Testing with Float64Array.) test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-canonical-invalid-index-prototype-chain-set.js:35: Test262Error: value should not be coerced Expected SameValue(«22», «0») to be true test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-canonical-invalid-index-prototype-chain-set.js:35: strict mode: Test262Error: value should not be coerced Expected SameValue(«22», «0») to be true test262/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-canonical-invalid-index-reflect-set.js:35: Test262Error: value should not be coerced Expected SameValue(«32», «0») to be true