diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/ArrayBuffer/prototype/transfer/new-length-excessive.js')
-rw-r--r-- | js/src/tests/test262/built-ins/ArrayBuffer/prototype/transfer/new-length-excessive.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/ArrayBuffer/prototype/transfer/new-length-excessive.js b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/transfer/new-length-excessive.js new file mode 100644 index 0000000000..d7debd55bf --- /dev/null +++ b/js/src/tests/test262/built-ins/ArrayBuffer/prototype/transfer/new-length-excessive.js @@ -0,0 +1,18 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-arraybuffer.prototype.transfer +description: > + Throws a RangeError if the newLength is larger than 2^53 - 1 due to clamping + in ToIndex. +features: [arraybuffer-transfer] +---*/ + +var ab = new ArrayBuffer(0); + +assert.throws(RangeError, function() { + // Math.pow(2, 53) = 9007199254740992 + ab.transfer(9007199254740992); +}); + +reportCompare(0, 0); |