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

Commit 6050f0b

Browse files
committed
fix($animate): do not get affected by custom, enumerable properties on Object.prototype
Fixes #14804 Closes #14830
1 parent 56a9eab commit 6050f0b

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
@@ -158,7 +158,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
158158
}
159159
);
160160

161-
var callbackRegistry = {};
161+
var callbackRegistry = Object.create(null);
162162

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

test/ngAnimate/animateSpec.js

+11
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,17 @@ describe("animations", function() {
19891989
expect(count).toBe(5);
19901990
}));
19911991

1992+
it('should not get affected by custom, enumerable properties on `Object.prototype`',
1993+
inject(function($animate) {
1994+
Object.prototype.foo = 'ENUMARABLE_AND_NOT_AN_ARRAY';
1995+
1996+
element = jqLite('<div></div>');
1997+
expect(function() { $animate.off(element); }).not.toThrow();
1998+
1999+
delete Object.prototype.foo;
2000+
})
2001+
);
2002+
19922003
it('should fire a `start` callback when the animation starts with the matching element',
19932004
inject(function($animate, $rootScope, $rootElement, $document) {
19942005

0 commit comments

Comments
 (0)