New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests of CallStack unwinding after caught exception (and quick patch) #853
Conversation
About this issue... Dug a bit into the Engine, probably with too little understanding of it, but... I think ideally, Lines 1274 to 1283 in 5b51036
... should have something like:
... to ensure that the call stack is always popped. This will yield the correct call stack when entering a In the case I've checked (the test jint/Jint/Runtime/Interpreter/JintStatementList.cs Lines 84 to 89 in 5b51036
... it's converted to a Lines 379 to 383 in 5b51036
... due to us having unwinded the stack through But still, not really sure what to do about it - the back and forth of I guess an alternative to |
Yes the current call stack handling is quite tricky if not brittle when it comes to the exception chain and re-throw and completions. It would definitely require some love. I think ideally (JS) exceptions should be allowed to flow through until the very end where at last step the completion would be handled. |
Added a quick patch for the catch issue - but like I write in the comment, it's not actually meant as a solution - but may clarify what the issue actually is, more so than my walls of text 😉 (For example, in an actual solution, call stack should also be unwound in Agree on the optimal solution being more consistent completions/throws. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an acceptable hack for time being until someone has the courage to redo some if the nested exception handling.
* remove quick patch from JintTryStatement introduced in sebastienros#853 * implement "ideal" solution described in sebastienros#853 (try/finally in Engine.Call and Engine.Construct) * change behaviour of JavaScriptException.SetJavaScriptCallstack() so that it will not overwrite the existing stack trace unless explicitly told to * add test
As mentioned in #852, callstack fails to unwind after catching an exception. Not quite sure where this should be handled. Included two tests, one just showing (by way of nested calls) that it's the entire callstack that fails to unwind - it's not just off by 1.