1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:12:08 +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:
Andrew Kaster 2024-01-18 13:04:52 -07:00 committed by Alexander Kalenik
parent 2cd93e6b58
commit 1358fe85b0
3 changed files with 14 additions and 3 deletions

View file

@ -15,11 +15,17 @@ namespace Web::HTML {
// this is a workaround to temporarily push an execution context.
class TemporaryExecutionContext {
public:
explicit TemporaryExecutionContext(EnvironmentSettingsObject&);
enum class CallbacksEnabled {
No,
Yes,
};
explicit TemporaryExecutionContext(EnvironmentSettingsObject&, CallbacksEnabled = CallbacksEnabled::No);
~TemporaryExecutionContext();
private:
EnvironmentSettingsObject& m_environment_settings;
CallbacksEnabled m_callbacks_enabled { CallbacksEnabled::No };
};
}