diff --git a/quickjs.c b/quickjs.c index a6936f6..9e15792 100644 --- a/quickjs.c +++ b/quickjs.c @@ -51982,6 +51982,8 @@ static JSValue js_array_buffer_resize(JSContext *ctx, JSValue this_val, abuf = JS_GetOpaque2(ctx, this_val, class_id); if (!abuf) return JS_EXCEPTION; + if (JS_ToInt64(ctx, &len, argv[0])) + return JS_EXCEPTION; if (abuf->detached) return JS_ThrowTypeErrorDetachedArrayBuffer(ctx); if (!array_buffer_is_resizable(abuf)) @@ -51989,8 +51991,6 @@ static JSValue js_array_buffer_resize(JSContext *ctx, JSValue this_val, // TODO(bnoordhuis) support externally managed RABs if (abuf->free_func != js_array_buffer_free) return JS_ThrowTypeError(ctx, "external array buffer is not resizable"); - if (JS_ToInt64(ctx, &len, argv[0])) - return JS_EXCEPTION; if (len < 0 || len > abuf->max_byte_length) { bad_length: return JS_ThrowRangeError(ctx, "invalid array buffer length"); diff --git a/test262_errors.txt b/test262_errors.txt index d4da2a6..17a8c86 100644 --- a/test262_errors.txt +++ b/test262_errors.txt @@ -1,5 +1,3 @@ -test262/test/built-ins/ArrayBuffer/prototype/resize/coerced-new-length-detach.js:15: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all -test262/test/built-ins/ArrayBuffer/prototype/resize/coerced-new-length-detach.js:15: strict mode: Test262Error: Expected a TypeError to be thrown but no exception was thrown at all test262/test/built-ins/AsyncFromSyncIteratorPrototype/next/iterator-result-poisoned-wrapper.js:64: TypeError: $DONE() not called test262/test/built-ins/AsyncFromSyncIteratorPrototype/next/iterator-result-poisoned-wrapper.js:64: strict mode: TypeError: $DONE() not called test262/test/built-ins/AsyncFromSyncIteratorPrototype/next/next-result-poisoned-wrapper.js:69: TypeError: $DONE() not called