tracekit/tracekit.js
/**
     * Computes stack trace information by walking the arguments.caller
     * chain at the time the exception occurred. This will cause earlier
     * frames to be missed but is the only way to get any stack trace in
     * Safari and IE. The top frame is restored by
     * {@link augmentStackTraceWithInitialElement}.
     * @param {Error} ex
     * @return {?Object.<string, *>} Stack trace information.
     */
Computes stack trace information by walking the arguments.caller
chain at the time the exception occurred. This will cause earlier
frames to be missed but is the only way to get any stack trace in
Safari and IE. The top frame is restored by
augmentStackTraceWithInitialElement.
@param {Error} ex
@return {?Object.} Stack trace information.
Computes stack trace information by walking the arguments . caller chain at the time the exception occurred . This will cause earlier frames to be missed but is the only way to get any stack trace in Safari and IE . The top frame is restored by augmentStackTraceWithInitialElement . @param { Error } ex @return { ?Object . } Stack trace information .
function computeStackTraceByWalkingCallerChain(ex, depth) {
        var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,
            stack = [],
            funcs = {},
            recursion = false,
            parts,
            item,
            source;
        for (var curr = computeStackTraceByWalkingCallerChain.caller; curr && !recursion; curr = curr.caller) {
            if (curr === computeStackTrace || curr === TraceKit.report) {
                continue;
            }
            item = {
                'url': null,
                'func': UNKNOWN_FUNCTION,
                'line': null,
                'column': null
            };
            if (curr.name) {
                item.func = curr.name;
            } else if ((parts = functionName.exec(curr.toString()))) {
                item.func = parts[1];
            }
            if (typeof item.func === 'undefined') {
              try {
                item.func = parts.input.substring(0, parts.input.indexOf('{'))
              } catch (e) { }
            }
            if ((source = findSourceByFunctionBody(curr))) {
                item.url = source.url;
                item.line = source.line;
                if (item.func === UNKNOWN_FUNCTION) {
                    item.func = guessFunctionName(item.url, item.line);
                }
                var reference = / '([^']+)' /.exec(ex.message || ex.description);
                if (reference) {
                    item.column = findSourceInLine(reference[1], source.url, source.line);
                }
            }
            if (funcs['' + curr]) {
                recursion = true;
            }else{
                funcs['' + curr] = true;
            }
            stack.push(item);
        }
        if (depth) {
            stack.splice(0, depth);
        }
        var result = {
            'mode': 'callers',
            'name': ex.name,
            'message': ex.message,
            'url': document.location.href,
            'stack': stack,
            'useragent': navigator.userAgent
        };
        augmentStackTraceWithInitialElement(result, ex.sourceURL || ex.fileName, ex.line || ex.lineNumber, ex.message || ex.description);
        return result;
    }
function computeStackTraceByWalkingCallerChain ( ex , depth ) { var functionName = / function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\( / i , stack = [ ] , funcs = { } , recursion = false , parts , item , source ; for ( var curr = computeStackTraceByWalkingCallerChain . caller ; curr && ! recursion ; curr = curr . caller ) { if ( curr === computeStackTrace || curr === TraceKit . report ) { continue ; } item = { 'url' : null , 'func' : UNKNOWN_FUNCTION , 'line' : null , 'column' : null } ; if ( curr . name ) { item . func = curr . name ; } else if ( ( parts = functionName . exec ( curr . toString ( ) ) ) ) { item . func = parts [ 1 ] ; } if ( typeof item . func === 'undefined' ) { try { item . func = parts . input . substring ( 0 , parts . input . indexOf ( '{' ) ) } catch ( e ) { } } if ( ( source = findSourceByFunctionBody ( curr ) ) ) { item . url = source . url ; item . line = source . line ; if ( item . func === UNKNOWN_FUNCTION ) { item . func = guessFunctionName ( item . url , item . line ) ; } var reference = /  '([^']+)'  / . exec ( ex . message || ex . description ) ; if ( reference ) { item . column = findSourceInLine ( reference [ 1 ] , source . url , source . line ) ; } } if ( funcs [ '' + curr ] ) { recursion = true ; } else { funcs [ '' + curr ] = true ; } stack . push ( item ) ; } if ( depth ) { stack . splice ( 0 , depth ) ; } var result = { 'mode' : 'callers' , 'name' : ex . name , 'message' : ex . message , 'url' : document . location . href , 'stack' : stack , 'useragent' : navigator . userAgent } ; augmentStackTraceWithInitialElement ( result , ex . sourceURL || ex . fileName , ex . line || ex . lineNumber , ex . message || ex . description ) ; return result ; }
Computes stack trace information by walking the arguments.caller
 chain at the time the exception occurred.
Computes stack trace information by walking the arguments . caller chain at the time the exception occurred .
// console.log('skipping internal function'); // console.log('depth is ' + depth); // console.log('stack is ' + stack.length);