fix($animate): do not get affected by custom, enumerable properties on Object.prototype
Fixes #14804 Closes #14830
This commit is contained in:
@@ -158,7 +158,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
}
|
||||
);
|
||||
|
||||
var callbackRegistry = {};
|
||||
var callbackRegistry = Object.create(null);
|
||||
|
||||
// remember that the classNameFilter is set during the provider/config
|
||||
// stage therefore we can optimize here and setup a helper function
|
||||
|
||||
@@ -1989,6 +1989,17 @@ describe("animations", function() {
|
||||
expect(count).toBe(5);
|
||||
}));
|
||||
|
||||
it('should not get affected by custom, enumerable properties on `Object.prototype`',
|
||||
inject(function($animate) {
|
||||
Object.prototype.foo = 'ENUMARABLE_AND_NOT_AN_ARRAY';
|
||||
|
||||
element = jqLite('<div></div>');
|
||||
expect(function() { $animate.off(element); }).not.toThrow();
|
||||
|
||||
delete Object.prototype.foo;
|
||||
})
|
||||
);
|
||||
|
||||
it('should fire a `start` callback when the animation starts with the matching element',
|
||||
inject(function($animate, $rootScope, $rootElement, $document) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user