[Webkit-unassigned] [Bug 55092] New: Stack information of uncaught Error object should be available in window.onerror
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Feb 23 15:14:25 PST 2011
https://bugs.webkit.org/show_bug.cgi?id=55092
Summary: Stack information of uncaught Error object should be
available in window.onerror
Product: WebKit
Version: 528+ (Nightly build)
Platform: All
OS/Version: All
Status: UNCONFIRMED
Severity: Enhancement
Priority: P2
Component: WebCore JavaScript
AssignedTo: webkit-unassigned at lists.webkit.org
ReportedBy: charles.kendrick at smartclient.com
When adding an onerror handler, the uncaught exception is not provided, and using "new Error().stack" also does
not work: it produces a stack which ends at onerror.
Other means of acquiring stacks, like walking the arguments.caller or arguments.callee.caller chain, are likewise unavailable.
This makes onerror mostly useless because you can get better diagnostics by putting try/catch blocks around your top-level event handling code, where you will get a valid error.stack. But this is cumbersome and doesn't catch every scenario.
So at the moment we (Isomorphic, creators of SmartClient/SmartGWT) need to continue to recommend that users launch Internet Explorer to get definitive error reporting, which is a shame.
<html>
<body>
<script>
window.onerror = function onErrorHandler (message, url, linenumber, arg4) {
alert("Error via new Error(): " + new Error().stack);
var caughtError;
try {
throw new Error("whoops");
} catch (e) {
caughtError = e;
}
alert("Error via try..catch: " + caughtError.stack);
alert("args.caller, args.callee.caller: " + [arguments.caller, arguments.callee.caller]);
};
function func3 () {
crash();
}
function func2 () {
func3();
}
function func1 () {
func2();
}
func1();
</script>
</body>
</html>
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list