Backed out 2 changesets (bug 1888310, bug 1884625) for causing failures on browser_ap...
[gecko.git] / js / src / tests / test262 / built-ins / Temporal / PlainDate / prototype / dayOfYear / builtin-calendar-no-observable-calls.js
blobb07a147c44ab5c42698cc0cfd755adc2be2bcd65
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2023 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
5 /*---
6 esid: sec-temporal.plaindate.prototype.dayofyear
7 description: >
8   Calling the method on an instance constructed with a builtin calendar causes
9   no observable lookups or calls to calendar methods.
10 includes: [temporalHelpers.js]
11 features: [Temporal]
12 ---*/
14 const dayOfYearOriginal = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "dayOfYear");
15 Object.defineProperty(Temporal.Calendar.prototype, "dayOfYear", {
16   configurable: true,
17   enumerable: false,
18   get() {
19     TemporalHelpers.assertUnreachable("dayOfYear should not be looked up");
20   },
21 });
23 const instance = new Temporal.PlainDate(2000, 5, 2, "iso8601");
24 instance.dayOfYear;
26 Object.defineProperty(Temporal.Calendar.prototype, "dayOfYear", dayOfYearOriginal);
28 reportCompare(0, 0);