mirror of
https://github.com/RGBCube/serenity
synced 2025-05-15 09:44:58 +00:00
LibJS: Check for exception after executing (do)while test expression
Otherwise we crash the interpreter when an exception is thrown during evaluation of the while or do/while test expression - which is easily caused by a ReferenceError - e.g.: while (someUndefinedVariable) { // ... }
This commit is contained in:
parent
a19d8aade4
commit
82ac936a9d
3 changed files with 23 additions and 3 deletions
|
@ -12,3 +12,9 @@ test("no braces", () => {
|
|||
while (number < 3);
|
||||
expect(number).toBe(3);
|
||||
});
|
||||
|
||||
test("exception in test expression", () => {
|
||||
expect(() => {
|
||||
do {} while (foo);
|
||||
}).toThrow(ReferenceError);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue