mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:08:12 +00:00

This overrides the JS host hooks to follow the spec for queuing promises, making/calling job callbacks, unhandled promise rejection handling and FinalizationRegistry queuing. This also allows us to drop the on_call_stack_emptied hook in Document::interpreter().
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibJS/Forward.h>
|
|
#include <LibJS/Runtime/JobCallback.h>
|
|
#include <LibJS/Runtime/VM.h>
|
|
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
|
|
|
namespace Web::Bindings {
|
|
|
|
struct WebEngineCustomData final : public JS::VM::CustomData {
|
|
virtual ~WebEngineCustomData() override { }
|
|
|
|
HTML::EventLoop event_loop;
|
|
};
|
|
|
|
struct WebEngineCustomJobCallbackData final : public JS::JobCallback::CustomData {
|
|
WebEngineCustomJobCallbackData(HTML::EnvironmentSettingsObject& incumbent_settings, OwnPtr<JS::ExecutionContext> active_script_context)
|
|
: incumbent_settings(incumbent_settings)
|
|
, active_script_context(move(active_script_context))
|
|
{
|
|
}
|
|
|
|
virtual ~WebEngineCustomJobCallbackData() override { }
|
|
|
|
HTML::EnvironmentSettingsObject& incumbent_settings;
|
|
OwnPtr<JS::ExecutionContext> active_script_context;
|
|
};
|
|
|
|
HTML::ClassicScript* active_script();
|
|
JS::VM& main_thread_vm();
|
|
|
|
}
|