WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
18855
Mechanism for storing line numbers and source URLs in JavaScript exceptions needs improvement
https://bugs.webkit.org/show_bug.cgi?id=18855
Summary
Mechanism for storing line numbers and source URLs in JavaScript exceptions n...
David Kilzer (:ddkilzer)
Reported
2008-05-02 14:42:28 PDT
* SUMMARY The mechanism for storing line numbers and source URLs for JavaScript exceptions fails to work in the following cases: - Throwing any non-object (like a string or a number) - Throwing any object with a property named "line" or a property named "sourceURL" What JavaScriptCore does now (in KJS::Node::handleException()) is to *modify* the exception object to add the "line" and "sourceURL" properties (but only if neither currently exist). It seems wrong to modify a JavaScript object simply to store metadata and obviously doesn't work if the exception is not an object. * STEPS TO REPRODUCE 1. Launch Safari/WebKit. 2. Open the Web Inspector. 3. Open one of the attached test cases. * RESULTS No line number or source URL is provided for the exceptions thrown in the test cases. * REGRESSION I don't think this is a regression. The code to set the "line" and "sourceURL" properties on the exception object existed as far back as r9352 in nodes.cpp.
Attachments
Test cases
(1007 bytes, text/html)
2008-05-02 14:59 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
David Kilzer (:ddkilzer)
Comment 1
2008-05-02 14:59:37 PDT
Created
attachment 20932
[details]
Test cases Additional fun facts: - Throwing an exception inside a function body from an onclick handler results in "undefined" for the description--always. - Throwing an object with just a "sourceURL" line will cause that URL to be printed in the Web Inspector.
David Kilzer (:ddkilzer)
Comment 2
2008-05-02 15:27:55 PDT
<
rdar://problem/5908160
>
Patrick Mueller
Comment 3
2009-12-04 08:15:11 PST
It would be good to provide a set of tests to run across browsers to capture what everyone is doing here. Basically, something like Dave's tests that just run and produce results. But also include some of the existing 'built-in' exceptions, both thrown by existing internal code, as well as cons'd up by the user (eg, someone write's code that does a "throw new Error()")
Gavin Barraclough
Comment 4
2012-09-07 00:39:57 PDT
***
Bug 62897
has been marked as a duplicate of this bug. ***
Oliver Hunt
Comment 5
2013-04-18 23:20:02 PDT
The regular object and the primitive cases should work now. I think we are still deliberately deferring to properties on objects if there's a lineNo property
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug