summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/ArrayBuffer/prototype/transfer/new-length-excessive.js
blob: d7debd55bf5e2055d7cc598369ff7510a8ee9d61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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);