Commit 8a9938ce 8a9938ce033b81f2f218bbe7f8b13551847d158f by Thomas Rosenau

Fixed incorrect merging algorithm; did not deep-clone when merging into empty object

1 parent 27440007
......@@ -533,14 +533,14 @@ exports.isWebPage = isWebPage;
function mergeObjects(origin, add) {
"use strict";
for (var p in add) {
try {
if (add[p].constructor === Object) {
if (add[p].constructor === Object) {
if (origin.hasOwnProperty(p) && origin[p].constructor === Object) {
origin[p] = mergeObjects(origin[p], add[p]);
} else {
origin[p] = add[p];
origin[p] = clone(add[p]);
}
} catch(e) {
origin[p] = add[p];
} else {
origin[p] = add[p];
}
}
return origin;
......