ladybird/Libraries/LibJS
Luke Wilde 6319dedbcd LibJS: Perform TLA async function construction in the module context
Previously it was only pushing the module context for the call to
capture the module execution context. This is incorrect, as the capture
occurs upon function construction. This resulted in it capturing the
execution context that execute_module was called from, instead of the
newly created module_context.
f87041bf3a/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp (L92)

This can be demonstrated with the following setup:
index.html:
```html
<script>
    var foo = 1;
</script>
<script type="module">
    import {test} from "./scriptA.mjs";
</script>
```

scriptA.mjs:
```js
function foo() {
	return {a: "b"};
}
export let test = await foo();
```

Before this fix, this would throw:
```
[TypeError] 1 is not a function (evaluated from 'foo')
    at module code with top-level await
    at module code with top-level await
    at <unknown>
    at <unknown>
```

Fixes #2245.
2024-11-15 18:52:22 +01:00
..
Bytecode LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Contrib/Test262 LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Heap LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Runtime LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Tests LibJS: Perform TLA async function construction in the module context 2024-11-15 18:52:22 +01:00
AST.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
AST.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
CMakeLists.txt LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Console.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Console.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
CyclicModule.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
CyclicModule.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Forward.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Lexer.cpp Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Lexer.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
MarkupGenerator.cpp Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
MarkupGenerator.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Module.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Module.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
ModuleLoading.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Parser.cpp LibJS: Allow division after IdentifierNames in optional chain 2024-11-11 20:19:26 +01:00
Parser.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
ParserError.cpp Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
ParserError.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Position.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Print.cpp Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Print.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Script.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Script.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
SourceCode.cpp Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
SourceCode.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
SourceRange.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
SourceTextModule.cpp LibJS: Perform TLA async function construction in the module context 2024-11-15 18:52:22 +01:00
SourceTextModule.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
SyntaxHighlighter.cpp Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
SyntaxHighlighter.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
SyntheticModule.cpp LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
SyntheticModule.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
Token.cpp Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Token.h Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00