The JSScript::AutoDelazify is used when cloning function scripts to keep the script non-lazy. In practice a
RootedScript(cx, JSFunction::getOrCreateScript(...)) should be enough to ensure we have the script we are cloning. Even if the source function is relazified, the we just need the source script for the clone.
The one wrinkle is that js::CloneScriptIntoFunction will blindly copy the script flags. We'll want to normalize them so that we don't get tripped up by a lazy script. Whatever work around we use here can be removed once JSFunction no longer tracks the is-lazy bit.