tor-browser

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

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


      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.duration.prototype.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 oneProperty = {
     14  hours: 1,
     15 };
     16 const allProperties = {
     17  years: 0,
     18  months: 0,
     19  weeks: 0,
     20  days: 0,
     21  hours: 1,
     22  minutes: 0,
     23  seconds: 0,
     24  milliseconds: 0,
     25  microseconds: 0,
     26  nanoseconds: 0,
     27 };
     28 const resultWithout = Temporal.Duration.compare(oneProperty, oneProperty);
     29 const resultWith = Temporal.Duration.compare(allProperties, allProperties);
     30 assert.sameValue(resultWithout, resultWith, "results should be the same with and without optional properties");
     31 
     32 reportCompare(0, 0);