[Pkg-mozext-commits] [firebug] 38/82: Show the pre-transformed expression in error messages

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 22:45:39 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag fbtest-1.11.2
in repository firebug.

commit d654a162f0ccf3519e4a127e48be6a674f267ad0
Author: Simon Lindholm <simon.lindholm10 at gmail.com>
Date:   Tue Jan 1 16:51:19 2013 +0100

    Show the pre-transformed expression in error messages
---
 extension/content/firebug/console/commandLine.js      | 19 ++++++++++---------
 .../content/firebug/console/commandLineExposed.js     | 12 ++++++------
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/extension/content/firebug/console/commandLine.js b/extension/content/firebug/console/commandLine.js
index f355518..ed0668c 100644
--- a/extension/content/firebug/console/commandLine.js
+++ b/extension/content/firebug/console/commandLine.js
@@ -84,22 +84,22 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
         {
             var debuggerState = Firebug.Debugger.beginInternalOperation();
 
-            expr = ClosureInspector.extendLanguageSyntax(expr, targetWindow, context);
+            var newExpr = ClosureInspector.extendLanguageSyntax(expr, targetWindow, context);
 
             if (this.isSandbox(context))
             {
-                this.evaluateInSandbox(expr, context, thisValue, targetWindow,
-                    successConsoleFunction, exceptionFunction);
+                this.evaluateInSandbox(newExpr, context, thisValue, targetWindow,
+                    successConsoleFunction, exceptionFunction, expr);
             }
             else if (Firebug.Debugger.hasValidStack(context))
             {
-                this.evaluateInDebugFrame(expr, context, thisValue, targetWindow,
-                    successConsoleFunction, exceptionFunction);
+                this.evaluateInDebugFrame(newExpr, context, thisValue, targetWindow,
+                    successConsoleFunction, exceptionFunction, expr);
             }
             else
             {
-                this.evaluateByEventPassing(expr, context, thisValue, targetWindow,
-                    successConsoleFunction, exceptionFunction);
+                this.evaluateByEventPassing(newExpr, context, thisValue, targetWindow,
+                    successConsoleFunction, exceptionFunction, expr);
             }
 
             if (!noStateChange)
@@ -121,7 +121,7 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
     },
 
     evaluateByEventPassing: function(expr, context, thisValue, targetWindow,
-        successConsoleFunction, exceptionFunction)
+        successConsoleFunction, exceptionFunction, origExpr)
     {
         var win = targetWindow || context.baseWindow || context.window;
 
@@ -177,8 +177,9 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
         event.initEvent("firebugCommandLine", true, false);
         win.document.setUserData("firebug-methodName", "evaluate", null);
 
-        expr = expr.toString();
+        origExpr = "with(_FirebugCommandLine){\n" + (origExpr || expr) + "\n};";
         expr = "with(_FirebugCommandLine){\n" + expr + "\n};";
+        win.document.setUserData("firebug-expr-orig", origExpr, null);
         win.document.setUserData("firebug-expr", expr, null);
 
         var consoleHandler = Firebug.Console.injector.getConsoleHandler(context, win);
diff --git a/extension/content/firebug/console/commandLineExposed.js b/extension/content/firebug/console/commandLineExposed.js
index 116e664..9050595 100644
--- a/extension/content/firebug/console/commandLineExposed.js
+++ b/extension/content/firebug/console/commandLineExposed.js
@@ -1,5 +1,5 @@
 /* See license.txt for terms of usage */
-/*jshint esnext:true, es5:true, curly:false */
+/*jshint esnext:true, es5:true, curly:false, evil:true */
 /*global Firebug:true, FBTrace:true, Components:true, define:true */
 
 define([
@@ -174,13 +174,14 @@ function createFirebugCommandLine(context, win)
 
         // see commandLine.js
         var expr = contentView.document.getUserData("firebug-expr");
-        evaluate(expr);
+        var origExpr = contentView.document.getUserData("firebug-expr-orig");
+        evaluate(expr, origExpr);
 
         if (FBTrace.DBG_COMMANDLINE)
             FBTrace.sysout("commandLine.Exposed; did evaluate on " + expr);
     }
 
-    function evaluate(expr)
+    function evaluate(expr, origExpr)
     {
         var result;
         try
@@ -223,9 +224,8 @@ function createFirebugCommandLine(context, win)
                 result.message = exc.message;
                 result.lineNumber = lineNumber - line;
 
-                // Try to make the closure inspector transformation look a bit nicer.
-                var niceExpr = expr.replace(/__fb_scopedVars\(/g, "<get closure>(");
-                result.fileName = "data:," + encodeURIComponent(niceExpr);
+                // Lie and show the pre-transformed expression instead.
+                result.fileName = "data:," + encodeURIComponent(origExpr);
 
                 if (!isXPCException)
                     result.name = exc.name;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git



More information about the Pkg-mozext-commits mailing list