mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:42:43 +00:00 
			
		
		
		
	 41837f548d
			
		
	
	
		41837f548d
		
	
	
	
	
		
			
			When value.to_string() throws an exception it returns a null string in which case we must not construct a valid PropertyName. Also ASSERT in PropertyName(String) and PropertyName(FlyString) to prevent this from happening in the future. Fixes #3941.
		
			
				
	
	
		
			19 lines
		
	
	
	
		
			459 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
	
		
			459 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| test("Issue #3459, exception in computed property expression", () => {
 | |
|     expect(() => {
 | |
|         "foo"[bar];
 | |
|     }).toThrow(ReferenceError);
 | |
|     expect(() => {
 | |
|         "foo"[bar]();
 | |
|     }).toThrow(ReferenceError);
 | |
| });
 | |
| 
 | |
| test("Issue #3941, exception in computed property's toString()", () => {
 | |
|     expect(() => {
 | |
|         const o = {
 | |
|             toString() {
 | |
|                 throw Error();
 | |
|             },
 | |
|         };
 | |
|         "foo"[o];
 | |
|     }).toThrow(Error);
 | |
| });
 |