|
38 | 38 | * @return Array[String] |
39 | 39 | */ |
40 | 40 | extractLocation: function ErrorStackParser$$extractLocation(urlLike) { |
41 | | - var locationParts = urlLike.split(':'); |
| 41 | + // Fail-fast but return locations like "(native)" |
| 42 | + if (urlLike.indexOf(':') === -1) { |
| 43 | + return [urlLike]; |
| 44 | + } |
| 45 | + |
| 46 | + var locationParts = urlLike.replace(/[\(\)\s]/g, '').split(':'); |
42 | 47 | var lastNumber = locationParts.pop(); |
43 | 48 | var possibleNumber = locationParts[locationParts.length - 1]; |
44 | 49 | if (!isNaN(parseFloat(possibleNumber)) && isFinite(possibleNumber)) { |
|
50 | 55 | }, |
51 | 56 |
|
52 | 57 | parseV8OrIE: function ErrorStackParser$$parseV8OrIE(error) { |
53 | | - return error.stack.split('\n').slice(1).map(function (line) { |
| 58 | + return error.stack.split('\n').filter(function (line) { |
| 59 | + return !!line.match(CHROME_IE_STACK_REGEXP); |
| 60 | + }, this).map(function (line) { |
54 | 61 | var tokens = line.replace(/^\s+/, '').split(/\s+/).slice(1); |
55 | | - var locationParts = this.extractLocation(tokens.pop().replace(/[\(\)\s]/g, '')); |
| 62 | + var locationParts = this.extractLocation(tokens.pop()); |
56 | 63 | var functionName = (!tokens[0] || tokens[0] === 'Anonymous') ? undefined : tokens[0]; |
57 | | - return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2]); |
| 64 | + return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); |
58 | 65 | }, this); |
59 | 66 | }, |
60 | 67 |
|
|
65 | 72 | var tokens = line.split('@'); |
66 | 73 | var locationParts = this.extractLocation(tokens.pop()); |
67 | 74 | var functionName = tokens.shift() || undefined; |
68 | | - return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2]); |
| 75 | + return new StackFrame(functionName, undefined, locationParts[0], locationParts[1], locationParts[2], line); |
69 | 76 | }, this); |
70 | 77 | }, |
71 | 78 |
|
|
88 | 95 | for (var i = 2, len = lines.length; i < len; i += 2) { |
89 | 96 | var match = lineRE.exec(lines[i]); |
90 | 97 | if (match) { |
91 | | - result.push(new StackFrame(undefined, undefined, match[2], match[1])); |
| 98 | + result.push(new StackFrame(undefined, undefined, match[2], match[1], lines[i])); |
92 | 99 | } |
93 | 100 | } |
94 | 101 |
|
|
103 | 110 | for (var i = 0, len = lines.length; i < len; i += 2) { |
104 | 111 | var match = lineRE.exec(lines[i]); |
105 | 112 | if (match) { |
106 | | - result.push(new StackFrame(match[3] || undefined, undefined, match[2], match[1])); |
| 113 | + result.push(new StackFrame(match[3] || undefined, undefined, match[2], match[1], lines[i])); |
107 | 114 | } |
108 | 115 | } |
109 | 116 |
|
|
127 | 134 | argsRaw = functionCall.replace(/^[^\(]+\(([^\)]*)\)$/, '$1'); |
128 | 135 | } |
129 | 136 | var args = (argsRaw === undefined || argsRaw === '[arguments not available]') ? undefined : argsRaw.split(','); |
130 | | - return new StackFrame(functionName, args, locationParts[0], locationParts[1], locationParts[2]); |
| 137 | + return new StackFrame(functionName, args, locationParts[0], locationParts[1], locationParts[2], line); |
131 | 138 | }, this); |
132 | 139 | } |
133 | 140 | }; |
|
0 commit comments