tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

excessive-byteoffset-throws.js (709B)


      1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-dataview-buffer-byteoffset-bytelength
      6 description: >
      7  Throws a RangeError if offset > bufferByteLength
      8 info: |
      9  24.2.2.1 DataView (buffer, byteOffset, byteLength )
     10 
     11  ...
     12  8. Let bufferByteLength be the value of buffer's [[ArrayBufferByteLength]]
     13  internal slot.
     14  9. If offset > bufferByteLength, throw a RangeError exception.
     15  ...
     16 ---*/
     17 
     18 var ab = new ArrayBuffer(1);
     19 
     20 assert.throws(RangeError, function() {
     21  new DataView(ab, 2);
     22 }, "2");
     23 
     24 assert.throws(RangeError, function() {
     25  new DataView(ab, Infinity);
     26 }, "Infinity");
     27 
     28 reportCompare(0, 0);