1
- /*! Raven.js 3.12.1 (3600a05 ) | github.com/getsentry/raven-js */
1
+ /*! Raven.js 3.13.0 (14f0148 ) | github.com/getsentry/raven-js */
2
2
3
3
/*
4
4
* Includes TraceKit
11
11
*/
12
12
13
13
( function ( f ) { if ( typeof exports === "object" && typeof module !== "undefined" ) { module . exports = f ( ) } else if ( typeof define === "function" && define . amd ) { define ( [ ] , f ) } else { var g ; if ( typeof window !== "undefined" ) { g = window } else if ( typeof global !== "undefined" ) { g = global } else if ( typeof self !== "undefined" ) { g = self } else { g = this } g . Raven = f ( ) } } ) ( function ( ) { var define , module , exports ; return ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( _dereq_ , module , exports ) {
14
- exports = module . exports = stringify
15
- exports . getSerialize = serializer
16
-
17
- function stringify ( obj , replacer , spaces , cycleReplacer ) {
18
- return JSON . stringify ( obj , serializer ( replacer , cycleReplacer ) , spaces )
19
- }
20
-
21
- function serializer ( replacer , cycleReplacer ) {
22
- var stack = [ ] , keys = [ ]
23
-
24
- if ( cycleReplacer == null ) cycleReplacer = function ( key , value ) {
25
- if ( stack [ 0 ] === value ) return "[Circular ~]"
26
- return "[Circular ~." + keys . slice ( 0 , stack . indexOf ( value ) ) . join ( "." ) + "]"
27
- }
28
-
29
- return function ( key , value ) {
30
- if ( stack . length > 0 ) {
31
- var thisPos = stack . indexOf ( this )
32
- ~ thisPos ? stack . splice ( thisPos + 1 ) : stack . push ( this )
33
- ~ thisPos ? keys . splice ( thisPos , Infinity , key ) : keys . push ( key )
34
- if ( ~ stack . indexOf ( value ) ) value = cycleReplacer . call ( this , key , value )
35
- }
36
- else stack . push ( value )
37
-
38
- return replacer == null ? value : replacer . call ( this , key , value )
39
- }
40
- }
41
-
42
- } , { } ] , 2 :[ function ( _dereq_ , module , exports ) {
43
14
'use strict' ;
44
15
45
16
function RavenConfigError ( message ) {
@@ -51,7 +22,7 @@ RavenConfigError.prototype.constructor = RavenConfigError;
51
22
52
23
module . exports = RavenConfigError ;
53
24
54
- } , { } ] , 3 :[ function ( _dereq_ , module , exports ) {
25
+ } , { } ] , 2 :[ function ( _dereq_ , module , exports ) {
55
26
'use strict' ;
56
27
57
28
var wrapMethod = function ( console , level , callback ) {
@@ -90,21 +61,20 @@ module.exports = {
90
61
wrapMethod : wrapMethod
91
62
} ;
92
63
93
- } , { } ] , 4 :[ function ( _dereq_ , module , exports ) {
64
+ } , { } ] , 3 :[ function ( _dereq_ , module , exports ) {
94
65
( function ( global ) {
95
66
/*global XDomainRequest:false, __DEV__:false*/
96
67
'use strict' ;
97
68
98
- var TraceKit = _dereq_ ( 7 ) ;
99
- var RavenConfigError = _dereq_ ( 2 ) ;
100
- var utils = _dereq_ ( 6 ) ;
69
+ var TraceKit = _dereq_ ( 6 ) ;
70
+ var stringify = _dereq_ ( 7 ) ;
71
+ var RavenConfigError = _dereq_ ( 1 ) ;
72
+ var utils = _dereq_ ( 5 ) ;
101
73
102
74
var isError = utils . isError ,
103
75
isObject = utils . isObject ;
104
76
105
- var stringify = _dereq_ ( 1 ) ;
106
-
107
- var wrapConsoleMethod = _dereq_ ( 3 ) . wrapMethod ;
77
+ var wrapConsoleMethod = _dereq_ ( 2 ) . wrapMethod ;
108
78
109
79
var dsnKeys = 'source protocol user pass host port path' . split ( ' ' ) ,
110
80
dsnPattern = / ^ (?: ( \w + ) : ) ? \/ \/ (?: ( \w + ) ( : \w + ) ? @ ) ? ( [ \w \. - ] + ) (?: : ( \d + ) ) ? ( \/ .* ) / ;
@@ -146,7 +116,8 @@ function Raven() {
146
116
collectWindowErrors : true ,
147
117
maxMessageLength : 0 ,
148
118
stackTraceLimit : 50 ,
149
- autoBreadcrumbs : true
119
+ autoBreadcrumbs : true ,
120
+ sampleRate : 1
150
121
} ;
151
122
this . _ignoreOnError = 0 ;
152
123
this . _isRavenInstalled = false ;
@@ -181,7 +152,7 @@ Raven.prototype = {
181
152
// webpack (using a build step causes webpack #1617). Grunt verifies that
182
153
// this value matches package.json during build.
183
154
// See: https://github.com/getsentry/raven-js/issues/465
184
- VERSION : '3.12.1 ' ,
155
+ VERSION : '3.13.0 ' ,
185
156
186
157
debug : false ,
187
158
@@ -1583,7 +1554,13 @@ Raven.prototype = {
1583
1554
return ;
1584
1555
}
1585
1556
1586
- this . _sendProcessedPayload ( data ) ;
1557
+ if ( typeof globalOptions . sampleRate === 'number' ) {
1558
+ if ( Math . random ( ) < globalOptions . sampleRate ) {
1559
+ this . _sendProcessedPayload ( data ) ;
1560
+ }
1561
+ } else {
1562
+ this . _sendProcessedPayload ( data ) ;
1563
+ }
1587
1564
} ,
1588
1565
1589
1566
_getUuid : function ( ) {
@@ -1679,24 +1656,18 @@ Raven.prototype = {
1679
1656
if ( ! hasCORS ) return ;
1680
1657
1681
1658
var url = opts . url ;
1682
- function handler ( ) {
1683
- if ( request . status === 200 ) {
1684
- if ( opts . onSuccess ) {
1685
- opts . onSuccess ( ) ;
1686
- }
1687
- } else if ( opts . onError ) {
1688
- var err = new Error ( 'Sentry error code: ' + request . status ) ;
1689
- err . request = request ;
1690
- opts . onError ( err ) ;
1691
- }
1692
- }
1693
1659
1694
1660
if ( 'withCredentials' in request ) {
1695
1661
request . onreadystatechange = function ( ) {
1696
1662
if ( request . readyState !== 4 ) {
1697
1663
return ;
1664
+ } else if ( request . status === 200 ) {
1665
+ opts . onSuccess && opts . onSuccess ( ) ;
1666
+ } else if ( opts . onError ) {
1667
+ var err = new Error ( 'Sentry error code: ' + request . status ) ;
1668
+ err . request = request ;
1669
+ opts . onError ( err ) ;
1698
1670
}
1699
- handler ( ) ;
1700
1671
} ;
1701
1672
} else {
1702
1673
request = new XDomainRequest ( ) ;
@@ -1705,7 +1676,16 @@ Raven.prototype = {
1705
1676
url = url . replace ( / ^ h t t p s ? : / , '' ) ;
1706
1677
1707
1678
// onreadystatechange not supported by XDomainRequest
1708
- request . onload = handler ;
1679
+ if ( opts . onSuccess ) {
1680
+ request . onload = opts . onSuccess ;
1681
+ }
1682
+ if ( opts . onError ) {
1683
+ request . onerror = function ( ) {
1684
+ var err = new Error ( 'Sentry error code: XDomainRequest' ) ;
1685
+ err . request = request ;
1686
+ opts . onError ( err ) ;
1687
+ }
1688
+ }
1709
1689
}
1710
1690
1711
1691
// NOTE: auth is intentionally sent as part of query string (NOT as custom
@@ -2059,7 +2039,7 @@ Raven.prototype.setReleaseContext = Raven.prototype.setRelease;
2059
2039
module . exports = Raven ;
2060
2040
2061
2041
} ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
2062
- } , { "1" :1 , "2" :2 , "3" : 3 , "6" :6 , "7" :7 } ] , 5 :[ function ( _dereq_ , module , exports ) {
2042
+ } , { "1" :1 , "2" :2 , "5" : 5 , "6" :6 , "7" :7 } ] , 4 :[ function ( _dereq_ , module , exports ) {
2063
2043
( function ( global ) {
2064
2044
/**
2065
2045
* Enforces a single instance of the Raven client, and the
@@ -2069,7 +2049,7 @@ module.exports = Raven;
2069
2049
2070
2050
'use strict' ;
2071
2051
2072
- var RavenConstructor = _dereq_ ( 4 ) ;
2052
+ var RavenConstructor = _dereq_ ( 3 ) ;
2073
2053
2074
2054
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
2075
2055
var _window = typeof window !== 'undefined' ? window
@@ -2096,7 +2076,7 @@ Raven.afterLoad();
2096
2076
module . exports = Raven ;
2097
2077
2098
2078
} ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
2099
- } , { "4" : 4 } ] , 6 :[ function ( _dereq_ , module , exports ) {
2079
+ } , { "3" : 3 } ] , 5 :[ function ( _dereq_ , module , exports ) {
2100
2080
'use strict' ;
2101
2081
2102
2082
function isObject ( what ) {
@@ -2117,11 +2097,11 @@ module.exports = {
2117
2097
isObject : isObject ,
2118
2098
isError : isError
2119
2099
} ;
2120
- } , { } ] , 7 :[ function ( _dereq_ , module , exports ) {
2100
+ } , { } ] , 6 :[ function ( _dereq_ , module , exports ) {
2121
2101
( function ( global ) {
2122
2102
'use strict' ;
2123
2103
2124
- var utils = _dereq_ ( 6 ) ;
2104
+ var utils = _dereq_ ( 5 ) ;
2125
2105
2126
2106
/*
2127
2107
TraceKit - Cross brower stack traces
@@ -2737,5 +2717,54 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
2737
2717
module . exports = TraceKit ;
2738
2718
2739
2719
} ) . call ( this , typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : { } )
2740
- } , { "6" :6 } ] } , { } , [ 5 ] ) ( 5 )
2720
+ } , { "5" :5 } ] , 7 :[ function ( _dereq_ , module , exports ) {
2721
+ 'use strict' ;
2722
+
2723
+ /*
2724
+ json-stringify-safe
2725
+ Like JSON.stringify, but doesn't throw on circular references.
2726
+
2727
+ Originally forked from https://github.com/isaacs/json-stringify-safe
2728
+ version 5.0.1 on 3/8/2017 and modified for IE8 compatibility.
2729
+ Tests for this are in test/vendor.
2730
+
2731
+ ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE
2732
+ */
2733
+
2734
+ exports = module . exports = stringify
2735
+ exports . getSerialize = serializer
2736
+
2737
+ function indexOf ( haystack , needle ) {
2738
+ for ( var i = 0 ; i < haystack . length ; ++ i ) {
2739
+ if ( haystack [ i ] === needle ) return i ;
2740
+ }
2741
+ return - 1 ;
2742
+ }
2743
+
2744
+ function stringify ( obj , replacer , spaces , cycleReplacer ) {
2745
+ return JSON . stringify ( obj , serializer ( replacer , cycleReplacer ) , spaces )
2746
+ }
2747
+
2748
+ function serializer ( replacer , cycleReplacer ) {
2749
+ var stack = [ ] , keys = [ ]
2750
+
2751
+ if ( cycleReplacer == null ) cycleReplacer = function ( key , value ) {
2752
+ if ( stack [ 0 ] === value ) return '[Circular ~]'
2753
+ return '[Circular ~.' + keys . slice ( 0 , indexOf ( stack , value ) ) . join ( '.' ) + ']'
2754
+ }
2755
+
2756
+ return function ( key , value ) {
2757
+ if ( stack . length > 0 ) {
2758
+ var thisPos = indexOf ( stack , this ) ;
2759
+ ~ thisPos ? stack . splice ( thisPos + 1 ) : stack . push ( this )
2760
+ ~ thisPos ? keys . splice ( thisPos , Infinity , key ) : keys . push ( key )
2761
+ if ( ~ indexOf ( stack , value ) ) value = cycleReplacer . call ( this , key , value )
2762
+ }
2763
+ else stack . push ( value )
2764
+
2765
+ return replacer == null ? value : replacer . call ( this , key , value )
2766
+ }
2767
+ }
2768
+
2769
+ } , { } ] } , { } , [ 4 ] ) ( 4 )
2741
2770
} ) ;
0 commit comments