mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-04 07:10:57 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			635 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			635 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
test("infinite recursion", () => {
 | 
						|
    function infiniteRecursion() {
 | 
						|
        infiniteRecursion();
 | 
						|
    }
 | 
						|
 | 
						|
    try {
 | 
						|
        infiniteRecursion();
 | 
						|
    } catch (e) {
 | 
						|
        expect(e).toBeInstanceOf(InternalError);
 | 
						|
        expect(e.name).toBe("InternalError");
 | 
						|
        expect(e.message).toBe("Call stack size limit exceeded");
 | 
						|
    }
 | 
						|
 | 
						|
    expect(() => {
 | 
						|
        JSON.stringify({}, () => ({ foo: "bar" }));
 | 
						|
    }).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
 | 
						|
 | 
						|
    expect(() => {
 | 
						|
        new Proxy({}, { get: (_, __, p) => p.foo }).foo;
 | 
						|
    }).toThrowWithMessage(InternalError, "Call stack size limit exceeded");
 | 
						|
});
 |