mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 09:18:42 +09:00
1367204 - Generate "[sourceless code]" for class constructors when sourceIsLazy and no source hook is set.
This commit is contained in:
parent
b9409d8774
commit
379a4231fe
1 changed files with 14 additions and 5 deletions
|
|
@ -1013,7 +1013,20 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPrint)
|
|||
if (!out.append(")"))
|
||||
return nullptr;
|
||||
}
|
||||
} else if (fun->isInterpreted() && !fun->isSelfHostedBuiltin()) {
|
||||
} else if (fun->isInterpreted() &&
|
||||
(!fun->isSelfHostedBuiltin() ||
|
||||
fun->infallibleIsDefaultClassConstructor(cx)))
|
||||
{
|
||||
// Default class constructors should always haveSource except;
|
||||
//
|
||||
// 1. Source has been discarded for the whole compartment.
|
||||
//
|
||||
// 2. The source is marked as "lazy", i.e., retrieved on demand, and
|
||||
// the embedding has not provided a hook to retrieve sources.
|
||||
MOZ_ASSERT_IF(fun->infallibleIsDefaultClassConstructor(cx),
|
||||
!cx->runtime()->sourceHook ||
|
||||
!script->scriptSource()->sourceRetrievable() ||
|
||||
fun->compartment()->behaviors().discardSource());
|
||||
if (!AppendPrelude() ||
|
||||
!out.append("() {\n ") ||
|
||||
!out.append("[sourceless code]") ||
|
||||
|
|
@ -1022,10 +1035,6 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPrint)
|
|||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
// Default class constructors should always haveSource unless source
|
||||
// has been discarded for the whole compartment.
|
||||
MOZ_ASSERT(!fun->infallibleIsDefaultClassConstructor(cx) ||
|
||||
fun->compartment()->behaviors().discardSource());
|
||||
|
||||
if (!AppendPrelude() ||
|
||||
!out.append("() {\n "))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue