fix($animate): do not get affected by custom, enumerable properties on Object.prototype

Fixes #14804

Closes #14830
This commit is contained in:
Georgios Kalpakas
2016-06-26 21:07:58 +03:00
parent 56a9eab849
commit 6050f0be30
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -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
+11
View File
@@ -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) {