mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 05:10:57 +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
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-19 01:47:14 +09:00 
				
			
			Author: https://github.com/linusg
Commit: 82ac936a9d
Pull-request: https://github.com/SerenityOS/serenity/pull/3822
			
					 3 changed files with 23 additions and 3 deletions
				
			
		|  | @ -17,3 +17,9 @@ test("does not loop when initially false", () => { | |||
|         expect().fail(); | ||||
|     } | ||||
| }); | ||||
| 
 | ||||
| test("exception in test expression", () => { | ||||
|     expect(() => { | ||||
|         while (foo); | ||||
|     }).toThrow(ReferenceError); | ||||
| }); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Linus Groh
						Linus Groh