Ensure __proto__ is treated as a regular key in assignments. [closes #2591]

This commit is contained in:
John-David Dalton
2016-08-22 10:58:39 -07:00
parent 358ecfd2eb
commit 343f48b08c
2 changed files with 21 additions and 5 deletions

View File

@@ -7461,7 +7461,7 @@
QUnit.module('`__proto__` property bugs');
(function() {
QUnit.test('internal data objects should work with the `__proto__` key', function(assert) {
QUnit.test('should work with the `__proto__` key in internal data objects', function(assert) {
assert.expect(4);
var stringLiteral = '__proto__',
@@ -7477,6 +7477,13 @@
assert.deepEqual(_.uniq(largeArray), expected);
assert.deepEqual(_.without.apply(_, [largeArray].concat(largeArray)), []);
});
QUnit.test('should treat `__proto__` as a regular key in assignments', function(assert) {
assert.expect(1);
var actual = _.groupBy([{ 'a': '__proto__' }], 'a');
assert.notOk(actual instanceof Array);
});
}());
/*--------------------------------------------------------------------------*/