mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-03 23:00:58 +00:00 
			
		
		
		
	In the cases where spec authors have us directly interact with promises in a task source context, we need to prepare the backup settings object stack as well as push an actual execution context to the JS VM.
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			891 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			891 B
		
	
	
	
		
			C++
		
	
	
	
	
	
/*
 | 
						|
 * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
 | 
						|
 *
 | 
						|
 * SPDX-License-Identifier: BSD-2-Clause
 | 
						|
 */
 | 
						|
 | 
						|
#include <LibWeb/HTML/Scripting/Environments.h>
 | 
						|
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
 | 
						|
 | 
						|
namespace Web::HTML {
 | 
						|
 | 
						|
TemporaryExecutionContext::TemporaryExecutionContext(EnvironmentSettingsObject& environment_settings, CallbacksEnabled callbacks_enabled)
 | 
						|
    : m_environment_settings(environment_settings)
 | 
						|
    , m_callbacks_enabled(callbacks_enabled)
 | 
						|
{
 | 
						|
    m_environment_settings.prepare_to_run_script();
 | 
						|
    if (m_callbacks_enabled == CallbacksEnabled::Yes)
 | 
						|
        m_environment_settings.prepare_to_run_callback();
 | 
						|
}
 | 
						|
 | 
						|
TemporaryExecutionContext::~TemporaryExecutionContext()
 | 
						|
{
 | 
						|
    m_environment_settings.clean_up_after_running_script();
 | 
						|
    if (m_callbacks_enabled == CallbacksEnabled::Yes)
 | 
						|
        m_environment_settings.clean_up_after_running_callback();
 | 
						|
}
 | 
						|
 | 
						|
}
 |