-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Properly cleanup the element builder in a try/finally
Currently we don't do any cleanup in the event of an error occuring during the actual execution of the VM. This can leave the VM in a bad state, in particular the element builder, since it doesn't actually finalize block nodes until _after_ the entire block has executed. This means that if an error occurs during the execution of a block, the VM will never properly initialize those blocks, and their first and last nodes will be `null`. While we don't currently support recovering from this type of an error, we do need to be able to cleanup the application after one, specifically for tests. Previously, this worked no matter what because of the Application Wrapper optional feature - there was always a root `div` element that we could clear, so there was always a first and last node for us to track. With the feature disabled, we started seeing failures such as [this issue within user tests](emberjs/ember-test-helpers#768 (comment)). This PR refactors VM updates, specifically, to allow them to properly clean up the element builder on failures. It now closes all remaining open blocks, finalizing them to ensure they have nodes. This only works for VM updates because the initial append is an _iterator_, which the user controls execution of. We'll need to have a different strategy for this API, but it shouldn't be a regression at the moment because any failures during the iteration will result in a completely broken app from the get-go. There is no result, and no accompanying `destroy` function, so existing tests and apps cannot be affected by failures during append.
- Loading branch information
Chris Garrett
committed
Apr 16, 2020
1 parent
a47b285
commit a5fefa3
Showing
5 changed files
with
117 additions
and
13 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
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