зеркало из 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;
|
return nullptr;
|
||||||
|
|
||||||
copy->hasParameterExprs = hasParameterExprs;
|
copy->hasParameterExprs = hasParameterExprs;
|
||||||
|
copy->canonicalFunction.init(fun);
|
||||||
|
|
||||||
// An environment may be needed regardless of existence of any closed over
|
// An environment may be needed regardless of existence of any closed over
|
||||||
// bindings:
|
// bindings:
|
||||||
|
@ -647,8 +648,6 @@ FunctionScope::create(JSContext* cx, Handle<Data*> data,
|
||||||
if (!scope)
|
if (!scope)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
copy->canonicalFunction.init(fun);
|
|
||||||
|
|
||||||
funScope = &scope->as<FunctionScope>();
|
funScope = &scope->as<FunctionScope>();
|
||||||
funScope->initData(Move(copy.get()));
|
funScope->initData(Move(copy.get()));
|
||||||
}
|
}
|
||||||
|
@ -701,12 +700,12 @@ FunctionScope::clone(JSContext* cx, Handle<FunctionScope*> scope, HandleFunction
|
||||||
if (!dataClone)
|
if (!dataClone)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
dataClone->canonicalFunction.init(fun);
|
||||||
|
|
||||||
Scope* scopeClone = Scope::create(cx, scope->kind(), enclosing, envShape);
|
Scope* scopeClone = Scope::create(cx, scope->kind(), enclosing, envShape);
|
||||||
if (!scopeClone)
|
if (!scopeClone)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
dataClone->canonicalFunction.init(fun);
|
|
||||||
|
|
||||||
funScopeClone = &scopeClone->as<FunctionScope>();
|
funScopeClone = &scopeClone->as<FunctionScope>();
|
||||||
funScopeClone->initData(Move(dataClone.get()));
|
funScopeClone->initData(Move(dataClone.get()));
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче