@@ -258,18 +258,18 @@ Raven.prototype = {
258
258
if ( func . __raven__ ) {
259
259
return func ;
260
260
}
261
+
262
+ // If this has already been wrapped in the past, return that
263
+ if ( func . __raven_wrapper__ ) {
264
+ return func . __raven_wrapper__ ;
265
+ }
261
266
} catch ( e ) {
262
- // Just accessing the __raven__ prop in some Selenium environments
267
+ // Just accessing custom props in some Selenium environments
263
268
// can cause a "Permission denied" exception (see raven-js#495).
264
269
// Bail on wrapping and return the function as-is (defers to window.onerror).
265
270
return func ;
266
271
}
267
272
268
- // If this has already been wrapped in the past, return that
269
- if ( func . __raven_wrapper__ ) {
270
- return func . __raven_wrapper__ ;
271
- }
272
-
273
273
function wrapped ( ) {
274
274
var args = [ ] , i = arguments . length ,
275
275
deep = ! options || options && options . deep !== false ;
@@ -864,7 +864,11 @@ Raven.prototype = {
864
864
} , wrappedBuiltIns ) ;
865
865
fill ( proto , 'removeEventListener' , function ( orig ) {
866
866
return function ( evt , fn , capture , secure ) {
867
- fn = fn && ( fn . __raven_wrapper__ ? fn . __raven_wrapper__ : fn ) ;
867
+ try {
868
+ fn = fn && ( fn . __raven_wrapper__ ? fn . __raven_wrapper__ : fn ) ;
869
+ } catch ( e ) {
870
+ // ignore, accessing __raven_wrapper__ will throw in some Selenium environments
871
+ }
868
872
return orig . call ( this , evt , fn , capture , secure ) ;
869
873
} ;
870
874
} , wrappedBuiltIns ) ;
0 commit comments