constructor-no-instanceof.js (939B)
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-datetimeformat-constructor 6 description: > 7 Tests that the Intl.DateTimeFormat constructor calls 8 OrdinaryHasInstance instead of the instanceof operator which includes a 9 Symbol.hasInstance lookup and call among other things. 10 info: > 11 ChainDateTimeFormat ( dateTimeFormat, newTarget, this ) 12 1. If newTarget is undefined and ? OrdinaryHasInstance(%DateTimeFormat%, this) is true, then 13 a. Perform ? DefinePropertyOrThrow(this, %Intl%.[[FallbackSymbol]], PropertyDescriptor{ 14 [[Value]]: dateTimeFormat, [[Writable]]: false, [[Enumerable]]: false, 15 [[Configurable]]: false }). 16 b. Return this. 17 ---*/ 18 19 Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, { 20 get() { throw new Test262Error(); } 21 }); 22 23 Intl.DateTimeFormat(); 24 25 reportCompare(0, 0);