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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 26 06:30:06 PDT 2009


bobv at google.com changed:

           What    |Removed                     |Added
                 CC|                            |bobv at google.com

------- Comment #17 from bobv at google.com  2009-06-26 06:30 PDT -------
(In reply to comment #16)
> Do you know how they usually get stack traces? Do they surround all code with
> try/catch, use window.onerror, or something else?

For applications written with Google Web Toolkit (e.g. Google Wave, the new
Adwords interface), the generated JS contains regular JS try/catch blocks that
correspond to try/catch block in the original Java source.

When a native JS Error object is caught, we wrap it in a JavaScriptException
and expose the inferred stack trace to the developer via
Throwable.getStackTrace().  As far as extracting the stack trace data, there
are several implementations.

FireFox / Opera : Parse e.stack
Everything else : Crawl arguments.callee

The problem with crawling arguments.callee is that it tends to not work with
reentrant functions.  Moreover, all we know is the function in which the catch
block appears, so we're usually missing a few frames (adding a try/catch to
every function would be prohibitively expensive).

As far as GWT goes, it would be preferable if the data were available off of
the native JS Error object, but we can make it work with pretty much any API.


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