This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Make the check for ZoneAwarePromise more stringent#495
Merged
mhevery merged 1 commit intoangular:masterfrom Nov 16, 2016
Merged
Make the check for ZoneAwarePromise more stringent#495mhevery merged 1 commit intoangular:masterfrom
mhevery merged 1 commit intoangular:masterfrom
Conversation
`resolvePromise` assumes that if a value is an `instanceof` ZoneAwarePromise then it has the properties "__zone_symbol__state" and "__zone_symbol__value" and it _is_ a true ZoneAwarePromise; however, a user can construct a value that breaks this assumption by inheriting from ZoneAwarePromise without actually having those properties or being a true ZoneAwarePromise (for example, by attempting to subclass Promise). We can fix this by adding checks for "__zone_symbol__state" and "__zone_symbol__value" to `resolvePromise`.
86b27ec to
29814dc
Compare
markandrus
added a commit
to twilio/twilio-video.js
that referenced
this pull request
Oct 25, 2016
For context, refer to the following GitHub issues and pull request: * #24 * angular/zone.js#494 * angular/zone.js#495 Ideally, we can add back the `inherits` call (if indeed this method of subclassing is correct) after Zone.js responds.
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Hi,
Here is my proposed fix for #494. I've opted to check for the properties "__zone_symbol__state" and "__zone_symbol__value". It just occurred to me that checking the
constructormight also work, but I am not sure. Commit message below.Thanks,
Mark
resolvePromiseassumes that if a value is aninstanceofZoneAwarePromise then it has the properties "__zone_symbol__state" and "__zone_symbol__value" and it is a true ZoneAwarePromise; however, a user can construct a value that breaks this assumption by inheriting from ZoneAwarePromise without actually having those properties or being a true ZoneAwarePromise (for example, by attempting to subclass Promise).We can fix this by adding checks for "__zone_symbol__state" and "__zone_symbol__value" to
resolvePromise.