|
56 | 56 | return filtered.map(function(line) {
|
57 | 57 | if (line.indexOf('(eval ') > -1) {
|
58 | 58 | // Throw away eval information until we implement stacktrace.js/stackframe#8
|
59 |
| - line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(\),.*$)/g, ''); |
| 59 | + line = line.replace(/eval code/g, 'eval').replace(/(\(eval at [^()]*)|(,.*$)/g, ''); |
60 | 60 | }
|
61 |
| - var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '('); |
| 61 | + var sanitizedLine = line.replace(/^\s+/, '').replace(/\(eval code/g, '(').replace(/^.*?\s+/, ''); |
62 | 62 |
|
63 | 63 | // capture and preseve the parenthesized location "(/foo/my bar.js:12:87)" in
|
64 | 64 | // case it has spaces in it, as the string is split on \s+ later on
|
65 |
| - var location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/); |
| 65 | + var location = sanitizedLine.match(/ (\(.+\)$)/); |
66 | 66 |
|
67 | 67 | // remove the parenthesized location from the line, if it was matched
|
68 | 68 | sanitizedLine = location ? sanitizedLine.replace(location[0], '') : sanitizedLine;
|
69 | 69 |
|
70 |
| - var tokens = sanitizedLine.split(/\s+/).slice(1); |
71 |
| - // if a location was matched, pass it to extractLocation() otherwise pop the last token |
72 |
| - var locationParts = this.extractLocation(location ? location[1] : tokens.pop()); |
73 |
| - var functionName = tokens.join(' ') || undefined; |
| 70 | + // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine |
| 71 | + // because this line doesn't have function name |
| 72 | + var locationParts = this.extractLocation(location ? location[1] : sanitizedLine); |
| 73 | + var functionName = location && sanitizedLine || undefined; |
74 | 74 | var fileName = ['eval', '<anonymous>'].indexOf(locationParts[0]) > -1 ? undefined : locationParts[0];
|
75 | 75 |
|
76 | 76 | return new StackFrame({
|
|
0 commit comments