tor-browser

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

zero-length.js (911B)


      1 // |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally
      2 // Copyright (C) 2015 André Bargull. 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-sharedarraybuffer-length
      8 description: >
      9  The `length` parameter can be zero.
     10 info: |
     11  SharedArrayBuffer( length )
     12 
     13  ...
     14  2. Let numberLength be ToNumber(length).
     15  3. Let byteLength be ToLength(numberLength).
     16  4. ReturnIfAbrupt(byteLength).
     17  5. If SameValueZero(numberLength, byteLength) is false, throw a RangeError exception.
     18  ...
     19 features: [SharedArrayBuffer]
     20 ---*/
     21 
     22 var positiveZero = new SharedArrayBuffer(+0);
     23 assert.sameValue(positiveZero.byteLength, 0);
     24 
     25 var negativeZero = new SharedArrayBuffer(-0);
     26 assert.sameValue(negativeZero.byteLength, 0);
     27 
     28 reportCompare(0, 0);