diff --git a/src/node.js b/src/node.js index 57c7a06ea7..b9419510db 100644 --- a/src/node.js +++ b/src/node.js @@ -135,18 +135,20 @@ process.mixin = function() { var d = Object.getOwnPropertyDescriptor(source, k); if (d.get) { target.__defineGetter__(k, d.get); - if (d.set) + if (d.set) { target.__defineSetter__(k, d.set); + } } else { // Prevent never-ending loop - if (target === d.value) + if (target === d.value) { continue; - + } + if (deep && d.value && typeof d.value === "object") { target[k] = process.mixin(deep, // Never move original objects, clone them - source || (d.value.length != null ? [] : {}) + source[k] || (d.value.length != null ? [] : {}) , d.value); } else { diff --git a/test/mjsunit/test-process-mixin.js b/test/mjsunit/test-process-mixin.js index 502c229b35..cf5fe6c7f4 100644 --- a/test/mjsunit/test-process-mixin.js +++ b/test/mjsunit/test-process-mixin.js @@ -13,7 +13,7 @@ var fakeDomElement = {deep: {nodeType: 4}}; target = {}; process.mixin(true, target, fakeDomElement); -assert.notStrictEqual(target.deep, fakeDomElement.deep); +assert.deepEqual(target.deep, fakeDomElement.deep); var objectWithUndefinedValue = {foo: undefined}; target = {};