-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LibJS: Test passes run as part of LibJS, but fails when run embedded in HTML #3251
Comments
After some more analysis, the original report was very confused. I don't know why this passes in test-js, but this issue is also reproducible with the following JS: let test = 0;
let result = (async function () {
try {
return 5;
} finally {
test = 42;
}
})();
console.log(test); Which will log 0 instead of 42. The issue is potentially related to codegen, but maybe something else I am missing. We are currently generating the bytecode inside of the async function as:
The await appears problematic, as it allows the code outside of the asynchronous function to continue executing before hitting the finally block. If we remove the await generation for this case here: ladybird/Libraries/LibJS/Bytecode/ASTCodegen.cpp Line 1846 in 3050768
And instead generate:
The test will work fine. |
This seems to indicate that the FIXME saying that there is a potential spec bug is not correct, adjusting that to spec makes this test work. |
This was originally introduced in SerenityOS/serenity#20465 To fix: SerenityOS/serenity#20275 That specific line does not appear to be necessary for that issue. However, making that change to follow spec breaks a single test in test262:
But it breaks 3 test-js tests in
Which were also introduced as part of that change |
Split from: #3230 as while they are somewhat related, this issue is likely to be smaller in scope and could be fixed independently.
The following test-js test passes:
But it fails when run as part of HTML, see:
Which outputs:
cc @Hendiadyoin1
The text was updated successfully, but these errors were encountered: