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; ...@@ -533,14 +533,14 @@ exports.isWebPage = isWebPage;
533 function mergeObjects(origin, add) { 533 function mergeObjects(origin, add) {
534 "use strict"; 534 "use strict";
535 for (var p in add) { 535 for (var p in add) {
536 try { 536 if (add[p].constructor === Object) {
537 if (add[p].constructor === Object) { 537 if (origin.hasOwnProperty(p) && origin[p].constructor === Object) {
538 origin[p] = mergeObjects(origin[p], add[p]); 538 origin[p] = mergeObjects(origin[p], add[p]);
539 } else { 539 } else {
540 origin[p] = add[p]; 540 origin[p] = clone(add[p]);
541 } 541 }
542 } catch(e) { 542 } else {
543 origin[p] = add[p]; 543 origin[p] = add[p];
544 } 544 }
545 } 545 }
546 return origin; 546 return origin;
......