Bug 1673553 part 73 - Turn CanReuseScriptForClone check in CloneFunctionObject into an assertion. r=tcampbell

CanReuseScriptForClone returned false for singleton functions, but these are gone now.

Depends on D98504

Differential Revision: https://phabricator.services.mozilla.com/D98505
This commit is contained in:
Jan de Mooij 2020-12-02 20:13:12 +00:00
Родитель 9865e1dd67
Коммит d08386a27e
1 изменённых файлов: 2 добавлений и 12 удалений

Просмотреть файл

@ -37,18 +37,8 @@ inline JSFunction* CloneFunctionObject(JSContext* cx, HandleFunction fun,
gc::AllocKind extendedFinalizeKind = gc::AllocKind::FUNCTION_EXTENDED; gc::AllocKind extendedFinalizeKind = gc::AllocKind::FUNCTION_EXTENDED;
gc::AllocKind kind = fun->isExtended() ? extendedFinalizeKind : finalizeKind; gc::AllocKind kind = fun->isExtended() ? extendedFinalizeKind : finalizeKind;
if (CanReuseScriptForClone(cx->realm(), fun, enclosingEnv)) { MOZ_ASSERT(CanReuseScriptForClone(cx->realm(), fun, enclosingEnv));
return CloneFunctionReuseScript(cx, fun, enclosingEnv, kind, proto); return CloneFunctionReuseScript(cx, fun, enclosingEnv, kind, proto);
}
RootedScript script(cx, JSFunction::getOrCreateScript(cx, fun));
if (!script) {
return nullptr;
}
RootedScope enclosingScope(cx, script->enclosingScope());
Rooted<ScriptSourceObject*> sourceObject(cx, script->sourceObject());
return CloneFunctionAndScript(cx, fun, enclosingEnv, enclosingScope,
sourceObject, kind, proto);
} }
} /* namespace js */ } /* namespace js */