Restore bizarro tests for Object.create.

This commit is contained in:
John-David Dalton
2016-02-15 16:47:21 -08:00
parent ba2d3f7704
commit 10dd42b6e4
3 changed files with 34 additions and 3 deletions

View File

@@ -458,7 +458,7 @@
// Allow bypassing native checks.
setProperty(funcProto, 'toString', function wrapper() {
setProperty(funcProto, 'toString', fnToString);
var result = _.has(this, 'toString') ? this.toString() : fnToString.call(this);
var result = lodashStable.has(this, 'toString') ? this.toString() : fnToString.call(this);
setProperty(funcProto, 'toString', wrapper);
return result;
});
@@ -467,6 +467,17 @@
funcProto._method = noop;
// Set bad shims.
setProperty(Object, 'create', (function() {
function object() {}
return function(prototype) {
if (lodashStable.isObject(prototype)) {
object.prototype = prototype;
var result = new object;
object.prototype = undefined;
}
return result || {};
};
}()));
var _getOwnPropertySymbols = Object.getOwnPropertySymbols;
setProperty(Object, 'getOwnPropertySymbols', undefined);
@@ -519,6 +530,7 @@
root._ = oldDash;
// Restore built-in methods.
setProperty(Object, 'create', create);
setProperty(objectProto, 'propertyIsEnumerable', _propertyIsEnumerable);
setProperty(root, 'Buffer', Buffer);