mirror of https://github.com/tc39/test262.git
Temporal: Add tests for fast path in ToTemporalTimeZone
Normally, a plain object passed into an API that takes a Temporal.TimeZone has its 'timeZone' property checked (observably) with a Has operation followed by a Get operation if the property is present. In the normative change https://github.com/tc39/proposal-temporal/pull/2392 which reached consensus at the September 2022 TC39 meeting, this was changed so that this check is skipped for objects which have the Temporal.TimeZone internal slots. This adds tests to all entry points that pass a user-supplied object to ToTemporalTimeZone, with a "poisoned" timeZone object which has the correct internal slots but a 'timeZone' accessor property whose getter throws. A correct implementation should not cause this getter to throw.
This commit is contained in:
parent
34805283d9
commit
1f59bf5911
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.compare
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to compare() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||
Temporal.Duration.compare(new Temporal.Duration(), new Temporal.Duration(), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.add
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to add() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Duration(1);
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||
instance.add(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.round
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to round() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Duration(1);
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||
instance.round({ largestUnit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.subtract
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to subtract() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Duration(1);
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||
instance.subtract(new Temporal.Duration(1), { relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.duration.prototype.total
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to total() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Duration(1);
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone } });
|
||||
instance.total({ unit: "months", relativeTo: { year: 2000, month: 5, day: 2, timeZone: { timeZone } } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.tostring
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to toString() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.toString({ timeZone });
|
||||
instance.toString({ timeZone: { timeZone } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.tozoneddatetime
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to toZonedDateTime() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.toZonedDateTime({ timeZone, calendar: "iso8601" });
|
||||
instance.toZonedDateTime({ timeZone: { timeZone }, calendar: "iso8601" });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.tozoneddatetimeiso
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to toZonedDateTimeISO() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.Instant(0n);
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.toZonedDateTimeISO(timeZone);
|
||||
instance.toZonedDateTimeISO({ timeZone });
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.plaindate
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to plainDate() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.Now.plainDate("iso8601", timeZone);
|
||||
Temporal.Now.plainDate("iso8601", { timeZone });
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.plaindateiso
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to plainDateISO() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.Now.plainDateISO(timeZone);
|
||||
Temporal.Now.plainDateISO({ timeZone });
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.plaindatetime
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to plainDateTime() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.Now.plainDateTime("iso8601", timeZone);
|
||||
Temporal.Now.plainDateTime("iso8601", { timeZone });
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.plaindatetimeiso
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to plainDateTimeISO() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.Now.plainDateTimeISO(timeZone);
|
||||
Temporal.Now.plainDateTimeISO({ timeZone });
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.plaintimeiso
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to plainTimeISO() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.Now.plainTimeISO(timeZone);
|
||||
Temporal.Now.plainTimeISO({ timeZone });
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.zoneddatetime
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to zonedDateTime() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.Now.zonedDateTime("iso8601", timeZone);
|
||||
Temporal.Now.zonedDateTime("iso8601", { timeZone });
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.zoneddatetimeiso
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to zonedDateTimeISO() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.Now.zonedDateTimeISO(timeZone);
|
||||
Temporal.Now.zonedDateTimeISO({ timeZone });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindate.prototype.tozoneddatetime
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to toZonedDateTime() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDate(2000, 5, 2);
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.toZonedDateTime(timeZone);
|
||||
instance.toZonedDateTime({ timeZone });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaindatetime.prototype.tozoneddatetime
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to toZonedDateTime() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainDateTime(2000, 5, 2);
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.toZonedDateTime(timeZone);
|
||||
instance.toZonedDateTime({ timeZone });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.plaintime.prototype.tozoneddatetime
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to toZonedDateTime() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.PlainTime();
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone });
|
||||
instance.toZonedDateTime({ plainDate: new Temporal.PlainDate(2000, 5, 2), timeZone: { timeZone } });
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.timezone.from
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to from() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.TimeZone.from(timeZone);
|
||||
Temporal.TimeZone.from({ timeZone });
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.compare
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to compare() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
const arg1 = { year: 2020, month: 5, day: 2, timeZone };
|
||||
Temporal.ZonedDateTime.compare(arg1, arg1);
|
||||
|
||||
const arg2 = { year: 2020, month: 5, day: 2, timeZone: { timeZone } };
|
||||
Temporal.ZonedDateTime.compare(arg2, arg2);
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.from
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to from() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone });
|
||||
Temporal.ZonedDateTime.from({ year: 2000, month: 5, day: 2, timeZone: { timeZone } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.equals
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to equals() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, new Temporal.TimeZone("UTC"));
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.equals({ year: 2020, month: 5, day: 2, timeZone });
|
||||
instance.equals({ year: 2020, month: 5, day: 2, timeZone: { timeZone } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.since
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to since() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, new Temporal.TimeZone("UTC"));
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.since({ year: 2020, month: 5, day: 2, timeZone });
|
||||
instance.since({ year: 2020, month: 5, day: 2, timeZone: { timeZone } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.until
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to until() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, new Temporal.TimeZone("UTC"));
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.until({ year: 2020, month: 5, day: 2, timeZone });
|
||||
instance.until({ year: 2020, month: 5, day: 2, timeZone: { timeZone } });
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.withtimezone
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to withTimeZone() does not have its
|
||||
'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instance = new Temporal.ZonedDateTime(0n, new Temporal.TimeZone("UTC"));
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
instance.withTimeZone(timeZone);
|
||||
instance.withTimeZone({ timeZone });
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime
|
||||
description: >
|
||||
A Temporal.TimeZone instance passed to new ZonedDateTime() does not have
|
||||
its 'timeZone' property observably checked
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
Object.defineProperty(timeZone, "timeZone", {
|
||||
get() {
|
||||
throw new Test262Error("timeZone.timeZone should not be accessed");
|
||||
},
|
||||
});
|
||||
|
||||
new Temporal.ZonedDateTime(0n, timeZone);
|
||||
new Temporal.ZonedDateTime(0n, { timeZone });
|
Loading…
Reference in New Issue