如何在IE 8中获取JavaScript异常的堆栈跟踪?

akn*_*ds1 11 javascript debugging exception stack-trace internet-explorer-8

当在IE 8中抛出JavaScript异常时,如何查看其堆栈跟踪?

例如,jQuery中的以下代码捕获异常并重新抛出它.在Visual Studio(2012)中进行调试时,执行会在jQuery捕获异常('e')时中断,但我不能在生命中看到异常源自的堆栈跟踪:

// resolve with given context and args
resolveWith: function( context, args ) {
    if ( !cancelled && !fired && !firing ) {
        firing = 1;
        try {
            while( callbacks[ 0 ] ) {
                callbacks.shift().apply( context, args );
            }
        }
        // We have to add a catch block for
        // IE prior to 8 or else the finally
        // block will never get executed
        catch (e) {
            throw e;
        }
        finally {
            fired = [ context, args ];
            firing = 0;
        }
    }
    return this;
}
Run Code Online (Sandbox Code Playgroud)

我已经尝试过stacktrace.js库,但是当浏览器是IE 8时它似乎忽略了异常,只是回到生成当前帧的堆栈跟踪.

编辑:

从下面的屏幕截图中可以看出,异常没有与堆栈相关的属性:

JavaScript异常对象

小智 -4

这行不通!!

function getStackTrace(e) {
  var stack = [];
  while (e) {
    stack.push({
      fileName: e.fileName,
      lineNumber: e.lineNumber,
      name: e.name,
      message: e.message,
      stack: e.stack
    });
  }
  return stack;
}
Run Code Online (Sandbox Code Playgroud)