mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-28 07:12:07 +00:00 
			
		
		
		
	 1d8f8ea5b1
			
		
	
	
		1d8f8ea5b1
		
	
	
	
	
		
			
			The DOM specification says that the primary use case for these is to give Promises abort semantics. It is also a prerequisite for Fetch, as it is used to make Fetch abortable. a
		
			
				
	
	
		
			20 lines
		
	
	
	
		
			630 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
	
		
			630 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| describe("AbortController", () => {
 | |
|     loadLocalPage("/res/html/misc/blank.html");
 | |
| 
 | |
|     afterInitialPageLoad(page => {
 | |
|         test("Basic functionality", () => {
 | |
|             const abortController = new page.AbortController();
 | |
|             let timesCallbackCalled = 0;
 | |
|             abortController.signal.addEventListener("abort", () => {
 | |
|                 timesCallbackCalled++;
 | |
|             });
 | |
| 
 | |
|             abortController.abort();
 | |
|             expect(abortController.signal.aborted).toBeTrue();
 | |
| 
 | |
|             abortController.abort();
 | |
|             expect(timesCallbackCalled).toBe(1);
 | |
|         });
 | |
|     });
 | |
|     waitForPageToLoad();
 | |
| });
 |