-
Notifications
You must be signed in to change notification settings - Fork 27.5k
fix(scope): do not remove the $listeners properties on $destroy #6908
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
if (hasOwnProperty.call(this, prop)) { | ||
if (hasOwnProperty.call(this, prop) && prop !== '$$destroyed' && | ||
// Avoid removing the listener properties as this causes many issues like #6897 | ||
prop !== '$$listeners' && prop !== '$$listenerCount') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that keeping these properties around will cause the v8 leak to be still present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ie8 compatibility (which I know is no longer being officially supported), In my code base I have modified this to have
Object.prototype.hasOwnProperty.call(this,prop)
instead of
hasOwnProperty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why wouldn't hasOwnProperty.call work on IE8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasOwnProperty is just:
var hasOwnProperty = Object.prototype.hasOwnProperty;
@IgorMinar I had an alternative patch that checked if this was a destroyed scope in several methods. If you think that approach would be best, then I can post the patch |
Add several checks on the methods that handle listeners so they are able to handle destroyed scopes that now do not have the references to the `$$listeners` and `$$listenersCount` when destroyed Closes angular#6897
6ecf4e7 is an alternative patch that fixes this issue while removing the |
The patch that caused the issue that this PR is trying to fix was reverted. This is, this PR is no longer valid |
Destroying the listener properties cases many issues when any of these operations is being performed on a destroyed scope or a child scope
$emit
from a child scope with a destroyed parentCloses #6897