File tree Expand file tree Collapse file tree 1 file changed +29
-25
lines changed Expand file tree Collapse file tree 1 file changed +29
-25
lines changed Original file line number Diff line number Diff line change @@ -134,31 +134,35 @@ console.log('Testing', 'isBoxedPrimitive');
134
134
assert ( types . isBoxedPrimitive ( entry ) ) ;
135
135
} ) ;
136
136
137
- [
138
- 'Uint8Array' ,
139
- 'Uint8ClampedArray' ,
140
- 'Uint16Array' ,
141
- 'Uint32Array' ,
142
- 'Int8Array' ,
143
- 'Int16Array' ,
144
- 'Int32Array' ,
145
- 'Float32Array' ,
146
- 'Float64Array' ,
147
- 'BigInt64Array' ,
148
- 'BigUint64Array'
149
- ] . forEach ( function ( typedArray ) {
150
- var method = 'is' + typedArray ;
151
- var constructor = 'new ' + typedArray ;
152
- var array ;
153
- try {
154
- array = vm . runInNewContext ( constructor ) ;
155
- } catch ( e ) {
156
- return ;
157
- }
158
- console . log ( 'Testing fake typed arrays' , method ) ;
159
- assert ( ! types [ method ] ( _defineProperty ( { } , Symbol . toStringTag , typedArray ) ) ) ;
160
- assert ( types [ method ] ( array ) ) ;
161
- } ) ;
137
+ var SymbolSupported = typeof Symbol !== 'undefined' ;
138
+ var SymbolToStringTagSupported = SymbolSupported && typeof Symbol . toStringTag !== 'undefined' ;
139
+ if ( SymbolToStringTagSupported ) {
140
+ [
141
+ 'Uint8Array' ,
142
+ 'Uint8ClampedArray' ,
143
+ 'Uint16Array' ,
144
+ 'Uint32Array' ,
145
+ 'Int8Array' ,
146
+ 'Int16Array' ,
147
+ 'Int32Array' ,
148
+ 'Float32Array' ,
149
+ 'Float64Array' ,
150
+ 'BigInt64Array' ,
151
+ 'BigUint64Array'
152
+ ] . forEach ( function ( typedArray ) {
153
+ var method = 'is' + typedArray ;
154
+ var constructor = 'new ' + typedArray ;
155
+ var array ;
156
+ try {
157
+ array = vm . runInNewContext ( constructor ) ;
158
+ } catch ( e ) {
159
+ return ;
160
+ }
161
+ console . log ( 'Testing fake typed arrays' , method ) ;
162
+ assert ( ! types [ method ] ( _defineProperty ( { } , Symbol . toStringTag , typedArray ) ) ) ;
163
+ assert ( types [ method ] ( array ) ) ;
164
+ } ) ;
165
+ }
162
166
163
167
{
164
168
var primitive = function primitive ( ) { return true ; } ;
You can’t perform that action at this time.
0 commit comments