tor-browser

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

use-internal-slots.js (776B)


      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-compareisodate
      7 description: compare() ignores the observable properties and uses internal slots
      8 features: [Temporal]
      9 ---*/
     10 
     11 function CustomError() {}
     12 
     13 class AvoidGettersDate extends Temporal.PlainDate {
     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 }
     24 
     25 const one = new AvoidGettersDate(2000, 5, 2);
     26 const two = new AvoidGettersDate(2006, 3, 25);
     27 assert.sameValue(Temporal.PlainDate.compare(one, two), -1);
     28 
     29 reportCompare(0, 0);