Permalink
Browse files

Properly get function name

  • Loading branch information...
janodvarko committed Mar 25, 2013
1 parent cf0aceb commit 176516a0a884a0e221750140bd43109878e1f3a9
Showing with 3 additions and 3 deletions.
  1. +3 −3 extension/content/firebug/chrome/reps.js
@@ -217,15 +217,15 @@ FirebugReps.Func = domplate(Firebug.Rep,
{
var fnText = Str.safeToString(fn);
- // xxxHonza: Simon this regexpr doesn't return 'myFunc' for:
- // "function myFunc(event) { ... }". Any tips?
- var namedFn = /^function ([^(]+\([^)]*\)) \{/.exec(fnText);
+ // Get function name.
+ var namedFn = /^function ([^(]+\([^)]*\))/.exec(fnText);
var anonFn = /^function \(/.test(fnText);
var displayName = fn.displayName;
var result = namedFn ? namedFn[1] : (displayName ? displayName + "()" :
(anonFn ? "function()" : fnText));
+ //xxxHonza: should we use an existing pref?
return Str.cropString(result, 100);
},

0 comments on commit 176516a

Please sign in to comment.