mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 21:30:58 +00:00 
			
		
		
		
	 6f433c8656
			
		
	
	
		6f433c8656
		
	
	
	
	
		
			
			This is a monster patch that turns all EventTargets into GC-allocated PlatformObjects. Their C++ wrapper classes are removed, and the LibJS garbage collector is now responsible for their lifetimes. There's a fair amount of hacks and band-aids in this patch, and we'll have a lot of cleanup to do after this.
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			669 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			669 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | ||
|  * Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
 | ||
|  *
 | ||
|  * SPDX-License-Identifier: BSD-2-Clause
 | ||
|  */
 | ||
| 
 | ||
| #include <LibWeb/DOM/AbortController.h>
 | ||
| #include <LibWeb/DOM/AbortSignal.h>
 | ||
| 
 | ||
| namespace Web::DOM {
 | ||
| 
 | ||
| // https://dom.spec.whatwg.org/#dom-abortcontroller-abortcontroller
 | ||
| AbortController::AbortController(HTML::Window& window)
 | ||
|     : m_signal(JS::make_handle(*AbortSignal::create_with_global_object(window)))
 | ||
| {
 | ||
| }
 | ||
| 
 | ||
| // https://dom.spec.whatwg.org/#dom-abortcontroller-abort
 | ||
| void AbortController::abort(JS::Value reason)
 | ||
| {
 | ||
|     // The abort(reason) method steps are to signal abort on this’s signal with reason if it is given.
 | ||
|     m_signal->signal_abort(reason);
 | ||
| }
 | ||
| 
 | ||
| }
 |