WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 18855
62897
Using "throw" with a string doesn't result in url and line number being set in the exception.
https://bugs.webkit.org/show_bug.cgi?id=62897
Summary
Using "throw" with a string doesn't result in url and line number being set i...
David Levin
Reported
2011-06-17 11:58:33 PDT
I guess that there is a missing call to addErrorInfo somewhere. Here's a test case: <html> <body> This should result in a one line of output with a message, url and line number. <div id=result></div> <script type="text/javascript" language="javascript"> if (window.layoutTestController) { layoutTestController.dumpAsText(); layoutTestController.waitUntilDone(); } function log(message) { document.getElementById("result").innerHTML += message + "<br>"; } window.onerror = function(msg, url, line) { // Clean up url here to remove path. log( "msg " + msg + " url " + url + " line " + line ); if (window.layoutTestController) layoutTestController.notifyDone(); } throw "Test Error"; </script> </body> </html>
Attachments
Add attachment
proposed patch, testcase, etc.
Oliver Hunt
Comment 1
2011-06-17 12:07:03 PDT
(In reply to
comment #0
)
> I guess that there is a missing call to addErrorInfo somewhere. >
Nope, you can't add properties to a string - strings aren't objects. This is a known (and sad making limitation in JSC, and there is a bug about it, but i can't find it :-/ )
Geoffrey Garen
Comment 2
2011-06-17 12:08:43 PDT
Seems like we could replace a thrown string with a string object, or a generic error object used to wrap primitive values.
Oliver Hunt
Comment 3
2011-06-17 12:20:22 PDT
(In reply to
comment #2
)
> Seems like we could replace a thrown string with a string object, or a generic error object used to wrap primitive values.
That would be behavioural bug -- if you throw a string, the caught value remains a string. We really just need to have an out of band mechanism for reporting where an exception came from.
Geoffrey Garen
Comment 4
2011-06-17 12:45:54 PDT
(In reply to
comment #3
)
> (In reply to
comment #2
) > > Seems like we could replace a thrown string with a string object, or a generic error object used to wrap primitive values. > > That would be behavioural bug -- if you throw a string, the caught value remains a string. We really just need to have an out of band mechanism for reporting where an exception came from.
We can distinguish between the value we pass to a catch block and the value we propagate as an exception. For example, in the generic error object design, we would unwrap the wrapped exception before running a catch block.
Gavin Barraclough
Comment 5
2012-09-07 00:39:57 PDT
*** This bug has been marked as a duplicate of
bug 18855
***
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