@@ -20,10 +20,18 @@ const {
2020 ArrayPrototypeSplice,
2121 ArrayPrototypeUnshift,
2222 BigIntPrototypeValueOf,
23+ Boolean,
24+ BooleanPrototype,
2325 BooleanPrototypeValueOf,
26+ DataView,
27+ DataViewPrototype,
28+ Date,
29+ DatePrototype,
2430 DatePrototypeGetTime,
2531 DatePrototypeToISOString,
2632 DatePrototypeToString,
33+ Error,
34+ ErrorPrototype,
2735 ErrorPrototypeToString,
2836 Function,
2937 FunctionPrototype,
@@ -47,6 +55,7 @@ const {
4755 NumberIsNaN,
4856 NumberParseFloat,
4957 NumberParseInt,
58+ NumberPrototype,
5059 NumberPrototypeToString,
5160 NumberPrototypeValueOf,
5261 Object,
@@ -63,9 +72,12 @@ const {
6372 ObjectPrototypePropertyIsEnumerable,
6473 ObjectSeal,
6574 ObjectSetPrototypeOf,
75+ Promise,
76+ PromisePrototype,
6677 ReflectApply,
6778 ReflectOwnKeys,
6879 RegExp,
80+ RegExpPrototype,
6981 RegExpPrototypeExec,
7082 RegExpPrototypeSymbolReplace,
7183 RegExpPrototypeSymbolSplit,
@@ -78,6 +90,7 @@ const {
7890 SetPrototypeGetSize,
7991 SetPrototypeValues,
8092 String,
93+ StringPrototype,
8194 StringPrototypeCharCodeAt,
8295 StringPrototypeCodePointAt,
8396 StringPrototypeEndsWith,
@@ -106,6 +119,10 @@ const {
106119 TypedArrayPrototypeGetLength,
107120 TypedArrayPrototypeGetSymbolToStringTag,
108121 Uint8Array,
122+ WeakMap,
123+ WeakMapPrototype,
124+ WeakSet,
125+ WeakSetPrototype,
109126 globalThis,
110127 uncurryThis,
111128} = primordials ;
@@ -608,21 +625,31 @@ function isInstanceof(object, proto) {
608625}
609626
610627// Special-case for some builtin prototypes in case their `constructor` property has been tampered.
611- const wellKnownPrototypes = new SafeMap ( ) ;
612- wellKnownPrototypes . set ( ArrayPrototype , { name : 'Array' , constructor : Array } ) ;
613- wellKnownPrototypes . set ( ArrayBufferPrototype , { name : 'ArrayBuffer' , constructor : ArrayBuffer } ) ;
614- wellKnownPrototypes . set ( FunctionPrototype , { name : 'Function' , constructor : Function } ) ;
615- wellKnownPrototypes . set ( MapPrototype , { name : 'Map' , constructor : Map } ) ;
616- wellKnownPrototypes . set ( ObjectPrototype , { name : 'Object' , constructor : Object } ) ;
617- wellKnownPrototypes . set ( SetPrototype , { name : 'Set' , constructor : Set } ) ;
618- wellKnownPrototypes . set ( TypedArrayPrototype , { name : 'TypedArray' , constructor : TypedArray } ) ;
628+ const wellKnownPrototypes = new SafeMap ( )
629+ . set ( ArrayPrototype , { name : 'Array' , constructor : Array } )
630+ . set ( ArrayBufferPrototype , { name : 'ArrayBuffer' , constructor : ArrayBuffer } )
631+ . set ( FunctionPrototype , { name : 'Function' , constructor : Function } )
632+ . set ( MapPrototype , { name : 'Map' , constructor : Map } )
633+ . set ( SetPrototype , { name : 'Set' , constructor : Set } )
634+ . set ( ObjectPrototype , { name : 'Object' , constructor : Object } )
635+ . set ( TypedArrayPrototype , { name : 'TypedArray' , constructor : TypedArray } )
636+ . set ( RegExpPrototype , { name : 'RegExp' , constructor : RegExp } )
637+ . set ( DatePrototype , { name : 'Date' , constructor : Date } )
638+ . set ( DataViewPrototype , { name : 'DataView' , constructor : DataView } )
639+ . set ( ErrorPrototype , { name : 'Error' , constructor : Error } )
640+ . set ( BooleanPrototype , { name : 'Boolean' , constructor : Boolean } )
641+ . set ( NumberPrototype , { name : 'Number' , constructor : Number } )
642+ . set ( StringPrototype , { name : 'String' , constructor : String } )
643+ . set ( PromisePrototype , { name : 'Promise' , constructor : Promise } )
644+ . set ( WeakMapPrototype , { name : 'WeakMap' , constructor : WeakMap } )
645+ . set ( WeakSetPrototype , { name : 'WeakSet' , constructor : WeakSet } ) ;
619646
620647function getConstructorName ( obj , ctx , recurseTimes , protoProps ) {
621648 let firstProto ;
622649 const tmp = obj ;
623650 while ( obj || isUndetectableObject ( obj ) ) {
624651 const wellKnownPrototypeNameAndConstructor = wellKnownPrototypes . get ( obj ) ;
625- if ( wellKnownPrototypeNameAndConstructor != null ) {
652+ if ( wellKnownPrototypeNameAndConstructor !== undefined ) {
626653 const { name, constructor } = wellKnownPrototypeNameAndConstructor ;
627654 if ( FunctionPrototypeSymbolHasInstance ( constructor , tmp ) ) {
628655 if ( protoProps !== undefined && firstProto !== obj ) {
0 commit comments