mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:28:12 +00:00
LibWeb: Implement the JS host hooks for promises, job callbacks and more
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().
This commit is contained in:
parent
4c1c6ef91c
commit
17aeb99e9e
7 changed files with 290 additions and 20 deletions
|
@ -43,7 +43,7 @@ NonnullRefPtr<ClassicScript> ClassicScript::create(String filename, StringView s
|
|||
|
||||
// 10. Let result be ParseScript(source, settings's Realm, script).
|
||||
auto parse_timer = Core::ElapsedTimer::start_new();
|
||||
auto result = JS::Script::parse(source, environment_settings_object.realm(), script->filename());
|
||||
auto result = JS::Script::parse(source, environment_settings_object.realm(), script->filename(), script.ptr());
|
||||
dbgln_if(HTML_SCRIPT_DEBUG, "ClassicScript: Parsed {} in {}ms", script->filename(), parse_timer.elapsed());
|
||||
|
||||
// 11. If result is a list of errors, then:
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#classic-script
|
||||
class ClassicScript final : public Script {
|
||||
class ClassicScript final
|
||||
: public Script
|
||||
, public JS::Script::HostDefined {
|
||||
public:
|
||||
~ClassicScript();
|
||||
virtual ~ClassicScript() override;
|
||||
|
||||
enum class MutedErrors {
|
||||
No,
|
||||
|
@ -34,6 +36,8 @@ public:
|
|||
};
|
||||
JS::Completion run(RethrowErrors = RethrowErrors::No);
|
||||
|
||||
MutedErrors muted_errors() const { return m_muted_errors; }
|
||||
|
||||
private:
|
||||
ClassicScript(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue