File tree 1 file changed +21
-4
lines changed
1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -276,13 +276,30 @@ if (typeof OriginalCallSite === 'function') {
276
276
return ;
277
277
}
278
278
const newWrapped = ( error , sst ) => {
279
+ const sandboxSst = ensureThis ( sst ) ;
279
280
if ( localArrayIsArray ( sst ) ) {
280
- for ( let i = 0 ; i < sst . length ; i ++ ) {
281
- const cs = sst [ i ] ;
282
- if ( typeof cs === 'object' && localReflectGetPrototypeOf ( cs ) === OriginalCallSite . prototype ) {
283
- sst [ i ] = new CallSite ( cs ) ;
281
+ if ( sst === sandboxSst ) {
282
+ for ( let i = 0 ; i < sst . length ; i ++ ) {
283
+ const cs = sst [ i ] ;
284
+ if ( typeof cs === 'object' && localReflectGetPrototypeOf ( cs ) === OriginalCallSite . prototype ) {
285
+ sst [ i ] = new CallSite ( cs ) ;
286
+ }
287
+ }
288
+ } else {
289
+ sst = [ ] ;
290
+ for ( let i = 0 ; i < sandboxSst . length ; i ++ ) {
291
+ const cs = sandboxSst [ i ] ;
292
+ localReflectDefineProperty ( sst , i , {
293
+ __proto__ : null ,
294
+ value : new CallSite ( cs ) ,
295
+ enumerable : true ,
296
+ configurable : true ,
297
+ writable : true
298
+ } ) ;
284
299
}
285
300
}
301
+ } else {
302
+ sst = sandboxSst ;
286
303
}
287
304
return value ( error , sst ) ;
288
305
} ;
You can’t perform that action at this time.
0 commit comments