Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 181e440

Browse files
committed
fix($animate): do not get affected by custom, enumerable properties on Object.prototype
Fixes #14804 Closes #14830
1 parent 5ce859b commit 181e440

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/ngAnimate/animateQueue.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
156156
}
157157
);
158158

159-
var callbackRegistry = {};
159+
var callbackRegistry = Object.create(null);
160160

161161
// remember that the classNameFilter is set during the provider/config
162162
// stage therefore we can optimize here and setup a helper function

test/ngAnimate/animateSpec.js

+11
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,17 @@ describe("animations", function() {
19711971
expect(count).toBe(5);
19721972
}));
19731973

1974+
it('should not get affected by custom, enumerable properties on `Object.prototype`',
1975+
inject(function($animate) {
1976+
Object.prototype.foo = 'ENUMARABLE_AND_NOT_AN_ARRAY';
1977+
1978+
element = jqLite('<div></div>');
1979+
expect(function() { $animate.off(element); }).not.toThrow();
1980+
1981+
delete Object.prototype.foo;
1982+
})
1983+
);
1984+
19741985
it('should fire a `start` callback when the animation starts with the matching element',
19751986
inject(function($animate, $rootScope, $rootElement, $document) {
19761987

0 commit comments

Comments
 (0)