Skip to content

Commit e8fa25c

Browse files
committed
Declare regex at top
1 parent 589ac17 commit e8fa25c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

vendor/TraceKit/tracekit.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,12 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
392392

393393
var chrome = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,
394394
gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?)(?::(\d+))?(?::(\d+))?\s*$/i,
395-
geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i,
396395
winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
396+
397+
// Used to additionally parse URL/line/column from eval frames
398+
geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i,
399+
chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/,
400+
397401
lines = ex.stack.split('\n'),
398402
stack = [],
399403
submatch,
@@ -405,7 +409,7 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
405409
if ((parts = chrome.exec(lines[i]))) {
406410
var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line
407411
var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
408-
if (isEval && (submatch = /\((\S*)(?::(\d+))(?::(\d+))\)/.exec(parts[2]))) {
412+
if (isEval && (submatch = chromeEval.exec(parts[2]))) {
409413
// throw out eval line/column and use top-most line/column number
410414
parts[2] = submatch[1]; // url
411415
parts[3] = submatch[2]; // line

0 commit comments

Comments
 (0)