mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 00:56:39 +00:00
LibJS: Stop swallowing exceptions in finalizers
This also fixes one of the try-catch-finally tests, and adds a new one.
This commit is contained in:
parent
b4b9c4b383
commit
27b238d9af
Notes:
sideshowbarker
2024-07-17 04:01:41 +09:00
Author: https://github.com/Hendiadyoin1
Commit: 27b238d9af
Pull-request: https://github.com/SerenityOS/serenity/pull/23927
Reviewed-by: https://github.com/ADKaster
3 changed files with 30 additions and 16 deletions
|
@ -342,19 +342,23 @@ test("labelled break in finally overrides labelled break in try", () => {
|
|||
|
||||
test("Throw while breaking", () => {
|
||||
const executionOrder = [];
|
||||
try {
|
||||
for (const i = 1337; ; expect().fail("Jumped to for loop update block")) {
|
||||
try {
|
||||
executionOrder.push(1);
|
||||
break;
|
||||
} finally {
|
||||
executionOrder.push(2);
|
||||
throw 1;
|
||||
expect(() => {
|
||||
try {
|
||||
for (const i = 1337; ; expect().fail("Jumped to for loop update block")) {
|
||||
try {
|
||||
executionOrder.push(1);
|
||||
break;
|
||||
} finally {
|
||||
executionOrder.push(2);
|
||||
throw Error(1);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
executionOrder.push(3);
|
||||
}
|
||||
} finally {
|
||||
executionOrder.push(3);
|
||||
}
|
||||
expect().fail("Running code after for loop");
|
||||
}).toThrowWithMessage(Error, 1);
|
||||
|
||||
expect(() => {
|
||||
i;
|
||||
}).toThrowWithMessage(ReferenceError, "'i' is not defined");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue