mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 16:02:53 +00:00
LibWeb: Add option to TemporaryExecutionContext to prepare for callbacks
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.
This commit is contained in:
parent
2cd93e6b58
commit
1358fe85b0
Notes:
sideshowbarker
2024-07-17 07:16:27 +09:00
Author: https://github.com/ADKaster
Commit: 1358fe85b0
Pull-request: https://github.com/SerenityOS/serenity/pull/22850
3 changed files with 14 additions and 3 deletions
|
@ -9,15 +9,20 @@
|
|||
|
||||
namespace Web::HTML {
|
||||
|
||||
TemporaryExecutionContext::TemporaryExecutionContext(EnvironmentSettingsObject& environment_settings)
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue