ladybird/Libraries/LibJS/Tests
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
..
builtins LibJS: Perform TLA async function construction in the module context 2024-11-15 18:52:22 +01:00
classes Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
functions Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
iterators Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
loops Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
math Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
modules Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
operators Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
regress Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
syntax LibJS: Allow division after IdentifierNames in optional chain 2024-11-11 20:19:26 +01:00
add-values-to-primitive.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
arguments-callee.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
arguments-object.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
assignment-evaluation-order.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
async-this-value.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
automatic-semicolon-insertion.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
break-continue-syntax-errors.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
comments-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
computed-property-sideeffects.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
computed-property-throws.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
const-declaration-missing-initializer.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
const-reassignment.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
copy-this-to-local.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
custom-@@hasInstance.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
custom-@@toPrimitive.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
custom-@@toStringTag.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
debugger-statement.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
duplicated-variable-declarations.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
empty-statements.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
eval-aliasing.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
eval-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
exception-in-catch-block.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
exception-ReferenceError.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
exponentiation-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
for-loop-per-iteration-env-bug.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
gc-deeply-nested-object-graph.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
global-var-let-const.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
if-statement-function-declaration.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
indexed-access-prototype-indirection.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
indexed-access-string-object.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
inline-cache-edge-cases.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
invalid-lhs-in-assignment.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
labels.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
let-scoping.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
new-expression.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
non-writable-assignment.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
null-or-undefined-access.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
numeric-literals-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
object-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
object-expression-__proto__.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
object-expression-computed-property.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
object-expression-numeric-property.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
object-getter-setter-shorthand.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
object-method-shorthand.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
object-spread.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
ordinary-to-primitive.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
parseInt.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
parser-declaration-in-single-statement-context.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
parser-invalid-destructuring-assignment-target.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
parser-line-terminators.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
parser-unary-associativity.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
permanently-screwed-by-eval.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
postfix-increment-eval-order.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
program-non-strict.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
program-strict-mode.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
return.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
runtime-error-call-stack-size.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
statement-with-many-labels.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
strict-mode-blocks.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
strict-mode-errors.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
string-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
string-concatenation.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
string-escapes.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
string-spread.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
switch-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
switch-break.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
switch-default-before-case.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
tagged-template-literals.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
template-literals.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
test-common-tests.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
test-common.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
this-value-strict.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
this-value.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
throw-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
to-number-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
to-number-exception.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
try-catch-finally-nested.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
try-catch-finally-return.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
try-catch-finally.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
try-finally-break.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
try-finally-continue.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
try-return-finally.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
unicode-identifier-escape.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
update-expression-on-member-expression.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
update-expressions-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
use-strict-directive.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
using-declaration.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
using-for-loops.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
var-multiple-declarator.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
var-scoping.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
variable-undefined.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
with-basic.js Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00