Bug 104408

Summary: Add exception object and stack trace to window.onerror
Product: WebKit Reporter: Chris Cinelli <chris.cinelli>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Enhancement CC: ap, aroben, doochik, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   

Description Chris Cinelli 2012-12-07 15:47:28 PST
Something on the the line of what is discussed here:  http://lists.w3.org/Archives/Public/public-whatwg-archive/2012May/thread.html#msg124
The reason is that as an organization I want to be able to catch errors in the code that we produce and being able to fix it.
I can (in most of the cases) sends an ajax request to the server to record what went wrong for further analysis.

I have been trying to use this: https://github.com/eriwen/javascript-stacktrace but it does not work because the onerror function does not have the context of the error.
Comment 1 Oliver Hunt 2012-12-10 10:35:57 PST
The spec explicitly states that onerror gives you the error string, url, and line number.  We can't arbitrarily extends a spec as we see fit.

Any way, the onerror api is already providing the most information that can be safely exposed -- the error object or stack trace can both be used to expose information in violation of the cross origin policy.  We recognize the difficulty this presents, but the reality is that we cannot specify behaviour that has fundamental security problems.  Your best bet is to use the debugger as it can do anything it wants (as it is obviously necessary to consider it trusted)
Comment 2 Adam Roben (:aroben) 2014-02-24 11:04:07 PST
The spec actually says that the original error object should be made available: http://html5.org/r/8086

This bug seems to be a dupe of bug 55092. I'm thinking about starting to work on fixing it. Oliver, if you still have concerns can you explain them in bug 55092?

*** This bug has been marked as a duplicate of bug 55092 ***