-
littledan authored
In the for-of desugaring, IteratorClose is a subtle thing to get right. When return exists, the logic for which exception to throw is as follows: 1. Get the 'return' property and property any exception that might come from the property read 2. Call return, not yet propagating an exception if it's thrown. 3. If we are closing the iterator due to an exception, propagate that error. 4. If return threw, propagate that error. 5. Check if return's return value was not an object, and throw if so Previously, we were effectively doing step 5 even if an exception "had already been thrown" by step 3. Because this took place in a finally block, the exception "won the race" and was the one propagated to the user. The fix is a simple change to the desugaring to do step 5 only if step 3 didn't happen. R=rossberg BUG=v8:4775 LOG=Y Review URL: https://codereview.chromium.org/1728973002 Cr-Commit-Position: refs/heads/master@{#34261}
5f67e34a