|
4 | 4 | // Johan Euphrosine <proppy@aminche.com> (2008) |
5 | 5 | // Oyvind Sean Kinsey http://kinsey.no/blog (2010) |
6 | 6 | // Victor Homyakov <victor-homyakov@users.sourceforge.net> (2010) |
7 | | -/*global module, exports, define*/ |
| 7 | +/*global module, exports, define, ActiveXObject*/ |
8 | 8 | (function(global, factory) { |
9 | 9 | if (typeof exports === 'object') { |
10 | 10 | // Node |
|
143 | 143 | * @return Array<String> of function calls, files and line numbers |
144 | 144 | */ |
145 | 145 | chrome: function(e) { |
146 | | - var stack = (e.stack + '\n').replace(/^\S[^\(]+?[\n$]/gm, ''). |
147 | | - replace(/^\s+(at eval )?at\s+/gm, ''). |
148 | | - replace(/^([^\(]+?)([\n$])/gm, '{anonymous}()@$1$2'). |
149 | | - replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}()@$1').split('\n'); |
| 146 | + var stack = (e.stack + '\n') |
| 147 | + .replace(/^\S[^\(]+?[\n$]/gm, '') // remove first line |
| 148 | + .replace(/^\s+(at eval )?at\s+/gm, '') // remove 'at' and indentation |
| 149 | + .replace(/^([^\(]+?)([\n$])/gm, '{anonymous}() ($1)$2') |
| 150 | + .replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm, '{anonymous}() ($1)') |
| 151 | + .replace(/^(.+) \((.+)\)$/gm, '$1@$2') |
| 152 | + .split('\n'); |
150 | 153 | stack.pop(); |
151 | 154 | return stack; |
152 | 155 | }, |
|
185 | 188 | * @return Array<String> of function calls, files and line numbers |
186 | 189 | */ |
187 | 190 | firefox: function(e) { |
188 | | - return e.stack.replace(/(?:\n@:0)?\s+$/m, '').replace(/^[\(@]/gm, '{anonymous}()@').split('\n'); |
| 191 | + return e.stack.replace(/(?:\n@:0)?\s+$/m, '') |
| 192 | + .replace(/^(?:\((\S*)\))?@/gm, '{anonymous}($1)@') |
| 193 | + .split('\n'); |
189 | 194 | }, |
190 | 195 |
|
191 | 196 | opera11: function(e) { |
|
0 commit comments