11// tslint:disable
22
3- import { getGlobalObject , isError , isErrorEvent } from '@sentry/utils' ;
3+ import { getGlobalObject , isError , isErrorEvent , normalize } from '@sentry/utils' ;
44
55/**
66 * @hidden
@@ -38,7 +38,6 @@ interface ComputeStackTrace {
3838 * @param {(string|number)= } depth
3939 */
4040 ( ex : Error , depth ?: string | number ) : StackTrace ;
41- _computeStackTraceFromStackProp ( ex : any ) : StackTrace ;
4241}
4342
4443/**
@@ -275,6 +274,9 @@ TraceKit._report = (function reportModuleWrapper() {
275274 var err = ( e && ( e . detail ? e . detail . reason : e . reason ) ) || e ;
276275 var stack = TraceKit . _computeStackTrace ( err ) ;
277276 stack . mechanism = 'onunhandledrejection' ;
277+ if ( ! stack . message ) {
278+ stack . message = JSON . stringify ( normalize ( err ) )
279+ }
278280 _notifyHandlers ( stack , true , err ) ;
279281 }
280282
@@ -479,7 +481,7 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {
479481 // gecko regex: `(?:bundle|\d+\.js)`: `bundle` is for react native, `\d+\.js` also but specifically for ram bundles because it
480482 // generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
481483 // We need this specific case for now because we want no other regex to match.
482- gecko = / ^ \s * ( .* ?) (?: \( ( .* ?) \) ) ? (?: ^ | @ ) ( (?: f i l e | h t t p s ? | b l o b | c h r o m e | w e b p a c k | r e s o u r c e | m o z - e x t e n s i o n ) .* ?: \/ .* ?| \[ n a t i v e c o d e \] | [ ^ @ ] * (?: b u n d l e | \d + \. j s ) ) (?: : ( \d + ) ) ? (?: : ( \d + ) ) ? \s * $ / i,
484+ gecko = / ^ \s * ( .* ?) (?: \( ( .* ?) \) ) ? (?: ^ | @ ) ? ( (?: f i l e | h t t p s ? | b l o b | c h r o m e | w e b p a c k | r e s o u r c e | m o z - e x t e n s i o n ) .* ?: \/ .* ?| \[ n a t i v e c o d e \] | [ ^ @ ] * (?: b u n d l e | \d + \. j s ) ) (?: : ( \d + ) ) ? (?: : ( \d + ) ) ? \s * $ / i,
483485 winjs = / ^ \s * a t (?: ( (?: \[ o b j e c t o b j e c t \] ) ? .+ ) ) ? \( ? ( (?: f i l e | m s - a p p x | h t t p s ? | w e b p a c k | b l o b ) : .* ?) : ( \d + ) (?: : ( \d + ) ) ? \) ? \s * $ / i,
484486 // Used to additionally parse URL/line/column from eval frames
485487 isEval ,
@@ -494,6 +496,7 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {
494496
495497 for ( var i = 0 , j = lines . length ; i < j ; ++ i ) {
496498 if ( ( parts = chrome . exec ( lines [ i ] ) ) ) {
499+ var isNative = parts [ 2 ] && parts [ 2 ] . indexOf ( 'native' ) === 0 ; // start of line
497500 isEval = parts [ 2 ] && parts [ 2 ] . indexOf ( 'eval' ) === 0 ; // start of line
498501 if ( isEval && ( submatch = chromeEval . exec ( parts [ 2 ] ) ) ) {
499502 // throw out eval line/column and use top-most line/column number
@@ -504,7 +507,7 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {
504507 element = {
505508 url : parts [ 2 ] ,
506509 func : parts [ 1 ] || UNKNOWN_FUNCTION ,
507- args : [ ] ,
510+ args : isNative ? [ parts [ 2 ] ] : [ ] ,
508511 line : parts [ 3 ] ? + parts [ 3 ] : null ,
509512 column : parts [ 4 ] ? + parts [ 4 ] : null ,
510513 } ;
@@ -520,6 +523,7 @@ TraceKit._computeStackTrace = (function _computeStackTraceWrapper() {
520523 isEval = parts [ 3 ] && parts [ 3 ] . indexOf ( ' > eval' ) > - 1 ;
521524 if ( isEval && ( submatch = geckoEval . exec ( parts [ 3 ] ) ) ) {
522525 // throw out eval line/column and use top-most line number
526+ parts [ 1 ] = parts [ 1 ] || `eval` ;
523527 parts [ 3 ] = submatch [ 1 ] ;
524528 parts [ 4 ] = submatch [ 2 ] ;
525529 parts [ 5 ] = '' ; // no column when eval
0 commit comments