[Webkit-unassigned] [Bug 13646] implement Error.prototype.stack

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 11 23:26:42 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=13646





------- Comment #10 from eric at webkit.org  2009-05-11 23:26 PDT -------
(In reply to comment #9)
> (In reply to comment #8)
> However, I do agree that adding a stack trace to every exception would be
> serious new burden to apps that throw regularly. (Not sure how common those
> are.)

error.stack is most interesting from a callback like window.onerror (see bug
8519).  So exposing a .stack accessor on every exception (which ideally could
be implemented to lazily crawl the stack) would be the ideal situation.

> Why not do roughly this, using existing APIs, instead:
> 
> function stack() {
> var stack = [];
> var caller = arguments.caller;
> while (caller != null) {
> stack.push(caller);
> caller = caller.caller;
> }
> }

Sure!  And this method is already used by things like Google Web Toolkit (and
likely many other JS frameworks):
http://google-web-toolkit.googlecode.com/svn/trunk/user/src/com/google/gwt/core/client/impl/StackTraceCreator.java

But it doesn't provide you as much information as the Firefox or Opera
Error.stack accessor does (including line numbers, file names, etc.)


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list