]> git.kaiwu.me - quickjs.git/commitdiff
update DataView.prototype.[byteLength|byteOffset] not to throw when the view is out...
authorFabrice Bellard <fabrice@bellard.org>
Sat, 31 Oct 2026 17:44:04 +0000 (18:44 +0100)
committerFabrice Bellard <fabrice@bellard.org>
Sat, 31 Oct 2026 17:44:04 +0000 (18:44 +0100)
quickjs.c

index 54eae1df96c530a08dc9da09df58e30e9cd78bfe..a824b57156e4c10f309a7b2dc0faa0e00bbea8b5 100644 (file)
--- a/quickjs.c
+++ b/quickjs.c
@@ -63966,7 +63966,7 @@ static JSValue js_dataview_get_byteLength(JSContext *ctx, JSValueConst this_val)
     if (!p)
         return JS_EXCEPTION;
     if (dataview_is_oob(p))
-        return JS_ThrowTypeErrorArrayBufferOOB(ctx);
+        return JS_NewInt32(ctx, 0);
     ta = p->u.typed_array;
     if (ta->track_rab) {
         abuf = ta->buffer->u.array_buffer;
@@ -63984,7 +63984,7 @@ static JSValue js_dataview_get_byteOffset(JSContext *ctx, JSValueConst this_val)
     if (!p)
         return JS_EXCEPTION;
     if (dataview_is_oob(p))
-        return JS_ThrowTypeErrorArrayBufferOOB(ctx);
+        return JS_NewInt32(ctx, 0);
     ta = p->u.typed_array;
     return JS_NewUint32(ctx, ta->offset);
 }