File tree Expand file tree Collapse file tree 3 files changed +29
-31
lines changed Expand file tree Collapse file tree 3 files changed +29
-31
lines changed Original file line number Diff line number Diff line change 836
836
}
837
837
}
838
838
839
- if ( ! usingWeakMap &&
840
- typeof Object . isExtensible === 'function' &&
841
- Object . isExtensible ( obj ) === false ) {
842
- throw new Error ( 'Non-extensible objects are not allowed as keys.' ) ;
843
- }
844
-
845
839
hash = ++ objHashUID ;
846
840
if ( objHashUID & 0x40000000 ) {
847
841
objHashUID = 0 ;
848
842
}
849
843
850
844
if ( usingWeakMap ) {
851
845
weakMap . set ( obj , hash ) ;
846
+ } else if ( isExtensible !== undefined && isExtensible ( obj ) === false ) {
847
+ throw new Error ( 'Non-extensible objects are not allowed as keys.' ) ;
852
848
} else if ( canDefineProperty ) {
853
849
Object . defineProperty ( obj , UID_HASH_KEY , {
854
850
'enumerable' : false ,
879
875
return hash ;
880
876
}
881
877
878
+ // Get references to ES5 object methods.
879
+ var isExtensible = Object . isExtensible ;
880
+
882
881
// True if Object.defineProperty works as expected. IE8 fails this test.
883
882
var canDefineProperty = ( function ( ) {
884
883
try {
You can’t perform that action at this time.
0 commit comments