mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-03 23:00:58 +00:00 
			
		
		
		
	LibWeb: Ensure EC on stack when resolving/rejecting image decode promise
Fixes #419
This commit is contained in:
		
							parent
							
								
									0a1fc7ee13
								
							
						
					
					
						commit
						9c80326053
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-16 20:12:13 +09:00 
				
			
			Author: https://github.com/awesomekling
Commit: 9c80326053
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/436
Issue: https://github.com/LadybirdBrowser/ladybird/issues/419
Reviewed-by: https://github.com/ADKaster
			
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -293,6 +293,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> HTMLImageElement::decode() co
 | 
			
		|||
                return false;
 | 
			
		||||
 | 
			
		||||
            auto exception = WebIDL::EncodingError::create(realm, "Node document not fully active"_fly_string);
 | 
			
		||||
            HTML::TemporaryExecutionContext context(HTML::relevant_settings_object(*this));
 | 
			
		||||
            WebIDL::reject_promise(realm, promise, exception);
 | 
			
		||||
            return true;
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -302,6 +303,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> HTMLImageElement::decode() co
 | 
			
		|||
                return false;
 | 
			
		||||
 | 
			
		||||
            auto exception = WebIDL::EncodingError::create(realm, "Current request state is broken"_fly_string);
 | 
			
		||||
            HTML::TemporaryExecutionContext context(HTML::relevant_settings_object(*this));
 | 
			
		||||
            WebIDL::reject_promise(realm, promise, exception);
 | 
			
		||||
            return true;
 | 
			
		||||
        };
 | 
			
		||||
| 
						 | 
				
			
			@ -349,7 +351,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> HTMLImageElement::decode() co
 | 
			
		|||
                // (Typically, this would only be violated in low-memory situations that require evicting decoded image data, or when the image is too large
 | 
			
		||||
                // to keep in decoded form for this period of time.)
 | 
			
		||||
 | 
			
		||||
                HTML::TemporaryExecutionContext execution_context { Bindings::host_defined_environment_settings_object(realm) };
 | 
			
		||||
                HTML::TemporaryExecutionContext context(HTML::relevant_settings_object(*this));
 | 
			
		||||
                WebIDL::resolve_promise(realm, promise, JS::js_undefined());
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue