-
Notifications
You must be signed in to change notification settings - Fork 289
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
🪲 Prevent stopped programs from executing #5225
Conversation
This is ready for review! I tried to solve to also bypass printing and exceptions, but ultimately was not able to! Remember to also review hedyorg/skulpt#2! |
I will pick this PR up! Do I test the skulpt PR in the same way as this one? Should I pull both and test at once? |
Only test this one! If this one works, approve both, since the files generated by Skulpt are also included here. |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
In Skulpt there really isn't a way to stop the execution of a program. If the program uses things like prompts for the `input` function, or sleep, then those promises are still somewhere in the JavaScript handler. Therefore, when you execute a new program while another one is still waiting for a promise to be fulfilled (i.e: waiting for user input through an ask prompt), when the new program finishes execution, the old one will continue its path. To fix this I added a new field to `sessionStorage` which will have an id for the program being executed, and I edited Skulpt to pass the id of the program. Therefore, when an old program is being executed, its id will be different than the current one and therefore will finish its execution. Fixes #5211 **How to test** * Go to level 14 and execute the TicTacToe adventure, fill the first ask. * With an ask prompt still open, switch to the Quizmaster tab and execute the program. * Only the Quizmaster program should be executed.
In Skulpt there really isn't a way to stop the execution of a program. If the program uses things like prompts for the
input
function, or sleep, then those promises are still somewhere in the JavaScript handler. Therefore, when you execute a new program while another one is still waiting for a promise to be fulfilled (i.e: waiting for user input through an ask prompt), when the new program finishes execution, the old one will continue its path.To fix this I added a new field to
sessionStorage
which will have an id for the program being executed, and I edited Skulpt to pass the id of the program. Therefore, when an old program is being executed, its id will be different than the current one and therefore will finish its execution.Fixes #5211
How to test