Index: test/mjsunit/regress/regress-4665.js |
diff --git a/test/mjsunit/regress/regress-4665.js b/test/mjsunit/regress/regress-4665.js |
index a75d68f105633322f9c9c8151dcf4a093e7bbff2..9aed4ed0ce44e453e47a2d0cdc30c11ae7171f9b 100644 |
--- a/test/mjsunit/regress/regress-4665.js |
+++ b/test/mjsunit/regress/regress-4665.js |
@@ -11,12 +11,14 @@ FirstBuffer.__proto__ = Uint8Array |
var buf = new Uint8Array(10) |
buf.__proto__ = FirstBuffer.prototype |
-var buf2 = buf.subarray(2) |
-assertEquals(8, buf2.length); |
+assertThrows(() => buf.subarray(2), TypeError); |
// Second test case |
+let seen_args = []; |
+ |
function SecondBuffer (arg) { |
+ seen_args.push(arg); |
var arr = new Uint8Array(arg) |
arr.__proto__ = SecondBuffer.prototype |
return arr |
@@ -25,7 +27,9 @@ SecondBuffer.prototype.__proto__ = Uint8Array.prototype |
SecondBuffer.__proto__ = Uint8Array |
var buf3 = new SecondBuffer(10) |
+assertEquals([10], seen_args); |
var buf4 = buf3.subarray(2) |
-assertEquals(8, buf4.length); |
+assertEquals(10, buf4.length); |
+assertEquals([10, buf3.buffer], seen_args); |