forked from dop251/goja
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't clear interrupt until the stack is empty (dop251#405)
* Don't clear interrupt until the stack is empty Previous to this the interrupt would be cleared whenever it is noticed before it starts returning the error up the stack. Unfortunately if you have goja code that called go code that called a goja code and it got interrupted. Once we get back in the go code we just got an error, and it's very likely that the code will just return it so it's just an exception. So at that point if there is `try/catch` it will just catch this and the code will not actually be interrupted. It is possible to at each such occurrence test that the error is not InterruptError and Interrupt again, but that seems like the worse of two choices. So instead now the Interrupt will *not* be cleared and if the go code just propagates the error - it will just keep interrupting. But it is still possible to check the error in the go code and decide to clear the interrupt manually. The interrupt will be cleared only once the stack is empty, so there is no way for the above problem. It will also clear the job queue. Otherwise, if there is any promise that has been resolved/rejected, and they aren't cleared they will be executed the next time the Runtime is used, and the stack is empty. * Update runtime.go Co-authored-by: Dmitry Panov <[email protected]> Co-authored-by: Dmitry Panov <[email protected]> (cherry picked from commit 8795259)
- Loading branch information
Showing
3 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters