tor-browser

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

argument-object-tostring.js (710B)


      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.from
      7 description: Object is converted to a string, then to Temporal.Instant
      8 features: [Temporal]
      9 ---*/
     10 
     11 const arg = {};
     12 assert.throws(RangeError, () => Temporal.Instant.from(arg), "[object Object] is not a valid ISO string");
     13 
     14 arg.toString = function() {
     15  return "1970-01-01T00:00Z";
     16 };
     17 const result = Temporal.Instant.from(arg);
     18 assert.sameValue(result.epochNanoseconds, 0n, "result of toString is interpreted as ISO string");
     19 
     20 reportCompare(0, 0);