RESOLVED FIXED 20093
JSC shell does not clear exceptions after it executes toString on an expression
https://bugs.webkit.org/show_bug.cgi?id=20093
Summary JSC shell does not clear exceptions after it executes toString on an expression
Oliver Hunt
Reported 2008-07-18 05:03:20 PDT
The JSC shell doesn't check for toString on the result of an expression throwing, so it will eventually result in incorrect behaviour in some cases. Trivial reproduction: 1. Start jsc 2. enter eval({toString:function(){throw{};}}); 3. goto 2
Attachments
Fix that exposes problem with exceptions and eval (1.98 KB, patch)
2008-08-24 17:29 PDT, Cameron Zwarich (cpst)
no flags
Proposed patch (2.52 KB, patch)
2008-08-24 18:24 PDT, Cameron Zwarich (cpst)
no flags
Proposed patch (with better ChangeLog) (2.67 KB, patch)
2008-08-24 18:31 PDT, Cameron Zwarich (cpst)
oliver: review+
Alexey Proskuryakov
Comment 1 2008-07-18 07:24:14 PDT
*** Bug 20094 has been marked as a duplicate of this bug. ***
Cameron Zwarich (cpst)
Comment 2 2008-08-24 17:27:24 PDT
I can fix this by checking the completion type, but for your example the completion type is Normal, not Throw, even though there is an exception on the global object's ExecState. This would appear to be a separate bug, so I'll file it.
Cameron Zwarich (cpst)
Comment 3 2008-08-24 17:29:44 PDT
Created attachment 22967 [details] Fix that exposes problem with exceptions and eval Here is my proposed fix. The assertions about exceptions on the global ExecState currently fail on Oliver's example.
Cameron Zwarich (cpst)
Comment 4 2008-08-24 18:02:03 PDT
The problem isn't with eval, it is that an exception is thrown while printing the value. A similar issue occurs with the inspector. We should decide what to do in both cases.
Cameron Zwarich (cpst)
Comment 5 2008-08-24 18:24:43 PDT
Created attachment 22970 [details] Proposed patch Here's a fix. It doesn't make the user aware of any exceptions that occurred while printing the final value, but we should deal with that problem later, together with the solution for the inspector.
Cameron Zwarich (cpst)
Comment 6 2008-08-24 18:31:31 PDT
Created attachment 22971 [details] Proposed patch (with better ChangeLog) I forgot to mention something in the ChangeLog.
Cameron Zwarich (cpst)
Comment 7 2008-08-24 21:08:50 PDT
Committed r35911.
Note You need to log in before you can comment on or make changes to this bug.