Skip to content

Commit

Permalink
Fix calculation of line numbers of errors in evaluated expressions
Browse files Browse the repository at this point in the history
Broken in 3118f39.
  • Loading branch information
simonlindholm committed Jan 4, 2013
1 parent 3118f39 commit 2f6ff47
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions extension/content/firebug/console/commandLineExposed.js
Expand Up @@ -185,10 +185,14 @@ function createFirebugCommandLine(context, win)
function evaluate(expr, origExpr)
{
var result;
var line = Components.stack.lineNumber;
var baseLine;
try
{
result = contentView.eval(expr);
// Errors thrown from within the expression of the eval call will
// have a line number equal to (line of eval, 1-based) + (line in
// expression, 0-based) - keep track of the former term so we can
// correct it later.
baseLine = Components.stack.lineNumber; result = contentView.eval(expr);

// See Issue 5221
//var result = FirebugEvaluate(expr, contentView);
Expand Down Expand Up @@ -223,7 +227,7 @@ function createFirebugCommandLine(context, win)
result.stack = null;
result.source = expr;
result.message = exc.message;
result.lineNumber = lineNumber - line;
result.lineNumber = lineNumber - baseLine + 1;

// Lie and show the pre-transformed expression instead.
result.fileName = "data:," + encodeURIComponent(origExpr);
Expand Down

0 comments on commit 2f6ff47

Please sign in to comment.