tor-browser

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

limits.js (1107B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2024 André Bargull. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-temporal.zoneddatetime
      7 description: >
      8  RangeError thrown when epoch nanoseconds not valid.
      9 info: |
     10  Temporal.ZonedDateTime ( epochNanoseconds, timeZone [ , calendar ] )
     11 
     12  2. Set epochNanoseconds to ? ToBigInt(epochNanoseconds).
     13  3. If IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception.
     14  ...
     15 features: [Temporal]
     16 ---*/
     17 
     18 var nsMaxInstant = 864n * 10n ** 19n;
     19 var nsMinInstant = -nsMaxInstant;
     20 
     21 var invalidEpochNanoseconds = [
     22  nsMaxInstant + 1n,
     23  nsMinInstant - 1n,
     24  2n ** 128n,
     25  -(2n ** 128n),
     26 ];
     27 
     28 var timeZones = [
     29  "UTC",
     30  "+00",
     31  "+01",
     32  "-01",
     33 ];
     34 
     35 for (var timeZone of timeZones) {
     36  for (var epochNs of invalidEpochNanoseconds) {
     37    assert.throws(
     38      RangeError,
     39      () => new Temporal.ZonedDateTime(epochNs, timeZone),
     40      `epochNs = ${epochNs}, timeZone = ${timeZone}`
     41    );
     42  }
     43 }
     44 
     45 reportCompare(0, 0);