diff options
Diffstat (limited to 'js/src/tests/test262/intl402/DateTimeFormat/constructor-no-instanceof.js')
-rw-r--r-- | js/src/tests/test262/intl402/DateTimeFormat/constructor-no-instanceof.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/DateTimeFormat/constructor-no-instanceof.js b/js/src/tests/test262/intl402/DateTimeFormat/constructor-no-instanceof.js new file mode 100644 index 0000000000..c2905aa57b --- /dev/null +++ b/js/src/tests/test262/intl402/DateTimeFormat/constructor-no-instanceof.js @@ -0,0 +1,25 @@ +// Copyright (C) 2021 Igalia S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl-datetimeformat-constructor +description: > + Tests that the Intl.DateTimeFormat constructor calls + OrdinaryHasInstance instead of the instanceof operator which includes a + Symbol.hasInstance lookup and call among other things. +info: > + ChainDateTimeFormat ( dateTimeFormat, newTarget, this ) + 1. If newTarget is undefined and ? OrdinaryHasInstance(%DateTimeFormat%, this) is true, then + a. Perform ? DefinePropertyOrThrow(this, %Intl%.[[FallbackSymbol]], PropertyDescriptor{ + [[Value]]: dateTimeFormat, [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: false }). + b. Return this. +---*/ + +Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, { + get() { throw new Test262Error(); } +}); + +Intl.DateTimeFormat(); + +reportCompare(0, 0); |