2012-07-07 111 views
1

如何使用Firebug的错误控制台获取堆栈跟踪?Firebug控制台堆栈跟踪

我已经试过了如下测试:

<!DOCTYPE html> 
<html> 
<head> 

<script type = "text/javascript"> 

function f3() { console.trace(); } 

function f2() { f3(); } 

function f1() { f2(); } 

</script> 
</head> 
<body onLoad = "f1()"> 
</body> 
</html> 

这项测试是调用了3个不同的功能,深创建堆栈3个级别。第三个函数只是打印出一个堆栈跟踪。但是,Firebug控制台不显示任何东西:

[07:26:47.955] GET http://mydomain.com/test.html [HTTP/1.0 200 OK 23ms] 

有没有别的东西,我需要做的就是堆栈跟踪工作?

+0

适合我。确保Firebug在任何控制台调用之前处于活动状态 – user123444555621 2012-07-07 14:21:29

回答

1

有趣的事实:当我运行代码,我得到在Safari以下堆栈跟踪:

enter image description here

但是当我运行此

<!DOCTYPE html> 
<html> 
<head> 
<body> 
    <script type = "text/javascript"> 
    function f3() { console.trace(); } 
    function f2() { f3(); } 
    function f1() { f2(); } 
    f1(); 
    </script> 
</body> 
</html> 

堆栈跟踪看起来是这样的:

enter image description here

也许会在这里发生一些奇怪的优化?