tor-browser

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

use-internal-slots.js (1165B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2020 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-compareisodatetime
      7 description: compare() ignores the observable properties and uses internal slots
      8 features: [Temporal]
      9 ---*/
     10 
     11 function CustomError() {}
     12 
     13 class AvoidGettersDateTime extends Temporal.PlainDateTime {
     14  get year() {
     15    throw new CustomError();
     16  }
     17  get month() {
     18    throw new CustomError();
     19  }
     20  get day() {
     21    throw new CustomError();
     22  }
     23  get hour() {
     24    throw new CustomError();
     25  }
     26  get minute() {
     27    throw new CustomError();
     28  }
     29  get second() {
     30    throw new CustomError();
     31  }
     32  get millisecond() {
     33    throw new CustomError();
     34  }
     35  get microsecond() {
     36    throw new CustomError();
     37  }
     38  get nanosecond() {
     39    throw new CustomError();
     40  }
     41 }
     42 
     43 const one = new AvoidGettersDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321);
     44 const two = new AvoidGettersDateTime(2006, 3, 25, 6, 54, 32, 123, 456, 789);
     45 assert.sameValue(Temporal.PlainDateTime.compare(one, two), -1);
     46 
     47 reportCompare(0, 0);