1
- /*! Raven.js 1.1.10 (e96d774 ) | github.com/getsentry/raven-js */
1
+ /*! Raven.js 1.1.11 (11645a0 ) | github.com/getsentry/raven-js */
2
2
3
3
/*
4
4
* Includes TraceKit
@@ -89,6 +89,7 @@ TraceKit.wrap = function traceKitWrapper(func) {
89
89
*/
90
90
TraceKit . report = ( function reportModuleWrapper ( ) {
91
91
var handlers = [ ] ,
92
+ lastArgs = null ,
92
93
lastException = null ,
93
94
lastExceptionStack = null ;
94
95
@@ -125,9 +126,9 @@ TraceKit.report = (function reportModuleWrapper() {
125
126
* Dispatch stack information to all handlers.
126
127
* @param {Object.<string, *> } stack
127
128
*/
128
- function notifyHandlers ( stack , windowError ) {
129
+ function notifyHandlers ( stack , isWindowError ) {
129
130
var exception = null ;
130
- if ( windowError && ! TraceKit . collectWindowErrors ) {
131
+ if ( isWindowError && ! TraceKit . collectWindowErrors ) {
131
132
return ;
132
133
}
133
134
for ( var i in handlers ) {
@@ -159,19 +160,17 @@ TraceKit.report = (function reportModuleWrapper() {
159
160
* @param {?Error } ex The actual Error object.
160
161
*/
161
162
function traceKitWindowOnError ( message , url , lineNo , colNo , ex ) {
162
- var stack = null , skipNotify = false ;
163
+ var stack = null ;
163
164
164
- if ( ! isUndefined ( ex ) ) {
165
+ if ( lastExceptionStack ) {
166
+ TraceKit . computeStackTrace . augmentStackTraceWithInitialElement ( lastExceptionStack , url , lineNo , message ) ;
167
+ processLastException ( ) ;
168
+ } else if ( ex ) {
165
169
// New chrome and blink send along a real error object
166
170
// Let's just report that like a normal error.
167
171
// See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
168
- report ( ex , false ) ;
169
- skipNotify = true ;
170
- } else if ( lastExceptionStack ) {
171
- TraceKit . computeStackTrace . augmentStackTraceWithInitialElement ( lastExceptionStack , url , lineNo , message ) ;
172
- stack = lastExceptionStack ;
173
- lastExceptionStack = null ;
174
- lastException = null ;
172
+ stack = TraceKit . computeStackTrace ( ex ) ;
173
+ notifyHandlers ( stack , true ) ;
175
174
} else {
176
175
var location = {
177
176
'url' : url ,
@@ -181,16 +180,11 @@ TraceKit.report = (function reportModuleWrapper() {
181
180
location . func = TraceKit . computeStackTrace . guessFunctionName ( location . url , location . line ) ;
182
181
location . context = TraceKit . computeStackTrace . gatherContext ( location . url , location . line ) ;
183
182
stack = {
184
- 'mode' : 'onerror' ,
185
183
'message' : message ,
186
184
'url' : document . location . href ,
187
- 'stack' : [ location ] ,
188
- 'useragent' : navigator . userAgent
185
+ 'stack' : [ location ]
189
186
} ;
190
- }
191
-
192
- if ( ! skipNotify ) {
193
- notifyHandlers ( stack , 'from window.onerror' ) ;
187
+ notifyHandlers ( stack , true ) ;
194
188
}
195
189
196
190
if ( _oldOnerrorHandler ) {
@@ -220,6 +214,15 @@ TraceKit.report = (function reportModuleWrapper() {
220
214
_oldOnerrorHandler = undefined ;
221
215
}
222
216
217
+ function processLastException ( ) {
218
+ var _lastExceptionStack = lastExceptionStack ,
219
+ _lastArgs = lastArgs ;
220
+ lastArgs = null ;
221
+ lastExceptionStack = null ;
222
+ lastException = null ;
223
+ notifyHandlers . apply ( null , [ _lastExceptionStack , false ] . concat ( _lastArgs ) ) ;
224
+ }
225
+
223
226
/**
224
227
* Reports an unhandled Error to TraceKit.
225
228
* @param {Error } ex
@@ -233,26 +236,22 @@ TraceKit.report = (function reportModuleWrapper() {
233
236
if ( lastException === ex ) {
234
237
return ; // already caught by an inner catch block, ignore
235
238
} else {
236
- var s = lastExceptionStack ;
237
- lastExceptionStack = null ;
238
- lastException = null ;
239
- notifyHandlers . apply ( null , [ s , null ] . concat ( args ) ) ;
239
+ processLastException ( ) ;
240
240
}
241
241
}
242
242
243
243
var stack = TraceKit . computeStackTrace ( ex ) ;
244
244
lastExceptionStack = stack ;
245
245
lastException = ex ;
246
+ lastArgs = args ;
246
247
247
248
// If the stack trace is incomplete, wait for 2 seconds for
248
249
// slow slow IE to see if onerror occurs or not before reporting
249
250
// this exception; otherwise, we will end up with an incomplete
250
251
// stack trace
251
252
window . setTimeout ( function ( ) {
252
253
if ( lastException === ex ) {
253
- lastExceptionStack = null ;
254
- lastException = null ;
255
- notifyHandlers . apply ( null , [ stack , null ] . concat ( args ) ) ;
254
+ processLastException ( ) ;
256
255
}
257
256
} , ( stack . incomplete ? 2000 : 0 ) ) ;
258
257
@@ -282,7 +281,6 @@ TraceKit.report = (function reportModuleWrapper() {
282
281
* s.stack[i].line - line number, if known
283
282
* s.stack[i].column - column number, if known
284
283
* s.stack[i].context - an array of source code lines; the middle element corresponds to the correct line#
285
- * s.mode - 'stack', 'stacktrace', 'multiline', 'callers', 'onerror', or 'failed' -- method used to collect the stack trace
286
284
*
287
285
* Supports:
288
286
* - Firefox: full stack trace with line numbers and unreliable column
@@ -373,6 +371,7 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
373
371
* @return {Array.<string> } Source contents.
374
372
*/
375
373
function getSource ( url ) {
374
+ if ( ! isString ( url ) ) return [ ] ;
376
375
if ( ! hasKey ( sourceCache , url ) ) {
377
376
// URL needs to be able to fetched within the acceptable domain. Otherwise,
378
377
// cross-domain errors will be triggered.
@@ -614,6 +613,7 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
614
613
// ex.message = qq is not defined
615
614
// ex.fileName = http://...
616
615
// ex.lineNumber = 59
616
+ // ex.columnNumber = 69
617
617
// ex.stack = ...stack trace... (see the example below)
618
618
// ex.name = ReferenceError
619
619
//
@@ -684,21 +684,24 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
684
684
stack . push ( element ) ;
685
685
}
686
686
687
- if ( stack [ 0 ] && stack [ 0 ] . line && ! stack [ 0 ] . column && reference ) {
688
- stack [ 0 ] . column = findSourceInLine ( reference [ 1 ] , stack [ 0 ] . url , stack [ 0 ] . line ) ;
689
- }
690
-
691
687
if ( ! stack . length ) {
692
688
return null ;
693
689
}
694
690
691
+ if ( stack [ 0 ] . line && ! stack [ 0 ] . column && reference ) {
692
+ stack [ 0 ] . column = findSourceInLine ( reference [ 1 ] , stack [ 0 ] . url , stack [ 0 ] . line ) ;
693
+ } else if ( ! stack [ 0 ] . column && ! isUndefined ( ex . columnNumber ) ) {
694
+ // FireFox uses this awesome columnNumber property for its top frame
695
+ // Also note, Firefox's column number is 0-based and everything else expects 1-based,
696
+ // so adding 1
697
+ stack [ 0 ] . column = ex . columnNumber + 1 ;
698
+ }
699
+
695
700
return {
696
- 'mode' : 'stack' ,
697
701
'name' : ex . name ,
698
702
'message' : ex . message ,
699
703
'url' : document . location . href ,
700
- 'stack' : stack ,
701
- 'useragent' : navigator . userAgent
704
+ 'stack' : stack
702
705
} ;
703
706
}
704
707
@@ -751,12 +754,10 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
751
754
}
752
755
753
756
return {
754
- 'mode' : 'stacktrace' ,
755
757
'name' : ex . name ,
756
758
'message' : ex . message ,
757
759
'url' : document . location . href ,
758
- 'stack' : stack ,
759
- 'useragent' : navigator . userAgent
760
+ 'stack' : stack
760
761
} ;
761
762
}
762
763
@@ -863,12 +864,10 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
863
864
}
864
865
865
866
return {
866
- 'mode' : 'multiline' ,
867
867
'name' : ex . name ,
868
868
'message' : lines [ 0 ] ,
869
869
'url' : document . location . href ,
870
- 'stack' : stack ,
871
- 'useragent' : navigator . userAgent
870
+ 'stack' : stack
872
871
} ;
873
872
}
874
873
@@ -996,12 +995,10 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
996
995
}
997
996
998
997
var result = {
999
- 'mode' : 'callers' ,
1000
998
'name' : ex . name ,
1001
999
'message' : ex . message ,
1002
1000
'url' : document . location . href ,
1003
- 'stack' : stack ,
1004
- 'useragent' : navigator . userAgent
1001
+ 'stack' : stack
1005
1002
} ;
1006
1003
augmentStackTraceWithInitialElement ( result , ex . sourceURL || ex . fileName , ex . line || ex . lineNumber , ex . message || ex . description ) ;
1007
1004
return result ;
@@ -1063,9 +1060,7 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
1063
1060
}
1064
1061
}
1065
1062
1066
- return {
1067
- 'mode' : 'failed'
1068
- } ;
1063
+ return { } ;
1069
1064
}
1070
1065
1071
1066
/**
@@ -1120,7 +1115,7 @@ var _Raven = window.Raven,
1120
1115
* @this {Raven}
1121
1116
*/
1122
1117
var Raven = {
1123
- VERSION : '1.1.10 ' ,
1118
+ VERSION : '1.1.11 ' ,
1124
1119
1125
1120
// Expose TraceKit to the Raven namespace
1126
1121
TraceKit : TraceKit ,
0 commit comments