fix(zone.js): patch child method that overrides an already patched method#39850
fix(zone.js): patch child method that overrides an already patched method#39850edusperoni wants to merge 1 commit intoangular:masterfrom
Conversation
JiaLiPassion
left a comment
There was a problem hiding this comment.
@edusperoni , please write some details information to describe,
- What is the issue?
- How this PR resolve it?
And also please make lint task pass, please also add the issue and how this PR resolve the issue in the commit message.
Finally please squash the two commits.
Thanks.
|
@JiaLiPassion I've added more information in the description. Is this enough? You want me to add that information in the commit as well, correct? Edit: Also, yarn lint is not outputting any errors on my code, can you clarify the issue? |
JiaLiPassion
left a comment
There was a problem hiding this comment.
LGTM, thanks.
And the lint is failing because the commit messages are not correct.
Please add the description you added in this PR to the commit message, and following the rule described here.
https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format
8bbab0d to
82926a7
Compare
mhevery
left a comment
There was a problem hiding this comment.
reviewed-for: global-approvers
…thod Fix a case where, if the parent class had already been patched, it would not patch the child class. In addition to checking if the method is defined in the prototype, and not inherited, it also does the same for the unpatched method.
82926a7 to
aac8b03
Compare
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When running
patchMethodon a target that had it's parent already patched, the patch would not be applied.Consider we have these 3 classes:
As we can see,
OverrideTypeoverridesmethod, so we want to patch it as well as patchingType. I've added the helper function patchType.Issue Number: N/A
What is the new behavior?
patchMethodcorrectly patches a class that overrides a parent method. It now verifies if the__symbol__(delegateName)is defined in the prototype and not just inherited, resulting in the following behavior:Does this PR introduce a breaking change?
Other information
This issue arose while providing patches to the NativeScript framework, which has an
Observableclass which emits events.View, which inheritsObservable, overridesaddEventListenerand provides it's own implementation to emit gesture events, as it needs to keep track of how many observers there are to remove the listeners when there are none.