v8/test/intl/date-format/UnwrapDateTimeFormatUseOrdinaryHasInstance.js
Frank Tang c2795bd790 [intl] Implement ECMA402 PR500 Use OrdinaryHasInstance
Implement https://github.com/tc39/ecma402/pull/500

For the legacy [optional]  Unwrap*Format steps, use OrdinaryHasInstance
instead of InstanceofOperator.

ECMA402 agree w/ PR500 on 2021-1-14

Bug: v8:10981
Change-Id: Ic697aa245b11fecaf998127c009e59a821aaa01e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2444092
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72303}
2021-01-25 22:33:04 +00:00

16 lines
603 B
JavaScript

// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Verify ECMA402 PR 500 Use OrdinaryHasInstance in normative optional steps
// https://github.com/tc39/ecma402/pull/500
Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, {
get() { throw new Error("Intl.DateTimeFormat[@@hasInstance] lookup"); }
});
var dtf;
assertDoesNotThrow(() => dtf = new Intl.DateTimeFormat());
assertDoesNotThrow(() => dtf.format(new Date()));
assertDoesNotThrow(() => dtf.resolvedOptions());