Builder: fix infinite loop when using spec with circular dependency

https://fedorahosted.org/freeipa/ticket/3235
This commit is contained in:
Petr Vobornik 2013-04-11 15:43:25 +02:00
parent dc6995ed7b
commit 4ae3372682
2 changed files with 6 additions and 3 deletions

View File

@ -149,7 +149,7 @@ define(['dojo/_base/declare',
pre = spec.$pre_ops,
post = spec.$post_ops;
var s = lang.clone(spec);
var s = lang.mixin({},spec);
delete s.$ctor;
delete s.$factory;
delete s.$mixim_spec;
@ -214,6 +214,9 @@ define(['dojo/_base/declare',
var cs = construction_spec,
obj = null;
// here we should clone cs.spec to prevent modification of original
// by pre_ops
cs.spec = this._run_preops(this.pre_ops, cs.spec, context);
if (cs.pre_ops) {
cs.spec = this._run_preops(cs.pre_ops, cs.spec, context);

View File

@ -45,8 +45,8 @@ define(['dojo/_base/declare',
* It makes sure that pre_ops, post_ops and spec are new Arrays/Object
*/
copy_cs: function(org_cs) {
var cs = lang.clone(org_cs);
if (cs.spec) cs.spec = lang.clone(cs.spec);
var cs = lang.mixin({}, org_cs);
if (cs.spec) cs.spec = lang.mixin({}, cs.spec);
cs.pre_ops = cs.pre_ops.slice(0);
cs.post_ops = cs.pre_ops.slice(0);
return cs;