tor-browser

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

non-integer-throws-rangeerror.js (768B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2021 Igalia, S.L. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-temporal.duration.prototype.with
      7 description: A non-integer value for any recognized property in the property bag, throws a RangeError
      8 features: [Temporal]
      9 ---*/
     10 
     11 const fields = [
     12  "years",
     13  "months",
     14  "weeks",
     15  "days",
     16  "hours",
     17  "minutes",
     18  "seconds",
     19  "milliseconds",
     20  "microseconds",
     21  "nanoseconds",
     22 ];
     23 fields.forEach((field) => {
     24  assert.throws(RangeError, () => Temporal.Duration.from({ [field]: 1.5 }));
     25  assert.throws(RangeError, () => Temporal.Duration.from({ [field]: -1.5 }));
     26 });
     27 
     28 reportCompare(0, 0);