IE11 Console: Increase stack trace depth
Asked Answered
F

2

5

In Chrome, you can increase the stack trace depth by setting a flag at runtime (using --js-flags="--stack-trace-limit <value>"), or through the console (using Error.stackTraceLimit), explained here: https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi

This is also possible in Firebug, from what I understand, although I'm not as familiar with the intricacies of that tool.

Is there any provision for this in IE11? I'm dealing with an IE-specific issue, and the stack trace doesn't shed any light beyond my library's code (AngularJS). Increasing the stack trace depth would likely help me here.

Thanks!

Francklin answered 27/12, 2013 at 21:32 Comment(0)
S
6

It appears that no documented Command Line Option exists that would offer this control. You can, however, increase the stack trace in Internet Explorer much like you would other popular browsers:

Error.stackTraceLimit = 20; // The default is 10

Internet Explorer has supported this property on the Error constructor since version 10. It will not work in versions prior to that. In 2012 the IEBlog demonstrated some sample use of this property, as well as use of Error.stack.

There doesn't appear to be any way to persist this setting for all page requests. The only option I could suggest here would be to setup a proxy that adds this to all server responses. Naturally I would encourage Fiddler for this.

Like other browsers, Internet Explorer 11 supports console.trace. So you need not wait for an error to get your stack trace. You can invoke it arbitrarily at any time.

One last feature to look at would be profiling. You can control profiling sessions via console.profile and console.profileEnd (both of which are fairly standard) if you wish to capture only a specific slice of your applications lifecycle.

Sykes answered 27/12, 2013 at 22:15 Comment(1)
As it turns out, I found the answer just by guessing what it might have been, and the autocomplete in the console confirmed my guess.Francklin
F
2

I found the answer to this by simply playing around in the console - I knew there was an Error object. As it turns out, the Error object in IE11 supports the same stackTraceLimit property that Chrome and Firebug do (I guess they standardized it, finally). This can be set in the console, similar to Google Chrome (example: Error.stackTraceLimit = 30) and it will persist from the time you set it until the next navigation event - going back, forward, anywhere else, or refreshing the page.

The default for the stackTraceLimit is 10.

I needed to set this when the page loaded to debug an error, and so I was able to set an early breakpoint and manually set Error.stackTraceLimit. I haven't found a way to make this persist across navigation yet, and I don't know if there's a startup flag or anything to set it in a more permanent fashion. (I'd postulate that there's a registry entry somewhere.)

I hope this helps someone else who comes across this issue. Of note, the new IE11 tools will autocomplete properties of a native object, which is actually pretty nice, so you can quickly see what other properties and methods the Error object has. (This is actually how I found the property in question.)

Francklin answered 27/12, 2013 at 22:59 Comment(1)
Excellent find. The IEBlog discussed this some time back.Sykes

© 2022 - 2024 — McMap. All rights reserved.