mirror of
https://github.com/tc39/test262.git
synced 2025-09-30 13:38:48 +02:00
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.
21 lines
574 B
JavaScript
21 lines
574 B
JavaScript
// 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 });
|