mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
LibJS: Fallback to undefined if last value in eval() is empty
For something like eval(""), the VM's 'last value' is an empty value, which we must not leak. Fixes #6643.
This commit is contained in:
parent
2b4c2301a9
commit
7b1ba4bd5c
2 changed files with 2 additions and 1 deletions
|
@ -323,7 +323,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::eval)
|
|||
vm.interpreter().execute_statement(global_object, program);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
return vm.last_value();
|
||||
return vm.last_value().value_or(js_undefined());
|
||||
}
|
||||
|
||||
// 19.2.6.1.1 Encode ( string, unescapedSet )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue