Channel72
Channel72

Reputation: 24719

Firebug console stacktrace

How do I get a stack trace using Firebug's error console?

I've tried the following test:

<!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>

This test simply calls 3 different functions, create a stack 3 levels deep. The third function just prints out a stacktrace. But, the Firebug console doesn't show anything:

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

Is there something else I need to do to get a stacktrace working?

Upvotes: 1

Views: 1763

Answers (1)

Patrick Oscity
Patrick Oscity

Reputation: 54674

Interesting fact: when i run your code, i get the following stack trace in safari:

enter image description here

but when i run this

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

the stack trace looks like this:

enter image description here

maybe some weird optimization going on here?

Upvotes: 1

Related Questions