Skip to content

Commit

Permalink
Fixing stack frame parser for Firefox new stack trace format (with co…
Browse files Browse the repository at this point in the history
…lumn numbers and more allowed symbols in function names). Fixes issue 8093
  • Loading branch information
barancev committed Oct 27, 2014
1 parent 55f56cd commit 4103276
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions javascript/firefox-driver/js/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,29 @@ fxdriver.error.toJSON = function(ex) {
var stack = ex.stack.replace(/\s*$/, '').split('\n');

for (var frame = stack.shift(); frame; frame = stack.shift()) {
var match = frame.match(/^([a-zA-Z_$][\w./<]*)?(?:\(.*\))?@(.+)?:(\d*)$/);
var methodName;
var fileName;
var lineNumber;
var columnNumber;

var match = frame.match(/(.*):(\d+):(\d+)$/);
if (match) {
stackFrames.push({
'methodName': match[1],
'fileName': match[2],
'lineNumber': Number(match[3])
});
frame = match[1];
lineNumber = Number(match[2]);
columnNumber = Number(match[3]);
} else {
stackFrames.push({'methodName': frame});
match = frame.match(/(.*):(\d+)$/);
frame = match[1];
lineNumber = Number(match[2]);
}

match = frame.match(/^([a-zA-Z_$][\w./<$]*)?(?:\(.*\))?@(.+)?$/);
stackFrames.push({
'methodName': match[1],
'fileName': match[2],
'lineNumber': lineNumber,
'columnNumber': columnNumber
});
}
}

Expand Down

0 comments on commit 4103276

Please sign in to comment.