Hello all,

I have recently installed firebug lite locally in a work project I am 
working on. I get the above error on line 23329 of firebug-lite-debug.js 
having run the script for the first time on chrome. This appears to be a 
bug in firebug lite. Has anyone else encountered the same issue and can 
anyone suggest a solution.

It would appear to have something to do with the way firebug is trying to 
call the stack trace. see below

 this.trace = function()
    {
        var getFuncName = function getFuncName (f)
        {
            if (f.getName instanceof Function)
            {
                return f.getName();
            }
            if (f.name) // in FireFox, Function objects have a name 
property...
            {
                return f.name;
            }
            
            var name = f.toString().match(/function\s*([_$\w\d]*)/)[1];
            return name || "anonymous";
        };
        
        var wasVisited = function(fn)
        {
            for (var i=0, l=frames.length; i<l; i++)
            {
                if (frames[i].fn == fn)
                {
                    return true;
                }
            }
            
            return false;
        };
        
        traceRecursion++;
        
        if (traceRecursion > 1)
        {
            traceRecursion--;
            return;
        }
    
        var frames = [];
        
        for (var fn = arguments.callee.caller.caller; fn; fn = fn.caller)
        {
            if (wasVisited(fn)) break;
            
            var args = [];
            
            for (var i = 0, l = fn.arguments.length; i < l; ++i)
            {
                args.push({value: fn.arguments[i]});
            }

            frames.push({fn: fn, name: getFuncName(fn), args: args});
        }
        
        
        // 
****************************************************************************************
        
        try
        {
            (0)();
        }
        catch(e)
        {
            var result = e;
            
            var stack = 
                result.stack || // Firefox / Google Chrome 
                result.stacktrace || // Opera
                "";
            
            stack = stack.replace(/\n\r|\r\n/g, "\n"); // normalize line 
breaks
            var items = stack.split(/[\n\r]/);
            
            // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * *
            // Google Chrome
            if (FBL.isSafari)
            {
                //var reChromeStackItem = /^\s+at\s+([^\(]+)\s\((.*)\)$/;
                //var reChromeStackItem = 
/^\s+at\s+(.*)((?:http|https|ftp|file):\/\/.*)$/;
                var reChromeStackItem = 
/^\s+at\s+(.*)((?:http|https|ftp|file):\/\/.*)$/;
                
                var reChromeStackItemName = /\s*\($/;
                var reChromeStackItemValue = /^(.+)\:(\d+\:\d+)\)?$/;
                
                var framePos = 0;
                for (var i=4, length=items.length; i<length; i++, 
framePos++)
                {
                    var frame = frames[framePos];
                    var item = items[i];
                    var match = item.match(reChromeStackItem);
                    
                    //Firebug.Console.log("["+ framePos 
+"]--------------------------");
                    //Firebug.Console.log(item);
                    //Firebug.Console.log("................");
                    
                    if (match)
                    {
                        var name = match[1];
                        if (name)
                        {
                            name = name.replace(reChromeStackItemName, "");
                            frame.name = name; 
                        }
                        
                        //Firebug.Console.log("name: "+name);
                        
                        var value = match[2].match(reChromeStackItemValue);
                        if (value)
                        {
                            frame.href = value[1];
                            frame.lineNo = value[2];
                            
                            //Firebug.Console.log("url: "+value[1]);
                            //Firebug.Console.log("line: "+value[2]);
                        }
                        //else
                        //    Firebug.Console.log(match[2]);
                        
                    }             
                }
            }
            /**/
            
            // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * *
            else if (FBL.isFirefox)
            {
                // Firefox
                var reFirefoxStackItem = /^(.*)@(.*)$/;
                var reFirefoxStackItemValue = /^(.+)\:(\d+)$/;
                
                var framePos = 0;
                for (var i=2, length=items.length; i<length; i++, 
framePos++)
                {
                    var frame = frames[framePos] || {};
                    var item = items[i];
                    var match = item.match(reFirefoxStackItem);
                    
                    if (match)
                    {
                        var name = match[1];
                        
                        //Firebug.Console.logFormatted("name: "+name);
                        
                        var value = match[2].match(reFirefoxStackItemValue);
                        if (value)
                        {
                            frame.href = value[1];
                            frame.lineNo = value[2];
                            
                            //Firebug.Console.log("href: "+ value[1]);
                            //Firebug.Console.log("line: " + value[2]);
                        }
                        //else
                        //    Firebug.Console.logFormatted([match[2]]);
                    }                
                }
            }
            /**/
            
            // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
* * * * * * * * * * * *
            /*
            else if (FBL.isOpera)
            {
                // Opera
                var reOperaStackItem = 
/^\s\s(?:\.\.\.\s\s)?Line\s(\d+)\sof\s(.+)$/;
                var reOperaStackItemValue = /^linked\sscript\s(.+)$/;
                
                for (var i=0, length=items.length; i<length; i+=2)
                {
                    var item = items[i];
                    
                    var match = item.match(reOperaStackItem);
                    
                    if (match)
                    {
                        //Firebug.Console.log(match[1]);
                        
                        var value = match[2].match(reOperaStackItemValue);
                        
                        if (value)
                        {
                            //Firebug.Console.log(value[1]);
                        }
                        //else
                        //    Firebug.Console.log(match[2]);
                        
                        //Firebug.Console.log("--------------------------");
                    }                
                }
            }
            /**/
        }
        
        //console.log(stack);
        //console.dir(frames);
        Firebug.Console.log({frames: frames}, context, "stackTrace", 
FirebugReps.StackTrace);
        
        traceRecursion--;
    };

Thanks,

jonathan

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/firebug.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/firebug/a72f1c5f-af86-4e36-932b-b85f4f7fd90a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to