-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
Do not invoke getters in walk #1059
Conversation
When stubbing a prototype, the `walk` implementation accesses getters to obtain the value of each property to pass it to the iterator function. This value is not needed by any of the iterator implementations anymore, but invoking the getter may have side effects or throw exceptions. With this change, values are no longer obtained from the objects. It keeps the code to pass a different target object to the iterator which allows to obtain the value in the iterator implementation if necessary.
Note: The browser tests are still failing due to our SauceLabs account being configured with zero concurrent VMs. I’ve email their support and hope to get the issue resolved soon. |
Merging this as the browser tests are failing anyway these days. |
Thank you for the commit. @fatso83, is it possible to cpeek this commit and release a new minor version? |
@mantoni and @fearphage : should we release a new minor version, or try to get #1040 fixed first? |
@fatso83 I'm currently linking sinon locally until this fix is released, so no pressure for me personally. |
@kkamkou : if you don't want to wait for a minor fix you can just link to the relevant commit in your |
@fatso83 already. In the same time we're using versioneye, therefore version tracking is broken for one particular repo. |
Purpose (TL;DR) - mandatory
When stubbing a prototype, the
walk
implementation accesses getters to obtain the value of each property to pass it to the iterator function. This value is not needed by any of the iterator implementations anymore, but invoking the getter may have side effects or throw exceptions.Solution - optional
With this change, values are no longer obtained from the objects. It keeps the code to pass a different target object to the iterator which allows to obtain the value in the iterator implementation if necessary.
It turned out that none of the iterator functions passed to
walk
actually used the value.How to verify - mandatory