mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:52:43 +00:00 
			
		
		
		
	 fc9d587e39
			
		
	
	
		fc9d587e39
		
	
	
	
	
		
			
			A struct with three raw pointers to other GC'd types is a pretty big liability, let's just turn this into a Cell itself. This comes with the additional benefit of being able to capture it in a lambda effortlessly, without having to create handles for individual members.
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibJS/Forward.h>
 | |
| #include <LibJS/SafeFunction.h>
 | |
| #include <LibWeb/Forward.h>
 | |
| 
 | |
| namespace Web::WebIDL {
 | |
| 
 | |
| using ReactionSteps = JS::SafeFunction<WebIDL::ExceptionOr<JS::Value>(JS::Value)>;
 | |
| 
 | |
| JS::NonnullGCPtr<JS::PromiseCapability> create_promise(JS::Realm&);
 | |
| JS::NonnullGCPtr<JS::PromiseCapability> create_resolved_promise(JS::Realm&, JS::Value);
 | |
| JS::NonnullGCPtr<JS::PromiseCapability> create_rejected_promise(JS::Realm&, JS::Value);
 | |
| void resolve_promise(JS::VM&, JS::PromiseCapability const&, JS::Value = JS::js_undefined());
 | |
| void reject_promise(JS::VM&, JS::PromiseCapability const&, JS::Value);
 | |
| JS::NonnullGCPtr<JS::Promise> react_to_promise(JS::PromiseCapability const&, Optional<ReactionSteps> on_fulfilled_callback, Optional<ReactionSteps> on_rejected_callback);
 | |
| JS::NonnullGCPtr<JS::Promise> upon_fulfillment(JS::PromiseCapability const&, ReactionSteps);
 | |
| JS::NonnullGCPtr<JS::Promise> upon_rejection(JS::PromiseCapability const&, ReactionSteps);
 | |
| void mark_promise_as_handled(JS::PromiseCapability const&);
 | |
| 
 | |
| }
 |