summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/NumberFormat/constructor-no-instanceof.js
blob: fe9f1ac72001cdc819b8e0c23ac1a10265fbe824 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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-numberformat-constructor
description: >
  Tests that the Intl.NumberFormat constructor calls
  OrdinaryHasInstance instead of the instanceof operator which includes a
  Symbol.hasInstance lookup and call among other things.
info: >
  ChainNumberFormat ( numberFormat, newTarget, this )
  1.  If newTarget is undefined and ? OrdinaryHasInstance(%NumberFormat%, this) is true, then
      a.  Perform ? DefinePropertyOrThrow(this, %Intl%.[[FallbackSymbol]], PropertyDescriptor{
          [[Value]]: numberFormat, [[Writable]]: false, [[Enumerable]]: false,
          [[Configurable]]: false }).
      b.  Return this.
---*/

Object.defineProperty(Intl.NumberFormat, Symbol.hasInstance, {
    get() { throw new Test262Error(); }
});

Intl.NumberFormat();

reportCompare(0, 0);