1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00
serenity/Userland/Libraries/LibJS
Linus Groh a92dc4e30d LibJS: Ensure function declarations don't leak outside function scopes
When using VM::set_variable() to put the created ScriptFunction onto a
ScopeObject, we would previously unexpectedly reach the global object as
set_variable() checks each traversed scope for an existing Variable with
the given name - which would cause a leak of the inner function past the
outer function (we even had a test expecting that behaviour!). Now we
first declare functions (as DeclarationKind::Var) before setting them.
This will need some more work to make hoisting across non-lexical scopes
work, but it fixes this specific issue for now.

Fixes #6766.
2021-05-13 23:59:00 +01:00
..
Heap AK: Rename adopt() to adopt_ref() 2021-04-23 16:46:57 +02:00
Runtime LibJS: Bring back runtime validation of RegExp flags 2021-05-11 22:47:14 +01:00
Tests LibJS: Ensure function declarations don't leak outside function scopes 2021-05-13 23:59:00 +01:00
AST.cpp LibJS: Make super() in catch block work 2021-05-11 23:31:30 +01:00
AST.h LibJS: Rename RegExpLiteral m_content to m_pattern 2021-05-10 11:57:35 +01:00
CMakeLists.txt LibJS: Precompile Heap.h and GlobalObject.h 2021-04-21 14:29:46 +02:00
Console.cpp Everywhere: Use linusg@serenityos.org for my copyright headers 2021-04-22 22:51:19 +02:00
Console.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Forward.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Interpreter.cpp LibJS: Ensure function declarations don't leak outside function scopes 2021-05-13 23:59:00 +01:00
Interpreter.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Lexer.cpp Everywhere: Use linusg@serenityos.org for my copyright headers 2021-04-22 22:51:19 +02:00
Lexer.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
MarkupGenerator.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
MarkupGenerator.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Parser.cpp LibJS: Make invalid RegExp flags a SyntaxError at parse time 2021-05-10 12:01:38 +01:00
Parser.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
SourceRange.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
SyntaxHighlighter.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
SyntaxHighlighter.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Token.cpp Everywhere: Use linusg@serenityos.org for my copyright headers 2021-04-22 22:51:19 +02:00
Token.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00