tor-browser

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

use-internal-slots.js (976B)


      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-comparetemporaltime
      7 description: compare() ignores the observable properties and uses internal slots
      8 features: [Temporal]
      9 ---*/
     10 
     11 function CustomError() {}
     12 
     13 class AvoidGettersTime extends Temporal.PlainTime {
     14  get hour() {
     15    throw new CustomError();
     16  }
     17  get minute() {
     18    throw new CustomError();
     19  }
     20  get second() {
     21    throw new CustomError();
     22  }
     23  get millisecond() {
     24    throw new CustomError();
     25  }
     26  get microsecond() {
     27    throw new CustomError();
     28  }
     29  get nanosecond() {
     30    throw new CustomError();
     31  }
     32 }
     33 
     34 const one = new AvoidGettersTime(12, 34, 56, 987, 654, 321);
     35 const two = new AvoidGettersTime(6, 54, 32, 123, 456, 789);
     36 assert.sameValue(Temporal.PlainTime.compare(one, two), 1);
     37 
     38 reportCompare(0, 0);