tor-browser

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

argument-propertybag-optional-properties.js (1010B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2025 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.plaindatetime.compare
      7 description: >
      8  A property bag missing optional properties is equivalent to a property bag
      9  with all the optional properties having their default values
     10 features: [Temporal]
     11 ---*/
     12 
     13 const minimumProperties = {
     14  year: 2021,
     15  month: 10,
     16  day: 28,
     17 };
     18 const allProperties = {
     19  year: 2021,
     20  month: 10,
     21  day: 28,
     22  hour: 0,
     23  minute: 0,
     24  second: 0,
     25  millisecond: 0,
     26  microsecond: 0,
     27  nanosecond: 0,
     28  calendar: "iso8601",
     29 };
     30 const resultWithout = Temporal.PlainDateTime.compare(minimumProperties, minimumProperties);
     31 const resultWith = Temporal.PlainDateTime.compare(allProperties, allProperties);
     32 assert.sameValue(resultWithout, resultWith, "results should be the same with and without optional properties");
     33 
     34 reportCompare(0, 0);