22
33const {
44 ArrayPrototypeAt,
5- ArrayPrototypeIndexOf,
65 ArrayPrototypePush,
76 ArrayPrototypePushApply,
87 ArrayPrototypeSlice,
@@ -15,6 +14,7 @@ const {
1514 ReflectApply,
1615 SafeFinalizationRegistry,
1716 SafeMap,
17+ SafeSet,
1818 SymbolDispose,
1919 SymbolHasInstance,
2020} = primordials ;
@@ -60,7 +60,6 @@ function withSuppressionsContext(set, fn, thisArg, args) {
6060 if ( storage ) {
6161 return storage . run ( set , ( ) => ReflectApply ( fn , thisArg , args ) ) ;
6262 }
63- // Fallback: just call the function without context
6463 return ReflectApply ( fn , thisArg , args ) ;
6564}
6665// Can't delete when weakref count reaches 0 as it could increment again.
@@ -164,7 +163,7 @@ class RunStoresScope {
164163class ActiveChannel {
165164 subscribe ( subscription , options = { } ) {
166165 validateFunction ( subscription , 'subscription' ) ;
167- let suppressedBy = options && options . suppressedBy !== undefined ? options . suppressedBy : null ;
166+ const suppressedBy = options && options . suppressedBy !== undefined ? options . suppressedBy : null ;
168167 if ( suppressedBy !== null ) {
169168 const t = typeof suppressedBy ;
170169 if ( t === 'string' || t === 'number' || t === 'bigint' || t === 'boolean' ) {
@@ -709,19 +708,10 @@ function suppressed(key, fn, thisArg, ...args) {
709708 }
710709
711710 const storage = getSuppressionsStorage ( ) ;
712- let currentSet ;
713- if ( storage ) {
714- currentSet = storage . getStore ( ) ;
715- }
716- const next = currentSet ? new Set ( currentSet ) : new Set ( ) ;
711+ const currentSet = storage ? storage . getStore ( ) : undefined ;
712+ const next = currentSet ? new SafeSet ( currentSet ) : new SafeSet ( ) ;
717713 next . add ( key ) ;
718- const wrapped = function ( ) {
719- try {
720- console . error ( 'diagnostics_channel: suppressed() executing callback' ) ;
721- } catch ( _ ) { }
722- return ReflectApply ( fn , thisArg , args ) ;
723- } ;
724- return withSuppressionsContext ( next , wrapped , thisArg , [ ] ) ;
714+ return withSuppressionsContext ( next , fn , thisArg , args ) ;
725715}
726716
727717module . exports = {
0 commit comments