assert: don't compare object prototype property

All own enumerable properties are compared already. Comparing
`prototype` property specifically can cause weird behaviour.

PR-URL: https://github.com/iojs/io.js/pull/636
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Vladimir Kurchatkin 2015-01-28 18:27:20 +03:00
parent 8d1179952a
commit e7573f9111
2 changed files with 1 additions and 3 deletions

View File

@ -186,8 +186,6 @@ function isArguments(object) {
function objEquiv(a, b) {
if (a === null || a === undefined || b === null || b === undefined)
return false;
// an identical 'prototype' property.
if (a.prototype !== b.prototype) return false;
// if one is a primitive, the other must be same
if (util.isPrimitive(a) || util.isPrimitive(b))
return a === b;

View File

@ -130,7 +130,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, nb1, nb2));
nameBuilder2.prototype = Object;
nb2 = new nameBuilder2('Ryan', 'Dahl');
assert.throws(makeBlock(a.deepEqual, nb1, nb2), a.AssertionError);
assert.doesNotThrow(makeBlock(a.deepEqual, nb1, nb2));
// primitives and object
assert.throws(makeBlock(a.deepEqual, null, {}), a.AssertionError);