Commit Graph
1 Commits
Author SHA1 Message Date
ToRaNekandClaude Fable 5.2 48cf6684da fix(libSceNKWebKit): refuse JSObjectMakeFunction text that is not one function
JSObjectMakeFunction joins the name, the parameters and the body into
"(function name(params) {\nbody\n})" and evaluates it. A body such as
"}), sideEffect(), (function () {" closed the function early: the call
ran sideEffect() and returned another function. Parameters, or a name,
could do the same.

JavaScriptCore parses the joined text as a program that must be a
single function whose parameters end where the given ones end, and
raises a SyntaxError otherwise. QuickJS gives no such check, so the
text is compiled, without being run, a few more times: the parameters
alone, the body alone, and with a declaration added after the body
that must land in the function that owns the first parameter.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 08:52:40 +01:00