Files
AnyPS5/docs/dev/debt/changes/fix-nkwebkit-js-make-function-single-function.md
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

783 B

libSceNKWebKit

add Functional

  • JSObjectMakeFunction text (libSceNKWebKit) - not checked on a console. The name, the parameters and the body must form one function, as UnlinkedFunctionExecutable::fromGlobalCode requires; text that closes the function early is refused with a SyntaxError and is not run. QuickJS cannot say where a function ends, so the check compiles the text several times instead, and the message is Parser error or the parameters message of JavaScriptCore, not always the one its parser gives. Closes when: compared with a console.