tor-browser

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

argument-string-critical-unknown-annotation.js (1058B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2022 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.instant.compare
      7 description: Unknown annotations with critical flag are rejected
      8 features: [Temporal]
      9 ---*/
     10 
     11 const invalidStrings = [
     12  "1970-01-01T00:00Z[!foo=bar]",
     13  "1970-01-01T00:00Z[UTC][!foo=bar]",
     14  "1970-01-01T00:00Z[u-ca=iso8601][!foo=bar]",
     15  "1970-01-01T00:00Z[UTC][!foo=bar][u-ca=iso8601]",
     16  "1970-01-01T00:00Z[foo=bar][!_foo-bar0=Dont-Ignore-This-99999999999]",
     17 ];
     18 
     19 const epoch = new Temporal.Instant(0n);
     20 
     21 invalidStrings.forEach((arg) => {
     22  assert.throws(
     23    RangeError,
     24    () => Temporal.Instant.compare(arg, epoch),
     25    `reject unknown annotation with critical flag: ${arg} (first argument)`
     26  );
     27  assert.throws(
     28    RangeError,
     29    () => Temporal.Instant.compare(epoch, arg),
     30    `reject unknown annotation with critical flag: ${arg} (second argument)`
     31  );
     32 });
     33 
     34 reportCompare(0, 0);