constructor-no-instanceof.js (923B)
1 // Copyright (C) 2021 Igalia S.L. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-intl-numberformat-constructor 6 description: > 7 Tests that the Intl.NumberFormat constructor calls 8 OrdinaryHasInstance instead of the instanceof operator which includes a 9 Symbol.hasInstance lookup and call among other things. 10 info: > 11 ChainNumberFormat ( numberFormat, newTarget, this ) 12 1. If newTarget is undefined and ? OrdinaryHasInstance(%NumberFormat%, this) is true, then 13 a. Perform ? DefinePropertyOrThrow(this, %Intl%.[[FallbackSymbol]], PropertyDescriptor{ 14 [[Value]]: numberFormat, [[Writable]]: false, [[Enumerable]]: false, 15 [[Configurable]]: false }). 16 b. Return this. 17 ---*/ 18 19 Object.defineProperty(Intl.NumberFormat, Symbol.hasInstance, { 20 get() { throw new Test262Error(); } 21 }); 22 23 Intl.NumberFormat(); 24 25 reportCompare(0, 0);