@@ -185,25 +185,18 @@ export class TryCatch implements Integration {
185
185
* our wrapped version of `addEventListener`, which internally calls `wrap` helper.
186
186
* This helper "wraps" whole callback inside a try/catch statement, and attached appropriate metadata to it,
187
187
* in order for us to make a distinction between wrapped/non-wrapped functions possible.
188
- * If a function has `__sentry__` property, it means that it was wrapped, and it has additional property
189
- * of `__sentry__original__`, holding the handler. And this original handler, has a reversed link,
190
- * with `__sentry_wrapped__` property, which holds the wrapped version.
188
+ * If a function was wrapped, it has additional property of `__sentry_wrapped__`, holding the handler.
191
189
*
192
190
* When someone adds a handler prior to initialization, and then do it again, but after,
193
191
* then we have to detach both of them. Otherwise, if we'd detach only wrapped one, it'd be impossible
194
192
* to get rid of the initial handler and it'd stick there forever.
195
- * In case of second scenario, `__sentry_original__` refers to initial handler, and passed function
196
- * is a wrapped version.
197
193
*/
198
- const callback = ( fn as any ) as WrappedFunction ;
199
194
try {
200
- if ( callback && callback . __sentry__ ) {
201
- original . call ( this , eventName , callback . __sentry_original__ , options ) ;
202
- }
195
+ original . call ( this , eventName , ( ( fn as unknown ) as WrappedFunction ) . __sentry_wrapped__ , options ) ;
203
196
} catch ( e ) {
204
- // ignore, accessing __sentry__ will throw in some Selenium environments
197
+ // ignore, accessing __sentry_wrapped__ will throw in some Selenium environments
205
198
}
206
- return original . call ( this , eventName , callback , options ) ;
199
+ return original . call ( this , eventName , fn , options ) ;
207
200
} ;
208
201
} ) ;
209
202
}
0 commit comments