test262/test/built-ins/Temporal/Now/plainDateTime/timezone-getoffsetnanosecondsfor-poisoned.js
Philip Chimento d6a24fe906 Validate required methods of Temporal TimeZone protocol
Checking whether an object implements the TimeZone protocol is now done by
means of HasProperty operations for each of the required methods unless
the object already has the TimeZone brand.

Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00

20 lines
623 B
JavaScript

// Copyright (C) 2021 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-temporal.now.plaindatetime
description: Forwards error when accessing `getOffsetNanosecondsFor` property throws
features: [Temporal]
---*/
var timeZone = {
id: 'Etc/Test',
getPossibleInstantsFor() { return []; },
get getOffsetNanosecondsFor() {
throw new Test262Error();
}
};
assert.throws(Test262Error, function() {
Temporal.Now.plainDateTime('iso8601', timeZone);
}, 'Temporal.Now.plainDateTime("iso8601", timeZone) throws a Test262Error exception');