1
- /*! Raven.js 3.8 .0 (d78f15c ) | github.com/getsentry/raven-js */
1
+ /*! Raven.js 3.9 .0 (8bbd939 ) | github.com/getsentry/raven-js */
2
2
3
3
/*
4
4
* Includes TraceKit
@@ -91,6 +91,7 @@ module.exports = {
91
91
} ;
92
92
93
93
} , { } ] , 4 :[ function ( _dereq_ , module , exports ) {
94
+ ( function ( global ) {
94
95
/*global XDomainRequest:false, __DEV__:false*/
95
96
'use strict' ;
96
97
@@ -107,8 +108,12 @@ function now() {
107
108
return + new Date ( ) ;
108
109
}
109
110
110
- var _window = typeof window !== 'undefined' ? window : undefined ;
111
- var _document = _window && _window . document ;
111
+ // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
112
+ var _window = typeof window !== 'undefined' ? window
113
+ : typeof global !== 'undefined' ? global
114
+ : typeof self !== 'undefined' ? self
115
+ : { } ;
116
+ var _document = _window . document ;
112
117
113
118
// First, check for JSON support
114
119
// If there is no JSON, we no-op the core features of Raven
@@ -167,7 +172,7 @@ Raven.prototype = {
167
172
// webpack (using a build step causes webpack #1617). Grunt verifies that
168
173
// this value matches package.json during build.
169
174
// See: https://github.com/getsentry/raven-js/issues/465
170
- VERSION : '3.8 .0' ,
175
+ VERSION : '3.9 .0' ,
171
176
172
177
debug : false ,
173
178
@@ -195,7 +200,7 @@ Raven.prototype = {
195
200
if ( options ) {
196
201
each ( options , function ( key , value ) {
197
202
// tags and extra are special and need to be put into context
198
- if ( key === 'tags' || key === 'extra' ) {
203
+ if ( key === 'tags' || key === 'extra' || key === 'user' ) {
199
204
self . _globalContext [ key ] = value ;
200
205
} else {
201
206
globalOptions [ key ] = value ;
@@ -221,7 +226,7 @@ Raven.prototype = {
221
226
xhr : true ,
222
227
console : true ,
223
228
dom : true ,
224
- location : true ,
229
+ location : true
225
230
} ;
226
231
227
232
var autoBreadcrumbs = globalOptions . autoBreadcrumbs ;
@@ -456,11 +461,13 @@ Raven.prototype = {
456
461
return ;
457
462
}
458
463
464
+ options = options || { } ;
465
+
459
466
var data = objectMerge ( {
460
467
message : msg + '' // Make sure it's actually a string
461
468
} , options ) ;
462
469
463
- if ( options && options . stacktrace ) {
470
+ if ( this . _globalOptions . stacktrace || ( options && options . stacktrace ) ) {
464
471
var ex ;
465
472
// create a stack trace from this point; just trim
466
473
// off extra frames so they don't include this function call (or
@@ -500,6 +507,16 @@ Raven.prototype = {
500
507
timestamp : now ( ) / 1000
501
508
} , obj ) ;
502
509
510
+ if ( isFunction ( this . _globalOptions . breadcrumbCallback ) ) {
511
+ var result = this . _globalOptions . breadcrumbCallback ( crumb ) ;
512
+
513
+ if ( isObject ( result ) && ! isEmptyObject ( result ) ) {
514
+ crumb = result ;
515
+ } else if ( result === false ) {
516
+ return this ;
517
+ }
518
+ }
519
+
503
520
this . _breadcrumbs . push ( crumb ) ;
504
521
if ( this . _breadcrumbs . length > this . _globalOptions . maxBreadcrumbs ) {
505
522
this . _breadcrumbs . shift ( ) ;
@@ -617,6 +634,22 @@ Raven.prototype = {
617
634
return this ;
618
635
} ,
619
636
637
+ /*
638
+ * Set the breadcrumbCallback option
639
+ *
640
+ * @param {function } callback The callback to run which allows filtering
641
+ * or mutating breadcrumbs
642
+ * @return {Raven }
643
+ */
644
+ setBreadcrumbCallback : function ( callback ) {
645
+ var original = this . _globalOptions . breadcrumbCallback ;
646
+ this . _globalOptions . breadcrumbCallback = isFunction ( callback )
647
+ ? function ( data ) { return callback ( data , original ) ; }
648
+ : callback ;
649
+
650
+ return this ;
651
+ } ,
652
+
620
653
/*
621
654
* Set the shouldSendCallback option
622
655
*
@@ -827,7 +860,6 @@ Raven.prototype = {
827
860
// TODO: if somehow user switches keypress target before
828
861
// debounce timeout is triggered, we will only capture
829
862
// a single breadcrumb from the FIRST target (acceptable?)
830
-
831
863
return function ( evt ) {
832
864
var target = evt . target ,
833
865
tagName = target && target . tagName ;
@@ -846,7 +878,7 @@ Raven.prototype = {
846
878
}
847
879
clearTimeout ( timeout ) ;
848
880
self . _keypressTimeout = setTimeout ( function ( ) {
849
- self . _keypressTimeout = null ;
881
+ self . _keypressTimeout = null ;
850
882
} , debounceDuration ) ;
851
883
} ;
852
884
} ,
@@ -932,13 +964,24 @@ Raven.prototype = {
932
964
933
965
// More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs`
934
966
// so that we don't have more than one wrapper function
935
- var before ;
967
+ var before ,
968
+ clickHandler ,
969
+ keypressHandler ;
970
+
936
971
if ( autoBreadcrumbs && autoBreadcrumbs . dom && ( global === 'EventTarget' || global === 'Node' ) ) {
937
- if ( evtName === 'click' ) {
938
- before = self . _breadcrumbEventHandler ( evtName ) ;
939
- } else if ( evtName === 'keypress' ) {
940
- before = self . _keypressEventHandler ( ) ;
941
- }
972
+ // NOTE: generating multiple handlers per addEventListener invocation, should
973
+ // revisit and verify we can just use one (almost certainly)
974
+ clickHandler = self . _breadcrumbEventHandler ( 'click' ) ;
975
+ keypressHandler = self . _keypressEventHandler ( ) ;
976
+ before = function ( evt ) {
977
+ // need to intercept every DOM event in `before` argument, in case that
978
+ // same wrapped method is re-used for different events (e.g. mousemove THEN click)
979
+ // see #724
980
+ if ( evt . type === 'click' )
981
+ return clickHandler ( evt ) ;
982
+ else if ( evt . type === 'keypress' )
983
+ return keypressHandler ( evt ) ;
984
+ } ;
942
985
}
943
986
return orig . call ( this , evtName , self . wrap ( fn , undefined , before ) , capture , secure ) ;
944
987
} ;
@@ -1849,7 +1892,9 @@ Raven.prototype.setReleaseContext = Raven.prototype.setRelease;
1849
1892
1850
1893
module . exports = Raven ;
1851
1894
1895
+ } ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
1852
1896
} , { "1" :1 , "2" :2 , "3" :3 , "6" :6 } ] , 5 :[ function ( _dereq_ , module , exports ) {
1897
+ ( function ( global ) {
1853
1898
/**
1854
1899
* Enforces a single instance of the Raven client, and the
1855
1900
* main entry point for Raven. If you are a consumer of the
@@ -1860,7 +1905,12 @@ module.exports = Raven;
1860
1905
1861
1906
var RavenConstructor = _dereq_ ( 4 ) ;
1862
1907
1863
- var _Raven = window . Raven ;
1908
+ // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
1909
+ var _window = typeof window !== 'undefined' ? window
1910
+ : typeof global !== 'undefined' ? global
1911
+ : typeof self !== 'undefined' ? self
1912
+ : { } ;
1913
+ var _Raven = _window . Raven ;
1864
1914
1865
1915
var Raven = new RavenConstructor ( ) ;
1866
1916
@@ -1871,15 +1921,17 @@ var Raven = new RavenConstructor();
1871
1921
* @return {Raven }
1872
1922
*/
1873
1923
Raven . noConflict = function ( ) {
1874
- window . Raven = _Raven ;
1924
+ _window . Raven = _Raven ;
1875
1925
return Raven ;
1876
1926
} ;
1877
1927
1878
1928
Raven . afterLoad ( ) ;
1879
1929
1880
1930
module . exports = Raven ;
1881
1931
1932
+ } ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
1882
1933
} , { "4" :4 } ] , 6 :[ function ( _dereq_ , module , exports ) {
1934
+ ( function ( global ) {
1883
1935
'use strict' ;
1884
1936
1885
1937
/*
@@ -1892,6 +1944,12 @@ var TraceKit = {
1892
1944
debug : false
1893
1945
} ;
1894
1946
1947
+ // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
1948
+ var _window = typeof window !== 'undefined' ? window
1949
+ : typeof global !== 'undefined' ? global
1950
+ : typeof self !== 'undefined' ? self
1951
+ : { } ;
1952
+
1895
1953
// global reference to slice
1896
1954
var _slice = [ ] . slice ;
1897
1955
var UNKNOWN_FUNCTION = '?' ;
@@ -2070,8 +2128,8 @@ TraceKit.report = (function reportModuleWrapper() {
2070
2128
if ( _onErrorHandlerInstalled ) {
2071
2129
return ;
2072
2130
}
2073
- _oldOnerrorHandler = window . onerror ;
2074
- window . onerror = traceKitWindowOnError ;
2131
+ _oldOnerrorHandler = _window . onerror ;
2132
+ _window . onerror = traceKitWindowOnError ;
2075
2133
_onErrorHandlerInstalled = true ;
2076
2134
}
2077
2135
@@ -2080,7 +2138,7 @@ TraceKit.report = (function reportModuleWrapper() {
2080
2138
if ( ! _onErrorHandlerInstalled ) {
2081
2139
return ;
2082
2140
}
2083
- window . onerror = _oldOnerrorHandler ;
2141
+ _window . onerror = _oldOnerrorHandler ;
2084
2142
_onErrorHandlerInstalled = false ;
2085
2143
_oldOnerrorHandler = undefined ;
2086
2144
}
@@ -2482,5 +2540,6 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
2482
2540
2483
2541
module . exports = TraceKit ;
2484
2542
2543
+ } ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
2485
2544
} , { } ] } , { } , [ 5 ] ) ( 5 )
2486
2545
} ) ;
0 commit comments