Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Promise execution in the sandbox.
Promise.prototype.then arguments are executed in a microtask queue, pushed to the end of the current event loop tick. The async lifetime tracking in the sandbox did not factor this into consideration. Certain completion functions needed to be deferred with setImmediate(), which will add to the task queue and execute after the current microtask queue drains. Calls to global timers also needed to be wrapped in a scoped context. Due to the setImmediate() delay, the bridge may disconnect when the context is disposed before the completion timer fires. Disconnecting the bridge removes all globals. This prevents reference errors from happening on the final tick. Original behavior of execution.return.async remains. It will only be set to `true` if there's a pending timer that hasn't been previously cleared.
- Loading branch information
1 parent
3f95cbf
commit d84220c
Showing
4 changed files
with
354 additions
and
19 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
Oops, something went wrong.