tor-browser

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

excessive-byteoffset-throws-sab.js (925B)


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