[BUGFIX] Use WeakMap to store tracked property values. #18091
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using a
Symbol
causes issues on IE11 when using the core-js polyfill. Specifically, the polyfill adds every symbol toObject.prototype
and therefore ourif (symbol in this) {
check was completely borked.Migrating to a
WeakMap
exposed another issue: we were accidentally relying on the fact that the symbols would be inherited through the prototype chain (introduced by #18074). This meant that setting a tracked property on a prototype would actually affect the value seen by every instance of that prototype.For example:
Before the changes in this commit, the above
console.log
would emitfoo
and after these changes it would printundefined
.Fixes #18075