зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1342101 - Move canonicalFunction.init before Scope::create in case create fails. r=jandem
This commit is contained in:
Родитель
6ae1479eb9
Коммит
48b67cbb5f
|
@ -630,6 +630,7 @@ FunctionScope::create(JSContext* cx, Handle<Data*> data,
|
|||
return nullptr;
|
||||
|
||||
copy->hasParameterExprs = hasParameterExprs;
|
||||
copy->canonicalFunction.init(fun);
|
||||
|
||||
// An environment may be needed regardless of existence of any closed over
|
||||
// bindings:
|
||||
|
@ -647,8 +648,6 @@ FunctionScope::create(JSContext* cx, Handle<Data*> data,
|
|||
if (!scope)
|
||||
return nullptr;
|
||||
|
||||
copy->canonicalFunction.init(fun);
|
||||
|
||||
funScope = &scope->as<FunctionScope>();
|
||||
funScope->initData(Move(copy.get()));
|
||||
}
|
||||
|
@ -701,12 +700,12 @@ FunctionScope::clone(JSContext* cx, Handle<FunctionScope*> scope, HandleFunction
|
|||
if (!dataClone)
|
||||
return nullptr;
|
||||
|
||||
Scope* scopeClone= Scope::create(cx, scope->kind(), enclosing, envShape);
|
||||
dataClone->canonicalFunction.init(fun);
|
||||
|
||||
Scope* scopeClone = Scope::create(cx, scope->kind(), enclosing, envShape);
|
||||
if (!scopeClone)
|
||||
return nullptr;
|
||||
|
||||
dataClone->canonicalFunction.init(fun);
|
||||
|
||||
funScopeClone = &scopeClone->as<FunctionScope>();
|
||||
funScopeClone->initData(Move(dataClone.get()));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче