1
- /*! Raven.js 1.1.6 (4e078a0 ) | github.com/getsentry/raven-js */
1
+ /*! Raven.js 1.1.7 (1a6c054 ) | github.com/getsentry/raven-js */
2
2
3
3
/*
4
4
* Includes TraceKit
14
14
MIT license
15
15
*/
16
16
17
- ; ( function ( window , undefined ) {
17
+ ( function ( window , undefined ) {
18
18
19
19
20
20
var TraceKit = { } ;
@@ -166,19 +166,29 @@ TraceKit.report = (function reportModuleWrapper() {
166
166
* @param {string } url URL of script that generated the exception.
167
167
* @param {(number|string) } lineNo The line number at which the error
168
168
* occurred.
169
+ * @param {?(number|string) } colNo The column number at which the error
170
+ * occurred.
171
+ * @param {?Error } ex The actual Error object.
169
172
*/
170
- function traceKitWindowOnError ( message , url , lineNo ) {
171
- var stack = null ;
172
-
173
- if ( lastExceptionStack ) {
173
+ function traceKitWindowOnError ( message , url , lineNo , colNo , ex ) {
174
+ var stack = null , skipNotify = false ;
175
+
176
+ if ( ! _isUndefined ( ex ) ) {
177
+ // New chrome and blink send along a real error object
178
+ // Let's just report that like a normal error.
179
+ // See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
180
+ report ( ex , false ) ;
181
+ skipNotify = true ;
182
+ } else if ( lastExceptionStack ) {
174
183
TraceKit . computeStackTrace . augmentStackTraceWithInitialElement ( lastExceptionStack , url , lineNo , message ) ;
175
184
stack = lastExceptionStack ;
176
185
lastExceptionStack = null ;
177
186
lastException = null ;
178
187
} else {
179
188
var location = {
180
189
'url' : url ,
181
- 'line' : lineNo
190
+ 'line' : lineNo ,
191
+ 'column' : colNo
182
192
} ;
183
193
location . func = TraceKit . computeStackTrace . guessFunctionName ( location . url , location . line ) ;
184
194
location . context = TraceKit . computeStackTrace . gatherContext ( location . url , location . line ) ;
@@ -191,7 +201,9 @@ TraceKit.report = (function reportModuleWrapper() {
191
201
} ;
192
202
}
193
203
194
- notifyHandlers ( stack , 'from window.onerror' ) ;
204
+ if ( ! skipNotify ) {
205
+ notifyHandlers ( stack , 'from window.onerror' ) ;
206
+ }
195
207
196
208
if ( _oldOnerrorHandler ) {
197
209
return _oldOnerrorHandler . apply ( this , arguments ) ;
@@ -213,8 +225,11 @@ TraceKit.report = (function reportModuleWrapper() {
213
225
/**
214
226
* Reports an unhandled Error to TraceKit.
215
227
* @param {Error } ex
228
+ * @param {?boolean } rethrow If false, do not re-throw the exception.
229
+ * Only used for window.onerror to not cause an infinite loop of
230
+ * rethrowing.
216
231
*/
217
- function report ( ex ) {
232
+ function report ( ex , rethrow ) {
218
233
var args = _slice . call ( arguments , 1 ) ;
219
234
if ( lastExceptionStack ) {
220
235
if ( lastException === ex ) {
@@ -243,7 +258,9 @@ TraceKit.report = (function reportModuleWrapper() {
243
258
}
244
259
} , ( stack . incomplete ? 2000 : 0 ) ) ;
245
260
246
- throw ex ; // re-throw to propagate to the top level (and cause window.onerror)
261
+ if ( rethrow !== false ) {
262
+ throw ex ; // re-throw to propagate to the top level (and cause window.onerror)
263
+ }
247
264
}
248
265
249
266
report . subscribe = subscribe ;
@@ -333,14 +350,14 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
333
350
return '' ;
334
351
}
335
352
try {
336
- function getXHR ( ) {
353
+ var getXHR = function ( ) {
337
354
try {
338
355
return new window . XMLHttpRequest ( ) ;
339
356
} catch ( e ) {
340
357
// explicitly bubble up the exception if not found
341
358
return new window . ActiveXObject ( 'Microsoft.XMLHTTP' ) ;
342
359
}
343
- }
360
+ } ;
344
361
345
362
var request = getXHR ( ) ;
346
363
request . open ( 'GET' , url , false ) ;
@@ -629,8 +646,8 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
629
646
return null ;
630
647
}
631
648
632
- var chrome = / ^ \s * a t (?: ( (?: \[ o b j e c t o b j e c t \] ) ? \S + ) ) ? \( ? ( (?: f i l e | h t t p | h t t p s ) : .* ?) : ( \d + ) (?: : ( \d + ) ) ? \) ? \s * $ / i,
633
- gecko = / ^ \s * ( \S * ) (?: \( ( .* ?) \) ) ? @ ( (?: f i l e | h t t p | h t t p s ) .* ?) : ( \d + ) (?: : ( \d + ) ) ? \s * $ / i,
649
+ var chrome = / ^ \s * a t (?: ( (?: \[ o b j e c t o b j e c t \] ) ? \S + (?: \[ a s \S + \] ) ? ) ) ? \( ? ( (?: f i l e | h t t p s ? ) : .* ?) : ( \d + ) (?: : ( \d + ) ) ? \) ? \s * $ / i,
650
+ gecko = / ^ \s * ( \S * ) (?: \( ( .* ?) \) ) ? @ ( (?: f i l e | h t t p s ? ) .* ?) : ( \d + ) (?: : ( \d + ) ) ? \s * $ / i,
634
651
lines = ex . stack . split ( '\n' ) ,
635
652
stack = [ ] ,
636
653
parts ,
@@ -773,8 +790,8 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
773
790
return null ;
774
791
}
775
792
776
- var lineRE1 = / ^ \s * L i n e ( \d + ) o f l i n k e d s c r i p t ( (?: f i l e | h t t p | h t t p s ) \S + ) (?: : i n f u n c t i o n ( \S + ) ) ? \s * $ / i,
777
- lineRE2 = / ^ \s * L i n e ( \d + ) o f i n l i n e # ( \d + ) s c r i p t i n ( (?: f i l e | h t t p | h t t p s ) \S + ) (?: : i n f u n c t i o n ( \S + ) ) ? \s * $ / i,
793
+ var lineRE1 = / ^ \s * L i n e ( \d + ) o f l i n k e d s c r i p t ( (?: f i l e | h t t p s ? ) \S + ) (?: : i n f u n c t i o n ( \S + ) ) ? \s * $ / i,
794
+ lineRE2 = / ^ \s * L i n e ( \d + ) o f i n l i n e # ( \d + ) s c r i p t i n ( (?: f i l e | h t t p s ? ) \S + ) (?: : i n f u n c t i o n ( \S + ) ) ? \s * $ / i,
778
795
lineRE3 = / ^ \s * L i n e ( \d + ) o f f u n c t i o n s c r i p t \s * $ / i,
779
796
stack = [ ] ,
780
797
scripts = document . getElementsByTagName ( 'script' ) ,
@@ -1064,8 +1081,6 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
1064
1081
} catch ( ex ) {
1065
1082
return computeStackTrace ( ex , depth + 1 ) ;
1066
1083
}
1067
-
1068
- return null ;
1069
1084
}
1070
1085
1071
1086
computeStackTrace . augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement ;
@@ -1132,7 +1147,7 @@ TK.remoteFetching = false;
1132
1147
* @this {Raven}
1133
1148
*/
1134
1149
var Raven = {
1135
- VERSION : '1.1.6 ' ,
1150
+ VERSION : '1.1.7 ' ,
1136
1151
1137
1152
// Expose TraceKit to the Raven namespace
1138
1153
TraceKit : TK ,
@@ -1361,7 +1376,7 @@ var Raven = {
1361
1376
captureMessage : function ( msg , options ) {
1362
1377
// Fire away!
1363
1378
send (
1364
- arrayMerge ( {
1379
+ objectMerge ( {
1365
1380
message : msg
1366
1381
} , options )
1367
1382
) ;
@@ -1462,6 +1477,11 @@ function isString(what) {
1462
1477
return typeof what === 'string' ;
1463
1478
}
1464
1479
1480
+ function isEmptyObject ( what ) {
1481
+ for ( var k in what ) return false ;
1482
+ return true ;
1483
+ }
1484
+
1465
1485
function each ( obj , callback ) {
1466
1486
var i , j ;
1467
1487
@@ -1627,7 +1647,7 @@ function processException(type, message, fileurl, lineno, frames, options) {
1627
1647
1628
1648
// Fire away!
1629
1649
send (
1630
- arrayMerge ( {
1650
+ objectMerge ( {
1631
1651
// sentry.interfaces.Exception
1632
1652
exception : {
1633
1653
type : type ,
@@ -1641,14 +1661,14 @@ function processException(type, message, fileurl, lineno, frames, options) {
1641
1661
) ;
1642
1662
}
1643
1663
1644
- function arrayMerge ( arr1 , arr2 ) {
1645
- if ( ! arr2 ) {
1646
- return arr1 ;
1664
+ function objectMerge ( obj1 , obj2 ) {
1665
+ if ( ! obj2 ) {
1666
+ return obj1 ;
1647
1667
}
1648
- each ( arr2 , function ( key , value ) {
1649
- arr1 [ key ] = value ;
1668
+ each ( obj2 , function ( key , value ) {
1669
+ obj1 [ key ] = value ;
1650
1670
} ) ;
1651
- return arr1 ;
1671
+ return obj1 ;
1652
1672
}
1653
1673
1654
1674
function getHttpData ( ) {
@@ -1669,7 +1689,7 @@ function getHttpData() {
1669
1689
function send ( data ) {
1670
1690
if ( ! isSetup ( ) ) return ;
1671
1691
1672
- data = arrayMerge ( {
1692
+ data = objectMerge ( {
1673
1693
project : globalProject ,
1674
1694
logger : globalOptions . logger ,
1675
1695
site : globalOptions . site ,
@@ -1678,13 +1698,13 @@ function send(data) {
1678
1698
request : getHttpData ( )
1679
1699
} , data ) ;
1680
1700
1681
- // Merge in the tags and extra separately since arrayMerge doesn't handle a deep merge
1682
- data . tags = arrayMerge ( globalOptions . tags , data . tags ) ;
1683
- data . extra = arrayMerge ( globalOptions . extra , data . extra ) ;
1701
+ // Merge in the tags and extra separately since objectMerge doesn't handle a deep merge
1702
+ data . tags = objectMerge ( globalOptions . tags , data . tags ) ;
1703
+ data . extra = objectMerge ( globalOptions . extra , data . extra ) ;
1684
1704
1685
1705
// If there are no tags/extra, strip the key from the payload alltogther.
1686
- if ( ! data . tags ) delete data . tags ;
1687
- if ( ! data . extra ) delete data . extra ;
1706
+ if ( isEmptyObject ( data . tags ) ) delete data . tags ;
1707
+ if ( isEmptyObject ( data . extra ) ) delete data . extra ;
1688
1708
1689
1709
if ( globalUser ) {
1690
1710
// sentry.interfaces.User
0 commit comments